/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ActionDto, ActionDto$inboundSchema, ActionDto$Outbound, ActionDto$outboundSchema, } from "./actiondto.js"; import { RedirectDto, RedirectDto$inboundSchema, RedirectDto$Outbound, RedirectDto$outboundSchema, } from "./redirectdto.js"; export type InAppControlDto = { /** * JSONLogic filter conditions for conditionally skipping the step execution. Supports complex logical operations with AND, OR, and comparison operators. See https://jsonlogic.com/ for full typing reference. */ skip?: { [k: string]: any } | undefined; /** * Content/body of the in-app message. Required if subject is empty. */ body?: string | undefined; /** * Subject/title of the in-app message. Required if body is empty. */ subject?: string | undefined; /** * URL for an avatar image. Must be a valid URL or start with / or {{ variable }}. */ avatar?: string | undefined; /** * Primary action button details. */ primaryAction?: ActionDto | undefined; /** * Secondary action button details. */ secondaryAction?: ActionDto | undefined; /** * Redirection URL configuration for the main content click (if no actions defined/clicked).. */ redirect?: RedirectDto | undefined; /** * Disable sanitization of the output. */ disableOutputSanitization?: boolean | undefined; /** * Additional data payload for the step. */ data?: { [k: string]: any } | undefined; }; /** @internal */ export const InAppControlDto$inboundSchema: z.ZodType< InAppControlDto, z.ZodTypeDef, unknown > = z.object({ skip: z.record(z.any()).optional(), body: z.string().optional(), subject: z.string().optional(), avatar: z.string().optional(), primaryAction: ActionDto$inboundSchema.optional(), secondaryAction: ActionDto$inboundSchema.optional(), redirect: RedirectDto$inboundSchema.optional(), disableOutputSanitization: z.boolean().default(false), data: z.record(z.any()).optional(), }); /** @internal */ export type InAppControlDto$Outbound = { skip?: { [k: string]: any } | undefined; body?: string | undefined; subject?: string | undefined; avatar?: string | undefined; primaryAction?: ActionDto$Outbound | undefined; secondaryAction?: ActionDto$Outbound | undefined; redirect?: RedirectDto$Outbound | undefined; disableOutputSanitization: boolean; data?: { [k: string]: any } | undefined; }; /** @internal */ export const InAppControlDto$outboundSchema: z.ZodType< InAppControlDto$Outbound, z.ZodTypeDef, InAppControlDto > = z.object({ skip: z.record(z.any()).optional(), body: z.string().optional(), subject: z.string().optional(), avatar: z.string().optional(), primaryAction: ActionDto$outboundSchema.optional(), secondaryAction: ActionDto$outboundSchema.optional(), redirect: RedirectDto$outboundSchema.optional(), disableOutputSanitization: z.boolean().default(false), data: z.record(z.any()).optional(), }); export function inAppControlDtoToJSON( inAppControlDto: InAppControlDto, ): string { return JSON.stringify(InAppControlDto$outboundSchema.parse(inAppControlDto)); } export function inAppControlDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => InAppControlDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InAppControlDto' from JSON`, ); }