@devvit/shared-types 0.12.1-next-2025-10-06-17-06-35-e747342f2.0 → 0.12.1-next-2025-10-07-15-33-36-9968992e8.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,5 +1,6 @@
|
|
|
1
1
|
import type { AppPermissionState } from '@devvit/protos/json/devvit/ui/effects/web_view/v1alpha/context.js';
|
|
2
2
|
import type { WebViewImmersiveMode } from '@devvit/protos/json/devvit/ui/effects/web_view/v1alpha/immersive_mode.js';
|
|
3
|
+
import type { WebbitToken } from '../webbit.js';
|
|
3
4
|
import type { Context } from './client-context.js';
|
|
4
5
|
/** `globalThis.devvit` in web views. */
|
|
5
6
|
export type DevvitGlobal = {
|
|
@@ -10,6 +11,8 @@ export type DevvitGlobal = {
|
|
|
10
11
|
};
|
|
11
12
|
share: Share | undefined;
|
|
12
13
|
appPermissionState: AppPermissionState | undefined;
|
|
14
|
+
/** @deprecated use `token`. */
|
|
15
|
+
webbitToken: WebbitToken;
|
|
13
16
|
webViewMode: WebViewImmersiveMode | undefined;
|
|
14
17
|
};
|
|
15
18
|
/** App deep link data. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devvit-global.d.ts","sourceRoot":"","sources":["../../src/client/devvit-global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0EAA0E,CAAC;AAErH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAExC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAEzB,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAEnD,WAAW,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC/C,CAAC;AAEF,0BAA0B;AAC1B,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"devvit-global.d.ts","sourceRoot":"","sources":["../../src/client/devvit-global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mEAAmE,CAAC;AAC5G,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0EAA0E,CAAC;AAErH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,oEAAoE;IACpE,WAAW,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAExC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAEzB,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAEnD,+BAA+B;IAC/B,WAAW,EAAE,WAAW,CAAC;IAEzB,WAAW,EAAE,oBAAoB,GAAG,SAAS,CAAC;CAC/C,CAAC;AAEF,0BAA0B;AAC1B,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
package/client/emit-effect.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Effect as SharedEffects } from '@devvit/protos/json/devvit/ui/effects/v1alpha/effect.js';
|
|
2
2
|
import type { WebViewImmersiveModeEffect } from '@devvit/protos/json/devvit/ui/effects/web_view/v1alpha/immersive_mode.js';
|
|
3
3
|
import type { WebViewShareEffect } from '@devvit/protos/json/devvit/ui/effects/web_view/v1alpha/share.js';
|
|
4
4
|
import { WebViewInternalEventMessage } from '@devvit/protos/types/devvit/ui/events/v1alpha/web_view.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emit-effect.d.ts","sourceRoot":"","sources":["../../src/client/emit-effect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"emit-effect.d.ts","sourceRoot":"","sources":["../../src/client/emit-effect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,IAAI,aAAa,EAE7B,MAAM,yDAAyD,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AAK3H,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iEAAiE,CAAC;AAC1G,OAAO,EACL,2BAA2B,EAE5B,MAAM,2DAA2D,CAAC;AAEnE,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,GAAG;IACrD,aAAa,CAAC,EAAE,0BAA0B,GAAG,SAAS,CAAC;IACvD,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAOF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,QAAQ,CAAC,MAAM,CAAC,KACvB,OAAO,CAAC,2BAA2B,GAAG,SAAS,CAsDjD,CAAC"}
|
package/client/emit-effect.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { EffectType, } from '@devvit/protos/json/devvit/ui/effects/v1alpha/effect.js';
|
|
2
|
+
import { WebViewInternalMessageScope, } from '@devvit/protos/json/devvit/ui/effects/web_view/v1alpha/post_message.js';
|
|
1
3
|
import { WebViewInternalEventMessage, WebViewMessageEvent_MessageData, } from '@devvit/protos/types/devvit/ui/events/v1alpha/web_view.js'; // to-do: use /json/ not /types/.
|
|
2
4
|
const EFFECTS_WITH_RESPONSE = [
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
EffectType.EFFECT_SHOW_FORM,
|
|
6
|
+
EffectType.EFFECT_CAN_RUN_AS_USER,
|
|
5
7
|
];
|
|
6
8
|
/**
|
|
7
9
|
* Emits an effect to the parent window and handles the response if required.
|
|
@@ -19,7 +21,7 @@ const EFFECTS_WITH_RESPONSE = [
|
|
|
19
21
|
export const emitEffect = (effect) => {
|
|
20
22
|
return new Promise((resolve) => {
|
|
21
23
|
const message = {
|
|
22
|
-
scope:
|
|
24
|
+
scope: WebViewInternalMessageScope.CLIENT,
|
|
23
25
|
type: 'devvit-internal',
|
|
24
26
|
};
|
|
25
27
|
if (effect.realtimeSubscriptions) {
|
|
@@ -31,16 +33,24 @@ export const emitEffect = (effect) => {
|
|
|
31
33
|
else if (effect.share) {
|
|
32
34
|
message.share = effect.share;
|
|
33
35
|
}
|
|
34
|
-
else {
|
|
35
|
-
message.effect = effect;
|
|
36
|
-
}
|
|
37
|
-
// For temporary backward compatibility, we set both `message.effect` above, its types counterpart, below
|
|
38
|
-
if (effect.showToast) {
|
|
36
|
+
else if (effect.showToast) {
|
|
39
37
|
message.showToast = effect.showToast;
|
|
40
38
|
}
|
|
41
39
|
else if (effect.navigateToUrl) {
|
|
42
40
|
message.navigateToUrl = effect.navigateToUrl;
|
|
43
41
|
}
|
|
42
|
+
else if (effect.showForm) {
|
|
43
|
+
message.showForm = effect.showForm;
|
|
44
|
+
}
|
|
45
|
+
// For temporary backward compatibility, we set both `message.effect_type` above, its types counterpart, below
|
|
46
|
+
// Once mobile clients are updated to consume the strongly typed properties above, and apps, we can remove this block
|
|
47
|
+
// *Do not* add new effects here, use the strongly typed properties above
|
|
48
|
+
if (effect.showToast ||
|
|
49
|
+
effect.navigateToUrl ||
|
|
50
|
+
effect.showForm ||
|
|
51
|
+
effect.type === EffectType.EFFECT_CAN_RUN_AS_USER) {
|
|
52
|
+
message.effect = effect;
|
|
53
|
+
}
|
|
44
54
|
// Only set message id and add a listener for effects which require a response
|
|
45
55
|
if (EFFECTS_WITH_RESPONSE.includes(effect.type)) {
|
|
46
56
|
const id = self.crypto.randomUUID();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/shared-types",
|
|
3
|
-
"version": "0.12.1-next-2025-10-
|
|
3
|
+
"version": "0.12.1-next-2025-10-07-15-33-36-9968992e8.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,13 +33,13 @@
|
|
|
33
33
|
},
|
|
34
34
|
"types": "./dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@devvit/protos": "0.12.1-next-2025-10-
|
|
36
|
+
"@devvit/protos": "0.12.1-next-2025-10-07-15-33-36-9968992e8.0",
|
|
37
37
|
"jsonschema": "1.4.1",
|
|
38
38
|
"uuid": "9.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@devvit/repo-tools": "0.12.1-next-2025-10-
|
|
42
|
-
"@devvit/tsconfig": "0.12.1-next-2025-10-
|
|
41
|
+
"@devvit/repo-tools": "0.12.1-next-2025-10-07-15-33-36-9968992e8.0",
|
|
42
|
+
"@devvit/tsconfig": "0.12.1-next-2025-10-07-15-33-36-9968992e8.0",
|
|
43
43
|
"@types/redis-mock": "0.17.1",
|
|
44
44
|
"@types/uuid": "9.0.0",
|
|
45
45
|
"chokidar-cli": "3.0.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"vitest": "1.6.1"
|
|
52
52
|
},
|
|
53
53
|
"source": "./src/index.ts",
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ca81733a2f5dbf790ac0e50c6d3a04c61c2de05c"
|
|
55
55
|
}
|
package/webbit.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
1
|
+
/**
|
|
2
|
+
* Signed Webbit user JWT (header, payload, signature base64 strings separated
|
|
3
|
+
* by dots). Users shouldn't share their JWTs with others, but perfectly fine
|
|
4
|
+
* for a given user to see. Named WebbitToken to match GQL's definition.
|
|
5
|
+
*
|
|
6
|
+
* See `BridgeContext.webbitToken`.
|
|
7
|
+
*/
|
|
5
8
|
export type WebbitToken = `${string}.${string}.${string}`;
|
|
6
9
|
export declare const noWebbitToken: WebbitToken;
|
|
7
10
|
//# sourceMappingURL=webbit.d.ts.map
|
package/webbit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webbit.d.ts","sourceRoot":"","sources":["../src/webbit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"webbit.d.ts","sourceRoot":"","sources":["../src/webbit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAC1D,eAAO,MAAM,aAAa,EAAE,WAAqB,CAAC"}
|