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.
- package/dist/analytics/index.d.ts +85 -2
- package/dist/analytics/index.js +26 -0
- package/dist/types/I_AccessDenial.d.ts +7 -0
- package/dist/types/I_AccessDenial.js +7 -0
- package/dist/types/agency-campaigns.d.ts +108 -5
- package/dist/types/agency-campaigns.js +111 -5
- package/dist/types/agency-pots.d.ts +518 -0
- package/dist/types/agency-pots.js +393 -0
- package/dist/types/agency-threads.d.ts +22 -1
- package/dist/types/agency.d.ts +93 -6
- package/dist/types/agency.js +70 -3
- package/dist/types/dealroom.d.ts +651 -0
- package/dist/types/dealroom.js +387 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +3 -0
- package/package.json +1 -1
- package/src/analytics/index.test.ts +23 -1
- package/src/analytics/index.ts +69 -2
- package/src/types/I_AccessDenial.ts +7 -0
- package/src/types/access-denial.test.ts +2 -1
- package/src/types/agency-campaigns.ts +187 -5
- package/src/types/agency-pots.test.ts +255 -0
- package/src/types/agency-pots.ts +751 -0
- package/src/types/agency-threads.ts +14 -3
- package/src/types/agency.ts +120 -7
- package/src/types/consumer-compat.test.ts +90 -0
- package/src/types/dealroom-audit1.test.ts +56 -0
- package/src/types/dealroom-wave2.test.ts +61 -0
- package/src/types/dealroom-wave3.test.ts +68 -0
- package/src/types/dealroom-wave4.test.ts +103 -0
- package/src/types/dealroom.test.ts +231 -0
- package/src/types/dealroom.ts +868 -0
- package/src/types/index.ts +4 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec 148 (Dealroom), T060: the additive types on top of 175's agency files.
|
|
3
|
+
*
|
|
4
|
+
* Two kinds of pin live here. The ADDITIONS (brand type, the `deals`
|
|
5
|
+
* delegation scope, application origins, the `apply` act, the Dealroom codes
|
|
6
|
+
* and the dormant money states) and the NON-CHANGES that make them safe: 175's
|
|
7
|
+
* offer status list and the scope set an organization may ask for stay
|
|
8
|
+
* byte-identical to 1.50.0.
|
|
9
|
+
*/
|
|
10
|
+
import { test } from "node:test";
|
|
11
|
+
import assert from "node:assert/strict";
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
AGENCY_GRANT_SCOPES,
|
|
15
|
+
AGENCY_ORGANIZATION_TYPES,
|
|
16
|
+
CREATOR_ACCESS_GRANT_ORIGINS,
|
|
17
|
+
DELEGATION_SCOPES,
|
|
18
|
+
isAgencyGrantScope,
|
|
19
|
+
isGrantScope,
|
|
20
|
+
} from "./agency";
|
|
21
|
+
import {
|
|
22
|
+
AGENCY_CAMPAIGN_MEMBER_ORIGINS,
|
|
23
|
+
AGENCY_OFFER_ACTIONS,
|
|
24
|
+
AGENCY_OFFER_STATUSES,
|
|
25
|
+
CampaignOfferActDto,
|
|
26
|
+
} from "./agency-campaigns";
|
|
27
|
+
import { I_OfferStatus } from "./I_Offer";
|
|
28
|
+
import {
|
|
29
|
+
CAMPAIGN_VISIBILITIES,
|
|
30
|
+
COMMISSION_AD_SPACE_DECISIONS,
|
|
31
|
+
COMMISSION_AD_SPACE_STATES,
|
|
32
|
+
COMMISSION_JOIN_STATES,
|
|
33
|
+
COMMISSION_LINK_MODES,
|
|
34
|
+
COMMISSION_LINK_STATES,
|
|
35
|
+
COMMISSION_MATERIAL_KINDS,
|
|
36
|
+
COMMISSION_NETWORKS,
|
|
37
|
+
ReviewCommissionAdSpaceDto,
|
|
38
|
+
COMMISSION_OFFER_STATES,
|
|
39
|
+
DEALROOM_CODES,
|
|
40
|
+
DEALROOM_PROFILE_FIELDS,
|
|
41
|
+
DEAL_MONEY_STATES,
|
|
42
|
+
DEAL_PAYOUT_STATES,
|
|
43
|
+
PAYOUT_BILLING_VARIANTS,
|
|
44
|
+
PAYOUT_LEDGER_SOURCES,
|
|
45
|
+
PAYOUT_LEDGER_STATES,
|
|
46
|
+
isCampaignVisibility,
|
|
47
|
+
} from "./dealroom";
|
|
48
|
+
import * as typesIndex from "./index";
|
|
49
|
+
import { EVENTS } from "../analytics";
|
|
50
|
+
|
|
51
|
+
// ── Non-changes (the 175 contract stays intact) ─────────────────────────────
|
|
52
|
+
|
|
53
|
+
test("AGENCY_OFFER_STATUSES is byte-identical to 1.50.0: no offer status is added or remodeled", () => {
|
|
54
|
+
assert.deepEqual(
|
|
55
|
+
[...AGENCY_OFFER_STATUSES],
|
|
56
|
+
[
|
|
57
|
+
I_OfferStatus.SENT,
|
|
58
|
+
I_OfferStatus.INFLUENCER_NEGOTIATED,
|
|
59
|
+
I_OfferStatus.AGENCY_NEGOTIATED,
|
|
60
|
+
I_OfferStatus.ACCEPTED,
|
|
61
|
+
I_OfferStatus.CONFIRMED,
|
|
62
|
+
I_OfferStatus.REJECTED,
|
|
63
|
+
I_OfferStatus.WITHDRAWN,
|
|
64
|
+
],
|
|
65
|
+
);
|
|
66
|
+
assert.deepEqual(
|
|
67
|
+
Object.entries(I_OfferStatus),
|
|
68
|
+
[
|
|
69
|
+
["DRAFT", "draft"],
|
|
70
|
+
["SENT", "sent"],
|
|
71
|
+
["DELETED", "deleted"],
|
|
72
|
+
["ACCEPTED", "accepted"],
|
|
73
|
+
["REJECTED", "rejected"],
|
|
74
|
+
["INFLUENCER_NEGOTIATED", "influencerNegotiated"],
|
|
75
|
+
["AGENCY_NEGOTIATED", "agencyNegotiated"],
|
|
76
|
+
["CONFIRMED", "confirmed"],
|
|
77
|
+
["ALTERNATIVE_SUGGESTED", "alternativeSuggested"],
|
|
78
|
+
["WITHDRAWN", "withdrawn"],
|
|
79
|
+
],
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test("AGENCY_GRANT_SCOPES (what an organization may ask for) is unchanged and never carries `deals`", () => {
|
|
84
|
+
assert.deepEqual([...AGENCY_GRANT_SCOPES], ["analytics", "comments", "posts"]);
|
|
85
|
+
assert.equal(isAgencyGrantScope("deals"), false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// ── Additions in 175's files ────────────────────────────────────────────────
|
|
89
|
+
|
|
90
|
+
test("an organization is an agency or a brand", () => {
|
|
91
|
+
assert.deepEqual([...AGENCY_ORGANIZATION_TYPES], ["agency", "brand"]);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("a grant may originate from a Dealroom application", () => {
|
|
95
|
+
assert.deepEqual([...CREATOR_ACCESS_GRANT_ORIGINS], ["invite_link", "agency_request", "dealroom_application"]);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test("delegation is one creator-only scope, `deals`, kept out of the organization's ask", () => {
|
|
99
|
+
assert.deepEqual([...DELEGATION_SCOPES], ["deals"]);
|
|
100
|
+
for (const scope of [...AGENCY_GRANT_SCOPES, ...DELEGATION_SCOPES]) assert.equal(isGrantScope(scope), true);
|
|
101
|
+
for (const notAScope of ["publish", "payouts", "contract", "settings", "", "Deals"]) {
|
|
102
|
+
assert.equal(isGrantScope(notAScope), false, `must refuse: ${notAScope}`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("a campaign membership comes from an invitation or an application", () => {
|
|
107
|
+
assert.deepEqual([...AGENCY_CAMPAIGN_MEMBER_ORIGINS], ["invitation", "application"]);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("`apply` is an offer act, appended after 175's four", () => {
|
|
111
|
+
assert.deepEqual([...AGENCY_OFFER_ACTIONS], ["accept", "counter", "confirm", "reject", "apply"]);
|
|
112
|
+
assert.equal(new CampaignOfferActDto({ action: "apply" }).action, "apply");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// ── dealroom.ts ─────────────────────────────────────────────────────────────
|
|
116
|
+
|
|
117
|
+
test("a campaign is private (every 175 campaign today) or open (listed in the feed)", () => {
|
|
118
|
+
assert.deepEqual([...CAMPAIGN_VISIBILITIES], ["private", "open"]);
|
|
119
|
+
assert.equal(isCampaignVisibility("open"), true);
|
|
120
|
+
assert.equal(isCampaignVisibility("public"), false);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("the incomplete-profile state names the two fields that can be missing", () => {
|
|
124
|
+
assert.deepEqual([...DEALROOM_PROFILE_FIELDS], ["country", "niches"]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("DEALROOM_CODES are exactly the contract's thirteen, wave 4's four, the commission lane's four and review 148's three", () => {
|
|
128
|
+
assert.deepEqual(Object.values(DEALROOM_CODES).sort(), [
|
|
129
|
+
"commission-ad-space-decision-closed",
|
|
130
|
+
"commission-ad-space-pending",
|
|
131
|
+
"commission-ad-space-unavailable",
|
|
132
|
+
"commission-network-unavailable",
|
|
133
|
+
"dealroom-brand-door-closed",
|
|
134
|
+
"dealroom-brand-no-roster",
|
|
135
|
+
"dealroom-config-missing",
|
|
136
|
+
"dealroom-contract-exists",
|
|
137
|
+
"dealroom-contract-unsigned",
|
|
138
|
+
"dealroom-deal-below-minimum",
|
|
139
|
+
"dealroom-delegate-consent-forbidden",
|
|
140
|
+
"dealroom-delegate-forbidden",
|
|
141
|
+
"dealroom-delegate-own-deal",
|
|
142
|
+
"dealroom-deposit-required",
|
|
143
|
+
"dealroom-guarantee-unavailable",
|
|
144
|
+
"dealroom-listing-frozen",
|
|
145
|
+
"dealroom-logo-required",
|
|
146
|
+
"dealroom-money-disabled",
|
|
147
|
+
"dealroom-money-wrong-step",
|
|
148
|
+
"dealroom-near-match-not-appliable",
|
|
149
|
+
"dealroom-not-funded",
|
|
150
|
+
"dealroom-offer-filled",
|
|
151
|
+
"dealroom-profile-incomplete",
|
|
152
|
+
"dealroom-template-pending",
|
|
153
|
+
]);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("the deal money states mirror data-model's state machine exactly; payout is its own column", () => {
|
|
157
|
+
assert.deepEqual(
|
|
158
|
+
[...DEAL_MONEY_STATES],
|
|
159
|
+
[
|
|
160
|
+
"awaiting_material",
|
|
161
|
+
"material_submitted",
|
|
162
|
+
"deposit_paid",
|
|
163
|
+
"funded",
|
|
164
|
+
"approved",
|
|
165
|
+
"published",
|
|
166
|
+
"closed_unviewed",
|
|
167
|
+
"refund_pending",
|
|
168
|
+
"refunded",
|
|
169
|
+
"guarantee_claimed",
|
|
170
|
+
],
|
|
171
|
+
);
|
|
172
|
+
assert.deepEqual([...DEAL_PAYOUT_STATES], ["none", "initiated", "paid"]);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
test("payout profiles and the ledger carry the data-model's values", () => {
|
|
176
|
+
assert.deepEqual([...PAYOUT_BILLING_VARIANTS], ["faktura_vat", "umowa_o_dzielo", "international"]);
|
|
177
|
+
assert.deepEqual([...PAYOUT_LEDGER_SOURCES], ["deal", "pot", "commission"]);
|
|
178
|
+
assert.deepEqual([...PAYOUT_LEDGER_STATES], ["earned", "validated", "paid"]);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("the commission lane carries the two networks and its own states", () => {
|
|
182
|
+
assert.deepEqual([...COMMISSION_NETWORKS], ["awin", "admitad"]);
|
|
183
|
+
assert.deepEqual([...COMMISSION_OFFER_STATES], ["live", "paused", "gone"]);
|
|
184
|
+
assert.deepEqual([...COMMISSION_LINK_STATES], ["active", "suspended"]);
|
|
185
|
+
assert.deepEqual([...COMMISSION_LINK_MODES], ["subnetwork", "deeplink"]);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// ── Commission lane, amended 2026-10-07 (Admitad Ad Space, Awin consent) ────
|
|
189
|
+
|
|
190
|
+
test("an Admitad Ad Space is reviewed, registered, rejected or suspended, never anything else", () => {
|
|
191
|
+
assert.deepEqual([...COMMISSION_AD_SPACE_STATES], ["pending_review", "registered", "rejected", "suspended"]);
|
|
192
|
+
assert.deepEqual([...COMMISSION_AD_SPACE_DECISIONS], ["approve", "reject", "suspend"]);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("a join answers a link, a deep link, or an Ad Space under review", () => {
|
|
196
|
+
assert.deepEqual([...COMMISSION_JOIN_STATES], ["link", "deeplink", "ad_space_pending"]);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("advertiser materials have named kinds", () => {
|
|
200
|
+
assert.deepEqual([...COMMISSION_MATERIAL_KINDS], ["logo", "banner", "landing_preview", "coupon"]);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test("ReviewCommissionAdSpaceDto carries the admin's decision", () => {
|
|
204
|
+
assert.equal(new ReviewCommissionAdSpaceDto({ decision: "approve" }).decision, "approve");
|
|
205
|
+
assert.equal(new ReviewCommissionAdSpaceDto().decision, undefined);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
test("dealroom.ts is exported from the types index", () => {
|
|
209
|
+
assert.equal((typesIndex as Record<string, unknown>).DEALROOM_CODES, DEALROOM_CODES);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// ── Analytics: Dealroom-only events ─────────────────────────────────────────
|
|
213
|
+
|
|
214
|
+
test("Dealroom adds only the events 175 has none for", () => {
|
|
215
|
+
const dealroom = Object.entries(EVENTS)
|
|
216
|
+
.filter(([key]) => key.startsWith("DEALROOM_"))
|
|
217
|
+
.map(([, value]) => value)
|
|
218
|
+
.sort();
|
|
219
|
+
assert.deepEqual(dealroom, [
|
|
220
|
+
"dealroom_applied",
|
|
221
|
+
"dealroom_broaden_toggled",
|
|
222
|
+
"dealroom_connect_from_near_match_clicked",
|
|
223
|
+
"dealroom_deal_money_state_changed",
|
|
224
|
+
"dealroom_deal_payout_state_changed",
|
|
225
|
+
"dealroom_delegation_changed",
|
|
226
|
+
"dealroom_feed_viewed",
|
|
227
|
+
"dealroom_listing_opened",
|
|
228
|
+
"dealroom_near_match_promoted",
|
|
229
|
+
"dealroom_near_match_shown",
|
|
230
|
+
]);
|
|
231
|
+
});
|