react-native-revnix 1.5.0 → 1.6.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.
@@ -34,11 +34,12 @@ import type {
34
34
  PaywallConfig,
35
35
  PaywallInteraction,
36
36
  PaywallPurchaseOutcome,
37
+ PlacementResolution,
37
38
  RegisterPurchaseResult,
38
39
  } from "../types.js";
39
40
  import { PREVIEW_PLACEMENT_KEY } from "../implicit.js";
40
41
  import { getStoreAdapter } from "../store.js";
41
- import type { RevnixClient } from "../client.js";
42
+ import { paywallImageUrls, type RevnixClient } from "../client.js";
42
43
  import type { PaywallBlockDoc } from "../blocks/types.js";
43
44
  import type { FontFamilyMap } from "../blocks/style.js";
44
45
  import { withAlpha } from "../blocks/color.js";
@@ -255,6 +256,19 @@ export interface RevnixPaywallProps {
255
256
  locale?: string;
256
257
  }
257
258
 
259
+ /** Warms React Native's image cache with every image `resolution`'s paywall
260
+ * loads, so it paints without waiting on the network. Pair it with
261
+ * `client.preload` / `resolvePlacement`. Never throws. */
262
+ export async function prefetchPaywallImages(
263
+ resolution: PlacementResolution | null
264
+ ): Promise<void> {
265
+ await Promise.all(
266
+ paywallImageUrls(resolution?.paywall).map((url) =>
267
+ Image.prefetch(url).catch(() => false)
268
+ )
269
+ );
270
+ }
271
+
258
272
  export function RevnixPaywall(props: RevnixPaywallProps) {
259
273
  // One view per mount: remounting (a re-shown paywall) is a genuine new
260
274
  // display; re-renders are not.
package/src/ui/index.ts CHANGED
@@ -2,6 +2,7 @@ export {
2
2
  RevnixPaywall,
3
3
  DEFAULT_PAYWALL_THEME,
4
4
  LIGHT_PAYWALL_THEME,
5
+ prefetchPaywallImages,
5
6
  type RevnixPaywallPackage,
6
7
  type RevnixPaywallProps,
7
8
  type RevnixPaywallTheme,
package/src/version.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  // L3: the single source of the SDK version inside src/. Must match
2
2
  // package.json "version" — version.test.ts fails the build when they drift
3
3
  // (they had: client.ts said 0.7.0 while the package shipped 0.9.0).
4
- export const SDK_VERSION = "1.5.0";
4
+ export const SDK_VERSION = "1.6.0";