@revenuecat/purchases-ui-js 4.8.17 → 4.8.18

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.
@@ -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.18",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },