@mpgd/adapter-devvit 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,12 @@
1
+ import { type DevvitSurfaceOptions, type DevvitSurfaceResult } from './surface.js';
1
2
  export type DevvitViewMode = 'inline' | 'expanded';
2
3
  export interface DevvitViewModeClient {
3
4
  getWebViewMode(): DevvitViewMode;
4
5
  }
6
+ export type DevvitPreviewViewModeOptions = DevvitSurfaceOptions;
7
+ export type DevvitPreviewViewModeResult = {
8
+ readonly surface: DevvitSurfaceResult;
9
+ };
5
10
  export interface DevvitInlineModeContext {
6
11
  /**
7
12
  * Loads gameplay in the current inline mode. Call this only from an explicit
@@ -22,10 +27,24 @@ export interface DevvitViewModeOptions {
22
27
  readonly onModeUnavailable?: (error: unknown) => void;
23
28
  }
24
29
  /**
30
+ * Preview-only inline entry contract. This is intentionally a thin alias of
31
+ * {@link startDevvitSurface}; generated games pin this policy-facing name while
32
+ * the lower-level surface API remains independently available.
33
+ *
34
+ * Use this contract by default for generated games. Games that intentionally
35
+ * support policy-compliant inline gameplay can opt in through
36
+ * {@link startDevvitViewMode} instead.
37
+ */
38
+ export declare function startDevvitPreviewViewMode(options: DevvitPreviewViewModeOptions): Promise<DevvitPreviewViewModeResult>;
39
+ /**
25
40
  * Starts a Devvit web view using Reddit's official inline and expanded mode
26
41
  * terminology. Inline mode mounts lightweight content first and exposes a
27
42
  * retryable, concurrency-safe gameplay loader for a later user action.
28
43
  * Expanded mode loads gameplay immediately. Outside a Devvit host, expanded
29
44
  * mode is used as the local-browser fallback.
45
+ *
46
+ * This is an explicit inline-gameplay opt-in. Prefer
47
+ * {@link startDevvitPreviewViewMode} unless the game's inline interaction and
48
+ * gesture model has been reviewed against current Reddit requirements.
30
49
  */
31
50
  export declare function startDevvitViewMode(options: DevvitViewModeOptions): Promise<DevvitViewModeResult>;
package/dist/view-mode.js CHANGED
@@ -1,9 +1,27 @@
1
+ import { startDevvitSurface, } from './surface.js';
2
+ /**
3
+ * Preview-only inline entry contract. This is intentionally a thin alias of
4
+ * {@link startDevvitSurface}; generated games pin this policy-facing name while
5
+ * the lower-level surface API remains independently available.
6
+ *
7
+ * Use this contract by default for generated games. Games that intentionally
8
+ * support policy-compliant inline gameplay can opt in through
9
+ * {@link startDevvitViewMode} instead.
10
+ */
11
+ export async function startDevvitPreviewViewMode(options) {
12
+ const surface = await startDevvitSurface(options);
13
+ return { surface };
14
+ }
1
15
  /**
2
16
  * Starts a Devvit web view using Reddit's official inline and expanded mode
3
17
  * terminology. Inline mode mounts lightweight content first and exposes a
4
18
  * retryable, concurrency-safe gameplay loader for a later user action.
5
19
  * Expanded mode loads gameplay immediately. Outside a Devvit host, expanded
6
20
  * mode is used as the local-browser fallback.
21
+ *
22
+ * This is an explicit inline-gameplay opt-in. Prefer
23
+ * {@link startDevvitPreviewViewMode} unless the game's inline interaction and
24
+ * gesture model has been reviewed against current Reddit requirements.
7
25
  */
8
26
  export async function startDevvitViewMode(options) {
9
27
  let mode;
package/dist/web.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import type { ShareResult } from '@mpgd/platform';
2
2
  import { type DevvitSurfaceOptions, type DevvitSurfaceResult } from './surface.js';
3
- import { type DevvitViewModeOptions, type DevvitViewModeResult } from './view-mode.js';
3
+ import { type DevvitPreviewViewModeOptions, type DevvitPreviewViewModeResult, type DevvitViewModeOptions, type DevvitViewModeResult } from './view-mode.js';
4
4
  export type { DevvitSurfaceClient, DevvitSurfaceMode, DevvitSurfaceOptions, DevvitSurfaceResult, } from './surface.js';
5
- export type { DevvitInlineModeContext, DevvitViewMode, DevvitViewModeClient, DevvitViewModeOptions, DevvitViewModeResult, } from './view-mode.js';
5
+ export type { DevvitInlineModeContext, DevvitPreviewViewModeOptions, DevvitPreviewViewModeResult, DevvitViewMode, DevvitViewModeClient, DevvitViewModeOptions, DevvitViewModeResult, } from './view-mode.js';
6
6
  export type DevvitWebSurfaceOptions = Omit<DevvitSurfaceOptions, 'client'>;
7
+ export type DevvitWebPreviewOptions = Omit<DevvitPreviewViewModeOptions, 'client'>;
7
8
  export type DevvitWebViewOptions = Omit<DevvitViewModeOptions, 'client'>;
8
9
  export interface DevvitShareSheetOptions {
9
10
  readonly data?: string;
@@ -12,8 +13,15 @@ export interface DevvitShareSheetOptions {
12
13
  }
13
14
  export declare function startDevvitWebSurface(options: DevvitWebSurfaceOptions): Promise<DevvitSurfaceResult>;
14
15
  /**
16
+ * Starts a preview-only inline entry and loads gameplay only in expanded mode.
17
+ * This is the safe default for generated Devvit games.
18
+ */
19
+ export declare function startDevvitPreviewWebView(options: DevvitWebPreviewOptions): Promise<DevvitPreviewViewModeResult>;
20
+ /**
15
21
  * Starts a Devvit web view in inline or expanded mode. Inline mode can defer
16
22
  * gameplay until an explicit user action while remaining inside the post.
23
+ * This is an explicit inline-gameplay opt-in; generated games use
24
+ * {@link startDevvitPreviewWebView} by default.
17
25
  */
18
26
  export declare function startDevvitWebView(options: DevvitWebViewOptions): Promise<DevvitViewModeResult>;
19
27
  export declare function requestDevvitExpandedMode(event: MouseEvent, entry: string): Promise<void>;
package/dist/web.js CHANGED
@@ -1,24 +1,39 @@
1
1
  import * as devvitWebClient from '@devvit/web/client';
2
2
  import { startDevvitSurface, } from './surface.js';
3
- import { startDevvitViewMode, } from './view-mode.js';
3
+ import { startDevvitPreviewViewMode, startDevvitViewMode, } from './view-mode.js';
4
4
  // The Devvit package publishes browser implementations behind an export
5
5
  // condition while its default declaration is a server-side panic module.
6
6
  // Keep the narrow browser contract explicit until its default types expose it.
7
7
  const browserClient = devvitWebClient;
8
+ const browserSurfaceClient = {
9
+ getWebViewMode: browserClient.getWebViewMode,
10
+ };
8
11
  export function startDevvitWebSurface(options) {
9
12
  return startDevvitSurface({
10
13
  ...options,
11
- client: { getWebViewMode: browserClient.getWebViewMode },
14
+ client: browserSurfaceClient,
15
+ });
16
+ }
17
+ /**
18
+ * Starts a preview-only inline entry and loads gameplay only in expanded mode.
19
+ * This is the safe default for generated Devvit games.
20
+ */
21
+ export function startDevvitPreviewWebView(options) {
22
+ return startDevvitPreviewViewMode({
23
+ ...options,
24
+ client: browserSurfaceClient,
12
25
  });
13
26
  }
14
27
  /**
15
28
  * Starts a Devvit web view in inline or expanded mode. Inline mode can defer
16
29
  * gameplay until an explicit user action while remaining inside the post.
30
+ * This is an explicit inline-gameplay opt-in; generated games use
31
+ * {@link startDevvitPreviewWebView} by default.
17
32
  */
18
33
  export function startDevvitWebView(options) {
19
34
  return startDevvitViewMode({
20
35
  ...options,
21
- client: { getWebViewMode: browserClient.getWebViewMode },
36
+ client: browserSurfaceClient,
22
37
  });
23
38
  }
24
39
  export async function requestDevvitExpandedMode(event, entry) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpgd/adapter-devvit",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "Reddit Devvit Web platform adapter for mpgd games.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -55,9 +55,9 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@devvit/web": "0.14.1",
58
- "@mpgd/game-services": "0.12.1",
58
+ "@mpgd/platform": "0.10.0",
59
59
  "@mpgd/bridge": "0.9.0",
60
- "@mpgd/platform": "0.10.0"
60
+ "@mpgd/game-services": "0.12.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "ttsc": "0.18.4",