@classytic/crm 0.1.1 → 0.3.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/CHANGELOG.md CHANGED
@@ -2,6 +2,67 @@
2
2
 
3
3
  All notable changes to `@classytic/crm` are documented here.
4
4
 
5
+ ## [0.3.0] — 2026-05-17
6
+
7
+ ### Added — `EmailEvent` domain
8
+
9
+ Closes the loop between outbound CRM sends and recipient engagement.
10
+ Hosts can now record opens, clicks, bounces, complaints, and unsubscribes
11
+ against a Contact / Subscription / Campaign tuple — and downstream
12
+ services (drip-sequence "if opened" branches, lead scoring, suppression
13
+ lists) consume the same events without polling the email transport.
14
+
15
+ - **Entity & enum** — `EmailEvent` (append-only) plus the
16
+ `EmailEventKind` enum (`open` / `click` / `bounce` / `complaint` /
17
+ `unsubscribe`) split into `ENGAGEMENT_KINDS` and `SUPPRESSION_KINDS`
18
+ helper sets for classification at call sites.
19
+ - **Port** — `EmailEventRepository` with filtered list, per-subject
20
+ timeline, per-campaign aggregates (`uniqueOpens`, `uniqueClicks`,
21
+ `bounces`, `complaints`, `unsubscribes`, `totalEvents`), and a
22
+ GDPR-style `deleteForSubject()` purge.
23
+ - **Service** — `EmailEventService.recordOpen()` /
24
+ `.recordClick({ url })` / `.recordBounce()` / `.recordComplaint()` /
25
+ `.recordUnsubscribe()` + read-side `.listForSubject()`,
26
+ `.aggregateForCampaign()`, and `.hasEngaged(subjectId, campaignId,
27
+ kind)` for drip-condition checks.
28
+ - **Events** — `crm:email_event.opened` / `.clicked` / `.bounced` /
29
+ `.complained` / `.unsubscribed` with Zod-validated payloads in
30
+ `event-catalog`, wired into `crmEventDefinitions[]`.
31
+ - **In-memory adapter** — `InMemoryEmailEventRepository` (tests +
32
+ dev). Hosts implement against Mongo / Postgres / etc.
33
+
34
+ ### Added — re-exports from `@classytic/primitives@0.6.0`
35
+
36
+ To eliminate duplicate type imports at consumer call sites:
37
+
38
+ ```ts
39
+ import {
40
+ appendStatus,
41
+ StatusChangeEntry,
42
+ StatusHistory,
43
+ timeInStatus,
44
+ lastTransitionTo,
45
+ } from '@classytic/crm';
46
+ ```
47
+
48
+ These pass through from `@classytic/primitives/status-history`. The
49
+ existing entity-specific `LeadStatusEntry` / `OpportunityStatusEntry` /
50
+ etc. names are still exported for back-compat — they remain structurally
51
+ compatible with `StatusChangeEntry<TStatus>`.
52
+
53
+ ### Changed
54
+
55
+ - Peer dep `@classytic/primitives` bumped from `>=0.5.0` to `>=0.6.0`
56
+ to access the new `status-history` subpath and value-typed primitives.
57
+ - Test harness `buildHarness()` now also exposes an
58
+ `emailEvents: EmailEventService` and `emailEventRepo` for integration
59
+ tests that exercise the engagement → drip path.
60
+
61
+ ### Dependencies
62
+
63
+ - `@classytic/primitives@>=0.6.0` (peer, was `>=0.5.0`)
64
+ - `zod@>=4.0.0` (peer, unchanged)
65
+
5
66
  ## [0.1.0] — 2026-04-18
6
67
 
7
68
  Initial release.
package/dist/chunk.js ADDED
@@ -0,0 +1,13 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __exportAll = (all, no_symbols) => {
4
+ let target = {};
5
+ for (var name in all) __defProp(target, name, {
6
+ get: all[name],
7
+ enumerable: true
8
+ });
9
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
+ return target;
11
+ };
12
+ //#endregion
13
+ export { __exportAll as t };