ad2app-lib 1.49.0 → 1.59.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.
@@ -9,7 +9,9 @@
9
9
  * Do NOT rename events after they ship — historical data does not migrate.
10
10
  */
11
11
  import type { AccessDenialCode } from "../types/I_AccessDenial";
12
- import type { SponsoredTier } from "../types/agency";
12
+ import type { CreatorAccessGrantOrigin, SponsoredTier } from "../types/agency";
13
+ import type { AgencyCampaignKind, CampaignPlatform } from "../types/agency-campaigns";
14
+ import type { DealMoneyState, DealPayoutState } from "../types/dealroom";
13
15
  /** Canonical PostHog event names. */
14
16
  export declare const EVENTS: {
15
17
  readonly LANDING_CTA_CLICKED: "landing_cta_clicked";
@@ -120,6 +122,27 @@ export declare const EVENTS: {
120
122
  readonly AGENCY_CAMPAIGN_MILESTONE_CONFIRMED: "agency_campaign_milestone_confirmed";
121
123
  readonly AGENCY_THREAD_STARTED: "agency_thread_started";
122
124
  readonly AGENCY_THREAD_MESSAGE_SENT: "agency_thread_message_sent";
125
+ readonly AGENCY_POT_APPLIED: "agency_pot_applied";
126
+ readonly AGENCY_POT_APPLICATION_DECIDED: "agency_pot_application_decided";
127
+ readonly AGENCY_POT_REFILLED: "agency_pot_refilled";
128
+ readonly AGENCY_POT_MOVED: "agency_pot_moved";
129
+ readonly AGENCY_POT_PUBLISH_TIME_CONFIRMED: "agency_pot_publish_time_confirmed";
130
+ readonly AGENCY_POT_PUBLISHED: "agency_pot_published";
131
+ readonly AGENCY_POT_BONUS_HELD: "agency_pot_bonus_held";
132
+ readonly AGENCY_POT_BONUS_DECIDED: "agency_pot_bonus_decided";
133
+ readonly AGENCY_POT_REMOVAL_DECIDED: "agency_pot_removal_decided";
134
+ readonly AGENCY_POT_EXPORTED: "agency_pot_exported";
135
+ readonly AGENCY_POT_FILE_UPLOADED: "agency_pot_file_uploaded";
136
+ readonly DEALROOM_FEED_VIEWED: "dealroom_feed_viewed";
137
+ readonly DEALROOM_LISTING_OPENED: "dealroom_listing_opened";
138
+ readonly DEALROOM_APPLIED: "dealroom_applied";
139
+ readonly DEALROOM_BROADEN_TOGGLED: "dealroom_broaden_toggled";
140
+ readonly DEALROOM_NEAR_MATCH_SHOWN: "dealroom_near_match_shown";
141
+ readonly DEALROOM_NEAR_MATCH_PROMOTED: "dealroom_near_match_promoted";
142
+ readonly DEALROOM_CONNECT_FROM_NEAR_MATCH_CLICKED: "dealroom_connect_from_near_match_clicked";
143
+ readonly DEALROOM_DELEGATION_CHANGED: "dealroom_delegation_changed";
144
+ readonly DEALROOM_DEAL_MONEY_STATE_CHANGED: "dealroom_deal_money_state_changed";
145
+ readonly DEALROOM_DEAL_PAYOUT_STATE_CHANGED: "dealroom_deal_payout_state_changed";
123
146
  };
124
147
  export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
125
148
  /** Which email program a send belongs to (spec 120). Wire values — do not rename. */
@@ -257,7 +280,7 @@ export interface AgencyEventProperties {
257
280
  /** Present once a specific consent is the subject of the act. */
258
281
  grant_id?: string;
259
282
  actor_role: 'owner' | 'member' | 'creator' | 'admin' | 'system';
260
- origin?: 'invite_link' | 'agency_request';
283
+ origin?: CreatorAccessGrantOrigin;
261
284
  terms_version?: string;
262
285
  tier?: SponsoredTier;
263
286
  /**
@@ -271,6 +294,16 @@ export interface AgencyEventProperties {
271
294
  export interface AgencyCampaignEventProperties extends AgencyEventProperties {
272
295
  campaign_id: string;
273
296
  }
297
+ /**
298
+ * A Dealroom listing event (148): which listing, of which organization and
299
+ * kind. Never a price and never a follower count: what a creator saw and
300
+ * applied to, not what they earn.
301
+ */
302
+ export interface DealroomListingEventProperties {
303
+ campaign_id: string;
304
+ organization_id: string;
305
+ kind: AgencyCampaignKind;
306
+ }
274
307
  export interface EventProperties {
275
308
  [EVENTS.LANDING_CTA_CLICKED]: {
276
309
  location: 'hero' | 'pricing' | 'final_cta' | 'nav' | 'ai_connector' | 'free_skills';
@@ -628,6 +661,56 @@ export interface EventProperties {
628
661
  [EVENTS.AGENCY_THREAD_MESSAGE_SENT]: AgencyEventProperties & {
629
662
  thread_id: string;
630
663
  };
664
+ [EVENTS.AGENCY_POT_APPLIED]: AgencyCampaignEventProperties;
665
+ [EVENTS.AGENCY_POT_APPLICATION_DECIDED]: AgencyCampaignEventProperties & {
666
+ action: 'accept' | 'decline';
667
+ };
668
+ [EVENTS.AGENCY_POT_REFILLED]: AgencyCampaignEventProperties;
669
+ [EVENTS.AGENCY_POT_MOVED]: AgencyCampaignEventProperties;
670
+ [EVENTS.AGENCY_POT_PUBLISH_TIME_CONFIRMED]: AgencyCampaignEventProperties;
671
+ [EVENTS.AGENCY_POT_PUBLISHED]: AgencyCampaignEventProperties;
672
+ [EVENTS.AGENCY_POT_BONUS_HELD]: AgencyCampaignEventProperties & {
673
+ reason: 'jump' | 'paid_delivery';
674
+ };
675
+ [EVENTS.AGENCY_POT_BONUS_DECIDED]: AgencyCampaignEventProperties & {
676
+ action: 'approve' | 'cap' | 'message';
677
+ };
678
+ [EVENTS.AGENCY_POT_REMOVAL_DECIDED]: AgencyCampaignEventProperties & {
679
+ decision: 'keep_base' | 'withhold_base';
680
+ };
681
+ [EVENTS.AGENCY_POT_EXPORTED]: AgencyCampaignEventProperties & {
682
+ format: 'csv' | 'xlsx' | 'report';
683
+ };
684
+ [EVENTS.AGENCY_POT_FILE_UPLOADED]: AgencyCampaignEventProperties;
685
+ [EVENTS.DEALROOM_FEED_VIEWED]: {
686
+ state: 'ok' | 'profile_incomplete';
687
+ listing_count: number;
688
+ broadened: boolean;
689
+ near_match_count?: number;
690
+ };
691
+ [EVENTS.DEALROOM_LISTING_OPENED]: DealroomListingEventProperties;
692
+ [EVENTS.DEALROOM_APPLIED]: DealroomListingEventProperties & {
693
+ acting_grant_id?: string;
694
+ };
695
+ [EVENTS.DEALROOM_BROADEN_TOGGLED]: {
696
+ broadened: boolean;
697
+ };
698
+ [EVENTS.DEALROOM_NEAR_MATCH_SHOWN]: DealroomListingEventProperties & {
699
+ gap: 'followers' | 'missing_platform';
700
+ };
701
+ [EVENTS.DEALROOM_NEAR_MATCH_PROMOTED]: DealroomListingEventProperties;
702
+ [EVENTS.DEALROOM_CONNECT_FROM_NEAR_MATCH_CLICKED]: DealroomListingEventProperties & {
703
+ platform: CampaignPlatform;
704
+ };
705
+ [EVENTS.DEALROOM_DELEGATION_CHANGED]: AgencyEventProperties & {
706
+ action: 'granted' | 'revoked';
707
+ };
708
+ [EVENTS.DEALROOM_DEAL_MONEY_STATE_CHANGED]: DealroomListingEventProperties & {
709
+ money_state: DealMoneyState;
710
+ };
711
+ [EVENTS.DEALROOM_DEAL_PAYOUT_STATE_CHANGED]: DealroomListingEventProperties & {
712
+ payout_state: DealPayoutState;
713
+ };
631
714
  }
632
715
  /** Canonical person property keys (set via identify / $set). */
633
716
  export declare const PERSON_PROPS: {
@@ -194,6 +194,32 @@ exports.EVENTS = {
194
194
  // Threads (175 US8). Never the message body: a conversation is not analytics.
195
195
  AGENCY_THREAD_STARTED: 'agency_thread_started',
196
196
  AGENCY_THREAD_MESSAGE_SENT: 'agency_thread_message_sent',
197
+ // Pot campaigns (175 US9). Never an amount: the pot's economics are the agency's.
198
+ AGENCY_POT_APPLIED: 'agency_pot_applied',
199
+ AGENCY_POT_APPLICATION_DECIDED: 'agency_pot_application_decided',
200
+ AGENCY_POT_REFILLED: 'agency_pot_refilled',
201
+ AGENCY_POT_MOVED: 'agency_pot_moved',
202
+ AGENCY_POT_PUBLISH_TIME_CONFIRMED: 'agency_pot_publish_time_confirmed',
203
+ AGENCY_POT_PUBLISHED: 'agency_pot_published',
204
+ AGENCY_POT_BONUS_HELD: 'agency_pot_bonus_held',
205
+ AGENCY_POT_BONUS_DECIDED: 'agency_pot_bonus_decided',
206
+ AGENCY_POT_REMOVAL_DECIDED: 'agency_pot_removal_decided',
207
+ AGENCY_POT_EXPORTED: 'agency_pot_exported',
208
+ AGENCY_POT_FILE_UPLOADED: 'agency_pot_file_uploaded',
209
+ // Dealroom (148): only what 175 has no event for. Offer, material and thread
210
+ // acts on a Dealroom deal reuse the AGENCY_CAMPAIGN_* / AGENCY_THREAD_* events.
211
+ DEALROOM_FEED_VIEWED: 'dealroom_feed_viewed',
212
+ DEALROOM_LISTING_OPENED: 'dealroom_listing_opened',
213
+ DEALROOM_APPLIED: 'dealroom_applied',
214
+ DEALROOM_BROADEN_TOGGLED: 'dealroom_broaden_toggled',
215
+ DEALROOM_NEAR_MATCH_SHOWN: 'dealroom_near_match_shown',
216
+ DEALROOM_NEAR_MATCH_PROMOTED: 'dealroom_near_match_promoted',
217
+ // The near-match's missing-platform nudge, clicked through to Connect (US11).
218
+ DEALROOM_CONNECT_FROM_NEAR_MATCH_CLICKED: 'dealroom_connect_from_near_match_clicked',
219
+ DEALROOM_DELEGATION_CHANGED: 'dealroom_delegation_changed',
220
+ // Money release (dormant until then): state moves, never an amount.
221
+ DEALROOM_DEAL_MONEY_STATE_CHANGED: 'dealroom_deal_money_state_changed',
222
+ DEALROOM_DEAL_PAYOUT_STATE_CHANGED: 'dealroom_deal_payout_state_changed',
197
223
  };
198
224
  /**
199
225
  * Canonical email event property KEYS (spec 120 T001). Emitters and tests
@@ -61,6 +61,13 @@ export declare const ACCESS_DENIAL_CODES: {
61
61
  readonly AGENCY_SCOPE_NOT_GRANTED: "agency-scope-not-granted";
62
62
  /** The consent screen is off in this environment (FR-020, the legal gate). */
63
63
  readonly AGENCY_CONSENT_DISABLED: "agency-consent-disabled";
64
+ /**
65
+ * The consent screen is on but this environment names no terms version, so
66
+ * no grant can be minted (FR-020). A deployment fault, said as a refusal
67
+ * rather than a 500 (spec 148 audit #1); the env gate requires the version
68
+ * wherever consent is switched on.
69
+ */
70
+ readonly AGENCY_TERMS_VERSION_MISSING: "agency-terms-version-missing";
64
71
  /** The roster invite link expired, was rotated, or its organization is not approved. */
65
72
  readonly AGENCY_LINK_INVALID: "agency-link-invalid";
66
73
  /** An admin may not decide on an organization they belong to (FR-017). */
@@ -65,6 +65,13 @@ exports.ACCESS_DENIAL_CODES = {
65
65
  AGENCY_SCOPE_NOT_GRANTED: "agency-scope-not-granted",
66
66
  /** The consent screen is off in this environment (FR-020, the legal gate). */
67
67
  AGENCY_CONSENT_DISABLED: "agency-consent-disabled",
68
+ /**
69
+ * The consent screen is on but this environment names no terms version, so
70
+ * no grant can be minted (FR-020). A deployment fault, said as a refusal
71
+ * rather than a 500 (spec 148 audit #1); the env gate requires the version
72
+ * wherever consent is switched on.
73
+ */
74
+ AGENCY_TERMS_VERSION_MISSING: "agency-terms-version-missing",
68
75
  /** The roster invite link expired, was rotated, or its organization is not approved. */
69
76
  AGENCY_LINK_INVALID: "agency-link-invalid",
70
77
  /** An admin may not decide on an organization they belong to (FR-017). */
@@ -1,6 +1,8 @@
1
1
  import { I_MediaStage } from './I_Media';
2
2
  import { I_OfferStatus } from './I_Offer';
3
3
  import { type I_AgencyGrantScope } from './agency';
4
+ import { PotFields, type I_AgencyPotView, type I_CampaignFile, type I_CreatorPotView, type I_DisclosureCheck } from './agency-pots';
5
+ import { type CampaignVisibility, type I_CampaignListing, type I_TargetProfile } from './dealroom';
4
6
  /**
5
7
  * The campaign loop (spec 175 US7) — an organization runs a campaign with the
6
8
  * creators on its roster or in the directory.
@@ -37,8 +39,18 @@ export declare const isCampaignPlacement: (platform: string, placement: string)
37
39
  /** The creator's own setting. The agency reads it and can never set it. */
38
40
  export declare const SETTLEMENT_FORMS: readonly ["invoice", "contract", "barter"];
39
41
  export type SettlementForm = (typeof SETTLEMENT_FORMS)[number];
42
+ /**
43
+ * An offer campaign negotiates one price per creator (US7); a pot campaign pays
44
+ * from one pot on each creator's own terms (US9). Chosen at creation, fixed once
45
+ * the first creator is invited (FR-030).
46
+ */
47
+ export declare const AGENCY_CAMPAIGN_KINDS: readonly ["offer", "pot"];
48
+ export type AgencyCampaignKind = (typeof AGENCY_CAMPAIGN_KINDS)[number];
40
49
  export declare const AGENCY_CAMPAIGN_MEMBER_STATES: readonly ["invited", "joined", "declined", "left", "removed"];
41
50
  export type AgencyCampaignMemberState = (typeof AGENCY_CAMPAIGN_MEMBER_STATES)[number];
51
+ /** How a creator came onto a campaign: 175's invitation, or a Dealroom application to an open listing (spec 148). */
52
+ export declare const AGENCY_CAMPAIGN_MEMBER_ORIGINS: readonly ["invitation", "application"];
53
+ export type AgencyCampaignMemberOrigin = (typeof AGENCY_CAMPAIGN_MEMBER_ORIGINS)[number];
42
54
  /** The offer statuses the agency loop writes. `draft`, `deleted` and `alternativeSuggested` are legacy-only. */
43
55
  export declare const AGENCY_OFFER_STATUSES: readonly [I_OfferStatus.SENT, I_OfferStatus.INFLUENCER_NEGOTIATED, I_OfferStatus.AGENCY_NEGOTIATED, I_OfferStatus.ACCEPTED, I_OfferStatus.CONFIRMED, I_OfferStatus.REJECTED, I_OfferStatus.WITHDRAWN];
44
56
  export type AgencyOfferStatus = (typeof AGENCY_OFFER_STATUSES)[number];
@@ -48,9 +60,13 @@ export type CampaignSide = 'agency' | 'creator';
48
60
  * right now is the server's `availableActions`, never a client guess.
49
61
  *
50
62
  * agency: counter · confirm · reject
51
- * creator: accept · counter · reject
63
+ * creator: accept · counter · reject · apply
64
+ *
65
+ * `apply` (spec 148) is the creator's opening price on an open listing, with
66
+ * no offer yet: it lands in the existing negotiating status, the agency's
67
+ * turn. No offer status is added for it.
52
68
  */
53
- export declare const AGENCY_OFFER_ACTIONS: readonly ["accept", "counter", "confirm", "reject"];
69
+ export declare const AGENCY_OFFER_ACTIONS: readonly ["accept", "counter", "confirm", "reject", "apply"];
54
70
  export type AgencyOfferAction = (typeof AGENCY_OFFER_ACTIONS)[number];
55
71
  /** The agency's acts on the latest material; the creator's only act is to upload. */
56
72
  export declare const AGENCY_MATERIAL_ACTIONS: readonly ["approve", "request_changes", "reject"];
@@ -68,7 +84,7 @@ export type AgencyMilestoneKind = (typeof AGENCY_MILESTONE_KINDS)[number];
68
84
  /** A milestone may wait on one rule: every ACTIVE offer at a status, or every active creator's latest material at a stage. */
69
85
  export declare const AGENCY_MILESTONE_OFFER_RULES: readonly [I_OfferStatus.CONFIRMED];
70
86
  export declare const AGENCY_MILESTONE_MEDIA_RULES: readonly [I_MediaStage.UPLOADED, I_MediaStage.ACCEPTED];
71
- export declare const AGENCY_CAMPAIGN_EVENT_KINDS: readonly ["invited", "joined", "declined", "left", "removed", "offer_sent", "offer_countered", "offer_accepted", "offer_confirmed", "offer_rejected", "offer_withdrawn", "material_uploaded", "material_approved", "material_changes_asked", "material_rejected", "published", "milestone_confirmed"];
87
+ export declare const AGENCY_CAMPAIGN_EVENT_KINDS: readonly ["invited", "joined", "declined", "left", "removed", "offer_sent", "offer_countered", "offer_accepted", "offer_confirmed", "offer_rejected", "offer_withdrawn", "material_uploaded", "material_approved", "material_changes_asked", "material_rejected", "published", "milestone_confirmed", "pot_applied", "pot_application_withdrawn", "pot_accepted", "pot_declined", "pot_released", "pot_refilled", "pot_moved", "pot_deadline_moved", "pot_publish_time_set", "pot_publish_time_confirmed", "pot_publish_refused", "pot_published", "pot_counted", "pot_frozen", "pot_bonus_held", "pot_bonus_approved", "pot_bonus_capped", "pot_bonus_message", "pot_kept", "pot_broken", "pot_removal_decided", "caption_edited", "file_uploaded", "file_removed", "contract_sent", "contract_signed", "contract_declined", "deposit_paid", "deal_funded", "deal_closed_unviewed", "deal_refund_requested", "deal_refunded", "guarantee_claimed", "payout_initiated", "payout_paid"];
72
88
  export type AgencyCampaignEventKind = (typeof AGENCY_CAMPAIGN_EVENT_KINDS)[number];
73
89
  /** Refusal codes the frontend owes its own copy for. */
74
90
  export declare const AGENCY_CAMPAIGN_CODES: {
@@ -131,6 +147,10 @@ export interface I_AgencyMaterial {
131
147
  uploadedAt: string;
132
148
  /** The note sent with a change request or a rejection of THIS version. */
133
149
  note: string | null;
150
+ /** The post's caption, uploaded with the material (US9, FR-032); the creator may edit it until publication. Optional: 1.49 backends omit it. */
151
+ caption?: string | null;
152
+ /** `checkDisclosure(caption)`, returned with every read (FR-040); null without a caption. Optional: 1.49 backends omit it. */
153
+ disclosure?: I_DisclosureCheck | null;
134
154
  }
135
155
  export interface I_AgencyMilestone {
136
156
  id: string;
@@ -148,9 +168,27 @@ export interface I_AgencyMilestone {
148
168
  export interface I_AgencyCampaignEvent {
149
169
  kind: AgencyCampaignEventKind;
150
170
  side: CampaignSide;
171
+ /** Done by ad2app itself (the daily pot job), not by a person on that side. */
172
+ byAd2app?: true;
151
173
  at: string;
152
174
  price?: I_Money;
175
+ /** A pot act's amount: a refill, a move, a reserved guarantee, an accrued bonus. */
176
+ amount?: I_Money;
153
177
  note?: string;
178
+ /** Set when a delegate acted on the creator's side through a `deals` grant (spec 148 FR-017a). */
179
+ actingGrantId?: string;
180
+ /** With `actingGrantId`: the member who acted, shown as "<member> for <creator>". */
181
+ actingMemberName?: string;
182
+ /** The act came from the creator's Dealroom application (spec 148 US4), not an invitation. */
183
+ fromApplication?: true;
184
+ }
185
+ /** Spec 148 US8 AC3: one act a manager did in the creator's deal, for the creator's own view. */
186
+ export interface I_CreatorDelegateAct {
187
+ kind: AgencyCampaignEventKind;
188
+ at: string;
189
+ /** The member of the managing agency who acted. */
190
+ memberName: string;
191
+ organizationName: string;
154
192
  }
155
193
  export interface I_CampaignCreatorIdentity {
156
194
  userId: string | null;
@@ -163,6 +201,8 @@ export interface I_AgencyCampaignMemberRow {
163
201
  memberId: string;
164
202
  creator: I_CampaignCreatorIdentity;
165
203
  state: AgencyCampaignMemberState;
204
+ /** Invitation or Dealroom application (spec 148). Absent on older backends: read as 'invitation'. */
205
+ origin?: AgencyCampaignMemberOrigin;
166
206
  /** The board column, or the reason the row is off the board. */
167
207
  step: AgencyCampaignStep | AgencyCampaignOffBoard;
168
208
  /** When the row reached its current step. */
@@ -194,6 +234,8 @@ export interface I_AgencyCampaignPipeline {
194
234
  export interface I_AgencyCampaignCard {
195
235
  id: string;
196
236
  name: string;
237
+ /** Absent from 1.49 backends: read as 'offer'. */
238
+ kind?: AgencyCampaignKind;
197
239
  isDraft: boolean;
198
240
  liveByAt: string | null;
199
241
  draftDueAt: string | null;
@@ -205,12 +247,18 @@ export interface I_AgencyCampaignCard {
205
247
  export interface I_AgencyCampaign {
206
248
  id: string;
207
249
  name: string;
250
+ /** Absent from 1.49 backends: read as 'offer'. */
251
+ kind?: AgencyCampaignKind;
252
+ /** Set on a pot campaign; the pot board itself is `GET /agency/campaigns/:id/pot/board`. */
253
+ pot?: I_AgencyPotView | null;
208
254
  isDraft: boolean;
209
255
  brief: I_AgencyCampaignBrief;
210
256
  members: I_AgencyCampaignMemberRow[];
211
257
  milestones: I_AgencyMilestone[];
212
258
  pipeline: I_AgencyCampaignPipeline;
213
259
  createdAt: string;
260
+ /** Spec 148: the Dealroom listing fields and their derived state. Absent on older backends. */
261
+ listing?: I_CampaignListing;
214
262
  }
215
263
  /** Opening one creator (FR-024): their course with dates, notes, files and milestones. */
216
264
  export interface I_AgencyCampaignCreatorDetail {
@@ -219,12 +267,41 @@ export interface I_AgencyCampaignCreatorDetail {
219
267
  events: I_AgencyCampaignEvent[];
220
268
  materials: I_AgencyMaterial[];
221
269
  milestones: I_AgencyMilestone[];
270
+ /** Spec 148 T067: an offer deal's agreed publication time. Absent on a pot (its entry carries it) and on older backends. */
271
+ publication?: I_OfferPublication | null;
272
+ }
273
+ /**
274
+ * Spec 148 T067: an OFFER deal publishes through 175 US9's auto-publish path.
275
+ * The organization sets the agreed time on a confirmed offer with an approved
276
+ * material (`PATCH /agency/campaigns/:id/members/:memberId/publish-at`); the
277
+ * creator confirms that exact time once (`POST /agency/campaign-invitations/
278
+ * :memberId/publish-at/confirm`, the same route as a pot's); the post then goes
279
+ * out from the creator's own account, and publication is known by construction.
280
+ * `POST .../members/:memberId/published` stays for off-platform posting.
281
+ */
282
+ export interface I_OfferPublication {
283
+ publishAt: string | null;
284
+ publishConfirmedAt: string | null;
285
+ /** The post is scheduled on the creator's account (the confirmed time is within the signed-link horizon). */
286
+ scheduled: boolean;
287
+ publishedAt: string | null;
288
+ /** The latest refusal at scheduling since the time was set or confirmed; the creator confirms again. */
289
+ publishRefusal: {
290
+ at: string;
291
+ reason: string;
292
+ } | null;
293
+ /** Organization side: the offer is confirmed, the latest material approved, and nothing is published yet. */
294
+ canSetPublishAt: boolean;
295
+ /** Creator side: a time is set and not confirmed, and the latest material's caption passes the disclosure check. */
296
+ canConfirmPublishAt: boolean;
222
297
  }
223
298
  /** `GET /agency/campaigns/attention` — what waits on the agency (FR-022, the rail). */
224
299
  export interface I_AgencyCampaignAttention {
225
300
  counterOffers: number;
226
301
  materialsToReview: number;
227
302
  milestonesReady: number;
303
+ /** US9: applications to answer, held bonuses to decide, and posts taken down after the bonus window. */
304
+ potDecisions?: number;
228
305
  total: number;
229
306
  }
230
307
  /** `GET /agency/panel` (FR-022). */
@@ -264,11 +341,17 @@ export interface I_CreatorCampaignView {
264
341
  id: string;
265
342
  name: string;
266
343
  };
344
+ /** `kind` is absent from 1.49 backends: read as 'offer'. */
267
345
  campaign: {
268
346
  id: string;
269
347
  name: string;
270
348
  brief: I_AgencyCampaignBrief;
349
+ kind?: AgencyCampaignKind;
271
350
  };
351
+ /** Set on a pot campaign: the creator's own terms, earnings and the two-valued availability, nothing pot-level (SC-016). */
352
+ pot?: I_CreatorPotView | null;
353
+ /** The agency's files for the campaign (FR-039): every one is for its creators; opened through a signed read. */
354
+ files?: I_CampaignFile[];
272
355
  creatorBrief: string | null;
273
356
  /** The access request folded into the invitation, while it is open. */
274
357
  requestedScopes: I_AgencyGrantScope[];
@@ -280,6 +363,10 @@ export interface I_CreatorCampaignView {
280
363
  canLeave: boolean;
281
364
  milestones: I_AgencyMilestone[];
282
365
  invitedAt: string;
366
+ /** Spec 148 T067: an offer deal's agreed publication time; null on a pot (see `pot.entry`) and before a confirmed offer. */
367
+ publication?: I_OfferPublication | null;
368
+ /** Spec 148 US8 AC3: what a manager did in this deal for the creator, oldest first. Absent on older backends. */
369
+ delegateActs?: I_CreatorDelegateAct[];
283
370
  }
284
371
  /** `GET /agency/campaign-invitations/mine` — pending invitations and live campaigns. */
285
372
  export interface I_CreatorCampaigns {
@@ -299,8 +386,8 @@ export interface I_SignedRead {
299
386
  url: string;
300
387
  expiresAt: string;
301
388
  }
302
- /** The brief's fields, shared by create and update. All optional on the wire. */
303
- declare class AgencyCampaignBriefFields {
389
+ /** The brief's fields, shared by create and update. All optional on the wire. The pot's fields ride along (US9). */
390
+ declare class AgencyCampaignBriefFields extends PotFields {
304
391
  text?: string;
305
392
  deliverables?: I_CampaignDeliverable[];
306
393
  draftDueAt?: string | null;
@@ -308,16 +395,30 @@ declare class AgencyCampaignBriefFields {
308
395
  licenceMonths?: number | null;
309
396
  paidPromoMonths?: number | null;
310
397
  revisionRounds?: number | null;
398
+ /** `open` lists the campaign in the Dealroom feed; it needs a target profile and the organization's logo. */
399
+ visibility?: CampaignVisibility;
400
+ /** Checked field by field in the service (flat bodies, see above). Blank constraint = no filter. */
401
+ targetProfile?: I_TargetProfile | null;
402
+ /** Null = unlimited. Once frozen, it may only grow. */
403
+ slots?: number | null;
404
+ /** Offer kind only (a pot keeps its own). Once frozen, it may only move later. */
405
+ applicationDeadline?: string | null;
406
+ /** Any date closes the listing NOW (server time): new applications stop, running deals do not. */
407
+ closedAt?: string | null;
311
408
  protected assignBrief(data?: Partial<AgencyCampaignBriefFields>): void;
312
409
  }
313
410
  export declare class CreateAgencyCampaignDto extends AgencyCampaignBriefFields {
314
411
  name: string;
412
+ /** Absent = an offer campaign (US7). */
413
+ kind?: AgencyCampaignKind;
315
414
  constructor(data?: Partial<CreateAgencyCampaignDto>);
316
415
  }
317
416
  export declare class UpdateAgencyCampaignDto extends AgencyCampaignBriefFields {
318
417
  name?: string;
319
418
  /** Setting false publishes the draft; the brief text must then be present (FR-025). */
320
419
  isDraft?: boolean;
420
+ /** Switch offer ↔ pot; refused once the first creator is invited (FR-030). */
421
+ kind?: AgencyCampaignKind;
321
422
  constructor(data?: Partial<UpdateAgencyCampaignDto>);
322
423
  }
323
424
  export declare class InviteCampaignCreatorDto {
@@ -370,6 +471,8 @@ export declare class PrepareMaterialUploadDto {
370
471
  }
371
472
  export declare class ConfirmMaterialUploadDto {
372
473
  uploadId: string;
474
+ /** The post's caption, sent with the material on a pot campaign (FR-032). */
475
+ caption?: string;
373
476
  constructor(data?: Partial<ConfirmMaterialUploadDto>);
374
477
  }
375
478
  export declare class CreateAgencyMilestoneDto {
@@ -9,11 +9,13 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.UpdateSettlementFormDto = exports.CreateAgencyMilestoneDto = exports.ConfirmMaterialUploadDto = exports.PrepareMaterialUploadDto = exports.MATERIAL_CONTENT_TYPE = exports.MATERIAL_IMAGE_TYPES = exports.MATERIAL_MAX_BYTES = exports.JoinCampaignDto = exports.CampaignMaterialActDto = exports.CampaignOfferActDto = exports.SendCampaignOfferDto = exports.InviteCampaignCreatorDto = exports.UpdateAgencyCampaignDto = exports.CreateAgencyCampaignDto = exports.AGENCY_CAMPAIGN_CODES = exports.AGENCY_CAMPAIGN_EVENT_KINDS = exports.AGENCY_MILESTONE_MEDIA_RULES = exports.AGENCY_MILESTONE_OFFER_RULES = exports.AGENCY_MILESTONE_KINDS = exports.AGENCY_CAMPAIGN_STEPS = exports.AGENCY_MATERIAL_ACTIONS = exports.AGENCY_OFFER_ACTIONS = exports.AGENCY_OFFER_STATUSES = exports.AGENCY_CAMPAIGN_MEMBER_STATES = exports.SETTLEMENT_FORMS = exports.isCampaignPlacement = exports.CAMPAIGN_PLATFORMS = exports.CAMPAIGN_PLACEMENTS = void 0;
12
+ exports.UpdateSettlementFormDto = exports.CreateAgencyMilestoneDto = exports.ConfirmMaterialUploadDto = exports.PrepareMaterialUploadDto = exports.MATERIAL_CONTENT_TYPE = exports.MATERIAL_IMAGE_TYPES = exports.MATERIAL_MAX_BYTES = exports.JoinCampaignDto = exports.CampaignMaterialActDto = exports.CampaignOfferActDto = exports.SendCampaignOfferDto = exports.InviteCampaignCreatorDto = exports.UpdateAgencyCampaignDto = exports.CreateAgencyCampaignDto = exports.AGENCY_CAMPAIGN_CODES = exports.AGENCY_CAMPAIGN_EVENT_KINDS = exports.AGENCY_MILESTONE_MEDIA_RULES = exports.AGENCY_MILESTONE_OFFER_RULES = exports.AGENCY_MILESTONE_KINDS = exports.AGENCY_CAMPAIGN_STEPS = exports.AGENCY_MATERIAL_ACTIONS = exports.AGENCY_OFFER_ACTIONS = exports.AGENCY_OFFER_STATUSES = exports.AGENCY_CAMPAIGN_MEMBER_ORIGINS = exports.AGENCY_CAMPAIGN_MEMBER_STATES = exports.AGENCY_CAMPAIGN_KINDS = exports.SETTLEMENT_FORMS = exports.isCampaignPlacement = exports.CAMPAIGN_PLATFORMS = exports.CAMPAIGN_PLACEMENTS = void 0;
13
13
  const class_validator_1 = require("class-validator");
14
14
  const I_Media_1 = require("./I_Media");
15
15
  const I_Offer_1 = require("./I_Offer");
16
16
  const agency_1 = require("./agency");
17
+ const agency_pots_1 = require("./agency-pots");
18
+ const dealroom_1 = require("./dealroom");
17
19
  /**
18
20
  * The campaign loop (spec 175 US7) — an organization runs a campaign with the
19
21
  * creators on its roster or in the directory.
@@ -52,7 +54,15 @@ exports.isCampaignPlacement = isCampaignPlacement;
52
54
  /** The creator's own setting. The agency reads it and can never set it. */
53
55
  exports.SETTLEMENT_FORMS = ['invoice', 'contract', 'barter'];
54
56
  // ── States ───────────────────────────────────────────────────────────────────
57
+ /**
58
+ * An offer campaign negotiates one price per creator (US7); a pot campaign pays
59
+ * from one pot on each creator's own terms (US9). Chosen at creation, fixed once
60
+ * the first creator is invited (FR-030).
61
+ */
62
+ exports.AGENCY_CAMPAIGN_KINDS = ['offer', 'pot'];
55
63
  exports.AGENCY_CAMPAIGN_MEMBER_STATES = ['invited', 'joined', 'declined', 'left', 'removed'];
64
+ /** How a creator came onto a campaign: 175's invitation, or a Dealroom application to an open listing (spec 148). */
65
+ exports.AGENCY_CAMPAIGN_MEMBER_ORIGINS = ['invitation', 'application'];
56
66
  /** The offer statuses the agency loop writes. `draft`, `deleted` and `alternativeSuggested` are legacy-only. */
57
67
  exports.AGENCY_OFFER_STATUSES = [
58
68
  I_Offer_1.I_OfferStatus.SENT,
@@ -68,9 +78,13 @@ exports.AGENCY_OFFER_STATUSES = [
68
78
  * right now is the server's `availableActions`, never a client guess.
69
79
  *
70
80
  * agency: counter · confirm · reject
71
- * creator: accept · counter · reject
81
+ * creator: accept · counter · reject · apply
82
+ *
83
+ * `apply` (spec 148) is the creator's opening price on an open listing, with
84
+ * no offer yet: it lands in the existing negotiating status, the agency's
85
+ * turn. No offer status is added for it.
72
86
  */
73
- exports.AGENCY_OFFER_ACTIONS = ['accept', 'counter', 'confirm', 'reject'];
87
+ exports.AGENCY_OFFER_ACTIONS = ['accept', 'counter', 'confirm', 'reject', 'apply'];
74
88
  /** The agency's acts on the latest material; the creator's only act is to upload. */
75
89
  exports.AGENCY_MATERIAL_ACTIONS = ['approve', 'request_changes', 'reject'];
76
90
  /**
@@ -110,6 +124,46 @@ exports.AGENCY_CAMPAIGN_EVENT_KINDS = [
110
124
  'material_rejected',
111
125
  'published',
112
126
  'milestone_confirmed',
127
+ // US9: the pot. Every money act carries its amount (FR-021, FR-033).
128
+ 'pot_applied',
129
+ 'pot_application_withdrawn',
130
+ 'pot_accepted',
131
+ 'pot_declined',
132
+ 'pot_released',
133
+ 'pot_refilled',
134
+ 'pot_moved',
135
+ 'pot_deadline_moved',
136
+ 'pot_publish_time_set',
137
+ 'pot_publish_time_confirmed',
138
+ /** Zernio refused the post at scheduling; `note` carries its reason. */
139
+ 'pot_publish_refused',
140
+ 'pot_published',
141
+ 'pot_counted',
142
+ 'pot_frozen',
143
+ 'pot_bonus_held',
144
+ 'pot_bonus_approved',
145
+ 'pot_bonus_capped',
146
+ 'pot_bonus_message',
147
+ 'pot_kept',
148
+ 'pot_broken',
149
+ 'pot_removal_decided',
150
+ 'caption_edited',
151
+ 'file_uploaded',
152
+ 'file_removed',
153
+ // Spec 148 money release (DORMANT): the contract, money and payout steps of a
154
+ // Dealroom deal are kinds in this one log (FR-008a). Mirrored by
155
+ // DEALROOM_MONEY_EVENT_KINDS in dealroom.ts.
156
+ 'contract_sent',
157
+ 'contract_signed',
158
+ 'contract_declined',
159
+ 'deposit_paid',
160
+ 'deal_funded',
161
+ 'deal_closed_unviewed',
162
+ 'deal_refund_requested',
163
+ 'deal_refunded',
164
+ 'guarantee_claimed',
165
+ 'payout_initiated',
166
+ 'payout_paid',
113
167
  ];
114
168
  /** Refusal codes the frontend owes its own copy for. */
115
169
  exports.AGENCY_CAMPAIGN_CODES = {
@@ -132,9 +186,15 @@ exports.AGENCY_CAMPAIGN_CODES = {
132
186
  // linked lib carries its own copy whose metadata the backend's ValidationPipe
133
187
  // never reads. `deliverables` is an array of plain objects checked item by
134
188
  // item in the service against CAMPAIGN_PLACEMENTS — the pair is the rule.
135
- /** The brief's fields, shared by create and update. All optional on the wire. */
136
- class AgencyCampaignBriefFields {
189
+ /** The brief's fields, shared by create and update. All optional on the wire. The pot's fields ride along (US9). */
190
+ class AgencyCampaignBriefFields extends agency_pots_1.PotFields {
137
191
  assignBrief(data) {
192
+ this.assignPot(data);
193
+ this.visibility = data?.visibility;
194
+ this.targetProfile = data?.targetProfile;
195
+ this.slots = data?.slots;
196
+ this.applicationDeadline = data?.applicationDeadline;
197
+ this.closedAt = data?.closedAt;
138
198
  this.text = data?.text;
139
199
  this.deliverables = data?.deliverables;
140
200
  this.draftDueAt = data?.draftDueAt;
@@ -187,10 +247,38 @@ __decorate([
187
247
  (0, class_validator_1.Max)(20),
188
248
  __metadata("design:type", Number)
189
249
  ], AgencyCampaignBriefFields.prototype, "revisionRounds", void 0);
250
+ __decorate([
251
+ (0, class_validator_1.IsOptional)(),
252
+ (0, class_validator_1.IsIn)(dealroom_1.CAMPAIGN_VISIBILITIES),
253
+ __metadata("design:type", String)
254
+ ], AgencyCampaignBriefFields.prototype, "visibility", void 0);
255
+ __decorate([
256
+ (0, class_validator_1.IsOptional)(),
257
+ (0, class_validator_1.IsObject)(),
258
+ __metadata("design:type", Object)
259
+ ], AgencyCampaignBriefFields.prototype, "targetProfile", void 0);
260
+ __decorate([
261
+ (0, class_validator_1.IsOptional)(),
262
+ (0, class_validator_1.IsInt)(),
263
+ (0, class_validator_1.Min)(1),
264
+ (0, class_validator_1.Max)(10000),
265
+ __metadata("design:type", Number)
266
+ ], AgencyCampaignBriefFields.prototype, "slots", void 0);
267
+ __decorate([
268
+ (0, class_validator_1.IsOptional)(),
269
+ (0, class_validator_1.IsDateString)(),
270
+ __metadata("design:type", String)
271
+ ], AgencyCampaignBriefFields.prototype, "applicationDeadline", void 0);
272
+ __decorate([
273
+ (0, class_validator_1.IsOptional)(),
274
+ (0, class_validator_1.IsDateString)(),
275
+ __metadata("design:type", String)
276
+ ], AgencyCampaignBriefFields.prototype, "closedAt", void 0);
190
277
  class CreateAgencyCampaignDto extends AgencyCampaignBriefFields {
191
278
  constructor(data) {
192
279
  super();
193
280
  this.name = data?.name ?? '';
281
+ this.kind = data?.kind;
194
282
  this.assignBrief(data);
195
283
  }
196
284
  }
@@ -201,11 +289,17 @@ __decorate([
201
289
  (0, class_validator_1.MaxLength)(128),
202
290
  __metadata("design:type", String)
203
291
  ], CreateAgencyCampaignDto.prototype, "name", void 0);
292
+ __decorate([
293
+ (0, class_validator_1.IsOptional)(),
294
+ (0, class_validator_1.IsIn)(exports.AGENCY_CAMPAIGN_KINDS),
295
+ __metadata("design:type", String)
296
+ ], CreateAgencyCampaignDto.prototype, "kind", void 0);
204
297
  class UpdateAgencyCampaignDto extends AgencyCampaignBriefFields {
205
298
  constructor(data) {
206
299
  super();
207
300
  this.name = data?.name;
208
301
  this.isDraft = data?.isDraft;
302
+ this.kind = data?.kind;
209
303
  this.assignBrief(data);
210
304
  }
211
305
  }
@@ -222,6 +316,11 @@ __decorate([
222
316
  (0, class_validator_1.IsBoolean)(),
223
317
  __metadata("design:type", Boolean)
224
318
  ], UpdateAgencyCampaignDto.prototype, "isDraft", void 0);
319
+ __decorate([
320
+ (0, class_validator_1.IsOptional)(),
321
+ (0, class_validator_1.IsIn)(exports.AGENCY_CAMPAIGN_KINDS),
322
+ __metadata("design:type", String)
323
+ ], UpdateAgencyCampaignDto.prototype, "kind", void 0);
225
324
  class InviteCampaignCreatorDto {
226
325
  constructor(data) {
227
326
  this.creatorUserId = data?.creatorUserId ?? '';
@@ -361,6 +460,7 @@ __decorate([
361
460
  class ConfirmMaterialUploadDto {
362
461
  constructor(data) {
363
462
  this.uploadId = data?.uploadId ?? '';
463
+ this.caption = data?.caption;
364
464
  }
365
465
  }
366
466
  exports.ConfirmMaterialUploadDto = ConfirmMaterialUploadDto;
@@ -370,6 +470,12 @@ __decorate([
370
470
  (0, class_validator_1.MaxLength)(512),
371
471
  __metadata("design:type", String)
372
472
  ], ConfirmMaterialUploadDto.prototype, "uploadId", void 0);
473
+ __decorate([
474
+ (0, class_validator_1.IsOptional)(),
475
+ (0, class_validator_1.IsString)(),
476
+ (0, class_validator_1.MaxLength)(2200),
477
+ __metadata("design:type", String)
478
+ ], ConfirmMaterialUploadDto.prototype, "caption", void 0);
373
479
  class CreateAgencyMilestoneDto {
374
480
  constructor(data) {
375
481
  this.kind = data?.kind ?? 'custom';