All files / src/services/elevenLabsInternalAPI/authAccount response.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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    1x           1x             1x             1x                                 1x                                
import z from "zod";
 
const GeoLocationSchema = z.object({
    country: z.string(),
    region: z.string(),
    city: z.string(),
});
 
const TermsAgreedToSchema = z
    .object({
        conversational_ai_agreement_unix_timestamp: z.number().nullable(),
        voice_design_agreement_unix_timestamp: z.number().nullable(),
        publishing_payouts_agreement_unix_timestamp: z.number().nullable(),
        batch_calling_agreement_unix_timestamp: z.number().nullable(),
    })
    .transform((data) => ({
        conversationalAIAgreementUnixTimestamp: data.conversational_ai_agreement_unix_timestamp,
        voiceDesignAgreementUnixTimestamp: data.voice_design_agreement_unix_timestamp,
        publishingPayoutsAgreementUnixTimestamp: data.publishing_payouts_agreement_unix_timestamp,
        batchCallingAgreementUnixTimestamp: data.batch_calling_agreement_unix_timestamp,
    }));
 
export const ResponseSchema = z
    .object({
        auth_account_id: z.string(),
        created_at_unix: z.number(),
        email: z.email(),
        is_mfa_enabled: z.boolean(),
        mfa_type: z.string().nullable(),
        agrees_to_product_updates: z.boolean(),
        locale: z.string(),
        moderation_warning_dismissed: z.boolean(),
        is_in_probation: z.boolean(),
        geo_location: GeoLocationSchema,
        terms_agreed_to: TermsAgreedToSchema,
        ccpa_opt_out: z.boolean(),
        accepted_bipa_terms: z.boolean(),
        first_name: z.string(),
    })
    .transform((data) => ({
        authAccountID: data.auth_account_id,
        createdAtUnix: data.created_at_unix,
        email: data.email,
        isMFAEnabled: data.is_mfa_enabled,
        mfaType: data.mfa_type,
        agreesToProductUpdates: data.agrees_to_product_updates,
        locale: data.locale,
        moderationWarningDismissed: data.moderation_warning_dismissed,
        isInProbation: data.is_in_probation,
        geoLocation: data.geo_location,
        termsAgreedTo: data.terms_agreed_to,
        ccpaOptOut: data.ccpa_opt_out,
        acceptedBIPATerms: data.accepted_bipa_terms,
        firstName: data.first_name,
    }));