@devvit/client 0.11.20-next-2025-07-25-17-24-54-9a691dab8.0 → 0.11.20-next-2025-07-28-13-12-45-ae6d04190.0

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 +1 @@
1
- {"version":3,"file":"immersive-mode.d.ts","sourceRoot":"","sources":["../../src/effects/immersive-mode.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;AAIvE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAErF;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAExF"}
1
+ {"version":3,"file":"immersive-mode.d.ts","sourceRoot":"","sources":["../../src/effects/immersive-mode.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAC;AAIvE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7D;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAErF;AAED;;;;GAIG;AACH,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAExF"}
@@ -1,5 +1,5 @@
1
1
  import { WebViewImmersiveMode } from '@devvit/protos/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js';
2
- import { emitEffect } from './emit-effect.js';
2
+ import { emitEffect } from '@devvit/shared-types/client/emit-effect.js';
3
3
  const immersiveListeners = new Set();
4
4
  /**
5
5
  * Requests immersive mode for the web view.
@@ -1 +1 @@
1
- {"version":3,"file":"navigate-to.d.ts","sourceRoot":"","sources":["../../src/effects/navigate-to.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAIrE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;AAC9C,wBAAgB,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AACjE,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACvD,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAC7D,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"navigate-to.d.ts","sourceRoot":"","sources":["../../src/effects/navigate-to.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGrE;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;AAC9C,wBAAgB,UAAU,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AACjE,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACvD,wBAAgB,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAC7D,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
- import { emitEffect } from './emit-effect.js';
1
+ import { emitEffect } from '@devvit/shared-types/client/emit-effect.js';
2
2
  export function navigateTo(thingOrUrl) {
3
3
  let url;
4
4
  if (typeof thingOrUrl === 'string') {
@@ -1,4 +1,4 @@
1
- import { emitEffect } from './emit-effect.js';
1
+ import { emitEffect } from '@devvit/shared-types/client/emit-effect.js';
2
2
  import { assertValidFormFields } from './helpers/assert-valid-form-fields.js';
3
3
  import { getFormValues } from './helpers/get-form-values.js';
4
4
  import { transformFormFields } from './helpers/transform-form.js';
@@ -1 +1 @@
1
- {"version":3,"file":"show-toast.d.ts","sourceRoot":"","sources":["../../src/effects/show-toast.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAI5C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;AAC9C,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC"}
1
+ {"version":3,"file":"show-toast.d.ts","sourceRoot":"","sources":["../../src/effects/show-toast.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;AAC9C,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
- import { emitEffect } from './emit-effect.js';
1
+ import { emitEffect } from '@devvit/shared-types/client/emit-effect.js';
2
2
  export function showToast(textOrToast) {
3
3
  let toast;
4
4
  if (textOrToast instanceof Object) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/client",
3
- "version": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
3
+ "version": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "types": "./index.d.ts",
27
27
  "dependencies": {
28
- "@devvit/protos": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
29
- "@devvit/reddit": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
30
- "@devvit/shared": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
31
- "@devvit/shared-types": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
32
- "@devvit/web-view-scripts": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0"
28
+ "@devvit/protos": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
29
+ "@devvit/reddit": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
30
+ "@devvit/shared": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
31
+ "@devvit/shared-types": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
32
+ "@devvit/web-view-scripts": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@ampproject/filesize": "4.3.0",
36
- "@devvit/repo-tools": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
37
- "@devvit/tsconfig": "0.11.20-next-2025-07-25-17-24-54-9a691dab8.0",
36
+ "@devvit/repo-tools": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
37
+ "@devvit/tsconfig": "0.11.20-next-2025-07-28-13-12-45-ae6d04190.0",
38
38
  "esbuild": "0.23.0",
39
39
  "eslint": "9.11.1",
40
40
  "typescript": "5.8.3",
@@ -50,5 +50,5 @@
50
50
  }
51
51
  },
52
52
  "source": "./src/index.ts",
53
- "gitHead": "fb15c146a01dfc979e3d8e41bfd914a58b6427a6"
53
+ "gitHead": "52100e7a870c1d6fd90ae04c842ae4b107e0b31d"
54
54
  }
@@ -1,3 +0,0 @@
1
- import type { EffectType } from '@devvit/protos/types/devvit/ui/effects/v1alpha/effect.js';
2
- export declare const EFFECTS_WITH_RESPONSE: readonly EffectType[];
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/effects/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0DAA0D,CAAC;AAE3F,eAAO,MAAM,qBAAqB,EAAE,SAAS,UAAU,EAEtD,CAAC"}
@@ -1,3 +0,0 @@
1
- export const EFFECTS_WITH_RESPONSE = [
2
- 3,
3
- ];
@@ -1,22 +0,0 @@
1
- import type { Effect as SharedEffects } from '@devvit/protos';
2
- import { WebViewImmersiveModeEffect } from '@devvit/protos/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js';
3
- import { WebViewInternalEventMessage } from '@devvit/protos/types/devvit/ui/events/v1alpha/web_view.js';
4
- type Effect = Omit<SharedEffects, 'interval'> & {
5
- immersiveMode?: WebViewImmersiveModeEffect | undefined;
6
- };
7
- /**
8
- * Emits an effect to the parent window and handles the response if required.
9
- *
10
- * @param effect - The effect to be emitted to the parent window
11
- * @returns A promise that resolves with the response message for effects that require
12
- * a response, or resolves immediately with undefined for effects that don't
13
- *
14
- * @description
15
- * This function handles two types of effects:
16
- * 1. Effects that require a response: Creates a unique ID, sets up a message listener,
17
- * and resolves the promise when a matching response is received
18
- * 2. Effects that don't require a response: Posts the message and resolves immediately
19
- */
20
- export declare const emitEffect: (effect: Effect) => Promise<WebViewInternalEventMessage | undefined>;
21
- export {};
22
- //# sourceMappingURL=emit-effect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit-effect.d.ts","sourceRoot":"","sources":["../../src/effects/emit-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2EAA2E,CAAC;AAKvH,OAAO,EAAE,2BAA2B,EAAE,MAAM,2DAA2D,CAAC;AAIxG,KAAK,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG;IAC9C,aAAa,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,KAAG,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAkC1F,CAAC"}
@@ -1,50 +0,0 @@
1
- import { WebViewImmersiveModeEffect } from '@devvit/protos/types/devvit/ui/effects/web_view/v1alpha/immersive_mode.js';
2
- import { WebViewInternalEventMessage } from '@devvit/protos/types/devvit/ui/events/v1alpha/web_view.js';
3
- import { EFFECTS_WITH_RESPONSE } from './constants.js';
4
- /**
5
- * Emits an effect to the parent window and handles the response if required.
6
- *
7
- * @param effect - The effect to be emitted to the parent window
8
- * @returns A promise that resolves with the response message for effects that require
9
- * a response, or resolves immediately with undefined for effects that don't
10
- *
11
- * @description
12
- * This function handles two types of effects:
13
- * 1. Effects that require a response: Creates a unique ID, sets up a message listener,
14
- * and resolves the promise when a matching response is received
15
- * 2. Effects that don't require a response: Posts the message and resolves immediately
16
- */
17
- export const emitEffect = (effect) => {
18
- return new Promise((resolve) => {
19
- const message = {
20
- scope: 0,
21
- type: 'devvit-internal',
22
- };
23
- if (effect.realtimeSubscriptions) {
24
- message.realtimeEffect = effect.realtimeSubscriptions;
25
- }
26
- else {
27
- message.effect = effect;
28
- }
29
- // Only set message id and add a listener for effects which require a response
30
- if (EFFECTS_WITH_RESPONSE.includes(effect.type)) {
31
- const id = self.crypto.randomUUID();
32
- message.id = id;
33
- const handleEffect = (event) => {
34
- if (event.data?.type === 'devvit-message' && event.data?.data?.id === id) {
35
- const serializedMessage = WebViewInternalEventMessage.fromJSON(event.data.data);
36
- resolve(serializedMessage);
37
- window.removeEventListener('message', handleEffect);
38
- }
39
- };
40
- window.addEventListener('message', handleEffect);
41
- // Post message to the parent window, handled by client web view component
42
- window.parent.postMessage(message, '*');
43
- }
44
- else {
45
- window.parent.postMessage(message, '*');
46
- // Resolve immediately for effects that don't expect a response.
47
- resolve(undefined);
48
- }
49
- });
50
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"emit-effect.test.d.ts","sourceRoot":"","sources":["../../src/effects/emit-effect.test.ts"],"names":[],"mappings":""}