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.
- package/dist/client.d.ts +46 -11
- package/dist/client.js +335 -114
- package/dist/esm/client.js +334 -114
- package/dist/esm/ui/RevnixPaywall.js +7 -0
- package/dist/esm/ui/index.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/ui/RevnixPaywall.d.ts +6 -2
- package/dist/ui/RevnixPaywall.js +8 -0
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +2 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/client.ts +388 -146
- package/src/ui/RevnixPaywall.tsx +15 -1
- package/src/ui/index.ts +1 -0
- package/src/version.ts +1 -1
package/src/ui/RevnixPaywall.tsx
CHANGED
|
@@ -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
|
|
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
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.
|
|
4
|
+
export const SDK_VERSION = "1.6.0";
|