Spaces:
Sleeping
Sleeping
| /** | |
| * 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 | |
| */ | |
| import * as zod from "zod"; | |
| /** | |
| * Returns server health status | |
| * @summary Health check | |
| */ | |
| export const HealthCheckResponse = zod.object({ | |
| status: zod.string(), | |
| }); | |
| /** | |
| * Analyzes page content for dark patterns using AI classification | |
| * @summary Detect dark patterns on a page | |
| */ | |
| export const DetectDarkPatternsBody = zod.object({ | |
| domain: zod.string().describe("The website domain being analyzed"), | |
| pageText: zod.string().describe("Extracted text content from the page"), | |
| timerElements: zod | |
| .array(zod.string()) | |
| .optional() | |
| .describe("Text from countdown timer elements found on the page"), | |
| stockAlerts: zod | |
| .array(zod.string()) | |
| .optional() | |
| .describe("Text from stock\/scarcity alert elements"), | |
| buttonLabels: zod | |
| .array(zod.string()) | |
| .optional() | |
| .describe("Text from all buttons on the page"), | |
| formFields: zod | |
| .array( | |
| zod.object({ | |
| id: zod.string(), | |
| label: zod.string(), | |
| type: zod.string(), | |
| checked: zod.boolean().nullish(), | |
| optional: zod.boolean().nullish(), | |
| }), | |
| ) | |
| .optional() | |
| .describe("Form field info including pre-checked state"), | |
| priceStrings: zod | |
| .array(zod.string()) | |
| .optional() | |
| .describe("All price strings found on the page"), | |
| }); | |
| export const DetectDarkPatternsResponse = zod.object({ | |
| domain: zod.string(), | |
| falseUrgency: zod.object({ | |
| detected: zod.boolean(), | |
| evidence: zod.string(), | |
| isTimerFake: zod.boolean().nullish(), | |
| }), | |
| falseScarcity: zod.object({ | |
| detected: zod.boolean(), | |
| evidence: zod.string(), | |
| }), | |
| confirmShaming: zod.object({ | |
| detected: zod.boolean(), | |
| shamingText: zod.string(), | |
| rewrittenText: zod.string(), | |
| }), | |
| hiddenFees: zod.object({ | |
| detected: zod.boolean(), | |
| feeItems: zod.array( | |
| zod.object({ | |
| label: zod.string(), | |
| amount: zod.number(), | |
| }), | |
| ), | |
| totalExtra: zod.number().nullish(), | |
| }), | |
| preCheckedAddOns: zod.object({ | |
| detected: zod.boolean(), | |
| fieldIds: zod.array(zod.string()), | |
| addOnLabels: zod.array(zod.string()), | |
| }), | |
| misdirection: zod.object({ | |
| detected: zod.boolean(), | |
| hiddenDeclineText: zod.string(), | |
| }), | |
| trustScore: zod.number().describe("Trust score 0-100"), | |
| summary: zod.string().describe("Human-readable summary of findings"), | |
| }); | |
| /** | |
| * Identifies what type of upsell/add-on screen is being shown | |
| * @summary Classify an upsell page type | |
| */ | |
| export const ClassifyUpsellBody = zod.object({ | |
| domain: zod.string(), | |
| pageText: zod.string().describe("Text content of the upsell page"), | |
| }); | |
| export const ClassifyUpsellResponse = zod.object({ | |
| type: zod.enum([ | |
| "insurance", | |
| "breakfast", | |
| "room_upgrade", | |
| "seat_selection", | |
| "newsletter", | |
| "sms_alerts", | |
| "warranty", | |
| "refundable_rate", | |
| "other", | |
| ]), | |
| confidence: zod.number(), | |
| recommendedAction: zod | |
| .string() | |
| .describe("Suggested action: decline, accept, or ask_user"), | |
| declineButtonHint: zod | |
| .string() | |
| .describe("Text or selector hint for the decline button"), | |
| }); | |
| /** | |
| * Returns trust ratings for all tracked domains | |
| * @summary List all site trust ratings | |
| */ | |
| export const ListTrustRatingsResponseItem = zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| score: zod.number().describe("Trust score 0-100"), | |
| tier: zod.enum([ | |
| "gold", | |
| "clean", | |
| "neutral", | |
| "suspicious", | |
| "high_manipulation", | |
| ]), | |
| totalScans: zod.number(), | |
| patternsDetectedCount: zod.number(), | |
| hiddenFeesCount: zod.number(), | |
| lastScannedAt: zod.string().nullish(), | |
| createdAt: zod.string(), | |
| updatedAt: zod.string(), | |
| }); | |
| export const ListTrustRatingsResponse = zod.array(ListTrustRatingsResponseItem); | |
| /** | |
| * Returns the trust rating and history for a specific domain | |
| * @summary Get trust rating for a domain | |
| */ | |
| export const GetTrustRatingParams = zod.object({ | |
| domain: zod.coerce.string(), | |
| }); | |
| export const GetTrustRatingResponse = zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| score: zod.number().describe("Trust score 0-100"), | |
| tier: zod.enum([ | |
| "gold", | |
| "clean", | |
| "neutral", | |
| "suspicious", | |
| "high_manipulation", | |
| ]), | |
| totalScans: zod.number(), | |
| patternsDetectedCount: zod.number(), | |
| hiddenFeesCount: zod.number(), | |
| lastScannedAt: zod.string().nullish(), | |
| createdAt: zod.string(), | |
| updatedAt: zod.string(), | |
| }); | |
| /** | |
| * Updates the trust rating after a checkout interaction | |
| * @summary Create or update trust rating for a domain | |
| */ | |
| export const UpsertTrustRatingParams = zod.object({ | |
| domain: zod.coerce.string(), | |
| }); | |
| export const UpsertTrustRatingBody = zod.object({ | |
| scoreDelta: zod | |
| .number() | |
| .describe("Amount to adjust the score (positive or negative)"), | |
| patternsFound: zod.number(), | |
| hiddenFeesFound: zod.number(), | |
| }); | |
| export const UpsertTrustRatingResponse = zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| score: zod.number().describe("Trust score 0-100"), | |
| tier: zod.enum([ | |
| "gold", | |
| "clean", | |
| "neutral", | |
| "suspicious", | |
| "high_manipulation", | |
| ]), | |
| totalScans: zod.number(), | |
| patternsDetectedCount: zod.number(), | |
| hiddenFeesCount: zod.number(), | |
| lastScannedAt: zod.string().nullish(), | |
| createdAt: zod.string(), | |
| updatedAt: zod.string(), | |
| }); | |
| /** | |
| * Returns recent dark pattern detection reports | |
| * @summary List detection reports | |
| */ | |
| export const ListReportsQueryParams = zod.object({ | |
| domain: zod.coerce.string().nullish(), | |
| limit: zod.coerce.number().nullish(), | |
| }); | |
| export const ListReportsResponseItem = zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| url: zod.string(), | |
| trustScore: zod.number(), | |
| falseUrgencyDetected: zod.boolean(), | |
| falseScarcityDetected: zod.boolean(), | |
| confirmShamingDetected: zod.boolean(), | |
| hiddenFeesDetected: zod.boolean(), | |
| preCheckedAddOnsDetected: zod.boolean(), | |
| misdirectionDetected: zod.boolean(), | |
| totalPatternsDetected: zod.number(), | |
| hiddenFeesTotal: zod.number().nullish(), | |
| summary: zod.string(), | |
| createdAt: zod.string(), | |
| }); | |
| export const ListReportsResponse = zod.array(ListReportsResponseItem); | |
| /** | |
| * Stores a dark pattern detection report for a session | |
| * @summary Save a detection report | |
| */ | |
| export const CreateReportBody = zod.object({ | |
| domain: zod.string(), | |
| url: zod.string(), | |
| trustScore: zod.number(), | |
| falseUrgencyDetected: zod.boolean(), | |
| falseScarcityDetected: zod.boolean(), | |
| confirmShamingDetected: zod.boolean(), | |
| hiddenFeesDetected: zod.boolean(), | |
| preCheckedAddOnsDetected: zod.boolean(), | |
| misdirectionDetected: zod.boolean(), | |
| totalPatternsDetected: zod.number(), | |
| hiddenFeesTotal: zod.number().nullish(), | |
| summary: zod.string(), | |
| }); | |
| /** | |
| * @summary Get a detection report by ID | |
| */ | |
| export const GetReportParams = zod.object({ | |
| id: zod.coerce.number(), | |
| }); | |
| export const GetReportResponse = zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| url: zod.string(), | |
| trustScore: zod.number(), | |
| falseUrgencyDetected: zod.boolean(), | |
| falseScarcityDetected: zod.boolean(), | |
| confirmShamingDetected: zod.boolean(), | |
| hiddenFeesDetected: zod.boolean(), | |
| preCheckedAddOnsDetected: zod.boolean(), | |
| misdirectionDetected: zod.boolean(), | |
| totalPatternsDetected: zod.number(), | |
| hiddenFeesTotal: zod.number().nullish(), | |
| summary: zod.string(), | |
| createdAt: zod.string(), | |
| }); | |
| /** | |
| * Returns aggregated stats — total scans, patterns detected, money saved estimates | |
| * @summary Get overall statistics summary | |
| */ | |
| export const GetStatsSummaryResponse = zod.object({ | |
| totalScans: zod.number(), | |
| totalPatternsDetected: zod.number(), | |
| totalHiddenFeesBlocked: zod | |
| .number() | |
| .describe("Estimated total money saved in dollars"), | |
| totalDomainsTracked: zod.number(), | |
| totalReportsLast30Days: zod.number(), | |
| avgTrustScore: zod.number(), | |
| goldTierDomains: zod.number(), | |
| highManipulationDomains: zod.number(), | |
| }); | |
| /** | |
| * Returns counts by dark pattern type across all reports | |
| * @summary Get pattern detection breakdown | |
| */ | |
| export const GetPatternBreakdownResponse = zod.object({ | |
| falseUrgency: zod.number(), | |
| falseScarcity: zod.number(), | |
| confirmShaming: zod.number(), | |
| hiddenFees: zod.number(), | |
| preCheckedAddOns: zod.number(), | |
| misdirection: zod.number(), | |
| }); | |
| /** | |
| * Detects dark patterns, saves report, and updates trust rating in one call. Perfect for live demos. | |
| * @summary All-in-one demo scan | |
| */ | |
| export const DemoScanBody = zod.object({ | |
| domain: zod.string(), | |
| url: zod.string(), | |
| pageText: zod.string(), | |
| timerElements: zod.array(zod.string()).optional(), | |
| stockAlerts: zod.array(zod.string()).optional(), | |
| buttonLabels: zod.array(zod.string()).optional(), | |
| priceStrings: zod.array(zod.string()).optional(), | |
| scenarioName: zod | |
| .string() | |
| .nullish() | |
| .describe("Name of the preset scenario being run"), | |
| }); | |
| export const DemoScanResponse = zod.object({ | |
| report: zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| url: zod.string(), | |
| trustScore: zod.number(), | |
| falseUrgencyDetected: zod.boolean(), | |
| falseScarcityDetected: zod.boolean(), | |
| confirmShamingDetected: zod.boolean(), | |
| hiddenFeesDetected: zod.boolean(), | |
| preCheckedAddOnsDetected: zod.boolean(), | |
| misdirectionDetected: zod.boolean(), | |
| totalPatternsDetected: zod.number(), | |
| hiddenFeesTotal: zod.number().nullish(), | |
| summary: zod.string(), | |
| createdAt: zod.string(), | |
| }), | |
| darkPatternReport: zod.object({ | |
| domain: zod.string(), | |
| falseUrgency: zod.object({ | |
| detected: zod.boolean(), | |
| evidence: zod.string(), | |
| isTimerFake: zod.boolean().nullish(), | |
| }), | |
| falseScarcity: zod.object({ | |
| detected: zod.boolean(), | |
| evidence: zod.string(), | |
| }), | |
| confirmShaming: zod.object({ | |
| detected: zod.boolean(), | |
| shamingText: zod.string(), | |
| rewrittenText: zod.string(), | |
| }), | |
| hiddenFees: zod.object({ | |
| detected: zod.boolean(), | |
| feeItems: zod.array( | |
| zod.object({ | |
| label: zod.string(), | |
| amount: zod.number(), | |
| }), | |
| ), | |
| totalExtra: zod.number().nullish(), | |
| }), | |
| preCheckedAddOns: zod.object({ | |
| detected: zod.boolean(), | |
| fieldIds: zod.array(zod.string()), | |
| addOnLabels: zod.array(zod.string()), | |
| }), | |
| misdirection: zod.object({ | |
| detected: zod.boolean(), | |
| hiddenDeclineText: zod.string(), | |
| }), | |
| trustScore: zod.number().describe("Trust score 0-100"), | |
| summary: zod.string().describe("Human-readable summary of findings"), | |
| }), | |
| trustRating: zod.object({ | |
| id: zod.number(), | |
| domain: zod.string(), | |
| score: zod.number().describe("Trust score 0-100"), | |
| tier: zod.enum([ | |
| "gold", | |
| "clean", | |
| "neutral", | |
| "suspicious", | |
| "high_manipulation", | |
| ]), | |
| totalScans: zod.number(), | |
| patternsDetectedCount: zod.number(), | |
| hiddenFeesCount: zod.number(), | |
| lastScannedAt: zod.string().nullish(), | |
| createdAt: zod.string(), | |
| updatedAt: zod.string(), | |
| }), | |
| }); | |
| /** | |
| * Uses AI to estimate hidden fees and total true price for a given site and listing price | |
| * @summary Estimate true final price | |
| */ | |
| export const demoFeeEstimateBodyCurrencyDefault = `USD`; | |
| export const DemoFeeEstimateBody = zod.object({ | |
| domain: zod.string(), | |
| merchantType: zod | |
| .string() | |
| .describe( | |
| "Type of merchant: hotel, airline, ecommerce, vacation_rental, car_rental", | |
| ), | |
| listedPrice: zod.number(), | |
| currency: zod.string().default(demoFeeEstimateBodyCurrencyDefault), | |
| itemDescription: zod.string().nullish(), | |
| }); | |
| export const DemoFeeEstimateResponse = zod.object({ | |
| listedPrice: zod.number(), | |
| estimatedTotal: zod.number(), | |
| savingsOpportunity: zod.number(), | |
| feeBreakdown: zod.array( | |
| zod.object({ | |
| label: zod.string(), | |
| amount: zod.number(), | |
| }), | |
| ), | |
| confidence: zod.enum(["high", "medium", "low"]), | |
| warningLevel: zod.enum(["green", "orange", "red"]), | |
| explanation: zod.string(), | |
| }); | |
| /** | |
| * Returns the domains with the most detected dark patterns | |
| * @summary Get top offending domains | |
| */ | |
| export const GetTopOffendersQueryParams = zod.object({ | |
| limit: zod.coerce.number().nullish(), | |
| }); | |
| export const GetTopOffendersResponseItem = zod.object({ | |
| domain: zod.string(), | |
| totalPatternsDetected: zod.number(), | |
| trustScore: zod.number(), | |
| tier: zod.string(), | |
| totalScans: zod.number(), | |
| }); | |
| export const GetTopOffendersResponse = zod.array(GetTopOffendersResponseItem); | |