ad2app-lib 1.11.0 → 1.15.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.
@@ -13,6 +13,14 @@ export enum SchedulingPostStatus {
13
13
  PUBLISHED = 'published',
14
14
  FAILED = 'failed',
15
15
  PARTIAL = 'partial',
16
+ /**
17
+ * The publisher accepted the post (an id exists) but its outcome could not
18
+ * be confirmed inline — a gateway timeout, or a 409 whose live status
19
+ * couldn't be fetched immediately (AD2-1153). Distinct from SCHEDULED: a
20
+ * PUBLISHING post may already be publishing server-side and must not be
21
+ * treated as still-editable.
22
+ */
23
+ PUBLISHING = 'publishing',
16
24
  }
17
25
 
18
26
  // ── Platform-status map ───────────────────────────────────────────────────────
@@ -78,11 +86,68 @@ export class SchedulingCreatePostDTO {
78
86
  export class SchedulingUpdatePostDTO {
79
87
  content?: string;
80
88
  scheduledAt?: string;
89
+ /**
90
+ * Per-platform targets for the edit patch (C2, AD2-1026) — the backend's
91
+ * `UpdatePostDTO` intersects this on top locally today; promoted here so
92
+ * the type ships from the lib instead of a local clone.
93
+ */
94
+ platforms?: SchedulingPlatformTargetDTO[];
95
+ /** Full media array for the edit patch (C2, AD2-1026), same shape as create. */
96
+ mediaItems?: SchedulingMediaItemDTO[];
81
97
 
82
98
  constructor(data?: Partial<SchedulingUpdatePostDTO>) {
83
99
  if (!data) return;
84
100
  this.content = data.content;
85
101
  this.scheduledAt = data.scheduledAt;
102
+ this.platforms = data.platforms;
103
+ this.mediaItems = data.mediaItems;
104
+ }
105
+ }
106
+
107
+ // ── SchedulingPostMediaItemDTO ────────────────────────────────────────────────
108
+
109
+ /**
110
+ * One media item on the edit-load response — verbatim from the live Zernio
111
+ * post's mediaItems (Post.mediaItems → MediaItem, OpenAPI v1.0.4:3223).
112
+ * Distinct from `SchedulingMediaItemDTO` (the create/update input shape):
113
+ * every field here is optional and `type` additionally allows `gif`/`document`
114
+ * to match what a fetched post can actually carry (T022b, AD2-1026).
115
+ */
116
+ export class SchedulingPostMediaItemDTO {
117
+ type?: 'image' | 'video' | 'gif' | 'document';
118
+ url?: string;
119
+ title?: string;
120
+
121
+ constructor(data?: Partial<SchedulingPostMediaItemDTO>) {
122
+ if (!data) return;
123
+ this.type = data.type;
124
+ this.url = data.url;
125
+ this.title = data.title;
126
+ }
127
+ }
128
+
129
+ // ── SchedulingPostTargetDTO ───────────────────────────────────────────────────
130
+
131
+ /**
132
+ * One per-platform target on the edit-load response — the request-shape
133
+ * subset of Zernio's PlatformTarget (OpenAPI v1.0.4:3275): `platform`,
134
+ * `accountId` (always normalized to the plain string id — Zernio expands it
135
+ * to an account object on fetched posts, yaml:3282), and
136
+ * `platformSpecificData` VERBATIM (yaml:3297, additionalProperties: true).
137
+ * Response-only fields (status, platformPostUrl, errors) are never exposed
138
+ * here — they already live on platformStatuses/postUrls/platformErrors
139
+ * (T022b, AD2-1026).
140
+ */
141
+ export class SchedulingPostTargetDTO {
142
+ platform: string;
143
+ accountId?: string;
144
+ platformSpecificData?: Record<string, unknown>;
145
+
146
+ constructor(data?: Partial<SchedulingPostTargetDTO>) {
147
+ if (!data) return;
148
+ this.platform = data.platform;
149
+ this.accountId = data.accountId;
150
+ this.platformSpecificData = data.platformSpecificData;
86
151
  }
87
152
  }
88
153
 
@@ -104,6 +169,25 @@ export class SchedulingPostDTO {
104
169
  contentSnippet?: string;
105
170
  createdAt: string;
106
171
  updatedAt: string;
172
+ /**
173
+ * Media-miniature pass-through fields (C1, AD2-1083) — present only when
174
+ * the cache row has a stored thumbnail/media URL, absent otherwise (never
175
+ * an empty string).
176
+ */
177
+ thumbnailUrl?: string;
178
+ mediaUrl?: string;
179
+ /**
180
+ * Edit-load fields for compose edit mode (C2, AD2-1026 + T022b):
181
+ * `content` is the COMPLETE caption (the cache only stores the 280-char
182
+ * `contentSnippet`); `mediaItems`/`platformTargets` are the full per-post
183
+ * media array and per-platform accountIds + compose settings. All three
184
+ * ride the live Zernio fetch: present when it succeeds (arrays may be
185
+ * possibly-empty = known-empty), ALL absent when it fails, which blocks
186
+ * edit frontend-side.
187
+ */
188
+ content?: string;
189
+ mediaItems?: SchedulingPostMediaItemDTO[];
190
+ platformTargets?: SchedulingPostTargetDTO[];
107
191
 
108
192
  constructor(data: SchedulingPostDTO) {
109
193
  this.id = data.id;
@@ -118,6 +202,11 @@ export class SchedulingPostDTO {
118
202
  this.contentSnippet = data.contentSnippet;
119
203
  this.createdAt = data.createdAt;
120
204
  this.updatedAt = data.updatedAt;
205
+ this.thumbnailUrl = data.thumbnailUrl;
206
+ this.mediaUrl = data.mediaUrl;
207
+ this.content = data.content;
208
+ this.mediaItems = data.mediaItems;
209
+ this.platformTargets = data.platformTargets;
121
210
  }
122
211
  }
123
212
 
package/CHANGELOG.md DELETED
@@ -1,43 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to `ad2app-lib` are documented here. The analytics taxonomy
4
- is the single source of truth across all surfaces; the matching spec lives in
5
- `ad2appus/docs/posthog-implementation.md` (§3).
6
-
7
- ## 1.9.0
8
-
9
- ### Added
10
-
11
- - Free Tier analytics (epic AD2-887):
12
- - `EVENTS.FREE_SKILLS_REQUESTED` (`free_skills_requested`), shape `{ source: string }` — email submitted for the free skills (AD2-889).
13
- - `EVENTS.ACCOUNT_CONNECT_BLOCKED` (`account_connect_blocked`), shape `{ platform?: string }` — free user hits the connect wall (AD2-892).
14
- - `EVENTS.MCP_POST_BLOCKED_FREE_TIER` (`mcp_post_blocked_free_tier`), shape `{ target_count?: number }` — free user tries to post in the MCP (AD2-898).
15
- - `'free_skills'` added to the `LANDING_CTA_CLICKED` location union.
16
- - Email lifecycle events (Resend webhook -> PostHog, AD2-894):
17
- `EVENTS.EMAIL_DELIVERED` / `EMAIL_OPENED` / `EMAIL_CLICKED` / `EMAIL_BOUNCED` /
18
- `EMAIL_COMPLAINED`, all sharing `EmailEventProperties` (`{ email_id?, subject?, link? }`).
19
-
20
- ## 1.8.0
21
-
22
- ### Added
23
-
24
- - `EVENTS.CONNECT_ARTIFACT_COPIED` (`connect_artifact_copied`) with property
25
- shape `{ target: 'app' | 'ask' | 'terminal' | 'editor' }` — fired when the
26
- `/connect` install snippet is copied.
27
- - `'ai_connector'` added to the `LANDING_CTA_CLICKED` location union
28
- (`hero | pricing | final_cta | nav | ai_connector`).
29
-
30
- ### Removed
31
-
32
- - `EVENTS.TRIAL_STARTED` (`trial_started`) and its `EventProperties` shape.
33
- - `PERSON_PROPS.TRIAL_ENDS_AT` (`trial_ends_at`).
34
- - `'trial'` removed from the documented `PLAN` person-property values, which now
35
- match the canonical `SchedulingSubscriptionTier` (`free | starter | pro`).
36
-
37
- ad2app is a paid-only product with no trial, so these events never fired.
38
- Verified that no consumer (frontend, backend, landing, mcp) referenced them.
39
-
40
- > **Semver note:** removing exported symbols is technically breaking. It is
41
- > released as a minor because no consumer referenced the removed tokens and all
42
- > consumers pin `^1.7.x`, so they upgrade frictionlessly. If you prefer strict
43
- > semver, retag as `2.0.0` and bump the consumer ranges deliberately.