@revenuecat/purchases-ui-js 0.0.8
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/LICENSE +21 -0
- package/README.md +11 -0
- package/dist/components/button/Button.svelte +33 -0
- package/dist/components/button/Button.svelte.d.ts +8 -0
- package/dist/components/button/ButtonNode.stories.svelte +204 -0
- package/dist/components/button/ButtonNode.stories.svelte.d.ts +27 -0
- package/dist/components/button/ButtonNode.svelte +15 -0
- package/dist/components/button/ButtonNode.svelte.d.ts +3 -0
- package/dist/components/footer/Footer.stories.svelte +237 -0
- package/dist/components/footer/Footer.stories.svelte.d.ts +25 -0
- package/dist/components/footer/Footer.svelte +11 -0
- package/dist/components/footer/Footer.svelte.d.ts +3 -0
- package/dist/components/image/Image.stories.svelte +165 -0
- package/dist/components/image/Image.stories.svelte.d.ts +19 -0
- package/dist/components/image/Image.svelte +45 -0
- package/dist/components/image/Image.svelte.d.ts +3 -0
- package/dist/components/image/image-utils.d.ts +20 -0
- package/dist/components/image/image-utils.js +19 -0
- package/dist/components/package/Package.stories.svelte +243 -0
- package/dist/components/package/Package.stories.svelte.d.ts +25 -0
- package/dist/components/package/Package.svelte +39 -0
- package/dist/components/package/Package.svelte.d.ts +3 -0
- package/dist/components/paywall/Node.svelte +55 -0
- package/dist/components/paywall/Node.svelte.d.ts +9 -0
- package/dist/components/paywall/Paywall.stories.svelte +24 -0
- package/dist/components/paywall/Paywall.stories.svelte.d.ts +19 -0
- package/dist/components/paywall/Paywall.svelte +122 -0
- package/dist/components/paywall/Paywall.svelte.d.ts +6 -0
- package/dist/components/paywall/global-styles.css +9 -0
- package/dist/components/purchase-button/PurchaseButton.stories.svelte +133 -0
- package/dist/components/purchase-button/PurchaseButton.stories.svelte.d.ts +24 -0
- package/dist/components/purchase-button/PurchaseButton.svelte +28 -0
- package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +3 -0
- package/dist/components/stack/Stack.stories.svelte +306 -0
- package/dist/components/stack/Stack.stories.svelte.d.ts +19 -0
- package/dist/components/stack/Stack.svelte +61 -0
- package/dist/components/stack/Stack.svelte.d.ts +3 -0
- package/dist/components/stack/stack-utils.d.ts +29 -0
- package/dist/components/stack/stack-utils.js +26 -0
- package/dist/components/text/Text.stories.svelte +101 -0
- package/dist/components/text/Text.stories.svelte.d.ts +19 -0
- package/dist/components/text/Text.svelte +40 -0
- package/dist/components/text/Text.svelte.d.ts +3 -0
- package/dist/components/text/text-utils.d.ts +20 -0
- package/dist/components/text/text-utils.js +34 -0
- package/dist/data/entities.d.ts +139 -0
- package/dist/data/entities.js +1 -0
- package/dist/data/state.d.ts +3 -0
- package/dist/data/state.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/stores/theme.d.ts +1 -0
- package/dist/stores/theme.js +17 -0
- package/dist/stories/fixtures.d.ts +12 -0
- package/dist/stories/fixtures.js +6855 -0
- package/dist/stories/meta-templates.d.ts +13 -0
- package/dist/stories/meta-templates.js +156 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.js +61 -0
- package/dist/utils.d.ts +93 -0
- package/dist/utils.js +227 -0
- package/package.json +91 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { StackProps } from "../../data/entities";
|
|
3
|
+
import Node from "../paywall/Node.svelte";
|
|
4
|
+
import { getStackComponentStyles } from "./stack-utils";
|
|
5
|
+
import { stringifyStyles } from "../../utils";
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
id,
|
|
9
|
+
components,
|
|
10
|
+
labels,
|
|
11
|
+
onAction,
|
|
12
|
+
purchaseState,
|
|
13
|
+
...restProps
|
|
14
|
+
}: StackProps = $props();
|
|
15
|
+
|
|
16
|
+
const stackStyles = $derived(
|
|
17
|
+
stringifyStyles(
|
|
18
|
+
getStackComponentStyles({
|
|
19
|
+
id,
|
|
20
|
+
components,
|
|
21
|
+
labels,
|
|
22
|
+
onAction,
|
|
23
|
+
purchaseState,
|
|
24
|
+
...restProps,
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<div {id} style={stackStyles} class="stack">
|
|
31
|
+
{#each components as component}
|
|
32
|
+
<Node nodeData={component} {labels} {onAction} {purchaseState} />
|
|
33
|
+
{/each}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.stack {
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-direction: var(--direction, unset);
|
|
41
|
+
width: var(--width, unset);
|
|
42
|
+
height: var(--height, unset);
|
|
43
|
+
gap: var(--spacing, 0);
|
|
44
|
+
background-color: var(--background-color, unset);
|
|
45
|
+
border: var(--border, none);
|
|
46
|
+
border-radius: var(--border-radius, 0);
|
|
47
|
+
box-shadow: var(--shadow, none);
|
|
48
|
+
justify-content: var(--distribution, flex-start);
|
|
49
|
+
align-items: var(--alignment, flex-start);
|
|
50
|
+
padding-block-start: var(--padding-block-start, 0);
|
|
51
|
+
padding-inline-end: var(--padding-inline-end, 0);
|
|
52
|
+
padding-block-end: var(--padding-block-end, 0);
|
|
53
|
+
padding-inline-start: var(--padding-inline-start, 0);
|
|
54
|
+
margin-block-start: var(--margin-block-start, 0);
|
|
55
|
+
margin-inline-end: var(--margin-inline-end, 0);
|
|
56
|
+
margin-block-end: var(--margin-block-end, 0);
|
|
57
|
+
margin-inline-start: var(--margin-inline-start, 0);
|
|
58
|
+
flex: var(--flex, 0 1 auto);
|
|
59
|
+
align-self: center;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { StackProps } from "../../data/entities";
|
|
2
|
+
type StackStyleVariables = {
|
|
3
|
+
"--height": string;
|
|
4
|
+
"--width": string;
|
|
5
|
+
"--spacing": string;
|
|
6
|
+
"--direction": string;
|
|
7
|
+
"--alignment": string;
|
|
8
|
+
"--distribution": string;
|
|
9
|
+
"--margin-block-start": string;
|
|
10
|
+
"--margin-inline-end": string;
|
|
11
|
+
"--margin-block-end": string;
|
|
12
|
+
"--margin-inline-start": string;
|
|
13
|
+
"--padding-block-start": string;
|
|
14
|
+
"--padding-inline-end": string;
|
|
15
|
+
"--padding-block-end": string;
|
|
16
|
+
"--padding-inline-start": string;
|
|
17
|
+
"--background-color": string;
|
|
18
|
+
"--text-color": string;
|
|
19
|
+
"--border": string;
|
|
20
|
+
"--border-radius": string;
|
|
21
|
+
"--shadow": string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Generates comprehensive styles for stack components by combining component, dimension and size styles
|
|
25
|
+
* @param props - Stack component properties including background, spacing, size, border etc.
|
|
26
|
+
* @returns CSS style variables object with all stack-specific styles
|
|
27
|
+
*/
|
|
28
|
+
export declare const getStackComponentStyles: (props: StackProps) => StackStyleVariables;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getComponentStyles, getDimensionStyle, getSizeStyle, } from "../../utils";
|
|
2
|
+
/**
|
|
3
|
+
* Generates comprehensive styles for stack components by combining component, dimension and size styles
|
|
4
|
+
* @param props - Stack component properties including background, spacing, size, border etc.
|
|
5
|
+
* @returns CSS style variables object with all stack-specific styles
|
|
6
|
+
*/
|
|
7
|
+
export const getStackComponentStyles = (props) => {
|
|
8
|
+
const { background_color, margin, padding, spacing, size, border, shape, colorMode, shadow, dimension, } = props;
|
|
9
|
+
const componentStyles = getComponentStyles({
|
|
10
|
+
backgroundColor: background_color,
|
|
11
|
+
margin,
|
|
12
|
+
padding,
|
|
13
|
+
border,
|
|
14
|
+
colorMode,
|
|
15
|
+
shape,
|
|
16
|
+
shadow,
|
|
17
|
+
});
|
|
18
|
+
const dimensionStyles = getDimensionStyle(dimension);
|
|
19
|
+
const sizeStyles = getSizeStyle(size);
|
|
20
|
+
return {
|
|
21
|
+
...sizeStyles,
|
|
22
|
+
...dimensionStyles,
|
|
23
|
+
...componentStyles,
|
|
24
|
+
"--spacing": `${spacing || 0}px`,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from "@storybook/addon-svelte-csf";
|
|
3
|
+
import Text from "./Text.svelte";
|
|
4
|
+
import {
|
|
5
|
+
colorModeStoryMeta,
|
|
6
|
+
fontSizeStoryMeta,
|
|
7
|
+
fontWeightStoryMeta,
|
|
8
|
+
getColorStoryMeta,
|
|
9
|
+
getSpacingStoryMeta,
|
|
10
|
+
getTextControlStoryMeta,
|
|
11
|
+
horizontalAlignmentStoryMeta,
|
|
12
|
+
} from "../../stories/meta-templates";
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* Documentatino for this component can be found in https://www.notion.so/revenuecat/Text-e257cb046e104351861f8364ede617be?pvs=4
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const { Story } = defineMeta({
|
|
19
|
+
title: "Components/Text",
|
|
20
|
+
component: Text,
|
|
21
|
+
tags: ["autodocs"],
|
|
22
|
+
argTypes: {
|
|
23
|
+
name: getTextControlStoryMeta("Content of the text to render"),
|
|
24
|
+
font_name: getTextControlStoryMeta(
|
|
25
|
+
"Font family to be used, uses GoogleFonts API",
|
|
26
|
+
),
|
|
27
|
+
font_weight: fontWeightStoryMeta,
|
|
28
|
+
colorMode: colorModeStoryMeta,
|
|
29
|
+
font_size: fontSizeStoryMeta,
|
|
30
|
+
color: getColorStoryMeta("Text color object"),
|
|
31
|
+
background_color: getColorStoryMeta("Background color object"),
|
|
32
|
+
horizontal_alignment: horizontalAlignmentStoryMeta,
|
|
33
|
+
padding: getSpacingStoryMeta("Padding values in pixels"),
|
|
34
|
+
margin: getSpacingStoryMeta("Margin values in pixels"),
|
|
35
|
+
},
|
|
36
|
+
args: {
|
|
37
|
+
labels: { en_US: { lb123: "Test text" } },
|
|
38
|
+
text_lid: "lb123",
|
|
39
|
+
size: {
|
|
40
|
+
width: { type: "fill" },
|
|
41
|
+
height: { type: "fill" },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<!-- Default story -->
|
|
48
|
+
<Story name="Default" args={{ name: "hello world!" }} />
|
|
49
|
+
|
|
50
|
+
<!-- Font Weight text story -->
|
|
51
|
+
<Story
|
|
52
|
+
name="Font Weight"
|
|
53
|
+
args={{
|
|
54
|
+
font_weight: "bold",
|
|
55
|
+
text_style: "normal",
|
|
56
|
+
horizontal_alignment: "start",
|
|
57
|
+
name: "hello world!",
|
|
58
|
+
}}
|
|
59
|
+
/>
|
|
60
|
+
|
|
61
|
+
<!-- Text Alignment text story -->
|
|
62
|
+
<Story
|
|
63
|
+
name="Text Alignment"
|
|
64
|
+
args={{
|
|
65
|
+
font_weight: "regular",
|
|
66
|
+
text_style: "normal",
|
|
67
|
+
horizontal_alignment: "center",
|
|
68
|
+
name: "hello world!",
|
|
69
|
+
}}
|
|
70
|
+
/>
|
|
71
|
+
|
|
72
|
+
<!-- Color text story -->
|
|
73
|
+
<Story
|
|
74
|
+
name="Color"
|
|
75
|
+
args={{
|
|
76
|
+
font_weight: "regular",
|
|
77
|
+
text_style: "normal",
|
|
78
|
+
horizontal_alignment: "start",
|
|
79
|
+
color: {
|
|
80
|
+
dark: { type: "hex", value: "#3471eb" },
|
|
81
|
+
light: { type: "hex", value: "#3471eb" },
|
|
82
|
+
},
|
|
83
|
+
background_color: {
|
|
84
|
+
dark: { type: "hex", value: "#dde0c1" },
|
|
85
|
+
light: { type: "hex", value: "#dde0c1" },
|
|
86
|
+
},
|
|
87
|
+
name: "hello world!",
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<!-- Text with spacing story -->
|
|
91
|
+
<Story
|
|
92
|
+
name="With Spacing"
|
|
93
|
+
args={{
|
|
94
|
+
font_weight: "regular",
|
|
95
|
+
text_style: "normal",
|
|
96
|
+
horizontal_alignment: "start",
|
|
97
|
+
padding: { top: 16, trailing: 24, bottom: 16, leading: 24 },
|
|
98
|
+
margin: { top: 8, trailing: 0, bottom: 8, leading: 0 },
|
|
99
|
+
name: "hello world!",
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Text from "./Text.svelte";
|
|
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Text: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Text = InstanceType<typeof Text>;
|
|
19
|
+
export default Text;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getTextComponentStyles } from "./text-utils";
|
|
3
|
+
import type { TextProps } from "../../data/entities";
|
|
4
|
+
import { stringifyStyles } from "../../utils";
|
|
5
|
+
|
|
6
|
+
const { id, labels, text_lid, ...restProps }: TextProps = $props();
|
|
7
|
+
|
|
8
|
+
const { tagToRender, textStyles } = $derived(
|
|
9
|
+
getTextComponentStyles({ id, labels, text_lid, ...restProps }),
|
|
10
|
+
);
|
|
11
|
+
const stylesString = $derived(stringifyStyles(textStyles));
|
|
12
|
+
|
|
13
|
+
// TODO: drill down the selected locale.
|
|
14
|
+
const label = $derived(labels["en_US"][text_lid]);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<svelte:element this={tagToRender} {id} style={stylesString} class="text-block">
|
|
18
|
+
{label}
|
|
19
|
+
</svelte:element>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.text-block {
|
|
23
|
+
padding-block-start: var(--padding-block-start, unset);
|
|
24
|
+
padding-inline-end: var(--padding-inline-end, unset);
|
|
25
|
+
padding-block-end: var(--padding-block-end, unset);
|
|
26
|
+
padding-inline-start: var(--padding-inline-start, unset);
|
|
27
|
+
margin-block-start: var(--margin-block-start, unset);
|
|
28
|
+
margin-inline-end: var(--margin-inline-end, unset);
|
|
29
|
+
margin-block-end: var(--margin-block-end, unset);
|
|
30
|
+
margin-inline-start: var(--margin-inline-start, unset);
|
|
31
|
+
color: var(--text-color, #ffffff);
|
|
32
|
+
background-color: var(--background-color, #ffffff);
|
|
33
|
+
font-size: var(--font-size, 1rem);
|
|
34
|
+
font-weight: var(--font-weight, normal);
|
|
35
|
+
text-align: var(--text-align, center);
|
|
36
|
+
height: var(--height, unset);
|
|
37
|
+
width: var(--width, unset);
|
|
38
|
+
font-family: var(--font-family, sans-serif);
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TextComponentTags } from "../../utils";
|
|
2
|
+
import type { TextProps } from "../../data/entities";
|
|
3
|
+
type TextStyleVariables = {
|
|
4
|
+
"--width": string;
|
|
5
|
+
"--height": string;
|
|
6
|
+
"--text-align": string;
|
|
7
|
+
"--font-weight": number | string;
|
|
8
|
+
"--font-size": string;
|
|
9
|
+
"--font-family": string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Generates comprehensive styles for text components by combining text, component and size styles
|
|
13
|
+
* @param props - Text component properties including font, color, background, spacing etc.
|
|
14
|
+
* @returns Object containing text style variables and the appropriate HTML tag to render
|
|
15
|
+
*/
|
|
16
|
+
export declare const getTextComponentStyles: (props: TextProps) => {
|
|
17
|
+
textStyles: TextStyleVariables;
|
|
18
|
+
tagToRender: TextComponentTags;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getSizeStyle, getTextComponentTag, getTextStyles, } from "../../utils";
|
|
2
|
+
import { getComponentStyles } from "../../utils";
|
|
3
|
+
/**
|
|
4
|
+
* Generates comprehensive styles for text components by combining text, component and size styles
|
|
5
|
+
* @param props - Text component properties including font, color, background, spacing etc.
|
|
6
|
+
* @returns Object containing text style variables and the appropriate HTML tag to render
|
|
7
|
+
*/
|
|
8
|
+
export const getTextComponentStyles = (props) => {
|
|
9
|
+
const { font_size = "body_m", color = {
|
|
10
|
+
dark: { type: "hex", value: "#000000" },
|
|
11
|
+
light: { type: "hex", value: "#000000" },
|
|
12
|
+
}, background_color = {
|
|
13
|
+
dark: { type: "hex", value: "#FFFFFF" },
|
|
14
|
+
light: { type: "hex", value: "#FFFFFF" },
|
|
15
|
+
}, padding, margin, colorMode, size, } = props;
|
|
16
|
+
const tagToRender = getTextComponentTag(font_size);
|
|
17
|
+
const textStyles = getTextStyles(props);
|
|
18
|
+
const componentStyles = getComponentStyles({
|
|
19
|
+
backgroundColor: background_color,
|
|
20
|
+
textColor: color,
|
|
21
|
+
margin,
|
|
22
|
+
padding,
|
|
23
|
+
colorMode,
|
|
24
|
+
});
|
|
25
|
+
const sizeStyles = getSizeStyle(size);
|
|
26
|
+
return {
|
|
27
|
+
textStyles: {
|
|
28
|
+
...textStyles,
|
|
29
|
+
...componentStyles,
|
|
30
|
+
...sizeStyles,
|
|
31
|
+
},
|
|
32
|
+
tagToRender,
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { BorderType, ColorMode, ColorType, CornerRadiusType, DimensionType, FitTypes, FontWeights, ShadowType, ShapeType, SizeType, Spacing, TextAlignment, FontSizeTags } from "../types";
|
|
2
|
+
import type { PurchaseState } from "./state";
|
|
3
|
+
export interface Extra {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export type ComponentTypes = "stack" | "text" | "image" | "button" | "purchase_button" | "footer" | "package";
|
|
7
|
+
export interface PaywallComponent extends Extra {
|
|
8
|
+
type: ComponentTypes;
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Text extends PaywallComponent {
|
|
13
|
+
}
|
|
14
|
+
export interface Stack extends PaywallComponent {
|
|
15
|
+
spacing: number;
|
|
16
|
+
components: PaywallComponent[];
|
|
17
|
+
}
|
|
18
|
+
export interface ComponentConfig {
|
|
19
|
+
base: {
|
|
20
|
+
stack: Stack;
|
|
21
|
+
sticky_footer?: {
|
|
22
|
+
stack: {
|
|
23
|
+
type: "stack";
|
|
24
|
+
components: PaywallComponent[];
|
|
25
|
+
};
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface ComponentLocalizations extends Extra {
|
|
30
|
+
en_US: {
|
|
31
|
+
[key: string]: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export interface PaywallData extends Extra {
|
|
35
|
+
components_config: ComponentConfig;
|
|
36
|
+
components_localizations: ComponentLocalizations;
|
|
37
|
+
}
|
|
38
|
+
export interface ActionsProps {
|
|
39
|
+
onAction?: (action: SupportedActions, data?: Extra) => void;
|
|
40
|
+
}
|
|
41
|
+
export interface PurchaseStateProps {
|
|
42
|
+
purchaseState?: PurchaseState;
|
|
43
|
+
}
|
|
44
|
+
interface SharedComponentProps extends PaywallComponent, ActionsProps, PurchaseStateProps {
|
|
45
|
+
labels: ComponentLocalizations;
|
|
46
|
+
id: string;
|
|
47
|
+
colorMode: ColorMode;
|
|
48
|
+
name: string;
|
|
49
|
+
}
|
|
50
|
+
interface Action {
|
|
51
|
+
type: "restore_purchases" | "navigate_to" | "navigate_back" | "purchase" | "select_package";
|
|
52
|
+
}
|
|
53
|
+
export interface RestorePurchasesAction extends Action {
|
|
54
|
+
type: "restore_purchases";
|
|
55
|
+
}
|
|
56
|
+
export interface NavigateBackAction extends Action {
|
|
57
|
+
type: "navigate_back";
|
|
58
|
+
}
|
|
59
|
+
export interface NavigateToAction extends Action {
|
|
60
|
+
type: "navigate_to";
|
|
61
|
+
destination: "customer_center" | "privacy_policy" | "terms" | "url";
|
|
62
|
+
url?: {
|
|
63
|
+
url_lid: string;
|
|
64
|
+
method: "in_app_browser" | "external_browser" | "deep_link";
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface PurchaseAction extends Action {
|
|
68
|
+
type: "purchase";
|
|
69
|
+
}
|
|
70
|
+
export interface SelectPackageAction extends Action {
|
|
71
|
+
type: "select_package";
|
|
72
|
+
}
|
|
73
|
+
export type SupportedActions = RestorePurchasesAction | NavigateBackAction | NavigateToAction | PurchaseAction | SelectPackageAction;
|
|
74
|
+
export interface ButtonNodeProps extends SharedComponentProps {
|
|
75
|
+
type: "button";
|
|
76
|
+
action: SupportedActions;
|
|
77
|
+
stack: StackProps;
|
|
78
|
+
}
|
|
79
|
+
export interface PurchaseButtonProps extends SharedComponentProps {
|
|
80
|
+
type: "purchase_button";
|
|
81
|
+
stack: StackProps;
|
|
82
|
+
}
|
|
83
|
+
export interface FooterProps extends SharedComponentProps {
|
|
84
|
+
type: "footer";
|
|
85
|
+
stack: StackProps;
|
|
86
|
+
}
|
|
87
|
+
export interface PackageProps extends SharedComponentProps {
|
|
88
|
+
type: "package";
|
|
89
|
+
stack: StackProps;
|
|
90
|
+
package_id: string;
|
|
91
|
+
is_selected_by_default: boolean;
|
|
92
|
+
}
|
|
93
|
+
export interface StackProps extends SharedComponentProps {
|
|
94
|
+
background_color?: ColorType;
|
|
95
|
+
border?: BorderType;
|
|
96
|
+
components: PaywallComponent[];
|
|
97
|
+
dimension: DimensionType;
|
|
98
|
+
margin: Spacing;
|
|
99
|
+
padding: Spacing;
|
|
100
|
+
shadow?: ShadowType;
|
|
101
|
+
shape?: ShapeType;
|
|
102
|
+
size: SizeType;
|
|
103
|
+
spacing?: number;
|
|
104
|
+
type: "stack";
|
|
105
|
+
}
|
|
106
|
+
export interface TextProps extends SharedComponentProps {
|
|
107
|
+
background_color?: ColorType;
|
|
108
|
+
color: ColorType;
|
|
109
|
+
components: PaywallComponent[];
|
|
110
|
+
font_name?: string;
|
|
111
|
+
font_size: keyof typeof FontSizeTags;
|
|
112
|
+
font_weight: keyof typeof FontWeights;
|
|
113
|
+
horizontal_alignment: TextAlignment;
|
|
114
|
+
margin: Spacing;
|
|
115
|
+
padding: Spacing;
|
|
116
|
+
text_lid: string;
|
|
117
|
+
type: "text";
|
|
118
|
+
size: SizeType;
|
|
119
|
+
}
|
|
120
|
+
type ImageSourceDictionaryType = Record<"original" | "heic" | "heic_low_res" | "webp" | "webp_low_res", string>;
|
|
121
|
+
type ImageSourceType = {
|
|
122
|
+
light: ImageSourceDictionaryType;
|
|
123
|
+
dark?: ImageSourceDictionaryType;
|
|
124
|
+
};
|
|
125
|
+
export interface ImageMaskShapeType {
|
|
126
|
+
type: "circle" | "rectangle" | "concave" | "convex";
|
|
127
|
+
corners?: CornerRadiusType;
|
|
128
|
+
}
|
|
129
|
+
export interface ImageProps extends SharedComponentProps {
|
|
130
|
+
type: "image";
|
|
131
|
+
fit_mode: FitTypes;
|
|
132
|
+
size: SizeType;
|
|
133
|
+
source: ImageSourceType;
|
|
134
|
+
gradient_colors?: ColorType[];
|
|
135
|
+
mask_shape?: ImageMaskShapeType;
|
|
136
|
+
max_height?: number;
|
|
137
|
+
override_source_lid?: string;
|
|
138
|
+
}
|
|
139
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { type PaywallData as PaywallData } from "./data/entities";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export { default as Paywall } from "./components/paywall/Paywall.svelte";
|
|
4
|
+
export { default as Stack } from "./components/stack/Stack.svelte";
|
|
5
|
+
export { default as Button } from "./components/button/Button.svelte";
|
|
6
|
+
export { default as Text } from "./components/text/Text.svelte";
|
|
7
|
+
export { default as Image } from "./components/image/Image.svelte";
|
|
8
|
+
export { default as PurchaseButton } from "./components/purchase-button/PurchaseButton.svelte";
|
|
9
|
+
export { default as Package } from "./components/package/Package.svelte";
|
|
10
|
+
export { default as Footer } from "./components/footer/Footer.svelte";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Reexport your entry components here
|
|
2
|
+
export {} from "./data/entities";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export { default as Paywall } from "./components/paywall/Paywall.svelte";
|
|
5
|
+
export { default as Stack } from "./components/stack/Stack.svelte";
|
|
6
|
+
export { default as Button } from "./components/button/Button.svelte";
|
|
7
|
+
export { default as Text } from "./components/text/Text.svelte";
|
|
8
|
+
export { default as Image } from "./components/image/Image.svelte";
|
|
9
|
+
export { default as PurchaseButton } from "./components/purchase-button/PurchaseButton.svelte";
|
|
10
|
+
export { default as Package } from "./components/package/Package.svelte";
|
|
11
|
+
export { default as Footer } from "./components/footer/Footer.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const prefersDarkMode: import("svelte/store").Readable<boolean>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readable } from "svelte/store";
|
|
2
|
+
// Create a readable store that updates when the system theme changes
|
|
3
|
+
export const prefersDarkMode = readable(false, (set) => {
|
|
4
|
+
// Check if window is defined (client-side)
|
|
5
|
+
if (typeof window !== "undefined") {
|
|
6
|
+
// Set initial value
|
|
7
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
8
|
+
set(mediaQuery.matches);
|
|
9
|
+
// Update value when system preference changes
|
|
10
|
+
const handler = (e) => set(e.matches);
|
|
11
|
+
mediaQuery.addEventListener("change", handler);
|
|
12
|
+
// Cleanup when store is destroyed
|
|
13
|
+
return () => mediaQuery.removeEventListener("change", handler);
|
|
14
|
+
}
|
|
15
|
+
// Return empty cleanup function for SSR
|
|
16
|
+
return () => { };
|
|
17
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PaywallData } from "../data/entities";
|
|
2
|
+
export declare const paywallData: PaywallData;
|
|
3
|
+
export declare const alignmentPaywallData: PaywallData;
|
|
4
|
+
export declare const fontsPaywallData: PaywallData;
|
|
5
|
+
export declare const pastaPaywallData: PaywallData;
|
|
6
|
+
export declare const labelsData: {
|
|
7
|
+
en_US: {
|
|
8
|
+
id1: string;
|
|
9
|
+
id2: string;
|
|
10
|
+
id3: string;
|
|
11
|
+
};
|
|
12
|
+
};
|