@revenuecat/purchases-ui-js 3.5.2 → 3.5.3
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/express-purchase-button/ExpressPurchaseButton.stories.svelte +368 -0
- package/dist/components/express-purchase-button/ExpressPurchaseButton.stories.svelte.d.ts +19 -0
- package/dist/components/express-purchase-button/ExpressPurchaseButton.svelte +43 -0
- package/dist/components/express-purchase-button/ExpressPurchaseButton.svelte.d.ts +4 -0
- package/dist/components/options/InputOption.svelte +5 -2
- package/dist/components/paywall/Node.svelte +6 -0
- package/dist/components/paywall/Paywall.stories.svelte +46 -2
- package/dist/components/paywall/Paywall.svelte +2 -2
- package/dist/components/paywall/Paywall.svelte.d.ts +2 -2
- package/dist/components/paywall/fixtures/express-purchase-button-paywall.d.ts +1786 -0
- package/dist/components/paywall/fixtures/express-purchase-button-paywall.js +1819 -0
- package/dist/components/purchase-button/PurchaseButton.svelte +2 -145
- package/dist/components/skeleton-loader/SkeletonLoader.svelte +127 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte.d.ts +8 -0
- package/dist/components/stack/Stack.svelte +2 -2
- package/dist/components/wallet-button/WalletButton.svelte +75 -0
- package/dist/components/wallet-button/WalletButton.svelte.d.ts +8 -0
- package/dist/stores/paywall.d.ts +3 -2
- package/dist/stories/paywall-decorator.d.ts +3 -3
- package/dist/stories/paywall-decorator.js +5 -5
- package/dist/stories/selected-package-id-decorator.d.ts +2 -0
- package/dist/stories/selected-package-id-decorator.js +12 -0
- package/dist/types/component.d.ts +4 -1
- package/dist/types/components/express-purchase-button-props.d.ts +8 -0
- package/dist/types/components/express-purchase-button-props.js +1 -0
- package/dist/types/components/skeleton-loader-props.d.ts +13 -0
- package/dist/types/components/skeleton-loader-props.js +1 -0
- package/dist/types/components/wallet-button.d.ts +14 -0
- package/dist/types/components/wallet-button.js +1 -0
- package/package.json +1 -1
|
@@ -2,159 +2,16 @@
|
|
|
2
2
|
import Stack from "../stack/Stack.svelte";
|
|
3
3
|
import { getPaywallContext } from "../../stores/paywall";
|
|
4
4
|
import type { PurchaseButtonProps } from "../../types/components/purchase-button";
|
|
5
|
-
import { getSelectedStateContext } from "../../stores/selected";
|
|
6
|
-
import { getActiveStateProps } from "../../utils/style-utils";
|
|
7
|
-
import {
|
|
8
|
-
type CSS,
|
|
9
|
-
css,
|
|
10
|
-
mapBorder,
|
|
11
|
-
mapBorderRadius,
|
|
12
|
-
mapShadow,
|
|
13
|
-
mapSize,
|
|
14
|
-
mapSpacing,
|
|
15
|
-
px,
|
|
16
|
-
} from "../../utils/base-utils";
|
|
17
|
-
import { mapDimension } from "../stack/stack-utils";
|
|
18
|
-
import type { StackProps } from "../../types/components/stack";
|
|
19
|
-
import { DEFAULT_SPACING } from "../../utils/constants";
|
|
20
|
-
import { getColorModeContext } from "../../stores/color-mode";
|
|
21
|
-
import { onMount } from "svelte";
|
|
22
5
|
|
|
23
6
|
const props: PurchaseButtonProps = $props();
|
|
24
7
|
const { stack } = props;
|
|
25
8
|
|
|
26
|
-
const { onPurchase
|
|
27
|
-
getPaywallContext();
|
|
28
|
-
|
|
29
|
-
const stackProps: StackProps & { style?: CSS } = { ...stack };
|
|
30
|
-
const selectedState = getSelectedStateContext();
|
|
31
|
-
const { size, dimension, spacing, margin, border, shape, shadow } =
|
|
32
|
-
$derived.by(() => {
|
|
33
|
-
return {
|
|
34
|
-
...stackProps,
|
|
35
|
-
...getActiveStateProps($selectedState, stackProps.overrides),
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const minDistanceBetweenPurchaseButtons = 10;
|
|
40
|
-
const maxWaitTimeBeforeClosingSkeleton = 3000;
|
|
41
|
-
|
|
42
|
-
const getColorMode = getColorModeContext();
|
|
43
|
-
const colorMode = $derived(getColorMode());
|
|
44
|
-
|
|
45
|
-
const stackLayoutRules = $derived({
|
|
46
|
-
...stackProps.style,
|
|
47
|
-
display: "flex",
|
|
48
|
-
position: "relative",
|
|
49
|
-
width: mapSize(size.width),
|
|
50
|
-
height: mapSize(size.height),
|
|
51
|
-
...mapDimension(dimension),
|
|
52
|
-
gap: px(spacing),
|
|
53
|
-
margin: mapSpacing({
|
|
54
|
-
...(margin
|
|
55
|
-
? {
|
|
56
|
-
...margin,
|
|
57
|
-
bottom: Math.max(margin.bottom, minDistanceBetweenPurchaseButtons),
|
|
58
|
-
}
|
|
59
|
-
: {
|
|
60
|
-
...DEFAULT_SPACING,
|
|
61
|
-
bottom: minDistanceBetweenPurchaseButtons,
|
|
62
|
-
}),
|
|
63
|
-
}),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
const stackStyle = $derived(css(stackLayoutRules));
|
|
67
|
-
|
|
68
|
-
const loaderStyle = $derived(
|
|
69
|
-
css({
|
|
70
|
-
...stackLayoutRules,
|
|
71
|
-
border: mapBorder(colorMode, border),
|
|
72
|
-
"border-radius": mapBorderRadius(shape),
|
|
73
|
-
"box-shadow": mapShadow(colorMode, shadow),
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
9
|
+
const { onPurchase } = getPaywallContext();
|
|
76
10
|
|
|
77
11
|
const onclick = () => {
|
|
78
12
|
const actionId = props.triggers?.on_purchase_press;
|
|
79
13
|
onPurchase(actionId);
|
|
80
14
|
};
|
|
81
|
-
|
|
82
|
-
let shouldShowWalletSkeleton = $state(!!walletButtonRender);
|
|
83
|
-
const onWalletButtonReady = () => {
|
|
84
|
-
shouldShowWalletSkeleton = false;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
onMount(() => {
|
|
88
|
-
setTimeout(() => {
|
|
89
|
-
shouldShowWalletSkeleton = false;
|
|
90
|
-
}, maxWaitTimeBeforeClosingSkeleton);
|
|
91
|
-
});
|
|
92
15
|
</script>
|
|
93
16
|
|
|
94
|
-
{
|
|
95
|
-
<div style={stackStyle}>
|
|
96
|
-
<div
|
|
97
|
-
style="flex-grow: 1; width:100%;"
|
|
98
|
-
use:walletButtonRender={{
|
|
99
|
-
selectedPackageId: $selectedPackageId,
|
|
100
|
-
onReady: onWalletButtonReady,
|
|
101
|
-
}}
|
|
102
|
-
></div>
|
|
103
|
-
</div>
|
|
104
|
-
{/if}
|
|
105
|
-
|
|
106
|
-
{#if shouldShowWalletSkeleton}
|
|
107
|
-
<div class="wallet-skeleton" style={loaderStyle} aria-hidden="true">
|
|
108
|
-
|
|
109
|
-
</div>
|
|
110
|
-
{:else}
|
|
111
|
-
<Stack {...stack} {onclick} />
|
|
112
|
-
{/if}
|
|
113
|
-
|
|
114
|
-
<style>
|
|
115
|
-
.wallet-skeleton {
|
|
116
|
-
position: relative;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
border-radius: 9999px;
|
|
119
|
-
background-color: rgba(128, 128, 128, 0.16);
|
|
120
|
-
backdrop-filter: blur(18px);
|
|
121
|
-
min-height: 48px;
|
|
122
|
-
content: " ";
|
|
123
|
-
flex-grow: 1;
|
|
124
|
-
width: 100%;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.wallet-skeleton::before {
|
|
128
|
-
content: "";
|
|
129
|
-
position: absolute;
|
|
130
|
-
inset: 0;
|
|
131
|
-
background: linear-gradient(
|
|
132
|
-
135deg,
|
|
133
|
-
rgba(255, 255, 255, 0.2),
|
|
134
|
-
rgba(255, 255, 255, 0.01)
|
|
135
|
-
);
|
|
136
|
-
opacity: 0.9;
|
|
137
|
-
mix-blend-mode: screen;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.wallet-skeleton::after {
|
|
141
|
-
content: "";
|
|
142
|
-
position: absolute;
|
|
143
|
-
inset: 0;
|
|
144
|
-
transform: translateX(-100%);
|
|
145
|
-
background: linear-gradient(
|
|
146
|
-
120deg,
|
|
147
|
-
transparent 0%,
|
|
148
|
-
rgba(255, 255, 255, 0.6) 20%,
|
|
149
|
-
transparent 40%
|
|
150
|
-
);
|
|
151
|
-
opacity: 0.8;
|
|
152
|
-
animation: wallet-skeleton-shimmer 1.4s ease-in-out infinite;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
@keyframes wallet-skeleton-shimmer {
|
|
156
|
-
100% {
|
|
157
|
-
transform: translateX(100%);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
</style>
|
|
17
|
+
<Stack {...stack} {onclick} />
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
type CSS,
|
|
4
|
+
css,
|
|
5
|
+
mapBorder,
|
|
6
|
+
mapBorderRadius,
|
|
7
|
+
mapShadow,
|
|
8
|
+
mapSize,
|
|
9
|
+
mapSpacing,
|
|
10
|
+
px,
|
|
11
|
+
} from "../../utils/base-utils";
|
|
12
|
+
import { mapDimension } from "../stack/stack-utils";
|
|
13
|
+
import { DEFAULT_SPACING } from "../../utils/constants";
|
|
14
|
+
import { getColorModeContext } from "../../stores/color-mode";
|
|
15
|
+
import type { SkeletonLoaderProps } from "../../types/components/skeleton-loader-props";
|
|
16
|
+
|
|
17
|
+
const stackProps: SkeletonLoaderProps & { style?: CSS } = $props();
|
|
18
|
+
|
|
19
|
+
const fallbackSize = {
|
|
20
|
+
width: { type: "fill" },
|
|
21
|
+
height: { type: "fit" },
|
|
22
|
+
} as const;
|
|
23
|
+
const fallbackDimension = {
|
|
24
|
+
type: "vertical",
|
|
25
|
+
alignment: "center",
|
|
26
|
+
distribution: "center",
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
const { size, dimension, spacing, margin, border, shape, shadow, style } =
|
|
30
|
+
$derived.by(() => {
|
|
31
|
+
return {
|
|
32
|
+
size: stackProps.size ?? fallbackSize,
|
|
33
|
+
dimension: stackProps.dimension ?? fallbackDimension,
|
|
34
|
+
spacing: stackProps.spacing ?? 0,
|
|
35
|
+
margin: stackProps.margin ?? DEFAULT_SPACING,
|
|
36
|
+
border: stackProps.border ?? null,
|
|
37
|
+
shape: stackProps.shape ?? null,
|
|
38
|
+
shadow: stackProps.shadow ?? null,
|
|
39
|
+
style: stackProps.style,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const minDistanceBetweenPurchaseButtons = 10;
|
|
44
|
+
|
|
45
|
+
const getColorMode = getColorModeContext();
|
|
46
|
+
const colorMode = $derived(getColorMode());
|
|
47
|
+
|
|
48
|
+
const stackLayoutRules = $derived({
|
|
49
|
+
...style,
|
|
50
|
+
display: "flex",
|
|
51
|
+
position: "relative",
|
|
52
|
+
width: mapSize(size.width),
|
|
53
|
+
height: mapSize(size.height),
|
|
54
|
+
...mapDimension(dimension),
|
|
55
|
+
gap: px(spacing),
|
|
56
|
+
margin: mapSpacing({
|
|
57
|
+
...(margin
|
|
58
|
+
? {
|
|
59
|
+
...margin,
|
|
60
|
+
bottom: Math.max(margin.bottom, minDistanceBetweenPurchaseButtons),
|
|
61
|
+
}
|
|
62
|
+
: {
|
|
63
|
+
...DEFAULT_SPACING,
|
|
64
|
+
bottom: minDistanceBetweenPurchaseButtons,
|
|
65
|
+
}),
|
|
66
|
+
}),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const loaderStyle = $derived(
|
|
70
|
+
css({
|
|
71
|
+
...stackLayoutRules,
|
|
72
|
+
border: mapBorder(colorMode, border),
|
|
73
|
+
"border-radius": mapBorderRadius(shape),
|
|
74
|
+
"box-shadow": mapShadow(colorMode, shadow),
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<div class="wallet-skeleton" style={loaderStyle} aria-hidden={true}> </div>
|
|
80
|
+
|
|
81
|
+
<style>
|
|
82
|
+
.wallet-skeleton {
|
|
83
|
+
position: relative;
|
|
84
|
+
overflow: hidden;
|
|
85
|
+
border-radius: 9999px;
|
|
86
|
+
background-color: rgba(128, 128, 128, 0.16);
|
|
87
|
+
backdrop-filter: blur(18px);
|
|
88
|
+
min-height: 48px;
|
|
89
|
+
content: " ";
|
|
90
|
+
flex-grow: 1;
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.wallet-skeleton::before {
|
|
95
|
+
content: "";
|
|
96
|
+
position: absolute;
|
|
97
|
+
inset: 0;
|
|
98
|
+
background: linear-gradient(
|
|
99
|
+
135deg,
|
|
100
|
+
rgba(255, 255, 255, 0.2),
|
|
101
|
+
rgba(255, 255, 255, 0.01)
|
|
102
|
+
);
|
|
103
|
+
opacity: 0.9;
|
|
104
|
+
mix-blend-mode: screen;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.wallet-skeleton::after {
|
|
108
|
+
content: "";
|
|
109
|
+
position: absolute;
|
|
110
|
+
inset: 0;
|
|
111
|
+
transform: translateX(-100%);
|
|
112
|
+
background: linear-gradient(
|
|
113
|
+
120deg,
|
|
114
|
+
transparent 0%,
|
|
115
|
+
rgba(255, 255, 255, 0.6) 20%,
|
|
116
|
+
transparent 40%
|
|
117
|
+
);
|
|
118
|
+
opacity: 0.8;
|
|
119
|
+
animation: wallet-skeleton-shimmer 1.4s ease-in-out infinite;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@keyframes wallet-skeleton-shimmer {
|
|
123
|
+
100% {
|
|
124
|
+
transform: translateX(100%);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CSS } from "../../utils/base-utils";
|
|
2
|
+
import type { SkeletonLoaderProps } from "../../types/components/skeleton-loader-props";
|
|
3
|
+
type $$ComponentProps = SkeletonLoaderProps & {
|
|
4
|
+
style?: CSS;
|
|
5
|
+
};
|
|
6
|
+
declare const SkeletonLoader: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type SkeletonLoader = ReturnType<typeof SkeletonLoader>;
|
|
8
|
+
export default SkeletonLoader;
|
|
@@ -59,8 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
const stackStyle = $derived(
|
|
61
61
|
css({
|
|
62
|
-
|
|
63
|
-
display: "flex",
|
|
62
|
+
display: props.visible === false ? "none" : "flex",
|
|
64
63
|
position: "relative",
|
|
65
64
|
width: mapSize(size.width),
|
|
66
65
|
height: mapSize(size.height),
|
|
@@ -72,6 +71,7 @@
|
|
|
72
71
|
border: mapBorder(colorMode, border),
|
|
73
72
|
"border-radius": mapBorderRadius(shape),
|
|
74
73
|
"box-shadow": mapShadow(colorMode, shadow),
|
|
74
|
+
...style,
|
|
75
75
|
}),
|
|
76
76
|
);
|
|
77
77
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getPaywallContext } from "../../stores/paywall";
|
|
3
|
+
import {
|
|
4
|
+
type CSS,
|
|
5
|
+
css,
|
|
6
|
+
mapSize,
|
|
7
|
+
mapSpacing,
|
|
8
|
+
px,
|
|
9
|
+
} from "../../utils/base-utils";
|
|
10
|
+
import { mapDimension } from "../stack/stack-utils";
|
|
11
|
+
import { DEFAULT_SPACING } from "../../utils/constants";
|
|
12
|
+
import type { WalletButtonProps } from "../../types/components/wallet-button";
|
|
13
|
+
|
|
14
|
+
const { walletButtonRender, onWalletButtonReady, selectedPackageId } =
|
|
15
|
+
getPaywallContext();
|
|
16
|
+
|
|
17
|
+
const props: WalletButtonProps & { style?: CSS } = $props();
|
|
18
|
+
|
|
19
|
+
const fallbackSize = {
|
|
20
|
+
width: { type: "fill" },
|
|
21
|
+
height: { type: "fit" },
|
|
22
|
+
} as const;
|
|
23
|
+
const fallbackDimension = {
|
|
24
|
+
type: "vertical",
|
|
25
|
+
alignment: "center",
|
|
26
|
+
distribution: "center",
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
const { size, dimension, spacing, margin, style, border, shape, shadow } =
|
|
30
|
+
$derived.by(() => {
|
|
31
|
+
return {
|
|
32
|
+
size: props.size ?? fallbackSize,
|
|
33
|
+
dimension: props.dimension ?? fallbackDimension,
|
|
34
|
+
spacing: props.spacing ?? 0,
|
|
35
|
+
margin: props.margin ?? DEFAULT_SPACING,
|
|
36
|
+
border: props.border ?? null,
|
|
37
|
+
shape: props.shape ?? null,
|
|
38
|
+
shadow: props.shadow ?? null,
|
|
39
|
+
style: props.style,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const stackLayoutRules = $derived({
|
|
44
|
+
...style,
|
|
45
|
+
display: "flex",
|
|
46
|
+
position: "relative",
|
|
47
|
+
width: mapSize(size.width),
|
|
48
|
+
height: mapSize(size.height),
|
|
49
|
+
...mapDimension(dimension),
|
|
50
|
+
gap: px(spacing),
|
|
51
|
+
margin: mapSpacing({
|
|
52
|
+
...(margin
|
|
53
|
+
? {
|
|
54
|
+
...margin,
|
|
55
|
+
}
|
|
56
|
+
: {
|
|
57
|
+
...DEFAULT_SPACING,
|
|
58
|
+
}),
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const stackStyle = $derived(css(stackLayoutRules));
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
{#if walletButtonRender && $selectedPackageId}
|
|
66
|
+
<div style={stackStyle}>
|
|
67
|
+
<div
|
|
68
|
+
style="flex-grow: 1; width:100%;"
|
|
69
|
+
use:walletButtonRender={{
|
|
70
|
+
selectedPackageId: $selectedPackageId,
|
|
71
|
+
onReady: props.onWalletButtonReady ?? onWalletButtonReady,
|
|
72
|
+
}}
|
|
73
|
+
></div>
|
|
74
|
+
</div>
|
|
75
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CSS } from "../../utils/base-utils";
|
|
2
|
+
import type { WalletButtonProps } from "../../types/components/wallet-button";
|
|
3
|
+
type $$ComponentProps = WalletButtonProps & {
|
|
4
|
+
style?: CSS;
|
|
5
|
+
};
|
|
6
|
+
declare const WalletButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type WalletButton = ReturnType<typeof WalletButton>;
|
|
8
|
+
export default WalletButton;
|
package/dist/stores/paywall.d.ts
CHANGED
|
@@ -9,14 +9,15 @@ type PaywallContext = Readonly<{
|
|
|
9
9
|
onPurchase: (actionId?: string) => void;
|
|
10
10
|
walletButtonRender?: (node: HTMLElement, params: {
|
|
11
11
|
selectedPackageId: string;
|
|
12
|
-
onReady?: () => void;
|
|
12
|
+
onReady?: (walletButtonAvailable?: boolean) => void;
|
|
13
13
|
}) => {
|
|
14
14
|
destroy?: () => void;
|
|
15
15
|
update?: (params: {
|
|
16
16
|
selectedPackageId: string;
|
|
17
|
-
onReady?: () => void;
|
|
17
|
+
onReady?: (walletButtonAvailable?: boolean) => void;
|
|
18
18
|
}) => void;
|
|
19
19
|
};
|
|
20
|
+
onWalletButtonReady?: (walletButtonAvailable?: boolean) => void;
|
|
20
21
|
onButtonAction: (action: Action, actionId?: string) => void;
|
|
21
22
|
uiConfig: UIConfig;
|
|
22
23
|
hideBackButtons: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DecoratorFunction, Renderer } from "storybook/internal/csf";
|
|
2
2
|
export declare function paywallDecorator<TRenderer extends Renderer, TArgs>(walletButtonRender?: (node: HTMLElement, params: {
|
|
3
3
|
selectedPackageId: string;
|
|
4
|
-
onReady?: () => void;
|
|
4
|
+
onReady?: (walletButtonAvailable?: boolean) => void;
|
|
5
5
|
}) => {
|
|
6
6
|
destroy?: () => void;
|
|
7
7
|
update?: (updateParams: {
|
|
8
8
|
selectedPackageId: string;
|
|
9
|
-
onReady?: () => void;
|
|
9
|
+
onReady?: (walletButtonAvailable?: boolean) => void;
|
|
10
10
|
}) => void;
|
|
11
|
-
}): DecoratorFunction<TRenderer, TArgs>;
|
|
11
|
+
}, selectedPackageId?: string): DecoratorFunction<TRenderer, TArgs>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { setPaywallContext } from "../stores/paywall";
|
|
2
2
|
import { readable, writable } from "svelte/store";
|
|
3
|
-
export function paywallDecorator(walletButtonRender) {
|
|
3
|
+
export function paywallDecorator(walletButtonRender, selectedPackageId) {
|
|
4
4
|
return (Story) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const selectedPackageIdWritable = writable(selectedPackageId);
|
|
6
|
+
selectedPackageIdWritable.subscribe((packageId) => {
|
|
7
7
|
if (packageId !== undefined) {
|
|
8
|
-
window.alert(`Selected package ${packageId}`);
|
|
8
|
+
//window.alert(`Selected package ${packageId}`);
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const emptyUiConfig = {
|
|
@@ -14,7 +14,7 @@ export function paywallDecorator(walletButtonRender) {
|
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
setPaywallContext({
|
|
17
|
-
selectedPackageId,
|
|
17
|
+
selectedPackageId: selectedPackageIdWritable,
|
|
18
18
|
variablesPerPackage: readable(undefined),
|
|
19
19
|
infoPerPackage: readable(undefined),
|
|
20
20
|
onPurchase: () => window.alert("Purchase clicked"),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { writable } from "svelte/store";
|
|
2
|
+
import { getPaywallContext, setPaywallContext } from "../stores/paywall";
|
|
3
|
+
export function selectedPackageIdDecorator(selectedPackageId) {
|
|
4
|
+
const paywallContext = getPaywallContext();
|
|
5
|
+
return (Story) => {
|
|
6
|
+
setPaywallContext({
|
|
7
|
+
...paywallContext,
|
|
8
|
+
selectedPackageId: writable(selectedPackageId),
|
|
9
|
+
});
|
|
10
|
+
return Story();
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -13,4 +13,7 @@ import type { TabControlButtonProps, TabControlProps, TabControlToggleProps, Tab
|
|
|
13
13
|
import type { TextNodeProps } from "./components/text";
|
|
14
14
|
import type { TimelineProps } from "./components/timeline";
|
|
15
15
|
import type { VideoProps } from "./components/video";
|
|
16
|
-
|
|
16
|
+
import type { WalletButtonProps } from "./components/wallet-button";
|
|
17
|
+
import type { SkeletonLoaderProps } from "./components/skeleton-loader-props";
|
|
18
|
+
import type { ExpressPurchaseButtonProps } from "./components/express-purchase-button-props";
|
|
19
|
+
export type Component = ButtonProps | CarouselProps | CountdownProps | ExpressPurchaseButtonProps | FooterProps | IconProps | ImageProps | InputMultipleChoiceProps | InputOptionProps | InputSingleChoiceProps | PackageProps | PurchaseButtonProps | RedemptionButtonProps | SkeletonLoaderProps | StackProps | TabControlButtonProps | TabControlToggleProps | TabControlProps | TabsProps | TextNodeProps | TimelineProps | WalletButtonProps | VideoProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseComponent } from "../base";
|
|
2
|
+
import type { StackProps } from "./stack";
|
|
3
|
+
export interface ExpressPurchaseButtonProps extends BaseComponent {
|
|
4
|
+
type: "express_purchase_button";
|
|
5
|
+
wallet_unknown_stack: StackProps;
|
|
6
|
+
wallet_available_stack: StackProps;
|
|
7
|
+
wallet_unavailable_stack: StackProps;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { BaseComponent } from "../base";
|
|
2
|
+
import type { BorderType, ShadowType, ShapeType, SizeType, Spacing } from "../..";
|
|
3
|
+
import type { Dimension } from "../alignment";
|
|
4
|
+
export interface SkeletonLoaderProps extends BaseComponent {
|
|
5
|
+
type: "skeleton_loader";
|
|
6
|
+
size?: SizeType;
|
|
7
|
+
dimension?: Dimension;
|
|
8
|
+
spacing?: number;
|
|
9
|
+
margin?: Spacing;
|
|
10
|
+
border?: BorderType | null;
|
|
11
|
+
shape?: ShapeType | null;
|
|
12
|
+
shadow?: ShadowType | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BaseComponent } from "../base";
|
|
2
|
+
import type { BorderType, ShadowType, ShapeType, SizeType, Spacing } from "../..";
|
|
3
|
+
import type { Dimension } from "../alignment";
|
|
4
|
+
export interface WalletButtonProps extends BaseComponent {
|
|
5
|
+
type: "wallet_button";
|
|
6
|
+
size?: SizeType;
|
|
7
|
+
dimension?: Dimension;
|
|
8
|
+
spacing?: number;
|
|
9
|
+
margin?: Spacing;
|
|
10
|
+
border?: BorderType | null;
|
|
11
|
+
shape?: ShapeType | null;
|
|
12
|
+
onWalletButtonReady?: (walletButtonAvailable?: boolean) => void;
|
|
13
|
+
shadow?: ShadowType | null;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|