ad2app-lib 1.50.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";
@@ -131,6 +133,16 @@ export declare const EVENTS: {
131
133
  readonly AGENCY_POT_REMOVAL_DECIDED: "agency_pot_removal_decided";
132
134
  readonly AGENCY_POT_EXPORTED: "agency_pot_exported";
133
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";
134
146
  };
135
147
  export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
136
148
  /** Which email program a send belongs to (spec 120). Wire values — do not rename. */
@@ -268,7 +280,7 @@ export interface AgencyEventProperties {
268
280
  /** Present once a specific consent is the subject of the act. */
269
281
  grant_id?: string;
270
282
  actor_role: 'owner' | 'member' | 'creator' | 'admin' | 'system';
271
- origin?: 'invite_link' | 'agency_request';
283
+ origin?: CreatorAccessGrantOrigin;
272
284
  terms_version?: string;
273
285
  tier?: SponsoredTier;
274
286
  /**
@@ -282,6 +294,16 @@ export interface AgencyEventProperties {
282
294
  export interface AgencyCampaignEventProperties extends AgencyEventProperties {
283
295
  campaign_id: string;
284
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
+ }
285
307
  export interface EventProperties {
286
308
  [EVENTS.LANDING_CTA_CLICKED]: {
287
309
  location: 'hero' | 'pricing' | 'final_cta' | 'nav' | 'ai_connector' | 'free_skills';
@@ -660,6 +682,35 @@ export interface EventProperties {
660
682
  format: 'csv' | 'xlsx' | 'report';
661
683
  };
662
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
+ };
663
714
  }
664
715
  /** Canonical person property keys (set via identify / $set). */
665
716
  export declare const PERSON_PROPS: {
@@ -206,6 +206,20 @@ exports.EVENTS = {
206
206
  AGENCY_POT_REMOVAL_DECIDED: 'agency_pot_removal_decided',
207
207
  AGENCY_POT_EXPORTED: 'agency_pot_exported',
208
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',
209
223
  };
210
224
  /**
211
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). */
@@ -2,6 +2,7 @@ import { I_MediaStage } from './I_Media';
2
2
  import { I_OfferStatus } from './I_Offer';
3
3
  import { type I_AgencyGrantScope } from './agency';
4
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';
5
6
  /**
6
7
  * The campaign loop (spec 175 US7) — an organization runs a campaign with the
7
8
  * creators on its roster or in the directory.
@@ -47,6 +48,9 @@ export declare const AGENCY_CAMPAIGN_KINDS: readonly ["offer", "pot"];
47
48
  export type AgencyCampaignKind = (typeof AGENCY_CAMPAIGN_KINDS)[number];
48
49
  export declare const AGENCY_CAMPAIGN_MEMBER_STATES: readonly ["invited", "joined", "declined", "left", "removed"];
49
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];
50
54
  /** The offer statuses the agency loop writes. `draft`, `deleted` and `alternativeSuggested` are legacy-only. */
51
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];
52
56
  export type AgencyOfferStatus = (typeof AGENCY_OFFER_STATUSES)[number];
@@ -56,9 +60,13 @@ export type CampaignSide = 'agency' | 'creator';
56
60
  * right now is the server's `availableActions`, never a client guess.
57
61
  *
58
62
  * agency: counter · confirm · reject
59
- * 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.
60
68
  */
61
- export declare const AGENCY_OFFER_ACTIONS: readonly ["accept", "counter", "confirm", "reject"];
69
+ export declare const AGENCY_OFFER_ACTIONS: readonly ["accept", "counter", "confirm", "reject", "apply"];
62
70
  export type AgencyOfferAction = (typeof AGENCY_OFFER_ACTIONS)[number];
63
71
  /** The agency's acts on the latest material; the creator's only act is to upload. */
64
72
  export declare const AGENCY_MATERIAL_ACTIONS: readonly ["approve", "request_changes", "reject"];
@@ -76,7 +84,7 @@ export type AgencyMilestoneKind = (typeof AGENCY_MILESTONE_KINDS)[number];
76
84
  /** A milestone may wait on one rule: every ACTIVE offer at a status, or every active creator's latest material at a stage. */
77
85
  export declare const AGENCY_MILESTONE_OFFER_RULES: readonly [I_OfferStatus.CONFIRMED];
78
86
  export declare const AGENCY_MILESTONE_MEDIA_RULES: readonly [I_MediaStage.UPLOADED, I_MediaStage.ACCEPTED];
79
- 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"];
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"];
80
88
  export type AgencyCampaignEventKind = (typeof AGENCY_CAMPAIGN_EVENT_KINDS)[number];
81
89
  /** Refusal codes the frontend owes its own copy for. */
82
90
  export declare const AGENCY_CAMPAIGN_CODES: {
@@ -167,6 +175,20 @@ export interface I_AgencyCampaignEvent {
167
175
  /** A pot act's amount: a refill, a move, a reserved guarantee, an accrued bonus. */
168
176
  amount?: I_Money;
169
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;
170
192
  }
171
193
  export interface I_CampaignCreatorIdentity {
172
194
  userId: string | null;
@@ -179,6 +201,8 @@ export interface I_AgencyCampaignMemberRow {
179
201
  memberId: string;
180
202
  creator: I_CampaignCreatorIdentity;
181
203
  state: AgencyCampaignMemberState;
204
+ /** Invitation or Dealroom application (spec 148). Absent on older backends: read as 'invitation'. */
205
+ origin?: AgencyCampaignMemberOrigin;
182
206
  /** The board column, or the reason the row is off the board. */
183
207
  step: AgencyCampaignStep | AgencyCampaignOffBoard;
184
208
  /** When the row reached its current step. */
@@ -233,6 +257,8 @@ export interface I_AgencyCampaign {
233
257
  milestones: I_AgencyMilestone[];
234
258
  pipeline: I_AgencyCampaignPipeline;
235
259
  createdAt: string;
260
+ /** Spec 148: the Dealroom listing fields and their derived state. Absent on older backends. */
261
+ listing?: I_CampaignListing;
236
262
  }
237
263
  /** Opening one creator (FR-024): their course with dates, notes, files and milestones. */
238
264
  export interface I_AgencyCampaignCreatorDetail {
@@ -241,6 +267,33 @@ export interface I_AgencyCampaignCreatorDetail {
241
267
  events: I_AgencyCampaignEvent[];
242
268
  materials: I_AgencyMaterial[];
243
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;
244
297
  }
245
298
  /** `GET /agency/campaigns/attention` — what waits on the agency (FR-022, the rail). */
246
299
  export interface I_AgencyCampaignAttention {
@@ -310,6 +363,10 @@ export interface I_CreatorCampaignView {
310
363
  canLeave: boolean;
311
364
  milestones: I_AgencyMilestone[];
312
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[];
313
370
  }
314
371
  /** `GET /agency/campaign-invitations/mine` — pending invitations and live campaigns. */
315
372
  export interface I_CreatorCampaigns {
@@ -338,6 +395,16 @@ declare class AgencyCampaignBriefFields extends PotFields {
338
395
  licenceMonths?: number | null;
339
396
  paidPromoMonths?: number | null;
340
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;
341
408
  protected assignBrief(data?: Partial<AgencyCampaignBriefFields>): void;
342
409
  }
343
410
  export declare class CreateAgencyCampaignDto extends AgencyCampaignBriefFields {
@@ -9,12 +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.AGENCY_CAMPAIGN_KINDS = 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
17
  const agency_pots_1 = require("./agency-pots");
18
+ const dealroom_1 = require("./dealroom");
18
19
  /**
19
20
  * The campaign loop (spec 175 US7) — an organization runs a campaign with the
20
21
  * creators on its roster or in the directory.
@@ -60,6 +61,8 @@ exports.SETTLEMENT_FORMS = ['invoice', 'contract', 'barter'];
60
61
  */
61
62
  exports.AGENCY_CAMPAIGN_KINDS = ['offer', 'pot'];
62
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'];
63
66
  /** The offer statuses the agency loop writes. `draft`, `deleted` and `alternativeSuggested` are legacy-only. */
64
67
  exports.AGENCY_OFFER_STATUSES = [
65
68
  I_Offer_1.I_OfferStatus.SENT,
@@ -75,9 +78,13 @@ exports.AGENCY_OFFER_STATUSES = [
75
78
  * right now is the server's `availableActions`, never a client guess.
76
79
  *
77
80
  * agency: counter · confirm · reject
78
- * 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.
79
86
  */
80
- exports.AGENCY_OFFER_ACTIONS = ['accept', 'counter', 'confirm', 'reject'];
87
+ exports.AGENCY_OFFER_ACTIONS = ['accept', 'counter', 'confirm', 'reject', 'apply'];
81
88
  /** The agency's acts on the latest material; the creator's only act is to upload. */
82
89
  exports.AGENCY_MATERIAL_ACTIONS = ['approve', 'request_changes', 'reject'];
83
90
  /**
@@ -143,6 +150,20 @@ exports.AGENCY_CAMPAIGN_EVENT_KINDS = [
143
150
  'caption_edited',
144
151
  'file_uploaded',
145
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',
146
167
  ];
147
168
  /** Refusal codes the frontend owes its own copy for. */
148
169
  exports.AGENCY_CAMPAIGN_CODES = {
@@ -169,6 +190,11 @@ exports.AGENCY_CAMPAIGN_CODES = {
169
190
  class AgencyCampaignBriefFields extends agency_pots_1.PotFields {
170
191
  assignBrief(data) {
171
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;
172
198
  this.text = data?.text;
173
199
  this.deliverables = data?.deliverables;
174
200
  this.draftDueAt = data?.draftDueAt;
@@ -221,6 +247,33 @@ __decorate([
221
247
  (0, class_validator_1.Max)(20),
222
248
  __metadata("design:type", Number)
223
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);
224
277
  class CreateAgencyCampaignDto extends AgencyCampaignBriefFields {
225
278
  constructor(data) {
226
279
  super();
@@ -1,4 +1,5 @@
1
1
  import type { CampaignSide, I_CampaignCreatorIdentity } from './agency-campaigns';
2
+ import type { AgencyOrganizationType } from './agency';
2
3
  /**
3
4
  * Agency ↔ creator threads (spec 175 US8, FR-023): one conversation per
4
5
  * organization and creator, inside ad2app.
@@ -31,21 +32,41 @@ export interface I_AgencyThreadMessage {
31
32
  side: CampaignSide;
32
33
  body: string;
33
34
  at: string;
35
+ /** A delegate wrote this for the creator through a `deals` grant (spec 148): which grant, and the member's name. */
36
+ actingFor?: {
37
+ grantId: string;
38
+ memberName: string;
39
+ };
34
40
  }
35
41
  export interface I_AgencyThreadSummary {
36
42
  id: string;
37
43
  /** Agency side: who the thread is with. */
38
44
  creator: I_CampaignCreatorIdentity;
39
- /** Creator side: which organization. */
45
+ /** Creator side: which organization, and whether it is an agency or a brand (spec 148). */
40
46
  organization: {
41
47
  id: string;
42
48
  name: string;
49
+ type?: AgencyOrganizationType;
43
50
  };
51
+ /** `actingFor`: a delegate wrote the last message for the creator (spec 148 US8), under this member's name. */
44
52
  lastMessage: {
45
53
  side: CampaignSide;
46
54
  body: string;
47
55
  at: string;
56
+ actingFor?: {
57
+ memberName: string;
58
+ };
48
59
  } | null;
60
+ /**
61
+ * Spec 148 US8 (audit #2): the other organizations whose members read this
62
+ * conversation acting for the creator: a manager holding the creator's
63
+ * `deals` grant while this is a deal's thread, or one whose member already
64
+ * wrote in it. Empty when only the two parties see it.
65
+ */
66
+ delegates?: Array<{
67
+ id: string;
68
+ name: string;
69
+ }>;
49
70
  /** The other side wrote last, seen from the caller's side. */
50
71
  unanswered: boolean;
51
72
  /** No live relationship: read-only for whoever still exists. */
@@ -54,8 +54,29 @@ export type I_AgencyGrantScope = (typeof AGENCY_GRANT_SCOPES)[number];
54
54
  * answer), so this is a trust boundary, not a convenience.
55
55
  */
56
56
  export declare const isAgencyGrantScope: (value: string) => value is I_AgencyGrantScope;
57
- /** `'brand'` arrives with spec 148; one column, no enum table. */
58
- export type AgencyOrganizationType = 'agency';
57
+ /**
58
+ * Delegation (spec 148 FR-017a): the one scope that reaches WRITES, and only
59
+ * the creator-side deal acts (apply, offer acts, materials, the deal thread).
60
+ *
61
+ * Kept OUT of AGENCY_GRANT_SCOPES on purpose: that list is what an
62
+ * organization may ASK for, and no organization ever asks for this. Only the
63
+ * creator adds it to `grantedScopes`, which makes it the one exception to
64
+ * "granted is a subset of requested". Publishing, contract signature,
65
+ * payouts, the settlement form and platforms stay unreachable through it.
66
+ */
67
+ export declare const DELEGATION_SCOPES: readonly ["deals"];
68
+ export type I_DelegationScope = (typeof DELEGATION_SCOPES)[number];
69
+ /** Everything a grant may carry once the creator has answered. */
70
+ export type I_GrantScope = I_AgencyGrantScope | I_DelegationScope;
71
+ /** Narrowing guard over both sets; an unrecognised scope fails closed. */
72
+ export declare const isGrantScope: (value: string) => value is I_GrantScope;
73
+ /**
74
+ * `'brand'` arrived with spec 148 (US2): one column, no enum table. A brand
75
+ * authors campaigns like an agency but has no roster; it is created only
76
+ * while the backend's brand door is open.
77
+ */
78
+ export declare const AGENCY_ORGANIZATION_TYPES: readonly ["agency", "brand"];
79
+ export type AgencyOrganizationType = (typeof AGENCY_ORGANIZATION_TYPES)[number];
59
80
  /**
60
81
  * `closed` was added by the 2026-09-21 requirements review (FR-004b).
61
82
  *
@@ -81,6 +102,11 @@ export interface I_AgencyOrganization {
81
102
  /** ISO-3166 alpha-2 of the register the identifier belongs to. */
82
103
  registryCountry: string;
83
104
  contactEmail: string;
105
+ /**
106
+ * The organization's logo, a storage path read through a signed URL (spec
107
+ * 148). Required before a campaign is listed open. Absent on older backends.
108
+ */
109
+ logoUrl?: string;
84
110
  status: AgencyOrganizationStatus;
85
111
  /** The reason an admin gave; shown to a rejected applicant (FR-002). */
86
112
  statusReason?: string;
@@ -117,7 +143,13 @@ export interface I_AgencyMember {
117
143
  */
118
144
  export declare const CREATOR_ACCESS_GRANT_STATES: readonly ["requested", "active", "declined", "expired", "revoked"];
119
145
  export type CreatorAccessGrantState = (typeof CREATOR_ACCESS_GRANT_STATES)[number];
120
- export type CreatorAccessGrantOrigin = 'invite_link' | 'agency_request';
146
+ /**
147
+ * `dealroom_application` (spec 148): created or widened when the creator
148
+ * applies to an open listing. The system revokes a grant of this origin, and
149
+ * only of this origin, when that deal ends.
150
+ */
151
+ export declare const CREATOR_ACCESS_GRANT_ORIGINS: readonly ["invite_link", "agency_request", "dealroom_application"];
152
+ export type CreatorAccessGrantOrigin = (typeof CREATOR_ACCESS_GRANT_ORIGINS)[number];
121
153
  /** Who ended it. Shown in the agency's past-creators history (FR-013b). */
122
154
  export type CreatorAccessGrantRevokedBy = 'creator' | 'agency' | 'organization' | 'account-deleted' | 'purge' | 'system';
123
155
  export interface I_CreatorAccessGrant {
@@ -130,10 +162,19 @@ export interface I_CreatorAccessGrant {
130
162
  creatorUserId?: string;
131
163
  organizationId: string;
132
164
  organizationName: string;
165
+ /** Spec 148: `brand` cannot hold `deals` (it is the creator's counterparty), so the switch is not offered. Absent on older backends. */
166
+ organizationType?: AgencyOrganizationType;
133
167
  /** What the agency asked for. */
134
168
  requestedScopes: I_AgencyGrantScope[];
135
- /** What the creator actually granted — a subset, possibly smaller, never larger. */
169
+ /** What the creator actually granted — a subset, possibly smaller, never larger. Reads only. */
136
170
  grantedScopes: I_AgencyGrantScope[];
171
+ /**
172
+ * Spec 148 FR-017a: the creator lets this organization run their Dealroom
173
+ * deals (the `deals` delegation scope, which no organization can ask for and
174
+ * only the creator adds). Kept out of `grantedScopes` so that list stays the
175
+ * reads 175 code is typed on. Absent on older backends: read absent as no.
176
+ */
177
+ deals?: boolean;
137
178
  /** Frozen at grant time; what the history shows after a purge. */
138
179
  creatorIdentity: {
139
180
  handle: string;
@@ -256,6 +297,12 @@ export interface I_AgencyRosterRow {
256
297
  */
257
298
  reaskedAt?: string;
258
299
  reaskAvailableAt?: string;
300
+ /**
301
+ * Spec 148 US8: the organization may act for this creator in the Dealroom
302
+ * (the active grant holds `deals`, the org is not a brand). Only
303
+ * sent while the Dealroom is on; absent while it is off (read absent as no).
304
+ */
305
+ canActForCreator?: boolean;
259
306
  }
260
307
  /**
261
308
  * The platforms a creator has connected, as the agency side sees them
@@ -428,6 +475,14 @@ export declare class CreateAgencyOrganizationDto {
428
475
  /** ISO-3166 alpha-2: which register a reviewer should look in. */
429
476
  registryCountry: string;
430
477
  contactEmail: string;
478
+ /** Spec 148 US2: absent = `agency`. `brand` is refused while the backend's brand door is closed. */
479
+ type?: AgencyOrganizationType;
480
+ /**
481
+ * Spec 148 US2, money release only (DORMANT): the card a brand pays its
482
+ * first subscription charge with, taken BEFORE the organization exists.
483
+ * Ignored while the backend's money switch is off (brands apply free).
484
+ */
485
+ paymentMethodId?: string;
431
486
  constructor(data?: Partial<CreateAgencyOrganizationDto>);
432
487
  }
433
488
  export declare class InviteAgencyMemberDto {
@@ -453,11 +508,29 @@ export declare class AcceptGrantDto {
453
508
  scopes?: I_AgencyGrantScope[];
454
509
  constructor(data?: Partial<AcceptGrantDto>);
455
510
  }
456
- /** The creator narrowing or widening a live grant — the only other write path. */
511
+ /**
512
+ * The creator narrowing or widening a live grant — the only other write path.
513
+ *
514
+ * `scopes` are the READS only; `deals` is never one of them (it stays out of
515
+ * AGENCY_GRANT_SCOPES). Delegation (spec 148 FR-017a) is its own field, so the
516
+ * data-access screen, which saves reads, can never drop it by omission:
517
+ *
518
+ * - `deals` absent ⇒ delegation unchanged (a reads-only save keeps `deals`);
519
+ * - `deals: true` ⇒ added, `deals: false` ⇒ removed;
520
+ * - `scopes` may be left out when `deals` is sent ⇒ the reads stay as they are.
521
+ */
457
522
  export declare class UpdateGrantScopesDto {
458
- scopes: I_AgencyGrantScope[];
523
+ scopes?: I_AgencyGrantScope[];
524
+ /** Let this organization run my deals (spec 148 US8). Creator-only; absent = unchanged. */
525
+ deals?: boolean;
459
526
  constructor(data?: Partial<UpdateGrantScopesDto>);
460
527
  }
528
+ /**
529
+ * Spec 148 US8: the header a delegate names the creator with on the
530
+ * creator-side deal routes (`X-Acting-For: <creatorUserId>`). Every other
531
+ * route refuses a request that carries it (`dealroom-delegate-forbidden`).
532
+ */
533
+ export declare const ACTING_FOR_HEADER = "x-acting-for";
461
534
  export declare class SponsorCreatorDto {
462
535
  tier: SponsoredTier;
463
536
  constructor(data?: Partial<SponsorCreatorDto>);
@@ -512,6 +585,20 @@ export interface I_AgencyDiscoverHit {
512
585
  export interface I_AgencyDiscoverResult {
513
586
  results: I_AgencyDiscoverHit[];
514
587
  }
588
+ /** `GET /admin/agency-organizations[?type=]`: one pending organization on the admin queue. */
589
+ export interface I_AdminOrganizationRow {
590
+ id: string;
591
+ /** Spec 148: `agency` or `brand`; filter with `?type=`. */
592
+ type: AgencyOrganizationType;
593
+ name: string;
594
+ website: string | null;
595
+ registryId: string;
596
+ registryCountry: string;
597
+ contactEmail: string;
598
+ /** Derived, a SIGNAL only (FR-003). */
599
+ contactEmailDomain: string;
600
+ appliedAt: string;
601
+ }
515
602
  export declare class AdminSetOrganizationStatusDto {
516
603
  status: Extract<AgencyOrganizationStatus, 'approved' | 'rejected'>;
517
604
  /** Required on reject — a rejected applicant is shown this (FR-002). The