File size: 6,882 Bytes
4d26b95
 
 
 
2211d3a
4d26b95
 
 
 
 
2211d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ad3cafa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2211d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
/**
 * Generated by orval v8.5.3 🍺
 * Do not edit manually.
 * Api
 * Guardian Agent API — dark pattern detection and checkout protection
 * OpenAPI spec version: 0.1.0
 */
export interface HealthStatus {
  status: string;
}

export interface ErrorResponse {
  error: string;
}

export interface FormFieldInfo {
  id: string;
  label: string;
  type: string;
  /** @nullable */
  checked?: boolean | null;
  /** @nullable */
  optional?: boolean | null;
}

export interface DetectDarkPatternsBody {
  /** The website domain being analyzed */
  domain: string;
  /** Extracted text content from the page */
  pageText: string;
  /** Text from countdown timer elements found on the page */
  timerElements?: string[];
  /** Text from stock/scarcity alert elements */
  stockAlerts?: string[];
  /** Text from all buttons on the page */
  buttonLabels?: string[];
  /** Form field info including pre-checked state */
  formFields?: FormFieldInfo[];
  /** All price strings found on the page */
  priceStrings?: string[];
}

export interface FalseUrgencyResult {
  detected: boolean;
  evidence: string;
  /** @nullable */
  isTimerFake?: boolean | null;
}

export interface FalseScarcityResult {
  detected: boolean;
  evidence: string;
}

export interface ConfirmShamingResult {
  detected: boolean;
  shamingText: string;
  rewrittenText: string;
}

export interface FeeItem {
  label: string;
  amount: number;
}

export interface HiddenFeesResult {
  detected: boolean;
  feeItems: FeeItem[];
  /** @nullable */
  totalExtra?: number | null;
}

export interface PreCheckedAddOnsResult {
  detected: boolean;
  fieldIds: string[];
  addOnLabels: string[];
}

export interface MisdirectionResult {
  detected: boolean;
  hiddenDeclineText: string;
}

export interface DarkPatternReport {
  domain: string;
  falseUrgency: FalseUrgencyResult;
  falseScarcity: FalseScarcityResult;
  confirmShaming: ConfirmShamingResult;
  hiddenFees: HiddenFeesResult;
  preCheckedAddOns: PreCheckedAddOnsResult;
  misdirection: MisdirectionResult;
  /** Trust score 0-100 */
  trustScore: number;
  /** Human-readable summary of findings */
  summary: string;
}

export interface ClassifyUpsellBody {
  domain: string;
  /** Text content of the upsell page */
  pageText: string;
}

export type UpsellClassificationType =
  (typeof UpsellClassificationType)[keyof typeof UpsellClassificationType];

export const UpsellClassificationType = {
  insurance: "insurance",
  breakfast: "breakfast",
  room_upgrade: "room_upgrade",
  seat_selection: "seat_selection",
  newsletter: "newsletter",
  sms_alerts: "sms_alerts",
  warranty: "warranty",
  refundable_rate: "refundable_rate",
  other: "other",
} as const;

export interface UpsellClassification {
  type: UpsellClassificationType;
  confidence: number;
  /** Suggested action: decline, accept, or ask_user */
  recommendedAction: string;
  /** Text or selector hint for the decline button */
  declineButtonHint: string;
}

export type TrustRatingTier =
  (typeof TrustRatingTier)[keyof typeof TrustRatingTier];

export const TrustRatingTier = {
  gold: "gold",
  clean: "clean",
  neutral: "neutral",
  suspicious: "suspicious",
  high_manipulation: "high_manipulation",
} as const;

export interface TrustRating {
  id: number;
  domain: string;
  /** Trust score 0-100 */
  score: number;
  tier: TrustRatingTier;
  totalScans: number;
  patternsDetectedCount: number;
  hiddenFeesCount: number;
  /** @nullable */
  lastScannedAt?: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface UpsertTrustRatingBody {
  /** Amount to adjust the score (positive or negative) */
  scoreDelta: number;
  patternsFound: number;
  hiddenFeesFound: number;
}

export interface DetectionReport {
  id: number;
  domain: string;
  url: string;
  trustScore: number;
  falseUrgencyDetected: boolean;
  falseScarcityDetected: boolean;
  confirmShamingDetected: boolean;
  hiddenFeesDetected: boolean;
  preCheckedAddOnsDetected: boolean;
  misdirectionDetected: boolean;
  totalPatternsDetected: number;
  /** @nullable */
  hiddenFeesTotal?: number | null;
  summary: string;
  createdAt: string;
}

export interface CreateReportBody {
  domain: string;
  url: string;
  trustScore: number;
  falseUrgencyDetected: boolean;
  falseScarcityDetected: boolean;
  confirmShamingDetected: boolean;
  hiddenFeesDetected: boolean;
  preCheckedAddOnsDetected: boolean;
  misdirectionDetected: boolean;
  totalPatternsDetected: number;
  /** @nullable */
  hiddenFeesTotal?: number | null;
  summary: string;
}

export interface StatsSummary {
  totalScans: number;
  totalPatternsDetected: number;
  /** Estimated total money saved in dollars */
  totalHiddenFeesBlocked: number;
  totalDomainsTracked: number;
  totalReportsLast30Days: number;
  avgTrustScore: number;
  goldTierDomains: number;
  highManipulationDomains: number;
}

export interface PatternBreakdown {
  falseUrgency: number;
  falseScarcity: number;
  confirmShaming: number;
  hiddenFees: number;
  preCheckedAddOns: number;
  misdirection: number;
}

export interface DomainOffenderSummary {
  domain: string;
  totalPatternsDetected: number;
  trustScore: number;
  tier: string;
  totalScans: number;
}

export interface DemoScanBody {
  domain: string;
  url: string;
  pageText: string;
  timerElements?: string[];
  stockAlerts?: string[];
  buttonLabels?: string[];
  priceStrings?: string[];
  /**
   * Name of the preset scenario being run
   * @nullable
   */
  scenarioName?: string | null;
}

export interface DemoScanResult {
  report: DetectionReport;
  darkPatternReport: DarkPatternReport;
  trustRating: TrustRating;
}

export interface FeeEstimateBody {
  domain: string;
  /** Type of merchant: hotel, airline, ecommerce, vacation_rental, car_rental */
  merchantType: string;
  listedPrice: number;
  currency?: string;
  /** @nullable */
  itemDescription?: string | null;
}

export type FeeEstimateResultConfidence =
  (typeof FeeEstimateResultConfidence)[keyof typeof FeeEstimateResultConfidence];

export const FeeEstimateResultConfidence = {
  high: "high",
  medium: "medium",
  low: "low",
} as const;

export type FeeEstimateResultWarningLevel =
  (typeof FeeEstimateResultWarningLevel)[keyof typeof FeeEstimateResultWarningLevel];

export const FeeEstimateResultWarningLevel = {
  green: "green",
  orange: "orange",
  red: "red",
} as const;

export interface FeeEstimateResult {
  listedPrice: number;
  estimatedTotal: number;
  savingsOpportunity: number;
  feeBreakdown: FeeItem[];
  confidence: FeeEstimateResultConfidence;
  warningLevel: FeeEstimateResultWarningLevel;
  explanation: string;
}

export type ListReportsParams = {
  /**
   * @nullable
   */
  domain?: string | null;
  /**
   * @nullable
   */
  limit?: number | null;
};

export type GetTopOffendersParams = {
  /**
   * @nullable
   */
  limit?: number | null;
};