@revenuecat/purchases-ui-js 4.8.17 → 4.8.19

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.
@@ -305,6 +305,13 @@
305
305
  }
306
306
  };
307
307
 
308
+ // Merge this component's own `customVariables` prop with the dashboard
309
+ // defaults. On the standalone path, this is the only source of custom
310
+ // variable values. On the workflow path, the host has already merged its
311
+ // `customVariables` into `globalVariables` — that merge must win here, or
312
+ // this component's defaults-only merge (since `customVariables` is never
313
+ // passed down by the workflow) silently overwrites the host's overrides
314
+ // for any variable that also has a declared dashboard default.
308
315
  const mergedCustomVars = mergeCustomVariables(customVariables, uiConfig);
309
316
 
310
317
  setPaywallContext({
@@ -312,8 +319,8 @@
312
319
  selectedPackageId,
313
320
  variablesPerPackage: readable(variablesPerPackage),
314
321
  baseVariables: readable({
315
- ...globalVariables,
316
322
  ...mergedCustomVars,
323
+ ...globalVariables,
317
324
  }),
318
325
  infoPerPackage: readable(infoPerPackage),
319
326
  onPurchase,
@@ -341,8 +348,8 @@
341
348
  const variables: VariablesStore = derived(selectedPackageId, (packageId) => {
342
349
  const packageVars = variablesPerPackage[packageId || ""];
343
350
  return {
344
- ...globalVariables,
345
351
  ...mergedCustomVars,
352
+ ...globalVariables,
346
353
  ...packageVars,
347
354
  };
348
355
  });
@@ -75,6 +75,8 @@
75
75
  }),
76
76
  variablesDecorator({
77
77
  "success.redemption_url": "myapp://redeem?token=abc123xyz",
78
+ "success.redemption_url_redirect":
79
+ "https://api.revenuecat.com/rcbilling/v1/redirect?url=myapp://redeem?token=abc123xyz",
78
80
  }),
79
81
  ],
80
82
  args: {
@@ -4,11 +4,18 @@
4
4
  import type { RedemptionButtonProps } from "../../types/components/redemption-button";
5
5
  import QRCode from "qrcode";
6
6
  import { onMount } from "svelte";
7
+ import { getRedemptionQrUrl } from "./redemption-url";
7
8
 
8
9
  const props: RedemptionButtonProps = $props();
9
10
 
10
11
  const variables = getVariablesContext();
11
12
  const redemptionUrl = $derived($variables?.["success.redemption_url"]);
13
+ const redemptionUrlRedirect = $derived(
14
+ $variables?.["success.redemption_url_redirect"],
15
+ );
16
+ const redemptionQrUrl = $derived(
17
+ getRedemptionQrUrl(redemptionUrl, redemptionUrlRedirect),
18
+ );
12
19
 
13
20
  let isMobile = $state(true);
14
21
  let qrCodeDataUrl = $state("");
@@ -30,9 +37,9 @@
30
37
  });
31
38
 
32
39
  $effect(() => {
33
- if (!isMobile && redemptionUrl) {
40
+ if (!isMobile && redemptionQrUrl) {
34
41
  qrFailed = false;
35
- QRCode.toDataURL(redemptionUrl, {
42
+ QRCode.toDataURL(redemptionQrUrl, {
36
43
  width: 512,
37
44
  margin: 2,
38
45
  errorCorrectionLevel: "M",
@@ -0,0 +1 @@
1
+ export declare const getRedemptionQrUrl: (redemptionUrl: string | undefined, redemptionUrlRedirect: string | undefined) => string | undefined;
@@ -0,0 +1 @@
1
+ export const getRedemptionQrUrl = (redemptionUrl, redemptionUrlRedirect) => redemptionUrlRedirect || redemptionUrl;
@@ -84,7 +84,7 @@ type CustomVariableName = string & {};
84
84
  */
85
85
  export type InputVariableName = `input.${string}`;
86
86
  export declare function mergeCustomVariables(customVariables: CustomVariables, uiConfig: UIConfig | undefined): VariableDictionary;
87
- type BuiltinVariableName = "product.price" | "product.price_per_period" | "product.price_per_period_abbreviated" | "product.price_per_day" | "product.price_per_week" | "product.price_per_month" | "product.price_per_year" | "product.period" | "product.period_abbreviated" | "product.periodly" | "product.period_in_days" | "product.period_in_weeks" | "product.period_in_months" | "product.period_in_years" | "product.period_with_unit" | "product.currency_code" | "product.currency_symbol" | "product.offer_price" | "product.offer_price_per_day" | "product.offer_price_per_week" | "product.offer_price_per_month" | "product.offer_price_per_year" | "product.offer_period" | "product.offer_period_abbreviated" | "product.offer_period_in_days" | "product.offer_period_in_weeks" | "product.offer_period_in_months" | "product.offer_period_in_years" | "product.offer_period_with_unit" | "product.offer_end_date" | "product.secondary_offer_price" | "product.secondary_offer_period" | "product.secondary_offer_period_abbreviated" | "product.relative_discount" | "product.store_product_name" | "success.redemption_url" | "success.package_identifier" | "success.product_identifier" | "success.product_title" | "success.product_description" | "success.price" | "success.currency_code" | "success.customer_email" | "success.is_subscription" | "success.is_trial";
87
+ type BuiltinVariableName = "product.price" | "product.price_per_period" | "product.price_per_period_abbreviated" | "product.price_per_day" | "product.price_per_week" | "product.price_per_month" | "product.price_per_year" | "product.period" | "product.period_abbreviated" | "product.periodly" | "product.period_in_days" | "product.period_in_weeks" | "product.period_in_months" | "product.period_in_years" | "product.period_with_unit" | "product.currency_code" | "product.currency_symbol" | "product.offer_price" | "product.offer_price_per_day" | "product.offer_price_per_week" | "product.offer_price_per_month" | "product.offer_price_per_year" | "product.offer_period" | "product.offer_period_abbreviated" | "product.offer_period_in_days" | "product.offer_period_in_weeks" | "product.offer_period_in_months" | "product.offer_period_in_years" | "product.offer_period_with_unit" | "product.offer_end_date" | "product.secondary_offer_price" | "product.secondary_offer_period" | "product.secondary_offer_period_abbreviated" | "product.relative_discount" | "product.store_product_name" | "success.redemption_url" | "success.redemption_url_redirect" | "success.package_identifier" | "success.product_identifier" | "success.product_title" | "success.product_description" | "success.price" | "success.currency_code" | "success.customer_email" | "success.is_subscription" | "success.is_trial";
88
88
  export type VariableDictionary = Partial<Record<BuiltinVariableName | InputVariableName | CustomVariableName, string>>;
89
89
  export type VariablesDictionary = Record<PackageIdentifier, VariableDictionary>;
90
90
  export interface PackageInfo {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@revenuecat/purchases-ui-js",
3
3
  "description": "Web components for Paywalls. Powered by RevenueCat",
4
4
  "private": false,
5
- "version": "4.8.17",
5
+ "version": "4.8.19",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },