@revenuecat/purchases-ui-js 1.0.2 → 2.0.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.
- package/dist/components/button/Button.svelte +1 -5
- package/dist/components/button/ButtonNode.stories.svelte +62 -70
- package/dist/components/button/ButtonNode.stories.svelte.d.ts +0 -8
- package/dist/components/button/ButtonNode.svelte +11 -19
- package/dist/components/button/ButtonNode.svelte.d.ts +2 -2
- package/dist/components/button/button-utils.d.ts +2 -2
- package/dist/components/footer/Footer.stories.svelte +30 -22
- package/dist/components/footer/Footer.stories.svelte.d.ts +0 -5
- package/dist/components/footer/Footer.svelte +3 -10
- package/dist/components/footer/Footer.svelte.d.ts +1 -1
- package/dist/components/image/Image.stories.svelte +26 -7
- package/dist/components/image/Image.svelte +17 -15
- package/dist/components/image/image-utils.d.ts +2 -1
- package/dist/components/image/image-utils.js +2 -2
- package/dist/components/package/Package.stories.svelte +31 -27
- package/dist/components/package/Package.stories.svelte.d.ts +0 -6
- package/dist/components/package/Package.svelte +18 -22
- package/dist/components/package/Package.svelte.d.ts +1 -1
- package/dist/components/paywall/Node.svelte +12 -39
- package/dist/components/paywall/Node.svelte.d.ts +4 -8
- package/dist/components/paywall/Paywall.stories.svelte +21 -78
- package/dist/components/paywall/Paywall.svelte +71 -98
- package/dist/components/paywall/Paywall.svelte.d.ts +4 -4
- package/dist/components/paywall/paywall-utils.d.ts +3 -2
- package/dist/components/paywall/paywall-utils.js +5 -5
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +32 -26
- package/dist/components/purchase-button/PurchaseButton.stories.svelte.d.ts +0 -5
- package/dist/components/purchase-button/PurchaseButton.svelte +7 -11
- package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +1 -1
- package/dist/components/purchase-button/purchase-button-utils.d.ts +1 -1
- package/dist/components/stack/Stack.stories.svelte +34 -79
- package/dist/components/stack/Stack.svelte +15 -25
- package/dist/components/stack/stack-utils.d.ts +4 -3
- package/dist/components/stack/stack-utils.js +7 -8
- package/dist/components/text/TextNode.stories.svelte +46 -141
- package/dist/components/text/TextNode.svelte +13 -12
- package/dist/components/text/text-utils.d.ts +7 -6
- package/dist/components/text/text-utils.js +7 -7
- package/dist/components/timeline/Timeline.stories.svelte +41 -47
- package/dist/components/timeline/TimelineItem.svelte +28 -11
- package/dist/components/timeline/timeline-utils.d.ts +3 -3
- package/dist/components/timeline/timeline-utils.js +7 -16
- package/dist/data/entities.d.ts +59 -120
- package/dist/data/state.d.ts +0 -5
- package/dist/stores/color-mode.d.ts +6 -0
- package/dist/stores/color-mode.js +15 -0
- package/dist/stores/localization.d.ts +13 -0
- package/dist/stores/localization.js +25 -0
- package/dist/stores/paywall.d.ts +10 -0
- package/dist/stores/paywall.js +13 -0
- package/dist/stores/variables.d.ts +6 -0
- package/dist/stores/variables.js +14 -0
- package/dist/stories/fixtures.js +7 -76
- package/dist/stories/localization-decorator.d.ts +3 -0
- package/dist/stories/localization-decorator.js +7 -0
- package/dist/stories/paywall-decorator.d.ts +2 -0
- package/dist/stories/paywall-decorator.js +18 -0
- package/dist/stories/variables-decorator.d.ts +3 -0
- package/dist/stories/variables-decorator.js +9 -0
- package/dist/stories/with-layout.svelte +1 -1
- package/dist/types/alignment.d.ts +19 -0
- package/dist/types/alignment.js +1 -0
- package/dist/types/background.d.ts +18 -0
- package/dist/types/background.js +1 -0
- package/dist/types/colors.d.ts +34 -0
- package/dist/types/colors.js +1 -0
- package/dist/types/components/button.d.ts +36 -0
- package/dist/types/components/button.js +1 -0
- package/dist/types/components/footer.d.ts +5 -0
- package/dist/types/components/footer.js +1 -0
- package/dist/types/components/package.d.ts +8 -0
- package/dist/types/components/package.js +1 -0
- package/dist/types/components/purchase-button.d.ts +5 -0
- package/dist/types/components/purchase-button.js +1 -0
- package/dist/types/localization.d.ts +4 -0
- package/dist/types/localization.js +1 -0
- package/dist/types/media.d.ts +18 -0
- package/dist/types/media.js +1 -0
- package/dist/types.d.ts +5 -35
- package/dist/ui/atoms/typography.stories.svelte +8 -14
- package/dist/ui/atoms/typography.svelte +1 -1
- package/dist/ui/molecules/button.stories.svelte +8 -15
- package/dist/ui/molecules/button.svelte +2 -3
- package/dist/ui/molecules/button.svelte.d.ts +2 -26
- package/dist/ui/molecules/types.d.ts +2 -1
- package/dist/utils/style-utils.d.ts +13 -11
- package/dist/utils/style-utils.js +8 -15
- package/dist/utils/variable-utils.d.ts +1 -38
- package/dist/utils/variable-utils.js +6 -48
- package/dist/web-components/index.css +1 -0
- package/dist/web-components/index.js +909 -1734
- package/package.json +33 -36
- package/dist/stores/theme.d.ts +0 -1
- package/dist/stores/theme.js +0 -17
|
@@ -1,160 +1,133 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
3
|
-
Extra,
|
|
4
|
-
NavigateToAction,
|
|
5
|
-
PaywallData,
|
|
6
|
-
StackProps,
|
|
7
|
-
SupportedActions,
|
|
8
|
-
} from "../../data/entities";
|
|
2
|
+
import type { PaywallData, StackProps } from "../../data/entities";
|
|
9
3
|
|
|
4
|
+
import Footer from "../footer/Footer.svelte";
|
|
10
5
|
import Node from "./Node.svelte";
|
|
11
|
-
import type { PurchaseState } from "../../data/state";
|
|
12
|
-
import { findSelectedPackageId } from "../../utils/style-utils";
|
|
13
|
-
import {
|
|
14
|
-
getLabelById,
|
|
15
|
-
type VariableDictionary,
|
|
16
|
-
} from "../../utils/variable-utils";
|
|
17
6
|
import {
|
|
18
7
|
getBackgroundImageSource,
|
|
19
8
|
getBackgroundStyles,
|
|
20
9
|
} from "./paywall-utils";
|
|
21
|
-
import {
|
|
10
|
+
import type { PurchaseState } from "../../data/state";
|
|
11
|
+
import { setColorModeContext } from "../../stores/color-mode";
|
|
12
|
+
import { setLocalizationContext } from "../../stores/localization";
|
|
13
|
+
import { setPaywallContext } from "../../stores/paywall";
|
|
14
|
+
import { setVariablesContext } from "../../stores/variables";
|
|
22
15
|
import type { ColorMode } from "../../types";
|
|
23
|
-
import
|
|
24
|
-
import {
|
|
16
|
+
import type { Action } from "../../types/components/button";
|
|
17
|
+
import { findSelectedPackageId } from "../../utils/style-utils";
|
|
18
|
+
import { type VariableDictionary } from "../../utils/variable-utils";
|
|
19
|
+
import { derived, writable } from "svelte/store";
|
|
25
20
|
|
|
26
21
|
interface Props {
|
|
27
22
|
paywallData: PaywallData;
|
|
23
|
+
selectedLocale?: string;
|
|
24
|
+
variablesPerPackage?: Record<string, VariableDictionary>;
|
|
25
|
+
preferredColorMode?: ColorMode;
|
|
28
26
|
onPurchaseClicked?: (selectedPackageId: string) => void;
|
|
29
27
|
onBackClicked?: () => void;
|
|
30
28
|
onVisitCustomerCenterClicked?: () => void;
|
|
31
29
|
onRestorePurchasesClicked?: () => void;
|
|
32
30
|
onNavigateToUrlClicked?: (url: string) => void;
|
|
33
|
-
selectedLocale?: string;
|
|
34
|
-
variablesPerPackage?: Record<string, VariableDictionary>;
|
|
35
|
-
preferredColorMode?: ColorMode;
|
|
36
31
|
onError?: (error: unknown) => void;
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
const {
|
|
40
35
|
paywallData,
|
|
41
|
-
onPurchaseClicked,
|
|
42
|
-
onRestorePurchasesClicked,
|
|
43
|
-
onNavigateToUrlClicked,
|
|
44
|
-
onBackClicked,
|
|
45
|
-
onVisitCustomerCenterClicked,
|
|
46
36
|
selectedLocale,
|
|
47
37
|
variablesPerPackage = {},
|
|
48
38
|
preferredColorMode,
|
|
39
|
+
onPurchaseClicked,
|
|
40
|
+
onBackClicked,
|
|
41
|
+
onVisitCustomerCenterClicked,
|
|
42
|
+
onRestorePurchasesClicked,
|
|
43
|
+
onNavigateToUrlClicked,
|
|
49
44
|
onError,
|
|
50
45
|
}: Props = $props();
|
|
51
46
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const getColorMode = setColorModeContext(() => preferredColorMode);
|
|
48
|
+
const colorMode = $derived(getColorMode());
|
|
49
|
+
|
|
50
|
+
const { getLocalizedString } = setLocalizationContext({
|
|
55
51
|
defaultLocale: paywallData.default_locale,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
preferredColorMode || ($prefersDarkMode ? "dark" : DEFAULT_COLOR_MODE),
|
|
52
|
+
selectedLocale,
|
|
53
|
+
localizations: paywallData.components_localizations!,
|
|
59
54
|
});
|
|
60
55
|
|
|
61
|
-
let
|
|
62
|
-
variablesPerPackage
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const onRestorePurchasesAction = (_: SupportedActions, _2?: Extra) => {
|
|
66
|
-
onRestorePurchasesClicked?.();
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const onNavigateBackAction = (_: SupportedActions, _2?: Extra) => {
|
|
70
|
-
onBackClicked?.();
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const onNavigateToUrl = (action: NavigateToAction, _?: Extra) => {
|
|
74
|
-
if (action.destination === "customer_center") {
|
|
75
|
-
onVisitCustomerCenterClicked?.();
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!action.url) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const localizedURL = getLabelById(
|
|
83
|
-
action.url.url_lid,
|
|
84
|
-
purchaseState.locale,
|
|
85
|
-
purchaseState.defaultLocale,
|
|
86
|
-
paywallData.components_localizations,
|
|
87
|
-
);
|
|
88
|
-
if (!localizedURL) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
56
|
+
let purchaseState = $state({
|
|
57
|
+
variablesPerPackage,
|
|
58
|
+
} satisfies PurchaseState);
|
|
91
59
|
|
|
92
|
-
|
|
93
|
-
|
|
60
|
+
const selectedPackageId = writable<string | undefined>(
|
|
61
|
+
findSelectedPackageId(paywallData),
|
|
62
|
+
);
|
|
94
63
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
64
|
+
const onPurchase = () => {
|
|
65
|
+
const packageId = $selectedPackageId;
|
|
66
|
+
if (packageId !== undefined) {
|
|
67
|
+
onPurchaseClicked?.(packageId);
|
|
99
68
|
}
|
|
100
69
|
};
|
|
101
70
|
|
|
102
|
-
const
|
|
103
|
-
if (purchaseState.selectedPackageId === undefined) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
onPurchaseClicked?.(purchaseState.selectedPackageId);
|
|
107
|
-
};
|
|
108
|
-
const onAction = (action: SupportedActions, data?: Extra) => {
|
|
71
|
+
const onButtonAction = (action: Action) => {
|
|
109
72
|
switch (action.type) {
|
|
110
|
-
case "select_package":
|
|
111
|
-
onSelectPackageAction(action, data);
|
|
112
|
-
break;
|
|
113
|
-
case "navigate_to":
|
|
114
|
-
onNavigateToUrl(action, data);
|
|
115
|
-
break;
|
|
116
73
|
case "navigate_back":
|
|
117
|
-
|
|
118
|
-
|
|
74
|
+
onBackClicked?.();
|
|
75
|
+
return;
|
|
119
76
|
case "restore_purchases":
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
77
|
+
onRestorePurchasesClicked?.();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
switch (action.destination) {
|
|
82
|
+
case "customer_center":
|
|
83
|
+
onVisitCustomerCenterClicked?.();
|
|
84
|
+
return;
|
|
85
|
+
case "privacy_policy":
|
|
86
|
+
case "terms":
|
|
87
|
+
case "url":
|
|
88
|
+
const url = getLocalizedString(action.url.url_lid);
|
|
89
|
+
if (url) {
|
|
90
|
+
onNavigateToUrlClicked?.(url);
|
|
91
|
+
}
|
|
92
|
+
return;
|
|
93
|
+
case "offer_code":
|
|
94
|
+
case "sheet":
|
|
95
|
+
case "web_paywall_link":
|
|
96
|
+
// TODO: Implement later.
|
|
97
|
+
return;
|
|
125
98
|
}
|
|
126
99
|
};
|
|
127
100
|
|
|
101
|
+
setPaywallContext({ selectedPackageId, onPurchase, onButtonAction });
|
|
102
|
+
|
|
103
|
+
const variables = derived(
|
|
104
|
+
selectedPackageId,
|
|
105
|
+
(packageId) => variablesPerPackage[packageId || ""] as VariableDictionary,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
setVariablesContext(variables);
|
|
109
|
+
|
|
128
110
|
const backgroundStyles = $derived(
|
|
129
111
|
getBackgroundStyles({
|
|
130
112
|
background: paywallData.components_config.base?.background,
|
|
131
|
-
colorMode
|
|
113
|
+
colorMode,
|
|
132
114
|
}),
|
|
133
115
|
);
|
|
134
116
|
const backgroundImgSource = $derived(
|
|
135
|
-
getBackgroundImageSource(paywallData,
|
|
117
|
+
getBackgroundImageSource(paywallData, colorMode),
|
|
136
118
|
);
|
|
137
119
|
</script>
|
|
138
120
|
|
|
139
121
|
<svelte:boundary onerror={onError}>
|
|
140
122
|
<div class="rc-pw-paywall">
|
|
141
|
-
<Node
|
|
142
|
-
{onAction}
|
|
143
|
-
nodeData={paywallData.components_config.base.stack}
|
|
144
|
-
labels={paywallData.components_localizations}
|
|
145
|
-
{purchaseState}
|
|
146
|
-
{variableDictionary}
|
|
147
|
-
/>
|
|
123
|
+
<Node nodeData={paywallData.components_config.base.stack} {purchaseState} />
|
|
148
124
|
|
|
149
125
|
{#if paywallData.components_config.base.sticky_footer}
|
|
150
126
|
<Footer
|
|
151
127
|
{...paywallData.components_config.base.sticky_footer}
|
|
152
128
|
stack={paywallData.components_config.base.sticky_footer
|
|
153
129
|
.stack as StackProps}
|
|
154
|
-
labels={paywallData.components_localizations}
|
|
155
130
|
{purchaseState}
|
|
156
|
-
{variableDictionary}
|
|
157
|
-
{onAction}
|
|
158
131
|
/>
|
|
159
132
|
{/if}
|
|
160
133
|
{#if paywallData.components_config.base.background?.type === "color"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { PaywallData } from "../../data/entities";
|
|
2
|
-
import { type VariableDictionary } from "../../utils/variable-utils";
|
|
3
2
|
import type { ColorMode } from "../../types";
|
|
3
|
+
import { type VariableDictionary } from "../../utils/variable-utils";
|
|
4
4
|
interface Props {
|
|
5
5
|
paywallData: PaywallData;
|
|
6
|
+
selectedLocale?: string;
|
|
7
|
+
variablesPerPackage?: Record<string, VariableDictionary>;
|
|
8
|
+
preferredColorMode?: ColorMode;
|
|
6
9
|
onPurchaseClicked?: (selectedPackageId: string) => void;
|
|
7
10
|
onBackClicked?: () => void;
|
|
8
11
|
onVisitCustomerCenterClicked?: () => void;
|
|
9
12
|
onRestorePurchasesClicked?: () => void;
|
|
10
13
|
onNavigateToUrlClicked?: (url: string) => void;
|
|
11
|
-
selectedLocale?: string;
|
|
12
|
-
variablesPerPackage?: Record<string, VariableDictionary>;
|
|
13
|
-
preferredColorMode?: ColorMode;
|
|
14
14
|
onError?: (error: unknown) => void;
|
|
15
15
|
}
|
|
16
16
|
declare const Paywall: import("svelte").Component<Props, {}, "">;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PaywallData } from "../../data/entities";
|
|
2
2
|
import type { ColorMode } from "../../types";
|
|
3
|
+
import type { Background } from "../../types/background";
|
|
3
4
|
export declare function getBackgroundStyles({ background, colorMode, }: {
|
|
4
|
-
background?:
|
|
5
|
+
background?: Background;
|
|
5
6
|
colorMode: ColorMode;
|
|
6
7
|
}): string;
|
|
7
8
|
export declare function getBackgroundImageSource(paywallData: PaywallData, colorMode: ColorMode): string | undefined;
|
|
@@ -15,10 +15,10 @@ export function getBackgroundStyles({ background, colorMode, }) {
|
|
|
15
15
|
return stringifyStyles(prefixedStyles);
|
|
16
16
|
}
|
|
17
17
|
export function getBackgroundImageSource(paywallData, colorMode) {
|
|
18
|
-
|
|
18
|
+
const { background } = paywallData.components_config.base;
|
|
19
|
+
if (background?.type !== "image") {
|
|
19
20
|
return "";
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
backgroundObject.value[DEFAULT_COLOR_MODE]?.original);
|
|
21
|
+
}
|
|
22
|
+
const { value } = background;
|
|
23
|
+
return value[colorMode]?.original ?? value[DEFAULT_COLOR_MODE]?.original;
|
|
24
24
|
}
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
2
|
import PurchaseButton from "./PurchaseButton.svelte";
|
|
4
3
|
import type { PurchaseState } from "../../data/state";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
4
|
+
import { localizationDecorator } from "../../stories/localization-decorator";
|
|
5
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
6
|
+
|
|
7
|
+
const defaultLocale = "en_US";
|
|
8
|
+
const text_lid = "6gpcQ4q6T8";
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
alert(action.type);
|
|
11
|
-
};
|
|
10
|
+
const purchaseState: PurchaseState = {};
|
|
12
11
|
|
|
13
12
|
const { Story } = defineMeta({
|
|
14
13
|
title: "Components/PurchaseButton",
|
|
15
14
|
component: PurchaseButton,
|
|
16
15
|
tags: ["autodocs"],
|
|
16
|
+
decorators: [
|
|
17
|
+
localizationDecorator({
|
|
18
|
+
defaultLocale,
|
|
19
|
+
localizations: {
|
|
20
|
+
[defaultLocale]: {
|
|
21
|
+
[text_lid]: "Continue",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
args: { purchaseState },
|
|
17
27
|
argTypes: {
|
|
18
28
|
stack: {
|
|
19
29
|
control: { type: "object" },
|
|
@@ -27,17 +37,6 @@
|
|
|
27
37
|
},
|
|
28
38
|
},
|
|
29
39
|
});
|
|
30
|
-
|
|
31
|
-
export const labelsData = {
|
|
32
|
-
en_US: {
|
|
33
|
-
"6gpcQ4q6T8": "Continue",
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const purchaseState: PurchaseState = {
|
|
37
|
-
colorMode: DEFAULT_COLOR_MODE,
|
|
38
|
-
locale: "en_US",
|
|
39
|
-
defaultLocale: "en_US",
|
|
40
|
-
};
|
|
41
40
|
</script>
|
|
42
41
|
|
|
43
42
|
<!-- Default button -->
|
|
@@ -55,6 +54,15 @@
|
|
|
55
54
|
value: "#a229f3",
|
|
56
55
|
},
|
|
57
56
|
},
|
|
57
|
+
background: {
|
|
58
|
+
type: "color",
|
|
59
|
+
value: {
|
|
60
|
+
light: {
|
|
61
|
+
type: "hex",
|
|
62
|
+
value: "#a229f3",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
58
66
|
components: [
|
|
59
67
|
{
|
|
60
68
|
purchaseState,
|
|
@@ -65,7 +73,6 @@
|
|
|
65
73
|
value: "#ffffff",
|
|
66
74
|
},
|
|
67
75
|
},
|
|
68
|
-
labels: labelsData,
|
|
69
76
|
components: [],
|
|
70
77
|
font_name: null,
|
|
71
78
|
font_size: "heading_m",
|
|
@@ -95,15 +102,15 @@
|
|
|
95
102
|
value: null,
|
|
96
103
|
},
|
|
97
104
|
},
|
|
98
|
-
text_lid
|
|
105
|
+
text_lid,
|
|
99
106
|
type: "text",
|
|
100
107
|
},
|
|
101
108
|
],
|
|
102
109
|
dimension: {
|
|
103
|
-
alignment: "top",
|
|
104
|
-
distribution: "space_between",
|
|
105
110
|
type: "vertical",
|
|
106
|
-
|
|
111
|
+
alignment: "center",
|
|
112
|
+
distribution: "center",
|
|
113
|
+
},
|
|
107
114
|
id: "pbvAUBvilP",
|
|
108
115
|
margin: {
|
|
109
116
|
bottom: 16,
|
|
@@ -118,6 +125,8 @@
|
|
|
118
125
|
top: 16,
|
|
119
126
|
trailing: 16,
|
|
120
127
|
},
|
|
128
|
+
border: null,
|
|
129
|
+
shadow: null,
|
|
121
130
|
shape: {
|
|
122
131
|
corners: {
|
|
123
132
|
bottom_leading: 8,
|
|
@@ -137,10 +146,7 @@
|
|
|
137
146
|
},
|
|
138
147
|
spacing: 8,
|
|
139
148
|
type: "stack",
|
|
140
|
-
labels: labelsData,
|
|
141
149
|
},
|
|
142
|
-
labels: labelsData,
|
|
143
150
|
type: "purchase_button",
|
|
144
|
-
onAction,
|
|
145
151
|
}}
|
|
146
152
|
/>
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import PurchaseButton from "./PurchaseButton.svelte";
|
|
2
|
-
export declare const labelsData: {
|
|
3
|
-
en_US: {
|
|
4
|
-
"6gpcQ4q6T8": string;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
2
|
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
8
3
|
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
4
|
$$bindings?: Bindings;
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { getPurchaseButtonStyles } from "./purchase-button-utils";
|
|
3
3
|
import Stack from "../stack/Stack.svelte";
|
|
4
4
|
import { ButtonDeprecated } from "../../index";
|
|
5
|
-
import {
|
|
5
|
+
import { getPaywallContext } from "../../stores/paywall";
|
|
6
|
+
import type { PurchaseButtonProps } from "../../types/components/purchase-button";
|
|
6
7
|
|
|
7
8
|
const {
|
|
8
9
|
stack,
|
|
9
10
|
labels,
|
|
10
|
-
onAction,
|
|
11
11
|
purchaseState,
|
|
12
|
-
variableDictionary,
|
|
13
12
|
zStackChildStyles,
|
|
14
13
|
...restProps
|
|
15
14
|
}: PurchaseButtonProps = $props();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
15
|
+
|
|
16
|
+
const { onPurchase } = getPaywallContext();
|
|
19
17
|
|
|
20
18
|
const buttonStyles = $derived(
|
|
21
19
|
getPurchaseButtonStyles({
|
|
22
20
|
stack,
|
|
23
21
|
labels,
|
|
24
|
-
onAction,
|
|
25
22
|
purchaseState,
|
|
26
|
-
variableDictionary,
|
|
27
23
|
zStackChildStyles,
|
|
28
24
|
...restProps,
|
|
29
25
|
}),
|
|
@@ -31,11 +27,11 @@
|
|
|
31
27
|
</script>
|
|
32
28
|
|
|
33
29
|
<ButtonDeprecated
|
|
34
|
-
onclick={
|
|
30
|
+
onclick={onPurchase}
|
|
35
31
|
class="rc-pw-purchase-button"
|
|
36
32
|
style={buttonStyles}
|
|
37
33
|
>
|
|
38
|
-
<Stack {...stack} {labels} {purchaseState}
|
|
34
|
+
<Stack {...stack} {labels} {purchaseState} />
|
|
39
35
|
</ButtonDeprecated>
|
|
40
36
|
|
|
41
37
|
<style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PurchaseButtonProps } from "../../
|
|
1
|
+
import type { PurchaseButtonProps } from "../../types/components/purchase-button";
|
|
2
2
|
declare const PurchaseButton: import("svelte").Component<PurchaseButtonProps, {}, "">;
|
|
3
3
|
type PurchaseButton = ReturnType<typeof PurchaseButton>;
|
|
4
4
|
export default PurchaseButton;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PurchaseButtonProps } from "../../
|
|
1
|
+
import type { PurchaseButtonProps } from "../../types/components/purchase-button";
|
|
2
2
|
export declare function getPurchaseButtonStyles({ stack, zStackChildStyles, }: PurchaseButtonProps): string;
|