@devvit/ui-renderer 0.11.0-next-2024-07-16-a1919dfa5.0 → 0.11.0-next-2024-07-16-33a38972d.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,8 +9,26 @@ import type { DevvitSubredditMetadata, LinkedBundle } from '@devvit/protos';
9
9
  * RenderPostContent(UIRequest), false if only
10
10
  * RenderPost(RenderPostRequest) is supported, undefined if unknown
11
11
  * (caller should choose a safe default).
12
+ *
13
+ * @deprecated Use shouldUseUIRequest
12
14
  */
13
15
  export declare function apiVersionSupportsUIRequest(dx: Readonly<{
14
16
  hostname: string;
15
17
  } & Partial<LinkedBundle>> | undefined, meta: Readonly<DevvitSubredditMetadata> | undefined): boolean | undefined;
18
+ /**
19
+ * @arg dx The static "DX_Bundle" LinkedBundle embedded in the post body. Even
20
+ * skinnier than a skinny LinkedBundle, only defining hostname and
21
+ * provides. See LinksAndCommentsSubmitCustomPost(). This should always
22
+ * be available but element properties can be undefined.
23
+ * @arg meta The current subreddit manifest.
24
+ * @return true if an app's @devvit/public-api version is > than 0.11.0 (forcing UI request to be on)
25
+ * RenderPostContent(UIRequest), false if only
26
+ * RenderPost(RenderPostRequest) is supported, undefined if unknown
27
+ * (caller should choose a safe default).
28
+ *
29
+ * @deprecated Use shouldUseUIRequest
30
+ */
31
+ export declare function shouldUseUIRequest(dx: Readonly<{
32
+ hostname: string;
33
+ } & Partial<LinkedBundle>> | undefined, meta: Readonly<DevvitSubredditMetadata> | undefined): boolean | undefined;
16
34
  //# sourceMappingURL=api-version-util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-version-util.d.ts","sourceRoot":"","sources":["../../library/src/client/api-version-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK5E;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,QAAQ,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,EACtE,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,SAAS,GAClD,OAAO,GAAG,SAAS,CAOrB"}
1
+ {"version":3,"file":"api-version-util.d.ts","sourceRoot":"","sources":["../../library/src/client/api-version-util.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAK5E;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,QAAQ,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,EACtE,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,SAAS,GAClD,OAAO,GAAG,SAAS,CAOrB;AAID;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,QAAQ,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG,SAAS,EACtE,IAAI,EAAE,QAAQ,CAAC,uBAAuB,CAAC,GAAG,SAAS,GAClD,OAAO,GAAG,SAAS,CAOrB"}
@@ -11,6 +11,8 @@ import { compareVersions } from 'compare-versions';
11
11
  * RenderPostContent(UIRequest), false if only
12
12
  * RenderPost(RenderPostRequest) is supported, undefined if unknown
13
13
  * (caller should choose a safe default).
14
+ *
15
+ * @deprecated Use shouldUseUIRequest
14
16
  */
15
17
  export function apiVersionSupportsUIRequest(dx, meta) {
16
18
  if (!dx || !meta)
@@ -23,3 +25,29 @@ export function apiVersionSupportsUIRequest(dx, meta) {
23
25
  return;
24
26
  return compareVersions(version, '0.10.19') >= 0;
25
27
  }
28
+ // to-do: delete when RenderPost is not used. Don't forget to delete
29
+ // compare-versions too.
30
+ /**
31
+ * @arg dx The static "DX_Bundle" LinkedBundle embedded in the post body. Even
32
+ * skinnier than a skinny LinkedBundle, only defining hostname and
33
+ * provides. See LinksAndCommentsSubmitCustomPost(). This should always
34
+ * be available but element properties can be undefined.
35
+ * @arg meta The current subreddit manifest.
36
+ * @return true if an app's @devvit/public-api version is > than 0.11.0 (forcing UI request to be on)
37
+ * RenderPostContent(UIRequest), false if only
38
+ * RenderPost(RenderPostRequest) is supported, undefined if unknown
39
+ * (caller should choose a safe default).
40
+ *
41
+ * @deprecated Use shouldUseUIRequest
42
+ */
43
+ export function shouldUseUIRequest(dx, meta) {
44
+ if (!dx || !meta)
45
+ return;
46
+ const skinny = meta.installedRemoteApps.find((skinny) => skinny.hostname === dx.hostname);
47
+ if (!skinny)
48
+ return;
49
+ const version = skinny.buildInfo?.dependencies['@devvit/public-api'];
50
+ if (!version)
51
+ return;
52
+ return compareVersions(version, '0.10.1000') > 0;
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devvit/ui-renderer",
3
- "version": "0.11.0-next-2024-07-16-a1919dfa5.0",
3
+ "version": "0.11.0-next-2024-07-16-33a38972d.0",
4
4
  "license": "BSD-3-Clause",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,9 +59,9 @@
59
59
  "types": "./index.d.ts",
60
60
  "dependencies": {
61
61
  "@devvit/multiplatform": "0.0.1-20240529-491771c9",
62
- "@devvit/protos": "0.11.0-next-2024-07-16-a1919dfa5.0",
63
- "@devvit/runtime-lite": "0.11.0-next-2024-07-16-a1919dfa5.0",
64
- "@devvit/shared-types": "0.11.0-next-2024-07-16-a1919dfa5.0",
62
+ "@devvit/protos": "0.11.0-next-2024-07-16-33a38972d.0",
63
+ "@devvit/runtime-lite": "0.11.0-next-2024-07-16-33a38972d.0",
64
+ "@devvit/shared-types": "0.11.0-next-2024-07-16-33a38972d.0",
65
65
  "@dotlottie/player-component": "2.7.2",
66
66
  "compare-versions": "6.1.0",
67
67
  "nice-grpc-web": "3.3.3",
@@ -89,10 +89,10 @@
89
89
  },
90
90
  "devDependencies": {
91
91
  "@ampproject/filesize": "4.3.0",
92
- "@devvit/eslint-config": "0.11.0-next-2024-07-16-a1919dfa5.0",
93
- "@devvit/public-api": "0.11.0-next-2024-07-16-a1919dfa5.0",
94
- "@devvit/repo-tools": "0.11.0-next-2024-07-16-a1919dfa5.0",
95
- "@devvit/tsconfig": "0.11.0-next-2024-07-16-a1919dfa5.0",
92
+ "@devvit/eslint-config": "0.11.0-next-2024-07-16-33a38972d.0",
93
+ "@devvit/public-api": "0.11.0-next-2024-07-16-33a38972d.0",
94
+ "@devvit/repo-tools": "0.11.0-next-2024-07-16-33a38972d.0",
95
+ "@devvit/tsconfig": "0.11.0-next-2024-07-16-33a38972d.0",
96
96
  "@lit-labs/ssr": "^2.2.3",
97
97
  "@lit/localize": "0.11.4",
98
98
  "@open-wc/testing-helpers": "2.3.0",
@@ -139,5 +139,5 @@
139
139
  }
140
140
  },
141
141
  "source": "./src/index.ts",
142
- "gitHead": "8caaa0427f9608f1a332341c568af93ca435f4a4"
142
+ "gitHead": "248f7725ddb3f5e02e902258262a537df7f6e437"
143
143
  }