/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 265430222ea9 */ import * as z from "zod/v3"; import { ClosedEnum } from "../../types/enums.js"; import { ManualFeedbackInfo, ManualFeedbackInfo$Outbound, ManualFeedbackInfo$outboundSchema, } from "./manualfeedbackinfo.js"; import { ManualFeedbackSideBySideInfo, ManualFeedbackSideBySideInfo$Outbound, ManualFeedbackSideBySideInfo$outboundSchema, } from "./manualfeedbacksidebysideinfo.js"; import { SeenFeedbackInfo, SeenFeedbackInfo$Outbound, SeenFeedbackInfo$outboundSchema, } from "./seenfeedbackinfo.js"; import { SessionInfo, SessionInfo$Outbound, SessionInfo$outboundSchema, } from "./sessioninfo.js"; import { User, User$Outbound, User$outboundSchema } from "./user.js"; import { UserViewInfo, UserViewInfo$Outbound, UserViewInfo$outboundSchema, } from "./userviewinfo.js"; import { WorkflowFeedbackInfo, WorkflowFeedbackInfo$Outbound, WorkflowFeedbackInfo$outboundSchema, } from "./workflowfeedbackinfo.js"; /** * The feature category to which the feedback applies. These should be broad product areas such as Announcements, Answers, Search, etc. rather than specific components or UI treatments within those areas. */ export const FeedbackCategory = { Announcement: "ANNOUNCEMENT", Autocomplete: "AUTOCOMPLETE", Collections: "COLLECTIONS", Feed: "FEED", Search: "SEARCH", Chat: "CHAT", Ntp: "NTP", Workflows: "WORKFLOWS", Summary: "SUMMARY", General: "GENERAL", Prism: "PRISM", Prompts: "PROMPTS", } as const; /** * The feature category to which the feedback applies. These should be broad product areas such as Announcements, Answers, Search, etc. rather than specific components or UI treatments within those areas. */ export type FeedbackCategory = ClosedEnum; /** * The action the user took within a Glean client with respect to the object referred to by the given `trackingToken`. */ export const Event = { /** * The object's primary link was clicked with the intent to view its full representation. Depending on the object type, this may imply an external navigation or navigating to a new page or view within the Glean app. */ Click: "CLICK", /** * A link to the object's parent container (e.g. the folder in which it's located) was clicked. */ ContainerClick: "CONTAINER_CLICK", /** * The user copied a link to the primary link. */ CopyLink: "COPY_LINK", /** * The user creates a document. */ Create: "CREATE", /** * The user dismissed the object such that it was hidden from view. */ Dismiss: "DISMISS", /** * The user gave feedback that the object was not useful. */ Downvote: "DOWNVOTE", /** * The user attempted to send an email. */ Email: "EMAIL", /** * The user executed the object (e.g. ran a workflow). */ Execute: "EXECUTE", /** * The user applied a filter. */ Filter: "FILTER", /** * The first token of a streaming response is received. */ FirstToken: "FIRST_TOKEN", /** * The user clicked into an interactive element, e.g. the search box. */ FocusIn: "FOCUS_IN", /** * The final token of a streaming response is received. */ LastToken: "LAST_TOKEN", /** * The user submitted textual manual feedback regarding the object. */ ManualFeedback: "MANUAL_FEEDBACK", /** * The user submitted comparative feedback for multiple side-by-side implementations. */ ManualFeedbackSideBySide: "MANUAL_FEEDBACK_SIDE_BY_SIDE", /** * The user submitted feedback about time saved by an agent or workflow. */ FeedbackTimeSaved: "FEEDBACK_TIME_SAVED", /** * The user explicitly marked the content as read. */ MarkAsRead: "MARK_AS_READ", /** * The user attempted to send a message using their default messaing app. */ Message: "MESSAGE", /** * The user middle clicked the object's primary link with the intent to open its full representation in a new tab. */ MiddleClick: "MIDDLE_CLICK", /** * The user puts a page out of focus but keeps it in the background. */ PageBlur: "PAGE_BLUR", /** * The user puts a page in focus, meaning it is the first to receive keyboard events. */ PageFocus: "PAGE_FOCUS", /** * The user leaves a page and it is unloaded (by clicking a link, closing the tab/window, etc). */ PageLeave: "PAGE_LEAVE", /** * The user clicked the object's inline preview affordance. */ Preview: "PREVIEW", RelatedClick: "RELATED_CLICK", /** * The user right clicked the object's primary link. This may indicate an intent to open it in a new tab or copy it. */ RightClick: "RIGHT_CLICK", /** * The user clicked a link to a subsection of the primary object. */ SectionClick: "SECTION_CLICK", /** * The user has likely seen the object (e.g. took action to make the object visible within the user's viewport). */ Seen: "SEEN", /** * The user explicitly selected something, eg. a chat response variant they prefer. */ Select: "SELECT", /** * The user shared the object with another user. */ Share: "SHARE", /** * The user clicked the object's show more affordance. */ ShowMore: "SHOW_MORE", /** * The user gave feedback that the object was useful. */ Upvote: "UPVOTE", /** * The object was visible within the user's viewport. */ View: "VIEW", /** * The object was visible within the user's viewport. */ Visible: "VISIBLE", } as const; /** * The action the user took within a Glean client with respect to the object referred to by the given `trackingToken`. */ export type Event = ClosedEnum; export const FeedbackChannel = { Company: "COMPANY", Glean: "GLEAN", } as const; export type FeedbackChannel = ClosedEnum; export type Feedback = { /** * Universally unique identifier of the event. To allow for reliable retransmission, only the earliest received event of a given UUID is considered valid by the server and subsequent are ignored. */ id?: string | undefined; /** * The feature category to which the feedback applies. These should be broad product areas such as Announcements, Answers, Search, etc. rather than specific components or UI treatments within those areas. */ category?: FeedbackCategory | undefined; /** * A list of server-generated trackingTokens to which this event applies. */ trackingTokens: Array; /** * The action the user took within a Glean client with respect to the object referred to by the given `trackingToken`. */ event: Event; /** * Position of the element in the case that the client controls order (such as feed and autocomplete). */ position?: number | undefined; /** * For type MANUAL_FEEDBACK, contains string of user feedback. For autocomplete, partial query string. For feed, string of user feedback in addition to manual feedback signals extracted from all suggested content. */ payload?: string | undefined; sessionInfo?: SessionInfo | undefined; /** * The ISO 8601 timestamp when the event occured. */ timestamp?: Date | undefined; user?: User | undefined; /** * The path the client was at when the feedback event triggered. */ pathname?: string | undefined; /** * Where the feedback will be sent, e.g. to Glean, the user's company, or both. If no channels are specified, feedback will go only to Glean. */ channels?: Array | undefined; /** * The URL the client was at when the feedback event triggered. */ url?: string | undefined; /** * The UI element tree associated with the event, if any. */ uiTree?: Array | undefined; /** * The UI element associated with the event, if any. */ uiElement?: string | undefined; manualFeedbackInfo?: ManualFeedbackInfo | undefined; manualFeedbackSideBySideInfo?: ManualFeedbackSideBySideInfo | undefined; seenFeedbackInfo?: SeenFeedbackInfo | undefined; userViewInfo?: UserViewInfo | undefined; workflowFeedbackInfo?: WorkflowFeedbackInfo | undefined; /** * The application ID of the client that sent the feedback event. */ applicationId?: string | undefined; /** * The agent ID of the client that sent the feedback event. */ agentId?: string | undefined; }; /** @internal */ export const FeedbackCategory$outboundSchema: z.ZodNativeEnum< typeof FeedbackCategory > = z.nativeEnum(FeedbackCategory); /** @internal */ export const Event$outboundSchema: z.ZodNativeEnum = z.nativeEnum( Event, ); /** @internal */ export const FeedbackChannel$outboundSchema: z.ZodNativeEnum< typeof FeedbackChannel > = z.nativeEnum(FeedbackChannel); /** @internal */ export type Feedback$Outbound = { id?: string | undefined; category?: string | undefined; trackingTokens: Array; event: string; position?: number | undefined; payload?: string | undefined; sessionInfo?: SessionInfo$Outbound | undefined; timestamp?: string | undefined; user?: User$Outbound | undefined; pathname?: string | undefined; channels?: Array | undefined; url?: string | undefined; uiTree?: Array | undefined; uiElement?: string | undefined; manualFeedbackInfo?: ManualFeedbackInfo$Outbound | undefined; manualFeedbackSideBySideInfo?: | ManualFeedbackSideBySideInfo$Outbound | undefined; seenFeedbackInfo?: SeenFeedbackInfo$Outbound | undefined; userViewInfo?: UserViewInfo$Outbound | undefined; workflowFeedbackInfo?: WorkflowFeedbackInfo$Outbound | undefined; applicationId?: string | undefined; agentId?: string | undefined; }; /** @internal */ export const Feedback$outboundSchema: z.ZodType< Feedback$Outbound, z.ZodTypeDef, Feedback > = z.object({ id: z.string().optional(), category: FeedbackCategory$outboundSchema.optional(), trackingTokens: z.array(z.string()), event: Event$outboundSchema, position: z.number().int().optional(), payload: z.string().optional(), sessionInfo: SessionInfo$outboundSchema.optional(), timestamp: z.date().transform(v => v.toISOString()).optional(), user: User$outboundSchema.optional(), pathname: z.string().optional(), channels: z.array(FeedbackChannel$outboundSchema).optional(), url: z.string().optional(), uiTree: z.array(z.string()).optional(), uiElement: z.string().optional(), manualFeedbackInfo: ManualFeedbackInfo$outboundSchema.optional(), manualFeedbackSideBySideInfo: ManualFeedbackSideBySideInfo$outboundSchema .optional(), seenFeedbackInfo: SeenFeedbackInfo$outboundSchema.optional(), userViewInfo: UserViewInfo$outboundSchema.optional(), workflowFeedbackInfo: WorkflowFeedbackInfo$outboundSchema.optional(), applicationId: z.string().optional(), agentId: z.string().optional(), }); export function feedbackToJSON(feedback: Feedback): string { return JSON.stringify(Feedback$outboundSchema.parse(feedback)); }