@revenuecat/purchases-ui-js 3.2.0 → 3.3.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.
@@ -15,7 +15,7 @@
15
15
  };
16
16
  });
17
17
 
18
- const { onButtonAction } = getPaywallContext();
18
+ const { onButtonAction, hideBackButtons } = getPaywallContext();
19
19
 
20
20
  const onclick = () => {
21
21
  const actionId = props.triggers?.on_press;
@@ -27,8 +27,9 @@
27
27
  case "workflow":
28
28
  return true;
29
29
  case "restore_purchases":
30
- case "navigate_back":
31
30
  return false;
31
+ case "navigate_back":
32
+ return !hideBackButtons;
32
33
  case "navigate_to":
33
34
  return action.destination !== "web_paywall_link";
34
35
  default:
@@ -47,6 +47,7 @@
47
47
  onNavigateToUrlClicked?: (url: string) => void;
48
48
  onActionTriggered?: (actionId: string) => void;
49
49
  onError?: (error: unknown) => void;
50
+ hideBackButtons?: boolean;
50
51
  walletButtonRender?: (
51
52
  node: HTMLElement,
52
53
  params: {
@@ -75,6 +76,7 @@
75
76
  onError,
76
77
  uiConfig,
77
78
  walletButtonRender,
79
+ hideBackButtons = false,
78
80
  }: Props = $props();
79
81
 
80
82
  const getColorMode = setColorModeContext(() => preferredColorMode);
@@ -148,6 +150,7 @@
148
150
  onButtonAction,
149
151
  walletButtonRender,
150
152
  uiConfig,
153
+ hideBackButtons,
151
154
  });
152
155
 
153
156
  const variables: VariablesStore = derived(selectedPackageId, (packageId) => {
@@ -23,6 +23,7 @@ interface Props {
23
23
  onNavigateToUrlClicked?: (url: string) => void;
24
24
  onActionTriggered?: (actionId: string) => void;
25
25
  onError?: (error: unknown) => void;
26
+ hideBackButtons?: boolean;
26
27
  walletButtonRender?: (node: HTMLElement, params: {
27
28
  selectedPackageId: string;
28
29
  onReady?: () => void;
@@ -16,6 +16,7 @@ type PaywallContext = Readonly<{
16
16
  };
17
17
  onButtonAction: (action: Action, actionId?: string) => void;
18
18
  uiConfig: UIConfig;
19
+ hideBackButtons: boolean;
19
20
  }>;
20
21
  export declare function setPaywallContext(context: PaywallContext): void;
21
22
  export declare function getPaywallContext(): PaywallContext;
@@ -19,6 +19,7 @@ export function paywallDecorator(walletButtonRender) {
19
19
  infoPerPackage: readable(undefined),
20
20
  onPurchase: () => window.alert("Purchase clicked"),
21
21
  onButtonAction: (action, actionId) => window.alert(`Button clicked: ${JSON.stringify({ action, actionId }, undefined, 2)}`),
22
+ hideBackButtons: false,
22
23
  walletButtonRender,
23
24
  uiConfig: emptyUiConfig,
24
25
  });
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": "3.2.0",
5
+ "version": "3.3.0",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },