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.
@@ -1,4 +1,4 @@
1
- export { RevnixPaywall, DEFAULT_PAYWALL_THEME, LIGHT_PAYWALL_THEME, } from "./RevnixPaywall.js";
1
+ export { RevnixPaywall, DEFAULT_PAYWALL_THEME, LIGHT_PAYWALL_THEME, prefetchPaywallImages, } from "./RevnixPaywall.js";
2
2
  export { RevnixBlockPaywall, } from "./RevnixBlockPaywall.js";
3
3
  export { DESIGN_CANVAS, } from "../blocks/types.js";
4
4
  export { backgroundBaseColor, backgroundLayers, coverPlacement, } from "../blocks/background.js";
@@ -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";
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { type StyleProp, type ViewStyle } from "react-native";
3
- import type { PaywallConfig, PaywallInteraction, PaywallPurchaseOutcome, RegisterPurchaseResult } from "../types.js";
4
- import type { RevnixClient } from "../client.js";
3
+ import type { PaywallConfig, PaywallInteraction, PaywallPurchaseOutcome, PlacementResolution, RegisterPurchaseResult } from "../types.js";
4
+ import { type RevnixClient } from "../client.js";
5
5
  import type { FontFamilyMap } from "../blocks/style.js";
6
6
  import { type RevnixBlurComponent, type RevnixGradientComponent } from "./RevnixBlockPaywall.js";
7
7
  /** One purchasable row. `priceLabel` must come from the store (localized). */
@@ -155,4 +155,8 @@ export interface RevnixPaywallProps {
155
155
  * layouts below render `config`'s own copy whatever this says. */
156
156
  locale?: string;
157
157
  }
158
+ /** Warms React Native's image cache with every image `resolution`'s paywall
159
+ * loads, so it paints without waiting on the network. Pair it with
160
+ * `client.preload` / `resolvePlacement`. Never throws. */
161
+ export declare function prefetchPaywallImages(resolution: PlacementResolution | null): Promise<void>;
158
162
  export declare function RevnixPaywall(props: RevnixPaywallProps): React.JSX.Element;
@@ -50,11 +50,13 @@ var __importStar = (this && this.__importStar) || (function () {
50
50
  })();
51
51
  Object.defineProperty(exports, "__esModule", { value: true });
52
52
  exports.LIGHT_PAYWALL_THEME = exports.DEFAULT_PAYWALL_THEME = void 0;
53
+ exports.prefetchPaywallImages = prefetchPaywallImages;
53
54
  exports.RevnixPaywall = RevnixPaywall;
54
55
  const React = __importStar(require("react"));
55
56
  const react_native_1 = require("react-native");
56
57
  const implicit_js_1 = require("../implicit.js");
57
58
  const store_js_1 = require("../store.js");
59
+ const client_js_1 = require("../client.js");
58
60
  const color_js_1 = require("../blocks/color.js");
59
61
  const RevnixBlockPaywall_js_1 = require("./RevnixBlockPaywall.js");
60
62
  /** `config.blocks` is opaque on the core config (the non-UI entrypoint must
@@ -103,6 +105,12 @@ const CURRENCY_SYMBOL = /[$€£¥₹₩₽₺₫₪฿₴₦₱]/;
103
105
  // part of the public theme — derived from the config's mode, in lockstep
104
106
  // with the dashboard preview's SCREEN_PALETTES.card.
105
107
  const CARD_BG = { dark: "#181b22", light: "#f4f5f7" };
108
+ /** Warms React Native's image cache with every image `resolution`'s paywall
109
+ * loads, so it paints without waiting on the network. Pair it with
110
+ * `client.preload` / `resolvePlacement`. Never throws. */
111
+ async function prefetchPaywallImages(resolution) {
112
+ await Promise.all((0, client_js_1.paywallImageUrls)(resolution?.paywall).map((url) => react_native_1.Image.prefetch(url).catch(() => false)));
113
+ }
106
114
  function RevnixPaywall(props) {
107
115
  // One view per mount: remounting (a re-shown paywall) is a genuine new
108
116
  // display; re-renders are not.
@@ -1,4 +1,4 @@
1
- export { RevnixPaywall, DEFAULT_PAYWALL_THEME, LIGHT_PAYWALL_THEME, type RevnixPaywallPackage, type RevnixPaywallProps, type RevnixPaywallTheme, } from "./RevnixPaywall.js";
1
+ export { RevnixPaywall, DEFAULT_PAYWALL_THEME, LIGHT_PAYWALL_THEME, prefetchPaywallImages, type RevnixPaywallPackage, type RevnixPaywallProps, type RevnixPaywallTheme, } from "./RevnixPaywall.js";
2
2
  export { RevnixBlockPaywall, type RevnixBlockPaywallProps, type RevnixBlurComponent, type RevnixBlurProps, type RevnixGradientComponent, type RevnixGradientProps, } from "./RevnixBlockPaywall.js";
3
3
  export { DESIGN_CANVAS, type BlockStyle, type PaywallBlock, type PaywallBlockDoc, } from "../blocks/types.js";
4
4
  export { backgroundBaseColor, backgroundLayers, coverPlacement, type BackgroundFit, type BackgroundImage, type BackgroundLayers, type BackgroundOverlay, type PaywallBackground, type PaywallBackgroundSpec, } from "../blocks/background.js";
package/dist/ui/index.js CHANGED
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveTags = exports.minorUnitsForCurrency = exports.setLocale = exports.normalizeLocale = exports.localizeBlockDoc = exports.localeChain = exports.linkLabels = exports.detectLocale = exports.coverPlacement = exports.backgroundLayers = exports.backgroundBaseColor = exports.DESIGN_CANVAS = exports.RevnixBlockPaywall = exports.LIGHT_PAYWALL_THEME = exports.DEFAULT_PAYWALL_THEME = exports.RevnixPaywall = void 0;
3
+ exports.resolveTags = exports.minorUnitsForCurrency = exports.setLocale = exports.normalizeLocale = exports.localizeBlockDoc = exports.localeChain = exports.linkLabels = exports.detectLocale = exports.coverPlacement = exports.backgroundLayers = exports.backgroundBaseColor = exports.DESIGN_CANVAS = exports.RevnixBlockPaywall = exports.prefetchPaywallImages = exports.LIGHT_PAYWALL_THEME = exports.DEFAULT_PAYWALL_THEME = exports.RevnixPaywall = void 0;
4
4
  var RevnixPaywall_js_1 = require("./RevnixPaywall.js");
5
5
  Object.defineProperty(exports, "RevnixPaywall", { enumerable: true, get: function () { return RevnixPaywall_js_1.RevnixPaywall; } });
6
6
  Object.defineProperty(exports, "DEFAULT_PAYWALL_THEME", { enumerable: true, get: function () { return RevnixPaywall_js_1.DEFAULT_PAYWALL_THEME; } });
7
7
  Object.defineProperty(exports, "LIGHT_PAYWALL_THEME", { enumerable: true, get: function () { return RevnixPaywall_js_1.LIGHT_PAYWALL_THEME; } });
8
+ Object.defineProperty(exports, "prefetchPaywallImages", { enumerable: true, get: function () { return RevnixPaywall_js_1.prefetchPaywallImages; } });
8
9
  var RevnixBlockPaywall_js_1 = require("./RevnixBlockPaywall.js");
9
10
  Object.defineProperty(exports, "RevnixBlockPaywall", { enumerable: true, get: function () { return RevnixBlockPaywall_js_1.RevnixBlockPaywall; } });
10
11
  var types_js_1 = require("../blocks/types.js");
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.5.0";
1
+ export declare const SDK_VERSION = "1.6.0";
package/dist/version.js CHANGED
@@ -4,4 +4,4 @@ exports.SDK_VERSION = void 0;
4
4
  // L3: the single source of the SDK version inside src/. Must match
5
5
  // package.json "version" — version.test.ts fails the build when they drift
6
6
  // (they had: client.ts said 0.7.0 while the package shipped 0.9.0).
7
- exports.SDK_VERSION = "1.5.0";
7
+ exports.SDK_VERSION = "1.6.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-revnix",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Revnix SDK for React, React Native & Next.js: purchase registration, entitlements, identity, and placements over the Revnix /v1 API.",
5
5
  "license": "MIT",
6
6
  "repository": {