@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
package/dist/data/entities.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import type { AlignmentType, BorderType, CircleShape, ColorType, CornerRadiusType, DimensionType, FitTypes, FontSizeTags, FontWeights, RectangleShape, ShadowType, ShapeType, SizeType, Spacing, TextAlignments } from "../types";
|
|
2
|
-
import type { PurchaseState } from "./state";
|
|
3
|
-
import type { VariableDictionary } from "../utils/variable-utils";
|
|
4
1
|
import type { ZStackChildStyles } from "../components/stack/stack-utils";
|
|
2
|
+
import type { PurchaseState } from "./state";
|
|
3
|
+
import type { AlignmentType, BorderType, CircleShape, CornerRadiusType, FontSizeTags, FontWeights, RectangleShape, ShadowType, ShapeType, SizeType, Spacing, TextAlignments } from "../types";
|
|
4
|
+
import type { Dimension } from "../types/alignment";
|
|
5
|
+
import type { Background } from "../types/background";
|
|
6
|
+
import type { ColorGradientScheme, ColorScheme } from "../types/colors";
|
|
7
|
+
import type { Localizations } from "../types/localization";
|
|
8
|
+
import type { ImageInfo, ImageObjectFit } from "../types/media";
|
|
5
9
|
export interface Extra {
|
|
6
10
|
[key: string]: unknown;
|
|
7
11
|
}
|
|
@@ -16,17 +20,16 @@ export interface Stack extends PaywallComponent {
|
|
|
16
20
|
spacing: number;
|
|
17
21
|
components: PaywallComponent[];
|
|
18
22
|
}
|
|
19
|
-
type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
export type RootPaywall = {
|
|
24
|
+
background?: Background;
|
|
25
|
+
stack: Stack;
|
|
26
|
+
sticky_footer?: null | {
|
|
27
|
+
stack: Stack;
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: "footer";
|
|
31
|
+
};
|
|
28
32
|
};
|
|
29
|
-
export type BaseNodeBackgroundType = BaseNodeBackgroundColor | BaseNodeBackgroundImage;
|
|
30
33
|
export interface ComponentConfig {
|
|
31
34
|
colors?: Record<string, string>;
|
|
32
35
|
fonts?: {
|
|
@@ -37,30 +40,22 @@ export interface ComponentConfig {
|
|
|
37
40
|
};
|
|
38
41
|
};
|
|
39
42
|
asset_base_url?: string;
|
|
40
|
-
base:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} | null;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export interface ComponentLocalizations extends Extra {
|
|
53
|
-
[locale: string]: {
|
|
54
|
-
[label_id: string]: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export interface PaywallData extends Extra {
|
|
58
|
-
components_config: ComponentConfig;
|
|
59
|
-
components_localizations: ComponentLocalizations;
|
|
43
|
+
base: RootPaywall;
|
|
44
|
+
}
|
|
45
|
+
export interface PaywallData {
|
|
46
|
+
template_name: string;
|
|
47
|
+
offering_id: string;
|
|
48
|
+
created_at: string;
|
|
49
|
+
updated_at: string;
|
|
50
|
+
published_at?: string | null;
|
|
51
|
+
asset_base_url: string;
|
|
60
52
|
default_locale: string;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
revision: number;
|
|
54
|
+
components_config: ComponentConfig;
|
|
55
|
+
components_localizations: Localizations;
|
|
56
|
+
published_revision?: number | null;
|
|
57
|
+
published_components_config?: ComponentConfig | null;
|
|
58
|
+
published_components_localizations?: Localizations | null;
|
|
64
59
|
}
|
|
65
60
|
export interface PurchaseStateProps {
|
|
66
61
|
purchaseState: PurchaseState;
|
|
@@ -68,97 +63,56 @@ export interface PurchaseStateProps {
|
|
|
68
63
|
export type ComponentState = {
|
|
69
64
|
[state: string]: boolean;
|
|
70
65
|
};
|
|
71
|
-
interface SharedComponentProps extends PaywallComponent,
|
|
72
|
-
labels: ComponentLocalizations;
|
|
66
|
+
export interface SharedComponentProps extends PaywallComponent, PurchaseStateProps {
|
|
73
67
|
id: string;
|
|
74
68
|
name: string;
|
|
75
|
-
variableDictionary?: VariableDictionary;
|
|
76
69
|
componentState?: ComponentState;
|
|
77
70
|
zStackChildStyles?: ZStackChildStyles;
|
|
78
71
|
}
|
|
79
|
-
|
|
80
|
-
type: "restore_purchases" | "navigate_to" | "navigate_back" | "purchase" | "select_package";
|
|
81
|
-
}
|
|
82
|
-
type OverrideProps<T> = {
|
|
72
|
+
export type OverrideProps<T> = {
|
|
83
73
|
states?: {
|
|
84
74
|
[state: string]: T;
|
|
85
75
|
};
|
|
86
76
|
};
|
|
87
|
-
export interface RestorePurchasesAction extends Action {
|
|
88
|
-
type: "restore_purchases";
|
|
89
|
-
}
|
|
90
|
-
export interface NavigateBackAction extends Action {
|
|
91
|
-
type: "navigate_back";
|
|
92
|
-
}
|
|
93
|
-
export interface NavigateToAction extends Action {
|
|
94
|
-
type: "navigate_to";
|
|
95
|
-
destination: "customer_center" | "privacy_policy" | "terms" | "url";
|
|
96
|
-
url?: {
|
|
97
|
-
url_lid: string;
|
|
98
|
-
method: "in_app_browser" | "external_browser" | "deep_link";
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
export interface PurchaseAction extends Action {
|
|
102
|
-
type: "purchase";
|
|
103
|
-
}
|
|
104
|
-
export interface SelectPackageAction extends Action {
|
|
105
|
-
type: "select_package";
|
|
106
|
-
}
|
|
107
|
-
export type SupportedActions = RestorePurchasesAction | NavigateBackAction | NavigateToAction | PurchaseAction | SelectPackageAction;
|
|
108
|
-
export interface ButtonNodeProps extends SharedComponentProps {
|
|
109
|
-
type: "button";
|
|
110
|
-
action: SupportedActions;
|
|
111
|
-
stack: StackProps;
|
|
112
|
-
}
|
|
113
|
-
export interface PurchaseButtonProps extends SharedComponentProps {
|
|
114
|
-
type: "purchase_button";
|
|
115
|
-
stack: StackProps;
|
|
116
|
-
}
|
|
117
|
-
export interface FooterProps extends SharedComponentProps {
|
|
118
|
-
type: "footer";
|
|
119
|
-
stack: StackProps;
|
|
120
|
-
}
|
|
121
|
-
export interface PackageProps extends SharedComponentProps {
|
|
122
|
-
type: "package";
|
|
123
|
-
stack: StackProps;
|
|
124
|
-
package_id: string;
|
|
125
|
-
is_selected_by_default: boolean;
|
|
126
|
-
}
|
|
127
77
|
export interface StackProps extends SharedComponentProps {
|
|
128
|
-
|
|
129
|
-
|
|
78
|
+
type: "stack";
|
|
79
|
+
visible?: boolean | null;
|
|
130
80
|
components: PaywallComponent[];
|
|
131
|
-
|
|
81
|
+
size: SizeType;
|
|
82
|
+
dimension: Dimension;
|
|
83
|
+
spacing: number;
|
|
132
84
|
margin: Spacing;
|
|
133
85
|
padding: Spacing;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
badge?: {
|
|
86
|
+
background_color: ColorGradientScheme | null;
|
|
87
|
+
background: Background | null;
|
|
88
|
+
border: BorderType | null;
|
|
89
|
+
shape: ShapeType | null;
|
|
90
|
+
shadow: ShadowType | null;
|
|
91
|
+
badge?: null | {
|
|
140
92
|
stack: {
|
|
141
93
|
components: PaywallComponent[];
|
|
142
94
|
type: "stack";
|
|
143
95
|
};
|
|
144
96
|
style: "overlay" | "edge_to_edge" | "nested";
|
|
145
97
|
alignment: Exclude<AlignmentType, "center">;
|
|
146
|
-
|
|
98
|
+
border?: BorderType | null;
|
|
99
|
+
shape: ShapeType | null;
|
|
100
|
+
shadow?: ShadowType | null;
|
|
147
101
|
padding: Spacing;
|
|
148
102
|
margin: Spacing;
|
|
149
103
|
text_lid: string;
|
|
150
|
-
color:
|
|
104
|
+
color: ColorScheme;
|
|
151
105
|
font_name?: string;
|
|
152
106
|
font_weight: keyof typeof FontWeights;
|
|
153
107
|
font_size: keyof typeof FontSizeTags;
|
|
154
108
|
horizontal_alignment: keyof typeof TextAlignments;
|
|
155
|
-
background_color:
|
|
109
|
+
background_color: ColorGradientScheme;
|
|
156
110
|
};
|
|
157
111
|
overrides?: OverrideProps<StackProps>;
|
|
158
112
|
}
|
|
159
113
|
export interface TextNodeProps extends SharedComponentProps {
|
|
160
|
-
background_color?:
|
|
161
|
-
color:
|
|
114
|
+
background_color?: ColorGradientScheme;
|
|
115
|
+
color: ColorScheme;
|
|
162
116
|
components: PaywallComponent[];
|
|
163
117
|
font_name?: string;
|
|
164
118
|
font_size: keyof typeof FontSizeTags;
|
|
@@ -169,32 +123,18 @@ export interface TextNodeProps extends SharedComponentProps {
|
|
|
169
123
|
text_lid: string;
|
|
170
124
|
type: "text";
|
|
171
125
|
size: SizeType;
|
|
172
|
-
variableDictionary?: VariableDictionary;
|
|
173
126
|
overrides?: OverrideProps<TextNodeProps>;
|
|
174
127
|
}
|
|
175
|
-
type ImageSourceDictionaryType = {
|
|
176
|
-
original: string;
|
|
177
|
-
heic: string;
|
|
178
|
-
heic_low_res: string;
|
|
179
|
-
webp: string;
|
|
180
|
-
webp_low_res: string;
|
|
181
|
-
width?: number;
|
|
182
|
-
height?: number;
|
|
183
|
-
};
|
|
184
|
-
type ImageSourceType = {
|
|
185
|
-
light: ImageSourceDictionaryType;
|
|
186
|
-
dark?: ImageSourceDictionaryType;
|
|
187
|
-
};
|
|
188
128
|
export interface ImageMaskShapeType {
|
|
189
129
|
type: "circle" | "rectangle" | "concave" | "convex";
|
|
190
130
|
corners?: CornerRadiusType;
|
|
191
131
|
}
|
|
192
132
|
export interface ImageProps extends SharedComponentProps {
|
|
193
133
|
type: "image";
|
|
194
|
-
fit_mode:
|
|
134
|
+
fit_mode: ImageObjectFit;
|
|
195
135
|
size: SizeType;
|
|
196
|
-
source:
|
|
197
|
-
color_overlay?:
|
|
136
|
+
source: ImageInfo;
|
|
137
|
+
color_overlay?: ColorGradientScheme | null;
|
|
198
138
|
mask_shape?: ImageMaskShapeType;
|
|
199
139
|
max_height?: number;
|
|
200
140
|
override_source_lid?: string;
|
|
@@ -203,7 +143,7 @@ export interface ImageProps extends SharedComponentProps {
|
|
|
203
143
|
export type ItemProps = {
|
|
204
144
|
title: {
|
|
205
145
|
text_lid: string;
|
|
206
|
-
color:
|
|
146
|
+
color: ColorScheme;
|
|
207
147
|
font_name?: string;
|
|
208
148
|
font_weight?: keyof typeof FontWeights;
|
|
209
149
|
font_size?: keyof typeof FontSizeTags;
|
|
@@ -211,7 +151,7 @@ export type ItemProps = {
|
|
|
211
151
|
};
|
|
212
152
|
description?: {
|
|
213
153
|
text_lid: string;
|
|
214
|
-
color:
|
|
154
|
+
color: ColorScheme;
|
|
215
155
|
font_name?: string;
|
|
216
156
|
font_weight?: keyof typeof FontWeights;
|
|
217
157
|
font_size?: keyof typeof FontSizeTags;
|
|
@@ -219,13 +159,13 @@ export type ItemProps = {
|
|
|
219
159
|
};
|
|
220
160
|
icon: {
|
|
221
161
|
name: string;
|
|
222
|
-
color:
|
|
162
|
+
color: ColorScheme;
|
|
223
163
|
width_and_height: number;
|
|
224
164
|
padding: number;
|
|
225
165
|
};
|
|
226
166
|
icon_background?: {
|
|
227
167
|
shape: CircleShape | RectangleShape;
|
|
228
|
-
color:
|
|
168
|
+
color: ColorScheme;
|
|
229
169
|
border?: BorderType;
|
|
230
170
|
};
|
|
231
171
|
connector?: {
|
|
@@ -234,7 +174,7 @@ export type ItemProps = {
|
|
|
234
174
|
top: number;
|
|
235
175
|
bottom: number;
|
|
236
176
|
};
|
|
237
|
-
color:
|
|
177
|
+
color: ColorGradientScheme;
|
|
238
178
|
};
|
|
239
179
|
};
|
|
240
180
|
export interface TimelineProps extends SharedComponentProps {
|
|
@@ -250,4 +190,3 @@ export interface TimelineItemProps extends ItemProps, SharedComponentProps {
|
|
|
250
190
|
text_spacing: number;
|
|
251
191
|
item_spacing: number;
|
|
252
192
|
}
|
|
253
|
-
export {};
|
package/dist/data/state.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import type { ColorMode } from "../types";
|
|
2
1
|
import type { VariableDictionary } from "../utils/variable-utils";
|
|
3
2
|
export interface PurchaseState {
|
|
4
|
-
selectedPackageId?: string;
|
|
5
|
-
locale: string;
|
|
6
|
-
defaultLocale: string;
|
|
7
3
|
variablesPerPackage?: Record<string, VariableDictionary>;
|
|
8
|
-
colorMode: ColorMode;
|
|
9
4
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ColorMode } from "../types";
|
|
2
|
+
export type ColorModeOverride = () => ColorMode | undefined;
|
|
3
|
+
type GetColorMode = () => ColorMode;
|
|
4
|
+
export declare function setColorModeContext(colorModeOverride?: ColorModeOverride): GetColorMode;
|
|
5
|
+
export declare function getColorModeContext(): GetColorMode;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DEFAULT_COLOR_MODE } from "../utils/constants";
|
|
2
|
+
import { getContext, setContext } from "svelte";
|
|
3
|
+
import { MediaQuery } from "svelte/reactivity";
|
|
4
|
+
const key = Symbol("color-mode");
|
|
5
|
+
export function setColorModeContext(colorModeOverride) {
|
|
6
|
+
const prefersDarkMode = new MediaQuery("prefers-color-scheme: dark", (colorModeOverride?.() ?? DEFAULT_COLOR_MODE) === "dark");
|
|
7
|
+
const context = () => colorModeOverride?.() ??
|
|
8
|
+
(prefersDarkMode.current ? "dark" : DEFAULT_COLOR_MODE);
|
|
9
|
+
setContext(key, context);
|
|
10
|
+
return context;
|
|
11
|
+
}
|
|
12
|
+
export function getColorModeContext() {
|
|
13
|
+
const context = getContext(key);
|
|
14
|
+
return context ?? (() => DEFAULT_COLOR_MODE);
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Localizations } from "../types/localization";
|
|
2
|
+
type GetLocalizedString = (id?: string) => string | undefined;
|
|
3
|
+
interface LocalizationContext {
|
|
4
|
+
getLocalizedString: GetLocalizedString;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalizationContextProps {
|
|
7
|
+
defaultLocale: string;
|
|
8
|
+
selectedLocale?: string;
|
|
9
|
+
localizations: Localizations;
|
|
10
|
+
}
|
|
11
|
+
export declare function setLocalizationContext({ defaultLocale, selectedLocale, localizations, }: LocalizationContextProps): LocalizationContext;
|
|
12
|
+
export declare function getLocalizationContext(): LocalizationContext;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
const key = Symbol("localization");
|
|
3
|
+
export function setLocalizationContext({ defaultLocale, selectedLocale, localizations, }) {
|
|
4
|
+
const locale = selectedLocale ?? defaultLocale;
|
|
5
|
+
const getLocalizedString = (id) => {
|
|
6
|
+
if (!id) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
const selected = localizations[locale]?.[id];
|
|
10
|
+
const fallback = localizations[defaultLocale]?.[id];
|
|
11
|
+
return selected ?? fallback;
|
|
12
|
+
};
|
|
13
|
+
const context = {
|
|
14
|
+
getLocalizedString,
|
|
15
|
+
};
|
|
16
|
+
setContext(key, context);
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
export function getLocalizationContext() {
|
|
20
|
+
const context = getContext(key);
|
|
21
|
+
if (context === undefined) {
|
|
22
|
+
throw new Error("Localization context not found");
|
|
23
|
+
}
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Action } from "../types/components/button";
|
|
2
|
+
import { type Writable } from "svelte/store";
|
|
3
|
+
interface PaywallContext {
|
|
4
|
+
selectedPackageId: Writable<string | undefined>;
|
|
5
|
+
onPurchase: () => void;
|
|
6
|
+
onButtonAction: (action: Action) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function setPaywallContext(context: PaywallContext): void;
|
|
9
|
+
export declare function getPaywallContext(): PaywallContext;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getContext, setContext } from "svelte";
|
|
2
|
+
import {} from "svelte/store";
|
|
3
|
+
const key = Symbol("paywall");
|
|
4
|
+
export function setPaywallContext(context) {
|
|
5
|
+
setContext(key, context);
|
|
6
|
+
}
|
|
7
|
+
export function getPaywallContext() {
|
|
8
|
+
const context = getContext(key);
|
|
9
|
+
if (context === undefined) {
|
|
10
|
+
throw new Error("Paywall context not found");
|
|
11
|
+
}
|
|
12
|
+
return context;
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type VariableDictionary } from "../utils/variable-utils";
|
|
2
|
+
import { type Readable } from "svelte/store";
|
|
3
|
+
type VariablesStore = Readable<VariableDictionary | undefined>;
|
|
4
|
+
export declare function setVariablesContext(variables: VariablesStore): void;
|
|
5
|
+
export declare function getVariablesContext(): VariablesStore;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {} from "../utils/variable-utils";
|
|
2
|
+
import { getContext, setContext } from "svelte";
|
|
3
|
+
import {} from "svelte/store";
|
|
4
|
+
const key = Symbol("variables");
|
|
5
|
+
export function setVariablesContext(variables) {
|
|
6
|
+
setContext(key, variables);
|
|
7
|
+
}
|
|
8
|
+
export function getVariablesContext() {
|
|
9
|
+
const context = getContext(key);
|
|
10
|
+
if (context === undefined) {
|
|
11
|
+
throw new Error("Variables context not found");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
package/dist/stories/fixtures.js
CHANGED
|
@@ -2223,13 +2223,8 @@ export const paywallData = {
|
|
|
2223
2223
|
zwOsIynvC9: "Annual",
|
|
2224
2224
|
},
|
|
2225
2225
|
},
|
|
2226
|
-
config: {},
|
|
2227
2226
|
created_at: "2024-11-07T04:36:37Z",
|
|
2228
2227
|
default_locale: "en_US",
|
|
2229
|
-
localized_strings: {
|
|
2230
|
-
en_US: {},
|
|
2231
|
-
},
|
|
2232
|
-
localized_strings_by_tier: {},
|
|
2233
2228
|
offering_id: "ofrngbfce748e08",
|
|
2234
2229
|
published_at: null,
|
|
2235
2230
|
published_revision: null,
|
|
@@ -3823,13 +3818,8 @@ export const alignmentPaywallData = {
|
|
|
3823
3818
|
components_localizations: {
|
|
3824
3819
|
en_US: {},
|
|
3825
3820
|
},
|
|
3826
|
-
config: {},
|
|
3827
3821
|
created_at: "2024-11-08T02:34:09Z",
|
|
3828
3822
|
default_locale: "en_US",
|
|
3829
|
-
localized_strings: {
|
|
3830
|
-
en_US: {},
|
|
3831
|
-
},
|
|
3832
|
-
localized_strings_by_tier: {},
|
|
3833
3823
|
offering_id: "ofrng4be31354c4",
|
|
3834
3824
|
published_at: null,
|
|
3835
3825
|
published_revision: null,
|
|
@@ -4883,13 +4873,8 @@ export const fontsPaywallData = {
|
|
|
4883
4873
|
uzD2rPJ68m: "**this is bold text**\\\n*this is italics*\\\n~this is strikethrough~\\\n`this is code`\\\n[this is a link](https://www.google.com)",
|
|
4884
4874
|
},
|
|
4885
4875
|
},
|
|
4886
|
-
config: {},
|
|
4887
4876
|
created_at: "2024-11-08T21:39:13Z",
|
|
4888
4877
|
default_locale: "en_US",
|
|
4889
|
-
localized_strings: {
|
|
4890
|
-
en_US: {},
|
|
4891
|
-
},
|
|
4892
|
-
localized_strings_by_tier: {},
|
|
4893
4878
|
offering_id: "ofrng0bfa13d98f",
|
|
4894
4879
|
published_at: null,
|
|
4895
4880
|
published_revision: null,
|
|
@@ -6932,13 +6917,8 @@ export const pastaPaywallData = {
|
|
|
6932
6917
|
uYHuXwbuaS: "500g - 9 min",
|
|
6933
6918
|
},
|
|
6934
6919
|
},
|
|
6935
|
-
config: {},
|
|
6936
6920
|
created_at: "2024-11-12T15:45:09Z",
|
|
6937
6921
|
default_locale: "en_US",
|
|
6938
|
-
localized_strings: {
|
|
6939
|
-
en_US: {},
|
|
6940
|
-
},
|
|
6941
|
-
localized_strings_by_tier: {},
|
|
6942
6922
|
offering_id: "ofrng284f6b25f9",
|
|
6943
6923
|
revision: 10,
|
|
6944
6924
|
template_name: "components",
|
|
@@ -8979,13 +8959,8 @@ export const variablesPastaPaywallData = {
|
|
|
8979
8959
|
uYHuXwbuaS: "500g - 9 min",
|
|
8980
8960
|
},
|
|
8981
8961
|
},
|
|
8982
|
-
config: {},
|
|
8983
8962
|
created_at: "2024-11-12T15:45:09Z",
|
|
8984
8963
|
default_locale: "en_US",
|
|
8985
|
-
localized_strings: {
|
|
8986
|
-
en_US: {},
|
|
8987
|
-
},
|
|
8988
|
-
localized_strings_by_tier: {},
|
|
8989
8964
|
offering_id: "ofrng284f6b25f9",
|
|
8990
8965
|
revision: 10,
|
|
8991
8966
|
template_name: "components",
|
|
@@ -8993,6 +8968,9 @@ export const variablesPastaPaywallData = {
|
|
|
8993
8968
|
};
|
|
8994
8969
|
export const gradientPaywallData = {
|
|
8995
8970
|
asset_base_url: "https://assets.pawwalls.com",
|
|
8971
|
+
offering_id: "ofrngbfce748e08",
|
|
8972
|
+
created_at: "2024-11-08T22:38:41Z",
|
|
8973
|
+
updated_at: "2024-11-08T22:38:41Z",
|
|
8996
8974
|
components_config: {
|
|
8997
8975
|
base: {
|
|
8998
8976
|
stack: {
|
|
@@ -11195,10 +11173,6 @@ export const gradientPaywallData = {
|
|
|
11195
11173
|
default_locale: "en_US",
|
|
11196
11174
|
revision: 21,
|
|
11197
11175
|
template_name: "components",
|
|
11198
|
-
zero_decimal_place_countries: {
|
|
11199
|
-
apple: ["TWN", "KAZ", "MEX", "PHL", "THA"],
|
|
11200
|
-
google: ["TW", "KZ", "MX", "PH", "TH"],
|
|
11201
|
-
},
|
|
11202
11176
|
};
|
|
11203
11177
|
export const calmPaywallData = {
|
|
11204
11178
|
asset_base_url: "https://assets.pawwalls.com",
|
|
@@ -12263,13 +12237,8 @@ export const calmPaywallData = {
|
|
|
12263
12237
|
wUmW3cccab: "100+ guided meditations on anxiety, stress, sleep and more",
|
|
12264
12238
|
},
|
|
12265
12239
|
},
|
|
12266
|
-
config: {},
|
|
12267
12240
|
created_at: "2024-11-08T21:36:50Z",
|
|
12268
12241
|
default_locale: "en_US",
|
|
12269
|
-
localized_strings: {
|
|
12270
|
-
en_US: {},
|
|
12271
|
-
},
|
|
12272
|
-
localized_strings_by_tier: {},
|
|
12273
12242
|
offering_id: "ofrngae6ecdad78",
|
|
12274
12243
|
revision: 9,
|
|
12275
12244
|
template_name: "components",
|
|
@@ -13645,13 +13614,8 @@ export const stateTemplate = {
|
|
|
13645
13614
|
xwdoMifL43: "Habit",
|
|
13646
13615
|
},
|
|
13647
13616
|
},
|
|
13648
|
-
config: {},
|
|
13649
13617
|
created_at: "2024-11-08T21:36:50Z",
|
|
13650
13618
|
default_locale: "en_US",
|
|
13651
|
-
localized_strings: {
|
|
13652
|
-
en_US: {},
|
|
13653
|
-
},
|
|
13654
|
-
localized_strings_by_tier: {},
|
|
13655
13619
|
offering_id: "ofrngae6ecdad78",
|
|
13656
13620
|
revision: 9,
|
|
13657
13621
|
template_name: "state",
|
|
@@ -15254,13 +15218,8 @@ export const posterMakerTemplate = {
|
|
|
15254
15218
|
vRN5_ma4Yq: "",
|
|
15255
15219
|
},
|
|
15256
15220
|
},
|
|
15257
|
-
config: {},
|
|
15258
15221
|
created_at: "2024-11-11T16:25:20Z",
|
|
15259
15222
|
default_locale: "en_US",
|
|
15260
|
-
localized_strings: {
|
|
15261
|
-
en_US: {},
|
|
15262
|
-
},
|
|
15263
|
-
localized_strings_by_tier: {},
|
|
15264
15223
|
offering_id: "ofrng4db5c5b61d",
|
|
15265
15224
|
published_at: null,
|
|
15266
15225
|
published_revision: null,
|
|
@@ -17833,13 +17792,8 @@ export const zStackTemplate = {
|
|
|
17833
17792
|
zMxG0H664k: "Bottom trailing",
|
|
17834
17793
|
},
|
|
17835
17794
|
},
|
|
17836
|
-
config: {},
|
|
17837
17795
|
created_at: "2024-12-19T20:46:54Z",
|
|
17838
17796
|
default_locale: "en_US",
|
|
17839
|
-
localized_strings: {
|
|
17840
|
-
en_US: {},
|
|
17841
|
-
},
|
|
17842
|
-
localized_strings_by_tier: {},
|
|
17843
17797
|
offering_id: "ofrng2063b5def2",
|
|
17844
17798
|
published_at: null,
|
|
17845
17799
|
published_components_config: null,
|
|
@@ -17899,7 +17853,6 @@ export const colorModeOverrideTemplate = {
|
|
|
17899
17853
|
},
|
|
17900
17854
|
],
|
|
17901
17855
|
type: "linear",
|
|
17902
|
-
value: "#ffffffff",
|
|
17903
17856
|
},
|
|
17904
17857
|
},
|
|
17905
17858
|
border: null,
|
|
@@ -18706,13 +18659,8 @@ export const colorModeOverrideTemplate = {
|
|
|
18706
18659
|
qy4JKggbZ_: "Monthly",
|
|
18707
18660
|
},
|
|
18708
18661
|
},
|
|
18709
|
-
config: {},
|
|
18710
18662
|
created_at: "2024-12-06T17:20:24Z",
|
|
18711
18663
|
default_locale: "en_US",
|
|
18712
|
-
localized_strings: {
|
|
18713
|
-
en_US: {},
|
|
18714
|
-
},
|
|
18715
|
-
localized_strings_by_tier: {},
|
|
18716
18664
|
offering_id: "ofrngb4d6b67d35",
|
|
18717
18665
|
published_at: null,
|
|
18718
18666
|
published_revision: null,
|
|
@@ -18748,7 +18696,6 @@ export const paywallWithFooter = {
|
|
|
18748
18696
|
},
|
|
18749
18697
|
],
|
|
18750
18698
|
type: "linear",
|
|
18751
|
-
value: "#ffffffff",
|
|
18752
18699
|
},
|
|
18753
18700
|
},
|
|
18754
18701
|
border: null,
|
|
@@ -19660,13 +19607,8 @@ export const paywallWithFooter = {
|
|
|
19660
19607
|
qy4JKggbZ_: "Monthly",
|
|
19661
19608
|
},
|
|
19662
19609
|
},
|
|
19663
|
-
config: {},
|
|
19664
19610
|
created_at: "2024-12-03T17:07:27Z",
|
|
19665
19611
|
default_locale: "en_US",
|
|
19666
|
-
localized_strings: {
|
|
19667
|
-
en_US: {},
|
|
19668
|
-
},
|
|
19669
|
-
localized_strings_by_tier: {},
|
|
19670
19612
|
offering_id: "ofrngea57cd715b",
|
|
19671
19613
|
published_at: "2024-12-03T17:34:02Z",
|
|
19672
19614
|
published_revision: 4,
|
|
@@ -19735,7 +19677,7 @@ export const errorPaywallData = {
|
|
|
19735
19677
|
},
|
|
19736
19678
|
},
|
|
19737
19679
|
spacing: 0,
|
|
19738
|
-
//
|
|
19680
|
+
// Intentional: testing unkown components.
|
|
19739
19681
|
type: "stackkkk",
|
|
19740
19682
|
},
|
|
19741
19683
|
],
|
|
@@ -19777,13 +19719,8 @@ export const errorPaywallData = {
|
|
|
19777
19719
|
components_localizations: {
|
|
19778
19720
|
en_US: {},
|
|
19779
19721
|
},
|
|
19780
|
-
config: {},
|
|
19781
19722
|
created_at: "2024-11-07T04:36:37Z",
|
|
19782
19723
|
default_locale: "en_US",
|
|
19783
|
-
localized_strings: {
|
|
19784
|
-
en_US: {},
|
|
19785
|
-
},
|
|
19786
|
-
localized_strings_by_tier: {},
|
|
19787
19724
|
offering_id: "ofrngbfce748e08",
|
|
19788
19725
|
published_at: null,
|
|
19789
19726
|
published_revision: null,
|
|
@@ -22060,13 +21997,8 @@ export const fallbackPaywallData = {
|
|
|
22060
21997
|
fallbackText123: "This is a fallback text",
|
|
22061
21998
|
},
|
|
22062
21999
|
},
|
|
22063
|
-
config: {},
|
|
22064
22000
|
created_at: "2024-11-07T04:36:37Z",
|
|
22065
22001
|
default_locale: "en_US",
|
|
22066
|
-
localized_strings: {
|
|
22067
|
-
en_US: {},
|
|
22068
|
-
},
|
|
22069
|
-
localized_strings_by_tier: {},
|
|
22070
22002
|
offering_id: "ofrngbfce748e08",
|
|
22071
22003
|
published_at: null,
|
|
22072
22004
|
published_revision: null,
|
|
@@ -22076,6 +22008,9 @@ export const fallbackPaywallData = {
|
|
|
22076
22008
|
};
|
|
22077
22009
|
export const e2eTestTemplate = {
|
|
22078
22010
|
asset_base_url: "https://assets.pawwalls.com",
|
|
22011
|
+
offering_id: "ofrngbfce748e08",
|
|
22012
|
+
created_at: "2024-11-08T22:38:41Z",
|
|
22013
|
+
updated_at: "2024-11-08T22:38:41Z",
|
|
22079
22014
|
components_config: {
|
|
22080
22015
|
base: {
|
|
22081
22016
|
background: {
|
|
@@ -24328,10 +24263,6 @@ export const e2eTestTemplate = {
|
|
|
24328
24263
|
default_locale: "en_US",
|
|
24329
24264
|
revision: 4,
|
|
24330
24265
|
template_name: "components",
|
|
24331
|
-
zero_decimal_place_countries: {
|
|
24332
|
-
apple: ["TWN", "KAZ", "MEX", "PHL", "THA"],
|
|
24333
|
-
google: ["TW", "KZ", "MX", "PH", "TH"],
|
|
24334
|
-
},
|
|
24335
24266
|
};
|
|
24336
24267
|
export const brandingAppearances = {
|
|
24337
24268
|
None: null,
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type LocalizationContextProps } from "../stores/localization";
|
|
2
|
+
import type { DecoratorFunction, Renderer } from "storybook/internal/csf";
|
|
3
|
+
export declare function localizationDecorator<TRenderer extends Renderer, TArgs>(props: LocalizationContextProps): DecoratorFunction<TRenderer, TArgs>;
|