/** * #context.ts * * Code generated by ts-proto. DO NOT EDIT. * @packageDocumentation */ import type { ConsentStatus, Scope } from "../../../../../reddit/devvit/app_permission/v1/app_permission.js"; import type { AppConfig } from "../../../../../reddit/devvit/common/v1/app.js"; import type { WebViewImmersiveMode } from "./immersive_mode.js"; /** The user client hosting the web view. */ export declare enum Client { CLIENT_UNSPECIFIED = 0, ANDROID = 1, IOS = 2, SHREDDIT = 3, UNRECOGNIZED = -1 } /** * Inline height of post. * * @deprecated */ export declare enum Height { HEIGHT_UNSPECIFIED = 0, REGULAR = 1, TALL = 2, UNRECOGNIZED = -1 } /** * Initialization data sent from the client (Shreddit, Android, iOS) to the * web view. */ export type BridgeContext = { postData?: DevvitPostData | undefined; shareParam?: ShareParam | undefined; /** @deprecated */ webViewContext?: WebViewContext | undefined; /** * Signed WebbitToken user JWT (header, payload, signature base64 strings * separated by dots). Users shouldn't share their JWTs with others, but * perfectly fine for a given user to see. Named WebbitToken to match GQL's * definition. Eg: * eyJhbGciOiJIUzI1NiIsImtpZCI6ImVlYzJjOWUzLWM0NTctNTM3Zi05NThmLTI5MDg3N2U4NjNlYyIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJkZXZ2aXQtZ2F0ZXdheS5yZWRkaXQuY29tIiwiYXVkIjpbIjhlMGUwZWI3LTc0NzgtNGVmMS1hNGZmLTk5NTlmMTkzZmNkMC0wLTAtOS13ZWJ2aWV3LmRldnZpdC5uZXQiXSwiZXhwIjoxNzUzMzcxODU2LCJuYmYiOjE3NTMyODU0NTYsImlhdCI6MTc1MzI4NTQ1NiwianRpIjoiYTA5NWMyOTktOWJkNS00MGUzLWEyYTEtYzhkYTBiMDc0ZjRhIiwiZGV2dml0LXBvc3QtaWQiOiJ0M18xbTdjcHZxIiwiZGV2dml0LXBvc3QtZGF0YSI6e30sImRldnZpdC11c2VyLWlkIjoidDJfazZsZGJqaDMiLCJkZXZ2aXQtaW5zdGFsbGF0aW9uIjoiOGUwZTBlYjctNzQ3OC00ZWYxLWE0ZmYtOTk1OWYxOTNmY2QwIn0.6M4NKCUsB4kWhZmslE909IL-hf2FAVMrkjB-peaHLHc * * @deprecated */ webbitToken: string; /** * Untrusted unknown debug user data passed in the case-insensitive * `devvitdebug` query param of the hosting window * (eg, `reddit.com?devvitdebug=...`). */ devvitDebug: string; client: Client; nativeVersion?: NativeClientVersion | undefined; /** `@devvit/protos` version used in Shreddit. */ shredditVersion?: SemVer | undefined; /** Data required for the "run as user" feature. */ appPermissionState?: AppPermissionState | undefined; viewMode?: WebViewImmersiveMode | undefined; /** Signed `RequestContext` JWT. */ signedRequestContext?: string | undefined; /** Opaque `WebViewClientData`. */ webViewClientData?: { [key: string]: any; } | undefined; /** Earliest moment the app started loading in fractional UTC milliseconds. */ startTime?: number | undefined; }; /** Android or iOS client version. Unavailable for web clients. */ export type NativeClientVersion = { /** Year built. Eg, `2025`. */ yyyy: number; /** Release number starting from 1 as the first release in January. Eg, `1`. */ release: number; /** Release attempt. Eg, `0`. */ attempt: number; /** Build number. Eg, `2417036`. */ number: number; }; /** Semantic version major, minor, and patch number. */ export type SemVer = { /** Major version. Eg, `1`. */ major: number; /** Minor version. Eg, `2`. */ minor: number; /** Patch version. Eg, `3`. */ patch: number; /** Original version string. */ version: string; }; /** * Data passed opaquely as a `google.protobuf.Struct` in the `DevvitPost` * GraphQL response. This allows the backend and web view code to update without * client changes. */ export type WebViewClientData = { appConfig?: AppConfig | undefined; }; /** @deprecated */ export type WebViewContext = { /** Subreddit Thing ID (t5) */ subredditId: string; subredditName: string; /** User Thing ID (t2) */ userId: string; appName: string; appVersion: string; /** Post Thing ID (t3) */ postId: string; }; /** * DevvitPostData contains all post data set on the custom post, including * internal data and developer-provided data. It originates from GraphQL as a * plain JSON string. This string **must** be ASCII to pass as metadata. See * asciiSafePostData(). */ export type DevvitPostData = { splash?: SplashPostData | undefined; /** Developer-provided data on the Post, in JSON format. This is what developers set via submitPost({ postData: {...} }). Eg: { "riddle": "hello world" } */ developerData?: { [key: string]: any; } | undefined; }; /** * App deep link. Passed in case-insensitive `devvitshare` query param of the * hosting window (eg, `reddit.com?devvitshare=...`) as user data. * * url.searchParams.set( * 'devvitshare', * JSON.stringify({params: {foo: 'bar'}, path: '/a/b/c/index.html', hash: '#abc', userData: 'abc'} satisfies ShareParam) // Encodes. * ) * const shareParam: ShareParam | undefined = JSON.parse( * url.searchParams.get('devvitshare') || '{}' // Decodes. * ) ?? undefined * ...Verify user data... * * Links are always assumed to use PDP. * * Emitted as WebViewShareEffect. */ export type ShareParam = { /** * Everything after and including the first /. Aligns to * https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname. * * @deprecated */ path: string; /** * URL query parameters (key-value). * * @deprecated */ params: { [key: string]: string; }; /** * Everything after and including the first #. Aligns to * https://developer.mozilla.org/en-US/docs/Web/API/URL/hash. * * @deprecated */ hash: string; /** User data as a string. Eg, `'abc'` or `'{"abc":"123"}'`. */ userData?: string | undefined; }; export type ShareParam_ParamsEntry = { key: string; value: string; }; /** * Splash screen post data. Everything needed to render a `Splash` screen * component. The below are recorded at post creation time to allow posts to * differ. Defaults are not recorded for anything but the fields needed to * render the `Loading` component to always prefer the current entry default * values when unspecified for everything that can be deferred. */ export type SplashPostData = { /** Application name. Eg, `'Comment Mop'`. */ appDisplayName?: string | undefined; /** Icon URL relative media directory or data URI. Eg, `'icon.png'`. */ appIconUri?: string | undefined; /** * Media directory relative background image URL or data URI. Eg, * `'background.png'`. */ backgroundUri?: string | undefined; /** The text of the web view launch button. */ buttonLabel?: string | undefined; /** Secondary text describing the post. */ description?: string | undefined; /** * The `devvit.json` `post.entrypoints` key. If not provided, defaults to * `defaultPostEntry`. See also `WebViewImmersiveModeEffect.entry_url`. */ entry?: string | undefined; /** Large text naming the post. Eg. `'What is this?'`. */ title?: string | undefined; }; /** Data required for the "run as user" feature. */ export type AppPermissionState = { /** If the app has been granted or revoked all the scopes. */ consentStatus: ConsentStatus; /** Scopes that has been granted or revoked by the user. */ grantedScopes: Scope[]; /** Scopes that the app has requested. */ requestedScopes: Scope[]; }; //# sourceMappingURL=context.d.ts.map