@revenuecat/purchases-ui-js 3.2.0 → 3.4.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.
- package/dist/components/button/ButtonNode.svelte +3 -2
- package/dist/components/paywall/Paywall.svelte +8 -0
- package/dist/components/paywall/Paywall.svelte.d.ts +2 -0
- package/dist/components/workflows/Screen.svelte +3 -0
- package/dist/components/workflows/Screen.svelte.d.ts +1 -0
- package/dist/stores/paywall.d.ts +1 -0
- package/dist/stories/paywall-decorator.js +1 -0
- package/package.json +1 -1
|
@@ -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: {
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
destroy?: () => void;
|
|
58
59
|
update?: (selectedPackageId: string) => void;
|
|
59
60
|
};
|
|
61
|
+
maxContentWidth?: string;
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
const {
|
|
@@ -75,6 +77,8 @@
|
|
|
75
77
|
onError,
|
|
76
78
|
uiConfig,
|
|
77
79
|
walletButtonRender,
|
|
80
|
+
hideBackButtons = false,
|
|
81
|
+
maxContentWidth,
|
|
78
82
|
}: Props = $props();
|
|
79
83
|
|
|
80
84
|
const getColorMode = setColorModeContext(() => preferredColorMode);
|
|
@@ -148,6 +152,7 @@
|
|
|
148
152
|
onButtonAction,
|
|
149
153
|
walletButtonRender,
|
|
150
154
|
uiConfig,
|
|
155
|
+
hideBackButtons,
|
|
151
156
|
});
|
|
152
157
|
|
|
153
158
|
const variables: VariablesStore = derived(selectedPackageId, (packageId) => {
|
|
@@ -170,6 +175,9 @@
|
|
|
170
175
|
const style = $derived(
|
|
171
176
|
css({
|
|
172
177
|
...mapBackground(colorMode, null, base.background),
|
|
178
|
+
...(maxContentWidth && {
|
|
179
|
+
"padding-inline": `max(0px, calc((100vw - ${maxContentWidth}) / 2))`,
|
|
180
|
+
}),
|
|
173
181
|
}),
|
|
174
182
|
);
|
|
175
183
|
|
|
@@ -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;
|
|
@@ -30,6 +31,7 @@ interface Props {
|
|
|
30
31
|
destroy?: () => void;
|
|
31
32
|
update?: (selectedPackageId: string) => void;
|
|
32
33
|
};
|
|
34
|
+
maxContentWidth?: string;
|
|
33
35
|
}
|
|
34
36
|
declare const Paywall: import("svelte").Component<Props, {}, "">;
|
|
35
37
|
type Paywall = ReturnType<typeof Paywall>;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
actionId: string,
|
|
17
17
|
) => void | Promise<void>;
|
|
18
18
|
containerId?: string;
|
|
19
|
+
maxContentWidth?: string;
|
|
19
20
|
}
|
|
20
21
|
const {
|
|
21
22
|
paywallComponents,
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
onActionTriggered,
|
|
26
27
|
onPurchaseClicked,
|
|
27
28
|
containerId = "screen-container",
|
|
29
|
+
maxContentWidth,
|
|
28
30
|
}: Props = $props();
|
|
29
31
|
</script>
|
|
30
32
|
|
|
@@ -36,6 +38,7 @@
|
|
|
36
38
|
{uiConfig}
|
|
37
39
|
variablesPerPackage={VARIABLES}
|
|
38
40
|
{globalVariables}
|
|
41
|
+
{maxContentWidth}
|
|
39
42
|
onNavigateToUrlClicked={() => {}}
|
|
40
43
|
onVisitCustomerCenterClicked={() => {}}
|
|
41
44
|
onBackClicked={() => {}}
|
|
@@ -9,6 +9,7 @@ interface Props {
|
|
|
9
9
|
onActionTriggered?: (actionId: string) => void;
|
|
10
10
|
onPurchaseClicked?: (packageId: string, actionId: string) => void | Promise<void>;
|
|
11
11
|
containerId?: string;
|
|
12
|
+
maxContentWidth?: string;
|
|
12
13
|
}
|
|
13
14
|
declare const Screen: import("svelte").Component<Props, {}, "">;
|
|
14
15
|
type Screen = ReturnType<typeof Screen>;
|
package/dist/stores/paywall.d.ts
CHANGED
|
@@ -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
|
});
|