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.
@@ -0,0 +1,651 @@
1
+ /**
2
+ * Dealroom (spec 148): only what spec 175 has no concept of.
3
+ *
4
+ * The organization, membership, grant, campaign, offer loop, materials,
5
+ * threads and pots are 175's (`agency*.ts`); 148 adds unions there and keeps
6
+ * this file for the open listing, matching, the coarse creator row, its codes,
7
+ * the dormant money layer and the commission lane.
8
+ *
9
+ * The money types below are DORMANT: the backend refuses every money act with
10
+ * `dealroom-money-disabled` until the money release (FR-027). Their state
11
+ * lists mirror data-model.md's state machine exactly.
12
+ *
13
+ * See specs/148-dealroom/contracts/lib-types.md.
14
+ */
15
+ import { type AgencyOrganizationType, type I_AgencyGrantScope } from './agency';
16
+ import type { AgencyCampaignKind, AgencyMilestoneKind, CampaignPlatform, I_CampaignDeliverable, I_CreatorCampaignView, I_Money, SettlementForm } from './agency-campaigns';
17
+ /** `private` is every 175 campaign today (members only); `open` is listed in the feed to matching creators. */
18
+ export declare const CAMPAIGN_VISIBILITIES: readonly ["private", "open"];
19
+ export type CampaignVisibility = (typeof CAMPAIGN_VISIBILITIES)[number];
20
+ export declare const isCampaignVisibility: (value: string) => value is CampaignVisibility;
21
+ /** A follower band on one platform; no `max` means no upper bound. */
22
+ export interface I_FollowerBand {
23
+ min: number;
24
+ max?: number;
25
+ }
26
+ /**
27
+ * Who a listing is for. A BLANK constraint means "no filter" — which is a
28
+ * listing's meaning only. A creator's missing country or niches never reads
29
+ * that way: it is an incomplete profile (FR-026).
30
+ */
31
+ export interface I_TargetProfile {
32
+ platforms: CampaignPlatform[];
33
+ followerBand: Partial<Record<CampaignPlatform, I_FollowerBand>>;
34
+ niches: string[];
35
+ /** ISO-3166 alpha-2. */
36
+ country?: string;
37
+ language?: string;
38
+ }
39
+ /**
40
+ * The verifiable parts of "why you see this", built from the same row the
41
+ * match query returned — never composed separately. The screen writes the
42
+ * sentence in the reader's language.
43
+ */
44
+ export interface I_MatchExplanation {
45
+ platform: CampaignPlatform;
46
+ followers: number;
47
+ /** The niches the creator and the listing share. */
48
+ niches: string[];
49
+ country?: string;
50
+ language?: string;
51
+ }
52
+ /** The one dimension a near match misses (US11): followers within ±20%, or one platform not connected. */
53
+ export type I_NearMatchGap = {
54
+ kind: 'followers';
55
+ /**
56
+ * The platform whose followers miss the band, so the sentence names it on
57
+ * a multi-platform listing. Always sent by the current backend;
58
+ * optional only so older fixtures still type.
59
+ */
60
+ platform?: CampaignPlatform;
61
+ followers: number;
62
+ band: I_FollowerBand;
63
+ percent: number;
64
+ direction: 'under' | 'over';
65
+ } | {
66
+ kind: 'missing_platform';
67
+ platform: CampaignPlatform;
68
+ };
69
+ export interface I_DealroomListingOrganization {
70
+ id: string;
71
+ name: string;
72
+ logoUrl: string | null;
73
+ type: AgencyOrganizationType;
74
+ }
75
+ /** One open listing in a creator's feed: coarse campaign data, never another creator. */
76
+ export interface I_DealroomListing {
77
+ campaignId: string;
78
+ /** The campaign's own name, the one the deal carries once joined (audit #1). Absent on older backends: read the brief. */
79
+ campaignName?: string;
80
+ kind: AgencyCampaignKind;
81
+ organization: I_DealroomListingOrganization;
82
+ briefSummary: string;
83
+ /** Filtered to the creator's platforms (175 rule). */
84
+ deliverables: I_CampaignDeliverable[];
85
+ currency: string;
86
+ /** Null = unlimited. */
87
+ slots: number | null;
88
+ /** Confirmed offers (offer kind) or accepted entries (pot kind) — a count, never who. */
89
+ acceptedCount: number;
90
+ applicationDeadline: string | null;
91
+ explanation: I_MatchExplanation;
92
+ /**
93
+ * What joining shares: the scopes the pre-join (175 consent) screen names.
94
+ * An open listing asks for every read an organization may ask for; the
95
+ * creator ticks a subset when applying. ABSENT = all of AGENCY_GRANT_SCOPES
96
+ * (the backend does not send it today).
97
+ */
98
+ askedScopes?: I_AgencyGrantScope[];
99
+ /** Money release only; absent while money is off (interpretation 8). */
100
+ guaranteedAmount?: I_Money;
101
+ /** Money release only; absent while money is off. */
102
+ depositPct?: number;
103
+ }
104
+ /** A listing the creator would match but for one gap. Never appliable, by construction. */
105
+ export interface I_NearMatch {
106
+ listing: Omit<I_DealroomListing, 'explanation'>;
107
+ explanation: I_MatchExplanation;
108
+ gap: I_NearMatchGap;
109
+ applicationAllowed: false;
110
+ }
111
+ /** The profile fields whose absence makes the feed `profile_incomplete` (FR-026). */
112
+ export declare const DEALROOM_PROFILE_FIELDS: readonly ["country", "niches"];
113
+ export type DealroomProfileField = (typeof DEALROOM_PROFILE_FIELDS)[number];
114
+ /** `GET /dealroom/feed[?broaden=true]`. */
115
+ export interface I_DealroomFeed {
116
+ state: 'ok' | 'profile_incomplete';
117
+ listings: I_DealroomListing[];
118
+ /** Present only when the creator broadened the view. */
119
+ nearMatches?: I_NearMatch[];
120
+ /** Distinct organizations in `listings`; empty when there are none, never filler. */
121
+ logoStrip: I_DealroomListingOrganization[];
122
+ /** With `profile_incomplete`: which fields to complete. */
123
+ missingProfileFields?: DealroomProfileField[];
124
+ }
125
+ /**
126
+ * A creator as an organization sees them on a match list, before any grant:
127
+ * handle, platforms, follower BAND per platform, niches, country. Never a
128
+ * rate, never an exact or rich metric (FR-007).
129
+ */
130
+ export interface I_CoarseCreatorProfile {
131
+ userId: string;
132
+ handle: string;
133
+ platforms: CampaignPlatform[];
134
+ followerBand: Partial<Record<CampaignPlatform, I_FollowerBand>>;
135
+ niches: string[];
136
+ country: string | null;
137
+ }
138
+ /**
139
+ * Derived, never stored: `draft` (175 isDraft) → `live` (open, not closed,
140
+ * before its deadline, a slot free) → `frozen` (live, and a creator has been
141
+ * invited or applied: only the deadline, the slots and closing may change) →
142
+ * `closed` (closed by the organization, past its deadline, or full).
143
+ */
144
+ export declare const DEALROOM_LISTING_STATES: readonly ["draft", "live", "frozen", "closed"];
145
+ export type DealroomListingState = (typeof DEALROOM_LISTING_STATES)[number];
146
+ /** `I_AgencyCampaign.listing`: the listing fields and where the listing stands. */
147
+ export interface I_CampaignListing {
148
+ visibility: CampaignVisibility;
149
+ targetProfile: I_TargetProfile | null;
150
+ /** Null = unlimited. */
151
+ slots: number | null;
152
+ /** Confirmed offers (offer kind) or accepted entries (pot kind): a count, never who. */
153
+ acceptedCount: number;
154
+ /** The offer's own deadline, or the pot's application deadline. */
155
+ applicationDeadline: string | null;
156
+ closedAt: string | null;
157
+ state: DealroomListingState;
158
+ /** True once a creator was invited or applied: terms are fixed (FR-004). */
159
+ frozen: boolean;
160
+ }
161
+ /** `GET /agency/campaigns/:id/matches`: coarse rows only, each invitable through 175's invitation route. */
162
+ export interface I_CampaignMatches {
163
+ matches: I_CoarseCreatorProfile[];
164
+ }
165
+ /**
166
+ * `POST /dealroom/listings/:campaignId/apply`. `scopes`: what the creator
167
+ * shares, a non-empty subset of the listing's `askedScopes`. An offer
168
+ * listing takes the opening price (`priceMinor` + `currency`); a pot listing
169
+ * takes the creator's own terms (`guaranteeMinor` + `ratePer1000Minor`).
170
+ */
171
+ export declare class ApplyToDealroomListingDto {
172
+ scopes: I_AgencyGrantScope[];
173
+ priceMinor?: number;
174
+ currency?: string;
175
+ guaranteeMinor?: number;
176
+ ratePer1000Minor?: number;
177
+ constructor(data?: Partial<ApplyToDealroomListingDto>);
178
+ }
179
+ /** The apply answer: the creator's campaign as 175 shows it; `alreadyMember` when they were on it before. */
180
+ export interface I_DealroomApplication {
181
+ alreadyMember: boolean;
182
+ campaign: I_CreatorCampaignView;
183
+ }
184
+ /** Refusal codes the frontend owes its own copy for (contracts/dealroom-api.md). */
185
+ export declare const DEALROOM_CODES: {
186
+ readonly OFFER_FILLED: "dealroom-offer-filled";
187
+ readonly LISTING_FROZEN: "dealroom-listing-frozen";
188
+ readonly NEAR_MATCH_NOT_APPLIABLE: "dealroom-near-match-not-appliable";
189
+ readonly PROFILE_INCOMPLETE: "dealroom-profile-incomplete";
190
+ readonly BRAND_DOOR_CLOSED: "dealroom-brand-door-closed";
191
+ readonly BRAND_NO_ROSTER: "dealroom-brand-no-roster";
192
+ readonly DELEGATE_FORBIDDEN: "dealroom-delegate-forbidden";
193
+ readonly DELEGATE_OWN_DEAL: "dealroom-delegate-own-deal";
194
+ /** A delegate never writes the creator's grant consent: joining with an access request, or an apply that would create or widen the grant's reads. */
195
+ readonly DELEGATE_CONSENT_FORBIDDEN: "dealroom-delegate-consent-forbidden";
196
+ /** The money switch is off: every money route and act answers 404 with this code (FR-027). Means nothing else. */
197
+ readonly MONEY_DISABLED: "dealroom-money-disabled";
198
+ /** Money on, but a value the act needs is not configured yet (e.g. the deal's deposit %). 422. */
199
+ readonly CONFIG_MISSING: "dealroom-config-missing";
200
+ /** Money on, but the platform contract template is still waiting for counsel: upload your own. 422. */
201
+ readonly TEMPLATE_PENDING: "dealroom-template-pending";
202
+ /** An open listing needs the organization's logo first (US2). 400. */
203
+ readonly LOGO_REQUIRED: "dealroom-logo-required";
204
+ readonly CONTRACT_UNSIGNED: "dealroom-contract-unsigned";
205
+ readonly DEPOSIT_REQUIRED: "dealroom-deposit-required";
206
+ readonly NOT_FUNDED: "dealroom-not-funded";
207
+ /** Money release: the agreed amount is under the fee config's minimum deal. */
208
+ readonly DEAL_BELOW_MINIMUM: "dealroom-deal-below-minimum";
209
+ /** Money release: that money act is not open at the deal's current step. */
210
+ readonly MONEY_WRONG_STEP: "dealroom-money-wrong-step";
211
+ /** Money release: the deal already has a contract out for signature or signed. */
212
+ readonly CONTRACT_EXISTS: "dealroom-contract-exists";
213
+ /** Money release: no guarantee is configured, or the claim is not open yet. */
214
+ readonly GUARANTEE_UNAVAILABLE: "dealroom-guarantee-unavailable";
215
+ /** Commission lane (2026-10-07): the creator's Admitad Ad Space is still under admin review; no link yet. */
216
+ readonly COMMISSION_AD_SPACE_PENDING: "commission-ad-space-pending";
217
+ /** Commission lane (2026-10-07): the creator's Admitad Ad Space was rejected or suspended; no Admitad link. */
218
+ readonly COMMISSION_AD_SPACE_UNAVAILABLE: "commission-ad-space-unavailable";
219
+ /** Admin: that decision is not open from the Ad Space's state (a suspended or rejected Ad Space is never re-registered under a new id). */
220
+ readonly COMMISSION_AD_SPACE_DECISION_CLOSED: "commission-ad-space-decision-closed";
221
+ /** The network did not answer a join or a registration; nothing was written. */
222
+ readonly COMMISSION_NETWORK_UNAVAILABLE: "commission-network-unavailable";
223
+ };
224
+ export type DealroomCode = (typeof DEALROOM_CODES)[keyof typeof DEALROOM_CODES];
225
+ /**
226
+ * The deal's money state (FR-010), exactly data-model.md's machine:
227
+ *
228
+ * awaiting_material → material_submitted → deposit_paid → funded → approved → published
229
+ * deposit declined → closed_unviewed
230
+ * funded/approved, never published → refund_pending → refunded
231
+ * delivered, never funded → guarantee_claimed
232
+ *
233
+ * The payout after publication is its own column (DEAL_PAYOUT_STATES).
234
+ */
235
+ export declare const DEAL_MONEY_STATES: readonly ["awaiting_material", "material_submitted", "deposit_paid", "funded", "approved", "published", "closed_unviewed", "refund_pending", "refunded", "guarantee_claimed"];
236
+ export type DealMoneyState = (typeof DEAL_MONEY_STATES)[number];
237
+ export declare const DEAL_PAYOUT_STATES: readonly ["none", "initiated", "paid"];
238
+ export type DealPayoutState = (typeof DEAL_PAYOUT_STATES)[number];
239
+ /** One payment-rail cost, passed through at cost and shown, never part of our fee. */
240
+ export interface I_RailCostItem {
241
+ kind: 'processing' | 'payout' | 'account' | 'fx' | 'other';
242
+ amount: I_Money;
243
+ note?: string;
244
+ }
245
+ /** The FX conversion a snapshot used (175 `fx_rates`, ECB daily). */
246
+ export interface I_FxSnapshot {
247
+ from: string;
248
+ to: string;
249
+ rate: number;
250
+ rateDate: string;
251
+ }
252
+ /** Frozen at signing: what the fees were, which cap bound, and whether the floor guard did. */
253
+ export interface I_DealFeeSnapshot {
254
+ agencyFee: I_Money;
255
+ creatorFee: I_Money;
256
+ capsApplied: {
257
+ agency: boolean;
258
+ creator: boolean;
259
+ };
260
+ railCosts: I_RailCostItem[];
261
+ floorGuardApplied: boolean;
262
+ fx?: I_FxSnapshot;
263
+ }
264
+ export interface I_DealroomDeal {
265
+ id: string;
266
+ /** Offer deals; null for a pot deal. */
267
+ collaborationId: string | null;
268
+ /** Pot deals; null for an offer deal. */
269
+ potEntryId: string | null;
270
+ campaignId: string;
271
+ organizationId: string;
272
+ creatorUserId: string | null;
273
+ agreed: I_Money;
274
+ feeSnapshot: I_DealFeeSnapshot;
275
+ moneyState: DealMoneyState;
276
+ payoutState: DealPayoutState;
277
+ /** The cap the guarantee covers, never more (US7 scenario 4); zero when no guarantee is configured. */
278
+ guaranteeCap: I_Money;
279
+ /** Snapshotted from the settlement form when the contract is signed; null before, or for barter / international. */
280
+ payoutTrack: 1 | 2 | null;
281
+ createdAt: string;
282
+ /** The 175 membership the deal belongs to (wave 4). */
283
+ memberId?: string;
284
+ /** When the fee snapshot was frozen (contract signed); null while it is still a quote. */
285
+ feeFrozenAt?: string | null;
286
+ /** The zadatek %, snapshotted at confirmation; null while counsel has not set it. */
287
+ depositPct?: number | null;
288
+ }
289
+ export interface I_DealContract {
290
+ collaborationId: string;
291
+ source: 'template' | 'uploaded';
292
+ documentUrl: string | null;
293
+ signatureLevel: 'SES' | 'QES';
294
+ provider: string;
295
+ state: 'draft' | 'sent' | 'signed';
296
+ signedAt: string | null;
297
+ /** Wave 4 (additive). */
298
+ id?: string;
299
+ /** The template's form fields as sent (template contracts). */
300
+ terms?: I_DealContractTerms | null;
301
+ /** The uploaded file's name (uploaded contracts). */
302
+ fileName?: string | null;
303
+ sentAt?: string | null;
304
+ createdAt?: string;
305
+ /**
306
+ * The e-sign provider's signing link for the CALLER's own party (the
307
+ * organization's signer or the creator), while the contract is `sent` and
308
+ * that party has not signed; null otherwise. Never the other party's link.
309
+ */
310
+ signingUrl?: string | null;
311
+ }
312
+ export interface I_DealPayment {
313
+ id: string;
314
+ collaborationId: string;
315
+ type: 'deposit' | 'funding' | 'refund' | 'payout';
316
+ amount: I_Money;
317
+ railCostsItemized: I_RailCostItem[];
318
+ state: 'pending' | 'succeeded' | 'failed';
319
+ fxSnapshot?: I_FxSnapshot;
320
+ createdAt: string;
321
+ /** Wave 4 (additive): the deal it belongs to. */
322
+ dealroomDealId?: string;
323
+ /** Wave 4: what the payer is charged in all: the amount, the organization's fee when it is due, and the rail costs. */
324
+ total?: I_Money;
325
+ /** Wave 4: the organization's fee carried by this payment (funding only). */
326
+ agencyFee?: I_Money | null;
327
+ method?: DealPaymentMethod;
328
+ }
329
+ /** Derived from 175's settlement form (`invoice` → faktura_vat, `contract` → umowa_o_dzielo); `international` is 148's. */
330
+ export declare const PAYOUT_BILLING_VARIANTS: readonly ["faktura_vat", "umowa_o_dzielo", "international"];
331
+ export type PayoutBillingVariant = (typeof PAYOUT_BILLING_VARIANTS)[number];
332
+ /** Settings → Payouts. The payment provider's account id is never surfaced. */
333
+ export interface I_PayoutProfile {
334
+ /** Wave 4 (additive): the 175 settlement form the track is read from (one setting, not two). */
335
+ settlementForm?: SettlementForm | null;
336
+ /** Wave 4: everything a payout needs is on file. Joining and working never wait for it; the first payout does. */
337
+ complete?: boolean;
338
+ /** Wave 4: what is still missing for the first payout. */
339
+ missing?: PayoutProfileField[];
340
+ /** Null while the settlement form is unset or barter (no payout) and the international variant is not chosen. */
341
+ billingVariant: PayoutBillingVariant | null;
342
+ /** 1 = invoice, 2 = umowa o dzieło (withholding); null for barter or international. */
343
+ track: 1 | 2 | null;
344
+ nip?: string;
345
+ taxStatement?: string;
346
+ intlBillingData?: Record<string, string>;
347
+ iban?: string;
348
+ payoutCurrency: string;
349
+ kycState: 'none' | 'pending' | 'verified' | 'rejected';
350
+ }
351
+ export declare const PAYOUT_LEDGER_SOURCES: readonly ["deal", "pot", "commission"];
352
+ export type PayoutLedgerSource = (typeof PAYOUT_LEDGER_SOURCES)[number];
353
+ /** Commission entries are `validated` only after the network pays us. */
354
+ export declare const PAYOUT_LEDGER_STATES: readonly ["earned", "validated", "paid"];
355
+ export type PayoutLedgerState = (typeof PAYOUT_LEDGER_STATES)[number];
356
+ export interface I_PayoutLedgerEntry {
357
+ id: string;
358
+ source: PayoutLedgerSource;
359
+ dealroomDealId?: string;
360
+ potEntryId?: string;
361
+ network?: CommissionNetwork;
362
+ amount: I_Money;
363
+ feesItemized: I_RailCostItem[];
364
+ state: PayoutLedgerState;
365
+ availableAt?: string;
366
+ createdAt: string;
367
+ /** Wave 4 (additive): track 2's withheld PIT, itemized; absent when nothing is withheld. */
368
+ withheld?: I_Money | null;
369
+ /** Wave 4: why the entry exists. */
370
+ reason?: 'publication' | 'guarantee' | 'deposit_forfeit' | 'pot' | 'commission';
371
+ /** Wave 4: why a due payout waits (`profile_incomplete`, `below_threshold`, …); null when it does not. */
372
+ holdReason?: string | null;
373
+ paidAt?: string | null;
374
+ }
375
+ /** The contract, money and payout kinds this release writes into 175's event log (FR-008a). */
376
+ export declare const DEALROOM_MONEY_EVENT_KINDS: readonly ["contract_sent", "contract_signed", "contract_declined", "deposit_paid", "deal_funded", "deal_closed_unviewed", "deal_refund_requested", "deal_refunded", "guarantee_claimed", "payout_initiated", "payout_paid"];
377
+ export type DealroomMoneyEventKind = (typeof DEALROOM_MONEY_EVENT_KINDS)[number];
378
+ export declare const DEAL_CONTRACT_SOURCES: readonly ["template", "uploaded"];
379
+ export type DealContractSource = (typeof DEAL_CONTRACT_SOURCES)[number];
380
+ /** `draft` again after a signer declines; `signed` once every party signed (the e-sign provider's word). */
381
+ export declare const DEAL_CONTRACT_STATES: readonly ["draft", "sent", "signed"];
382
+ export type DealContractState = (typeof DEAL_CONTRACT_STATES)[number];
383
+ /** SES by default, QES as an option (research R2; counsel point 3 may require QES for some documents). */
384
+ export declare const DEAL_SIGNATURE_LEVELS: readonly ["SES", "QES"];
385
+ export type DealSignatureLevel = (typeof DEAL_SIGNATURE_LEVELS)[number];
386
+ /** What a template contract carries (the organization's form-fill). Parties and rate come from the deal, never the form. */
387
+ export interface I_DealContractTerms {
388
+ parties: {
389
+ organization: string;
390
+ creator: string;
391
+ };
392
+ deliverables: string[];
393
+ rate: I_Money;
394
+ draftDueAt: string | null;
395
+ liveByAt: string | null;
396
+ licenceMonths: number | null;
397
+ paidPromoMonths: number | null;
398
+ }
399
+ /**
400
+ * `POST /agency/campaigns/:id/members/:memberId/contract` (organization side).
401
+ * `template`: the form fields (deliverables default to the brief's, the rate is
402
+ * the agreed price). `uploaded`: the organization's own file, base64.
403
+ */
404
+ export declare class CreateDealContractDto {
405
+ source: DealContractSource;
406
+ signatureLevel?: DealSignatureLevel;
407
+ deliverables?: string[];
408
+ draftDueAt?: string;
409
+ liveByAt?: string;
410
+ licenceMonths?: number;
411
+ paidPromoMonths?: number;
412
+ fileName?: string;
413
+ /** The uploaded file, base64; the backend checks the type and the size. */
414
+ fileBase64?: string;
415
+ constructor(data?: Partial<CreateDealContractDto>);
416
+ }
417
+ /** Card (PaymentIntent, confirmed in the browser) or invoice (a Stripe invoice the organization pays by transfer). */
418
+ export declare const DEAL_PAYMENT_METHODS: readonly ["card", "invoice"];
419
+ export type DealPaymentMethod = (typeof DEAL_PAYMENT_METHODS)[number];
420
+ /** `POST /agency/campaigns/:id/members/:memberId/deal/deposit|fund`. Big sums go by invoice whatever is asked. */
421
+ export declare class StartDealPaymentDto {
422
+ method?: DealPaymentMethod;
423
+ constructor(data?: Partial<StartDealPaymentDto>);
424
+ }
425
+ /** A started payment: confirm `clientSecret` with Stripe.js (card), or send the payer to `invoiceUrl` (invoice). */
426
+ export interface I_DealPaymentStart {
427
+ payment: I_DealPayment;
428
+ clientSecret: string | null;
429
+ invoiceUrl: string | null;
430
+ }
431
+ /** The money acts a deal view may offer; the server decides which, per side and step. */
432
+ export declare const DEAL_MONEY_ACTIONS: readonly ["send_contract", "pay_deposit", "decline_deposit", "fund", "refund", "claim_guarantee"];
433
+ export type DealMoneyAction = (typeof DEAL_MONEY_ACTIONS)[number];
434
+ /**
435
+ * One deal's money, as one side reads it:
436
+ * `GET /agency/campaigns/:id/members/:memberId/deal` (organization) and
437
+ * `GET /dealroom/my-deals/:memberId` (creator). Null `deal` ⇒ no money row
438
+ * (money was off at confirmation, or a pot entry with no guarantee).
439
+ */
440
+ export interface I_DealroomDealView {
441
+ deal: I_DealroomDeal;
442
+ contract: I_DealContract | null;
443
+ /** The zadatek and the rest; null while counsel has not set the deposit %. */
444
+ deposit: I_Money | null;
445
+ remaining: I_Money | null;
446
+ payments: I_DealPayment[];
447
+ /** The organization may open the submitted material (deposit paid). */
448
+ materialViewable: boolean;
449
+ /** The organization may approve it (fully funded). */
450
+ approvable: boolean;
451
+ actions: DealMoneyAction[];
452
+ }
453
+ /** What the first payout needs and is missing; the provider's KYC runs behind the form and is never a field. */
454
+ export declare const PAYOUT_PROFILE_FIELDS: readonly ["settlement_form", "nip", "tax_statement", "intl_billing_data", "iban", "payout_currency"];
455
+ export type PayoutProfileField = (typeof PAYOUT_PROFILE_FIELDS)[number];
456
+ /**
457
+ * `PUT /dealroom/payouts/profile`. The track is NOT here: it is read from the
458
+ * 175 settlement form. `international` picks the international variant.
459
+ */
460
+ export declare class UpsertPayoutProfileDto {
461
+ international?: boolean;
462
+ nip?: string;
463
+ taxStatement?: string;
464
+ intlBillingData?: Record<string, string>;
465
+ /** IBAN: country code, check digits, 11-30 alphanumerics, spaces allowed. */
466
+ iban: string;
467
+ payoutCurrency: string;
468
+ constructor(data?: Partial<UpsertPayoutProfileDto>);
469
+ }
470
+ /** `GET /dealroom/payouts/ledger`: every entry and the totals per currency, honestly per state. */
471
+ export interface I_PayoutLedger {
472
+ entries: I_PayoutLedgerEntry[];
473
+ totals: Array<{
474
+ currency: string;
475
+ earned: number;
476
+ validated: number;
477
+ paid: number;
478
+ }>;
479
+ /** Commission payouts batch monthly from this amount up; below it they accrue. */
480
+ commissionThreshold: I_Money;
481
+ profileComplete: boolean;
482
+ }
483
+ export declare const COMMISSION_NETWORKS: readonly ["awin", "admitad"];
484
+ export type CommissionNetwork = (typeof COMMISSION_NETWORKS)[number];
485
+ export declare const COMMISSION_OFFER_STATES: readonly ["live", "paused", "gone"];
486
+ export type CommissionOfferState = (typeof COMMISSION_OFFER_STATES)[number];
487
+ export declare const COMMISSION_LINK_STATES: readonly ["active", "suspended"];
488
+ export type CommissionLinkState = (typeof COMMISSION_LINK_STATES)[number];
489
+ /**
490
+ * `subnetwork`: minted from OUR publisher account with the creator's own
491
+ * attribution (Awin `clickref` = creator id; Admitad = the creator's registered
492
+ * Ad Space). `deeplink`: the fallback while a network's subnetwork mode is off,
493
+ * a plain link to the programme on the network, carrying no attribution of ours.
494
+ */
495
+ export declare const COMMISSION_LINK_MODES: readonly ["subnetwork", "deeplink"];
496
+ export type CommissionLinkMode = (typeof COMMISSION_LINK_MODES)[number];
497
+ /** An advertiser creative as the network feed carries it (2026-10-07). */
498
+ export declare const COMMISSION_MATERIAL_KINDS: readonly ["logo", "banner", "landing_preview", "coupon"];
499
+ export type CommissionMaterialKind = (typeof COMMISSION_MATERIAL_KINDS)[number];
500
+ export interface I_CommissionMaterial {
501
+ kind: CommissionMaterialKind;
502
+ /** Image or landing page; absent on a text-only coupon. */
503
+ url?: string;
504
+ /** Coupon code or creative text. */
505
+ text?: string;
506
+ width?: number;
507
+ height?: number;
508
+ }
509
+ export interface I_CommissionOffer {
510
+ id: string;
511
+ /** Always 'commission': a row of this lane is never an agency listing. */
512
+ kind: 'commission';
513
+ network: CommissionNetwork;
514
+ /** The advertiser (programme) name, as the network names it. */
515
+ title: string;
516
+ /** The commercial terms, as the network states them (e.g. "5% od sprzedaży", "12,00 PLN za lead"). */
517
+ terms: string;
518
+ commissionType: 'CPS' | 'CPL' | 'CPC' | 'CPI';
519
+ plEligible: boolean;
520
+ /** country is always PL; niches from the programme's categories when mappable, else blank (all). */
521
+ derivedTargetProfile: I_TargetProfile;
522
+ state: CommissionOfferState;
523
+ lastSyncAt: string;
524
+ /**
525
+ * Advertiser materials (2026-10-07). PRESENT ONLY when that network's
526
+ * written-consent flag is on (Awin: DEALROOM_COMMISSION_AWIN_MATERIALS_CONSENT;
527
+ * Admitad: never in v1). The server strips them; the client never decides.
528
+ */
529
+ materials?: I_CommissionMaterial[];
530
+ /** The caller's own link to this offer, when they joined it. */
531
+ myLink?: I_CommissionLink;
532
+ }
533
+ export interface I_CommissionLink {
534
+ id: string;
535
+ commissionOfferId: string;
536
+ mode: CommissionLinkMode;
537
+ url: string;
538
+ state: CommissionLinkState;
539
+ /** Admitad in subnetwork mode: the creator's registered Ad Space id. */
540
+ adSpaceId?: string;
541
+ }
542
+ /**
543
+ * `GET /dealroom/commission/offers`. The lane, never mixed with agency offers.
544
+ * A network that failed its last sync contributes NO rows (never a stale
545
+ * cache shown as live) and is named in `unavailableNetworks`.
546
+ */
547
+ export interface I_CommissionLane {
548
+ state: 'ok' | 'profile_incomplete';
549
+ offers: I_CommissionOffer[];
550
+ unavailableNetworks: CommissionNetwork[];
551
+ /** With `profile_incomplete`: which fields to complete (the feed's rule, FR-026). */
552
+ missingProfileFields?: DealroomProfileField[];
553
+ }
554
+ /** `POST /dealroom/commission/offers/:id/join`: what the join produced. */
555
+ export declare const COMMISSION_JOIN_STATES: readonly ["link", "deeplink", "ad_space_pending"];
556
+ export type CommissionJoinState = (typeof COMMISSION_JOIN_STATES)[number];
557
+ /**
558
+ * `link` (200): a subnetwork link from our account, attributed to the creator.
559
+ * `deeplink` (200): the network's own programme page (subnetwork mode off).
560
+ * `ad_space_pending` (202): the creator's first Admitad join created their Ad
561
+ * Space for admin review; no link until it is registered.
562
+ */
563
+ export interface I_CommissionJoinResult {
564
+ state: CommissionJoinState;
565
+ url?: string;
566
+ link?: I_CommissionLink;
567
+ }
568
+ /**
569
+ * One static Ad Space per creator (Admitad Subnetwork Code of Conduct §3.1/§5):
570
+ * created `pending_review` on the first Admitad join, `registered` through the
571
+ * Partner networks API after an admin approves, or `rejected` / `suspended`.
572
+ * Its id is never rotated, deleted or reassigned.
573
+ */
574
+ export declare const COMMISSION_AD_SPACE_STATES: readonly ["pending_review", "registered", "rejected", "suspended"];
575
+ export type CommissionAdSpaceState = (typeof COMMISSION_AD_SPACE_STATES)[number];
576
+ export declare const COMMISSION_AD_SPACE_DECISIONS: readonly ["approve", "reject", "suspend"];
577
+ export type CommissionAdSpaceDecision = (typeof COMMISSION_AD_SPACE_DECISIONS)[number];
578
+ /** A row of `GET /admin/dealroom/commission/ad-spaces` (admin only). */
579
+ export interface I_CommissionAdSpace {
580
+ id: string;
581
+ network: 'admitad';
582
+ state: CommissionAdSpaceState;
583
+ creator: {
584
+ userId: string;
585
+ email: string | null;
586
+ displayName: string | null;
587
+ };
588
+ /** The creator's connected profile URL, sent with the registration. */
589
+ sourceUrl: string;
590
+ /** Set at registration; static from then on. */
591
+ adSpaceId: string | null;
592
+ reviewedAt: string | null;
593
+ registeredAt: string | null;
594
+ createdAt: string;
595
+ /** How many of the creator's Admitad links are active. */
596
+ activeLinks: number;
597
+ }
598
+ /** `PATCH /admin/dealroom/commission/ad-spaces/:id`. */
599
+ export declare class ReviewCommissionAdSpaceDto {
600
+ decision: CommissionAdSpaceDecision;
601
+ constructor(data?: Partial<ReviewCommissionAdSpaceDto>);
602
+ }
603
+ /**
604
+ * What a deal date on the creator's calendar is. No second deadline store:
605
+ * `milestone` is a 175 milestone (`campaign-deadlines`, the creator's own or
606
+ * campaign-wide); the pot dates are the US9 schedule; `publish_at` is the
607
+ * agreed publication time (a pot entry's, or an offer deal's, T067).
608
+ */
609
+ export declare const DEALROOM_CALENDAR_KINDS: readonly ["milestone", "application_deadline", "materials_due", "publication_due", "publish_at", "bonus_ends", "keep_up_ends"];
610
+ export type DealroomCalendarKind = (typeof DEALROOM_CALENDAR_KINDS)[number];
611
+ /** One marker on the Dashboard calendar; the marker IS the tap target. */
612
+ export interface I_DealroomCalendarItem {
613
+ /** Stable per marker: `<kind>:<memberId>[:<milestoneId>]`. */
614
+ id: string;
615
+ kind: DealroomCalendarKind;
616
+ /** ISO timestamp of the deadline. */
617
+ at: string;
618
+ /** `milestone` only: draft_due | live_by | custom; `label` is set for custom. */
619
+ milestoneKind?: AgencyMilestoneKind;
620
+ label?: string | null;
621
+ /** `milestone` only: the milestone is confirmed. */
622
+ done?: boolean;
623
+ organization: {
624
+ id: string;
625
+ name: string;
626
+ };
627
+ campaign: {
628
+ id: string;
629
+ name: string;
630
+ kind: AgencyCampaignKind;
631
+ };
632
+ /** The deep link into the deal: the creator's campaign + their membership + the step the date is about. */
633
+ target: {
634
+ campaignId: string;
635
+ memberId: string;
636
+ step: string | null;
637
+ };
638
+ }
639
+ /** `GET /dealroom/calendar?from&to` — the creator's own deal dates in the window, oldest first. */
640
+ export interface I_DealroomCalendar {
641
+ from: string;
642
+ to: string;
643
+ items: I_DealroomCalendarItem[];
644
+ }
645
+ /** The calendar window: both ends required, at most DEALROOM_CALENDAR_MAX_DAYS apart. */
646
+ export declare const DEALROOM_CALENDAR_MAX_DAYS = 400;
647
+ export declare class DealroomCalendarQueryDto {
648
+ from: string;
649
+ to: string;
650
+ constructor(data?: Partial<DealroomCalendarQueryDto>);
651
+ }