@revenuecat/purchases-ui-js 3.9.0 → 3.9.1

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.
@@ -36,6 +36,7 @@
36
36
  type PackageInfoStore,
37
37
  setPackageInfoContext,
38
38
  } from "../../stores/packageInfo";
39
+ import type { WalletButtonRender } from "../../types/wallet";
39
40
 
40
41
  /**
41
42
  * Props are captured once at mount and are not reactive to subsequent changes.
@@ -63,19 +64,7 @@
63
64
  onActionTriggered?: (actionId: string) => void;
64
65
  onError?: (error: unknown) => void;
65
66
  hideBackButtons?: boolean;
66
- walletButtonRender?: (
67
- node: HTMLElement,
68
- params: {
69
- selectedPackageId: string;
70
- onReady?: (walletButtonAvailable?: boolean) => void;
71
- },
72
- ) => {
73
- destroy?: () => void;
74
- update?: (updateParams: {
75
- selectedPackageId: string;
76
- onReady?: (walletButtonAvailable?: boolean) => void;
77
- }) => void;
78
- };
67
+ walletButtonRender?: WalletButtonRender;
79
68
  maxContentWidth?: string;
80
69
  initialInputSelections?: InitialInputSelections;
81
70
  /**
@@ -3,6 +3,7 @@ import type { ColorMode } from "../../types";
3
3
  import type { PaywallData } from "../../types/paywall";
4
4
  import type { UIConfig } from "../../types/ui-config";
5
5
  import { type CustomVariables, type PackageInfo, type VariableDictionary } from "../../types/variables";
6
+ import type { WalletButtonRender } from "../../types/wallet";
6
7
  /**
7
8
  * Props are captured once at mount and are not reactive to subsequent changes.
8
9
  * The paywall should be remounted to reflect new prop values.
@@ -29,16 +30,7 @@ interface Props {
29
30
  onActionTriggered?: (actionId: string) => void;
30
31
  onError?: (error: unknown) => void;
31
32
  hideBackButtons?: boolean;
32
- walletButtonRender?: (node: HTMLElement, params: {
33
- selectedPackageId: string;
34
- onReady?: (walletButtonAvailable?: boolean) => void;
35
- }) => {
36
- destroy?: () => void;
37
- update?: (updateParams: {
38
- selectedPackageId: string;
39
- onReady?: (walletButtonAvailable?: boolean) => void;
40
- }) => void;
41
- };
33
+ walletButtonRender?: WalletButtonRender;
42
34
  maxContentWidth?: string;
43
35
  initialInputSelections?: InitialInputSelections;
44
36
  /**
@@ -1,10 +1,11 @@
1
1
  <script lang="ts">
2
- import Paywall, {
3
- type UIConfig,
4
- } from "../paywall/Paywall.svelte";
2
+ import Paywall from "../paywall/Paywall.svelte";
5
3
  import type { InitialInputSelections } from "../../stores/inputValidation";
6
4
  import type { WorkflowScreen } from "../../types/workflow";
7
5
  import type { VariableDictionary } from "../../types/variables";
6
+ import type { WalletButtonRender } from "../../types/wallet";
7
+ import type { UIConfig } from "../../types/ui-config";
8
+
8
9
  interface Props {
9
10
  paywallComponents: WorkflowScreen | null | undefined;
10
11
  selectedLocale?: string;
@@ -20,7 +21,9 @@
20
21
  maxContentWidth?: string;
21
22
  variablesPerPackage?: Record<string, VariableDictionary>;
22
23
  initialInputSelections?: InitialInputSelections;
24
+ walletButtonRender?: WalletButtonRender;
23
25
  }
26
+
24
27
  const {
25
28
  paywallComponents,
26
29
  selectedLocale = "en_US",
@@ -33,6 +36,7 @@
33
36
  maxContentWidth,
34
37
  variablesPerPackage,
35
38
  initialInputSelections = {},
39
+ walletButtonRender,
36
40
  }: Props = $props();
37
41
  </script>
38
42
 
@@ -56,6 +60,7 @@
56
60
  onActionTriggered?.(actionId);
57
61
  }}
58
62
  {onPurchaseClicked}
63
+ {walletButtonRender}
59
64
  onError={(error) => {
60
65
  console.error("Paywall error:", error);
61
66
  }}
@@ -1,7 +1,8 @@
1
- import { type UIConfig } from "../paywall/Paywall.svelte";
2
1
  import type { InitialInputSelections } from "../../stores/inputValidation";
3
2
  import type { WorkflowScreen } from "../../types/workflow";
4
3
  import type { VariableDictionary } from "../../types/variables";
4
+ import type { WalletButtonRender } from "../../types/wallet";
5
+ import type { UIConfig } from "../../types/ui-config";
5
6
  interface Props {
6
7
  paywallComponents: WorkflowScreen | null | undefined;
7
8
  selectedLocale?: string;
@@ -14,6 +15,7 @@ interface Props {
14
15
  maxContentWidth?: string;
15
16
  variablesPerPackage?: Record<string, VariableDictionary>;
16
17
  initialInputSelections?: InitialInputSelections;
18
+ walletButtonRender?: WalletButtonRender;
17
19
  }
18
20
  declare const Screen: import("svelte").Component<Props, {}, "">;
19
21
  type Screen = ReturnType<typeof Screen>;
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./types";
17
17
  export { type PaywallData } from "./types/paywall";
18
18
  export { type InitialInputSelections } from "./stores/inputValidation";
19
19
  export { type UIConfig } from "./types/ui-config";
20
+ export { type WalletButtonRender } from "./types/wallet";
20
21
  export { type CustomVariables, CustomVariableValue, type VariableDictionary, type PackageInfo, } from "./types/variables";
21
22
  export * from "./ui/globals";
22
23
  export { default as Button } from "./ui/molecules/button.svelte";
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ export * from "./types";
18
18
  export {} from "./types/paywall";
19
19
  export {} from "./stores/inputValidation";
20
20
  export {} from "./types/ui-config";
21
+ export {} from "./types/wallet";
21
22
  export { CustomVariableValue, } from "./types/variables";
22
23
  export * from "./ui/globals";
23
24
  export { default as Button } from "./ui/molecules/button.svelte";
@@ -1,6 +1,7 @@
1
1
  import type { Action } from "../types/components/button";
2
2
  import type { UIConfig } from "../types/ui-config";
3
3
  import type { PackageInfo, VariableDictionary } from "../types/variables";
4
+ import type { WalletButtonRender } from "../types/wallet";
4
5
  import { type Readable, type Writable } from "svelte/store";
5
6
  type PaywallContext = Readonly<{
6
7
  selectedPackageId: Writable<string | undefined>;
@@ -15,16 +16,7 @@ type PaywallContext = Readonly<{
15
16
  baseVariables: Readable<VariableDictionary | undefined>;
16
17
  infoPerPackage: Readable<Record<string, PackageInfo> | undefined>;
17
18
  onPurchase: (actionId?: string) => void;
18
- walletButtonRender?: (node: HTMLElement, params: {
19
- selectedPackageId: string;
20
- onReady?: (walletButtonAvailable?: boolean) => void;
21
- }) => {
22
- destroy?: () => void;
23
- update?: (params: {
24
- selectedPackageId: string;
25
- onReady?: (walletButtonAvailable?: boolean) => void;
26
- }) => void;
27
- };
19
+ walletButtonRender?: WalletButtonRender;
28
20
  onWalletButtonReady?: (walletButtonAvailable?: boolean) => void;
29
21
  onButtonAction: (action: Action, actionId?: string) => void;
30
22
  uiConfig: UIConfig;
@@ -1,11 +1,3 @@
1
+ import type { WalletButtonRender } from "../types/wallet";
1
2
  import type { DecoratorFunction, Renderer } from "storybook/internal/csf";
2
- export declare function paywallDecorator<TRenderer extends Renderer, TArgs>(walletButtonRender?: (node: HTMLElement, params: {
3
- selectedPackageId: string;
4
- onReady?: (walletButtonAvailable?: boolean) => void;
5
- }) => {
6
- destroy?: () => void;
7
- update?: (updateParams: {
8
- selectedPackageId: string;
9
- onReady?: (walletButtonAvailable?: boolean) => void;
10
- }) => void;
11
- }, selectedPackageId?: string): DecoratorFunction<TRenderer, TArgs>;
3
+ export declare function paywallDecorator<TRenderer extends Renderer, TArgs>(walletButtonRender?: WalletButtonRender, selectedPackageId?: string): DecoratorFunction<TRenderer, TArgs>;
@@ -0,0 +1,10 @@
1
+ export type WalletButtonRender = (node: HTMLElement, params: {
2
+ selectedPackageId: string;
3
+ onReady?: (walletButtonAvailable?: boolean) => void;
4
+ }) => {
5
+ destroy?: () => void;
6
+ update?: (updateParams: {
7
+ selectedPackageId: string;
8
+ onReady?: (walletButtonAvailable?: boolean) => void;
9
+ }) => void;
10
+ };
@@ -0,0 +1 @@
1
+ export {};
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.9.0",
5
+ "version": "3.9.1",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },