@devvit/public-api 0.11.15-next-2025-05-07-f6b0b32e2.0 → 0.11.15-next-2025-05-07-302a29e16.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.
- package/devvit/internals/blocks/handler/useWebView.d.ts.map +1 -1
- package/devvit/internals/blocks/handler/useWebView.js +15 -3
- package/meta.json +3 -3
- package/meta.min.json +4 -4
- package/package.json +7 -7
- package/public-api.iife.js +14 -3
- package/public-api.min.js +6 -6
- package/public-api.min.js.map +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebView.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useWebView.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAEV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"useWebView.d.ts","sourceRoot":"","sources":["../../../../../src/devvit/internals/blocks/handler/useWebView.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,KAAK,EAEV,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAmI9B;;KAEK;AACL,wBAAgB,UAAU,CAAC,IAAI,SAAS,SAAS,GAAG,SAAS,EAAE,EAAE,SAAS,SAAS,GAAG,SAAS,EAC7F,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,GACnC,gBAAgB,CAAC,EAAE,CAAC,CAUtB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _WebViewHook_hookId, _WebViewHook_url, _WebViewHook_onMessage, _WebViewHook_onUnmount, _WebViewHook_renderContext, _WebViewHook_emitFullscreenEffect;
|
|
12
|
+
var _WebViewHook_hookId, _WebViewHook_url, _WebViewHook_onMessage, _WebViewHook_onUnmount, _WebViewHook_renderContext, _WebViewHook_invalidate, _WebViewHook_emitFullscreenEffect;
|
|
13
13
|
import { EffectType } from '@devvit/protos';
|
|
14
14
|
import { WebViewVisibility } from '@devvit/protos';
|
|
15
15
|
import { StringUtil } from '@devvit/shared-types/StringUtil.js';
|
|
@@ -17,7 +17,7 @@ import { webViewMessageIsInternalAndClientScope } from '../../helpers/devvitInte
|
|
|
17
17
|
import { registerHook } from './BlocksHandler.js';
|
|
18
18
|
class WebViewHook {
|
|
19
19
|
constructor(params, options) {
|
|
20
|
-
this.state = { messageCount: 0 };
|
|
20
|
+
this.state = { messageCount: 0, isMounted: false };
|
|
21
21
|
_WebViewHook_hookId.set(this, void 0);
|
|
22
22
|
// This url is the path to the asset that will be loaded in the web view.
|
|
23
23
|
// It is ensured to be a valid path prior to the effect being emitted.
|
|
@@ -25,6 +25,7 @@ class WebViewHook {
|
|
|
25
25
|
_WebViewHook_onMessage.set(this, void 0);
|
|
26
26
|
_WebViewHook_onUnmount.set(this, void 0);
|
|
27
27
|
_WebViewHook_renderContext.set(this, void 0);
|
|
28
|
+
_WebViewHook_invalidate.set(this, void 0);
|
|
28
29
|
/**
|
|
29
30
|
* Send a message from a Devvit app to a web view (fullscreen).
|
|
30
31
|
*/
|
|
@@ -56,6 +57,11 @@ class WebViewHook {
|
|
|
56
57
|
* Triggers the fullscreen effect to show the web view in fullscreen mode.
|
|
57
58
|
*/
|
|
58
59
|
this.mount = () => {
|
|
60
|
+
// If already mounted, do nothing
|
|
61
|
+
if (this.state.isMounted) {
|
|
62
|
+
console.warn('Webview is already mounted!');
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
59
65
|
const assets = __classPrivateFieldGet(this, _WebViewHook_renderContext, "f")?.devvitContext?.assets;
|
|
60
66
|
// Get the public URL for the asset. Returns an empty string if the asset is not found.
|
|
61
67
|
const url = assets.getURL(__classPrivateFieldGet(this, _WebViewHook_url, "f"), { webView: true });
|
|
@@ -88,6 +94,10 @@ class WebViewHook {
|
|
|
88
94
|
__classPrivateFieldSet(this, _WebViewHook_onMessage, options.onMessage, "f");
|
|
89
95
|
__classPrivateFieldSet(this, _WebViewHook_onUnmount, options.onUnmount, "f");
|
|
90
96
|
__classPrivateFieldSet(this, _WebViewHook_renderContext, params.context, "f");
|
|
97
|
+
__classPrivateFieldSet(this, _WebViewHook_invalidate, params.invalidate, "f");
|
|
98
|
+
}
|
|
99
|
+
onStateLoaded() {
|
|
100
|
+
// No need to remount here since the UI events will handle the state
|
|
91
101
|
}
|
|
92
102
|
/**
|
|
93
103
|
* Handles UI events originating from the web view and calls associated callbacks for the Devvit app to handle.
|
|
@@ -95,6 +105,8 @@ class WebViewHook {
|
|
|
95
105
|
async onUIEvent(event) {
|
|
96
106
|
if (event.webView?.fullScreen) {
|
|
97
107
|
const isVisible = event.webView.fullScreen.visibility === WebViewVisibility.WEBVIEW_VISIBLE;
|
|
108
|
+
this.state.isMounted = isVisible;
|
|
109
|
+
__classPrivateFieldGet(this, _WebViewHook_invalidate, "f").call(this); // Ensure the state change is persisted
|
|
98
110
|
if (!isVisible && __classPrivateFieldGet(this, _WebViewHook_onUnmount, "f"))
|
|
99
111
|
await __classPrivateFieldGet(this, _WebViewHook_onUnmount, "f").call(this, this);
|
|
100
112
|
}
|
|
@@ -111,7 +123,7 @@ class WebViewHook {
|
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
125
|
}
|
|
114
|
-
_WebViewHook_hookId = new WeakMap(), _WebViewHook_url = new WeakMap(), _WebViewHook_onMessage = new WeakMap(), _WebViewHook_onUnmount = new WeakMap(), _WebViewHook_renderContext = new WeakMap(), _WebViewHook_emitFullscreenEffect = new WeakMap();
|
|
126
|
+
_WebViewHook_hookId = new WeakMap(), _WebViewHook_url = new WeakMap(), _WebViewHook_onMessage = new WeakMap(), _WebViewHook_onUnmount = new WeakMap(), _WebViewHook_renderContext = new WeakMap(), _WebViewHook_invalidate = new WeakMap(), _WebViewHook_emitFullscreenEffect = new WeakMap();
|
|
115
127
|
/**
|
|
116
128
|
* Use this hook to handle a web view's visibility state and any messages sent to your app.
|
|
117
129
|
* */
|
package/meta.json
CHANGED
|
@@ -9610,7 +9610,7 @@
|
|
|
9610
9610
|
"format": "esm"
|
|
9611
9611
|
},
|
|
9612
9612
|
"src/devvit/internals/blocks/handler/useWebView.ts": {
|
|
9613
|
-
"bytes":
|
|
9613
|
+
"bytes": 5566,
|
|
9614
9614
|
"imports": [
|
|
9615
9615
|
{
|
|
9616
9616
|
"path": "../protos/dist/index.js",
|
|
@@ -10389,10 +10389,10 @@
|
|
|
10389
10389
|
"bytesInOutput": 251
|
|
10390
10390
|
},
|
|
10391
10391
|
"src/devvit/internals/blocks/handler/useWebView.ts": {
|
|
10392
|
-
"bytesInOutput":
|
|
10392
|
+
"bytesInOutput": 4418
|
|
10393
10393
|
}
|
|
10394
10394
|
},
|
|
10395
|
-
"bytes":
|
|
10395
|
+
"bytes": 12547715
|
|
10396
10396
|
}
|
|
10397
10397
|
}
|
|
10398
10398
|
}
|
package/meta.min.json
CHANGED
|
@@ -2419,7 +2419,7 @@
|
|
|
2419
2419
|
"format": "esm"
|
|
2420
2420
|
},
|
|
2421
2421
|
"src/devvit/internals/blocks/handler/useWebView.ts": {
|
|
2422
|
-
"bytes":
|
|
2422
|
+
"bytes": 5566,
|
|
2423
2423
|
"imports": [
|
|
2424
2424
|
{
|
|
2425
2425
|
"path": "@devvit/protos",
|
|
@@ -2536,7 +2536,7 @@
|
|
|
2536
2536
|
"imports": [],
|
|
2537
2537
|
"exports": [],
|
|
2538
2538
|
"inputs": {},
|
|
2539
|
-
"bytes":
|
|
2539
|
+
"bytes": 1074374
|
|
2540
2540
|
},
|
|
2541
2541
|
"dist/public-api.min.js": {
|
|
2542
2542
|
"imports": [
|
|
@@ -3083,13 +3083,13 @@
|
|
|
3083
3083
|
"bytesInOutput": 178
|
|
3084
3084
|
},
|
|
3085
3085
|
"src/devvit/internals/blocks/handler/useWebView.ts": {
|
|
3086
|
-
"bytesInOutput":
|
|
3086
|
+
"bytesInOutput": 1871
|
|
3087
3087
|
},
|
|
3088
3088
|
"src/devvit/internals/helpers/devvitInternalMessage.ts": {
|
|
3089
3089
|
"bytesInOutput": 107
|
|
3090
3090
|
}
|
|
3091
3091
|
},
|
|
3092
|
-
"bytes":
|
|
3092
|
+
"bytes": 221487
|
|
3093
3093
|
}
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/public-api",
|
|
3
|
-
"version": "0.11.15-next-2025-05-07-
|
|
3
|
+
"version": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,17 +30,17 @@
|
|
|
30
30
|
},
|
|
31
31
|
"types": "./index.d.ts",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@devvit/metrics": "0.11.15-next-2025-05-07-
|
|
34
|
-
"@devvit/protos": "0.11.15-next-2025-05-07-
|
|
35
|
-
"@devvit/shared-types": "0.11.15-next-2025-05-07-
|
|
33
|
+
"@devvit/metrics": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
34
|
+
"@devvit/protos": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
35
|
+
"@devvit/shared-types": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
36
36
|
"base64-js": "1.5.1",
|
|
37
37
|
"clone-deep": "4.0.1",
|
|
38
38
|
"moderndash": "4.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@ampproject/filesize": "4.3.0",
|
|
42
|
-
"@devvit/repo-tools": "0.11.15-next-2025-05-07-
|
|
43
|
-
"@devvit/tsconfig": "0.11.15-next-2025-05-07-
|
|
42
|
+
"@devvit/repo-tools": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
43
|
+
"@devvit/tsconfig": "0.11.15-next-2025-05-07-302a29e16.0",
|
|
44
44
|
"@microsoft/api-extractor": "7.41.0",
|
|
45
45
|
"@reddit/faceplate-ui": "18.0.1",
|
|
46
46
|
"@types/clone-deep": "4.0.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
"source": "./src/index.ts",
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "b4f3b530cf96101380d1c8f90c7015e958b1a34f"
|
|
65
65
|
}
|