@revenuecat/purchases-ui-js 0.0.16 → 0.0.18

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.
Files changed (67) hide show
  1. package/dist/components/button/Button.svelte +0 -13
  2. package/dist/components/button/Button.svelte.d.ts +4 -2
  3. package/dist/components/button/ButtonNode.stories.svelte +16 -11
  4. package/dist/components/button/ButtonNode.svelte +26 -1
  5. package/dist/components/button/ButtonNode.svelte.d.ts +1 -0
  6. package/dist/components/button/button-utils.d.ts +2 -0
  7. package/dist/components/button/button-utils.js +19 -0
  8. package/dist/components/footer/Footer.stories.svelte +47 -155
  9. package/dist/components/footer/Footer.stories.svelte.d.ts +1 -2
  10. package/dist/components/footer/Footer.svelte +10 -1
  11. package/dist/components/footer/Footer.svelte.d.ts +1 -0
  12. package/dist/components/image/Image.stories.svelte +13 -7
  13. package/dist/components/image/Image.svelte +37 -19
  14. package/dist/components/image/Image.svelte.d.ts +1 -0
  15. package/dist/components/image/image-utils.d.ts +2 -12
  16. package/dist/components/image/image-utils.js +28 -11
  17. package/dist/components/package/Package.stories.svelte +5 -5
  18. package/dist/components/package/Package.svelte +15 -6
  19. package/dist/components/package/Package.svelte.d.ts +1 -0
  20. package/dist/components/paywall/Node.svelte +77 -17
  21. package/dist/components/paywall/Node.svelte.d.ts +21 -2
  22. package/dist/components/paywall/Paywall.stories.svelte +93 -15
  23. package/dist/components/paywall/Paywall.svelte +110 -88
  24. package/dist/components/paywall/Paywall.svelte.d.ts +4 -0
  25. package/dist/components/paywall/paywall-utils.d.ts +1 -1
  26. package/dist/components/paywall/paywall-utils.js +11 -9
  27. package/dist/components/purchase-button/PurchaseButton.stories.svelte +7 -8
  28. package/dist/components/purchase-button/PurchaseButton.svelte +24 -10
  29. package/dist/components/purchase-button/PurchaseButton.svelte.d.ts +1 -0
  30. package/dist/components/purchase-button/purchase-button-utils.d.ts +2 -0
  31. package/dist/components/purchase-button/purchase-button-utils.js +20 -0
  32. package/dist/components/stack/Stack.stories.svelte +1138 -6
  33. package/dist/components/stack/Stack.svelte +160 -42
  34. package/dist/components/stack/Stack.svelte.d.ts +1 -0
  35. package/dist/components/stack/stack-utils.d.ts +24 -24
  36. package/dist/components/stack/stack-utils.js +245 -12
  37. package/dist/components/text/Text.svelte +24 -19
  38. package/dist/components/text/Text.svelte.d.ts +4 -2
  39. package/dist/components/text/TextNode.stories.svelte +13 -13
  40. package/dist/components/text/TextNode.svelte +24 -34
  41. package/dist/components/text/TextNode.svelte.d.ts +1 -0
  42. package/dist/components/text/text-utils.d.ts +11 -14
  43. package/dist/components/text/text-utils.js +130 -15
  44. package/dist/components/timeline/Timeline.stories.svelte +640 -0
  45. package/dist/components/timeline/Timeline.stories.svelte.d.ts +19 -0
  46. package/dist/components/timeline/Timeline.svelte +40 -0
  47. package/dist/components/timeline/Timeline.svelte.d.ts +4 -0
  48. package/dist/components/timeline/TimelineItem.svelte +112 -0
  49. package/dist/components/timeline/TimelineItem.svelte.d.ts +4 -0
  50. package/dist/components/timeline/timeline-utils.d.ts +8 -0
  51. package/dist/components/timeline/timeline-utils.js +128 -0
  52. package/dist/data/entities.d.ts +89 -9
  53. package/dist/data/state.d.ts +2 -0
  54. package/dist/index.d.ts +3 -2
  55. package/dist/index.js +3 -2
  56. package/dist/stories/fixtures.d.ts +7 -1
  57. package/dist/stories/fixtures.js +6898 -7
  58. package/dist/stories/meta-templates.d.ts +0 -1
  59. package/dist/stories/meta-templates.js +0 -5
  60. package/dist/types.d.ts +16 -7
  61. package/dist/types.js +7 -0
  62. package/dist/utils/style-utils.d.ts +80 -41
  63. package/dist/utils/style-utils.js +157 -70
  64. package/dist/utils/variable-utils.d.ts +27 -0
  65. package/dist/utils/variable-utils.js +37 -0
  66. package/package.json +27 -25
  67. package/dist/components/paywall/global-styles.css +0 -9
@@ -1,48 +1,66 @@
1
1
  <script lang="ts">
2
2
  import { getImageComponentStyles } from "./image-utils";
3
- import { stringifyStyles } from "../../utils/style-utils";
4
3
  import type { ImageProps } from "../../data/entities";
5
4
 
6
- const { id, colorMode, source, ...restProps }: ImageProps = $props();
5
+ const { id, source, purchaseState, ...restProps }: ImageProps = $props();
7
6
 
8
7
  const { gradientStyles, imageStyles } = $derived(
9
- getImageComponentStyles({ id, colorMode, source, ...restProps }),
8
+ getImageComponentStyles({
9
+ id,
10
+ colorMode: purchaseState.colorMode,
11
+ source,
12
+ purchaseState,
13
+ ...restProps,
14
+ }),
10
15
  );
11
- const gradientStylesString = $derived(stringifyStyles(gradientStyles));
12
- const imageStylesString = $derived(stringifyStyles(imageStyles));
16
+
17
+ const imageSource = $derived.by(() => {
18
+ const colorMode = purchaseState.colorMode;
19
+ if (source[colorMode]?.original) {
20
+ return source[colorMode].original;
21
+ } else {
22
+ return source["light"].original as string;
23
+ }
24
+ });
13
25
  </script>
14
26
 
15
27
  <div
16
- class="image-container"
17
- id={`image-container-${id}`}
18
- style={imageStylesString}
28
+ class="rc-pw-image-container"
29
+ id={`rc-pw-image-container-${id}`}
30
+ style={imageStyles}
19
31
  >
20
- <img class="image" src={source[colorMode || "light"]?.original} alt="" {id} />
21
- <span class="image-overlay" style={gradientStylesString}></span>
32
+ <img class="rc-pw-image" src={imageSource} alt="" {id} />
33
+ <span class="rc-pw-image-overlay" style={gradientStyles}></span>
22
34
  </div>
23
35
 
24
36
  <style>
25
- .image-container {
37
+ .rc-pw-image-container {
26
38
  position: relative;
27
- height: var(--height, unset);
28
- width: var(--width, unset);
29
39
  overflow: hidden;
30
- border-radius: var(--corner-radius, unset);
31
- clip-path: var(--clip-path, unset);
40
+ border-end-start-radius: var(--image-border-end-start-radius, 0px);
41
+ border-end-end-radius: var(--image-border-end-end-radius, 0px);
42
+ border-start-start-radius: var(--image-border-start-start-radius, 0px);
43
+ border-start-end-radius: var(--image-border-start-end-radius, 0px);
44
+ clip-path: var(--image-clip-path, initial);
32
45
  display: flex;
33
- flex: var(--flex, 1 1 auto);
46
+ flex: var(--image-flex, 1 1 auto);
47
+ position: var(--image-position, relative);
48
+ inset: var(--image-inset, 0);
49
+ transform: var(--image-transform, initial);
50
+ height: var(--image-height, initial);
51
+ width: var(--image-width, initial);
34
52
  }
35
53
 
36
- .image {
54
+ .rc-pw-image {
37
55
  width: 100%;
38
56
  height: 100%;
39
57
  object-fit: cover;
40
58
  display: block;
41
59
  }
42
60
 
43
- .image-overlay {
61
+ .rc-pw-image-overlay {
44
62
  position: absolute;
45
63
  inset: 0;
46
- background: var(--background, none);
64
+ background: var(--image-background, none);
47
65
  }
48
66
  </style>
@@ -1,3 +1,4 @@
1
1
  import type { ImageProps } from "../../data/entities";
2
2
  declare const Image: import("svelte").Component<ImageProps, {}, "">;
3
+ type Image = ReturnType<typeof Image>;
3
4
  export default Image;
@@ -1,20 +1,10 @@
1
1
  import type { ImageProps } from "../../data/entities";
2
- type ImageStyleVariables = {
3
- "--height": string;
4
- "--width": string;
5
- "--clip-path": string;
6
- "--corner-radius": string;
7
- };
8
- type GradientStyleVariables = {
9
- "--background": string;
10
- };
11
2
  /**
12
3
  * Generates comprehensive styles for image components by combining gradient and size styles
13
4
  * @param props - Image component properties including gradient, mask and size
14
5
  * @returns Object containing image style variables and gradient style variables
15
6
  */
16
7
  export declare const getImageComponentStyles: (props: ImageProps) => {
17
- imageStyles: ImageStyleVariables;
18
- gradientStyles: GradientStyleVariables;
8
+ imageStyles: string;
9
+ gradientStyles: string;
19
10
  };
20
- export {};
@@ -1,24 +1,41 @@
1
- import { getActiveStateProps, getGradientStyle, getMaskStyle, getSizeStyle, } from "../../utils/style-utils";
1
+ import { getActiveStateProps, getGradientStyle, getMaskStyle, getSizeStyle, prefixObject, stringifyStyles, } from "../../utils/style-utils";
2
2
  /**
3
3
  * Generates comprehensive styles for image components by combining gradient and size styles
4
4
  * @param props - Image component properties including gradient, mask and size
5
5
  * @returns Object containing image style variables and gradient style variables
6
6
  */
7
7
  export const getImageComponentStyles = (props) => {
8
- const { gradient_colors, colorMode, mask_shape, size,
8
+ const { gradient_colors, mask_shape, size,
9
9
  // max_height, // TODO: implement this. still waiting on spec
10
10
  // override_source_lid, // TODO: Implement this once structure is defined
11
- overrides, componentState, } = props;
11
+ overrides, componentState, purchaseState, zStackChildStyles, } = props;
12
+ const imageStyles = {
13
+ "--height": "unset",
14
+ "--width": "unset",
15
+ "--clip-path": "none",
16
+ "--border-end-start-radius": "unset",
17
+ "--border-end-end-radius": "unset",
18
+ "--border-start-start-radius": "unset",
19
+ "--border-start-end-radius": "unset",
20
+ "--position": "relative",
21
+ "--inset": "0",
22
+ "--transform": "initial",
23
+ };
24
+ Object.assign(imageStyles, zStackChildStyles);
25
+ const backgroundStyles = {
26
+ "--background": "none",
27
+ };
12
28
  const activeStateProps = getActiveStateProps(overrides, componentState);
13
- const gradientStyles = getGradientStyle(colorMode, activeStateProps?.gradient_colors || gradient_colors);
14
- const sizeStyles = getSizeStyle({ ...size, ...activeStateProps });
15
- const maskStyles = getMaskStyle({
29
+ Object.assign(backgroundStyles, getGradientStyle(purchaseState.colorMode, activeStateProps?.gradient_colors || gradient_colors));
30
+ Object.assign(imageStyles, getSizeStyle({ ...size, ...activeStateProps }));
31
+ Object.assign(imageStyles, getMaskStyle({
16
32
  ...mask_shape,
17
33
  ...activeStateProps,
18
- });
19
- const imageStylesObject = {
20
- ...sizeStyles,
21
- ...maskStyles,
34
+ }));
35
+ const prefixedImageStyles = prefixObject(imageStyles, "image");
36
+ const prefixedGradientStyles = prefixObject(backgroundStyles, "image");
37
+ return {
38
+ imageStyles: stringifyStyles(prefixedImageStyles),
39
+ gradientStyles: stringifyStyles(prefixedGradientStyles),
22
40
  };
23
- return { imageStyles: imageStylesObject, gradientStyles };
24
41
  };
@@ -1,10 +1,11 @@
1
1
  <script module lang="ts">
2
2
  import { defineMeta } from "@storybook/addon-svelte-csf";
3
3
  import Package from "./Package.svelte";
4
- import { colorModeStoryMeta } from "../../stories/meta-templates";
5
4
  import type { Extra, SupportedActions } from "../../data/entities";
5
+ import type { PurchaseState } from "../../data/state";
6
+ import type { ColorMode } from "../../types";
6
7
 
7
- const onAction = (action: SupportedActions, data: Extra) => {
8
+ const onAction = (action: SupportedActions, data?: Extra) => {
8
9
  alert(`${action.type} ${JSON.stringify(data)}`);
9
10
  };
10
11
 
@@ -13,7 +14,6 @@
13
14
  component: Package,
14
15
  tags: ["autodocs"],
15
16
  argTypes: {
16
- colorMode: colorModeStoryMeta,
17
17
  stack: {
18
18
  control: { type: "object" },
19
19
  description: "Stack configuration for package content",
@@ -33,7 +33,8 @@
33
33
  QZ4ZmYsqjN: "$1.99",
34
34
  },
35
35
  };
36
- const purchaseState = {
36
+ const purchaseState: PurchaseState = {
37
+ colorMode: "light" as ColorMode,
37
38
  locale: "en_US",
38
39
  defaultLocale: "en_US",
39
40
  };
@@ -232,7 +233,6 @@
232
233
  size: {
233
234
  height: {
234
235
  type: "fit",
235
- value: null,
236
236
  },
237
237
  width: {
238
238
  type: "fixed",
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { PackageProps, SelectPackageAction } from "../../data/entities";
3
3
  import Stack from "../stack/Stack.svelte";
4
+ import { prefixObject, stringifyStyles } from "../../utils/style-utils";
4
5
 
5
6
  const {
6
7
  stack,
@@ -10,8 +11,8 @@
10
11
  onAction,
11
12
  purchaseState,
12
13
  variableDictionary,
14
+ zStackChildStyles,
13
15
  }: PackageProps = $props();
14
-
15
16
  const onPackageClick = (evt: MouseEvent) => {
16
17
  evt.preventDefault();
17
18
  evt.stopPropagation();
@@ -28,13 +29,18 @@
28
29
  const componentState = $derived({
29
30
  selected: purchaseState?.selectedPackageId === package_id,
30
31
  });
32
+
33
+ const styles = $derived(
34
+ stringifyStyles(prefixObject(zStackChildStyles, "package")),
35
+ );
31
36
  </script>
32
37
 
33
38
  <button
34
- class="package"
39
+ class="rc-pw-package"
35
40
  class:selected={componentState.selected}
36
41
  {id}
37
42
  onclick={onPackageClick}
43
+ style={styles}
38
44
  >
39
45
  <Stack
40
46
  {...stack}
@@ -47,13 +53,16 @@
47
53
  </button>
48
54
 
49
55
  <style>
50
- .package {
56
+ .rc-pw-package {
51
57
  width: 100%;
52
58
  display: flex;
53
59
  margin: 0;
54
60
  padding: 0;
55
- background: unset;
56
- border: unset;
57
- text-align: unset;
61
+ background: initial;
62
+ border: initial;
63
+ text-align: initial;
64
+ position: var(--package-position, relative);
65
+ inset: var(--package-inset, 0);
66
+ transform: var(--package-transform, initial);
58
67
  }
59
68
  </style>
@@ -1,3 +1,4 @@
1
1
  import type { PackageProps } from "../../data/entities";
2
2
  declare const Package: import("svelte").Component<PackageProps, {}, "">;
3
+ type Package = ReturnType<typeof Package>;
3
4
  export default Package;
@@ -1,5 +1,4 @@
1
1
  <script lang="ts">
2
- import { Stack, Image, PurchaseButton, Package, Footer } from "../..";
3
2
  import Self from "./Node.svelte";
4
3
  import {
5
4
  type ActionsProps,
@@ -10,46 +9,107 @@
10
9
  type SupportedActions,
11
10
  } from "../../data/entities";
12
11
  import { prefersDarkMode } from "../../stores/theme";
13
- import ButtonNode from "../button/ButtonNode.svelte";
14
- import TextNode from "../text/TextNode.svelte";
15
12
  import type { VariableDictionary } from "../../utils/variable-utils";
13
+ import type { ZStackChildStyles } from "../stack/stack-utils";
14
+ import TextNode from "../text/TextNode.svelte";
15
+ import {
16
+ Footer,
17
+ Image,
18
+ Package,
19
+ PurchaseButton,
20
+ Stack,
21
+ Timeline,
22
+ } from "../..";
23
+ import ButtonNode from "../button/ButtonNode.svelte";
24
+ import type { Component } from "svelte";
25
+
26
+ type SupportedComponents =
27
+ | TextNode
28
+ | Stack
29
+ | Image
30
+ | ButtonNode
31
+ | PurchaseButton
32
+ | Package
33
+ | Footer
34
+ | Timeline;
16
35
 
17
36
  interface Props extends ActionsProps, PurchaseStateProps {
18
37
  nodeData: PaywallComponent;
19
38
  labels: ComponentLocalizations;
20
39
  onAction?: (action: SupportedActions, data?: Extra) => void;
21
40
  variableDictionary?: VariableDictionary;
41
+ zStackChildStyles?: ZStackChildStyles;
22
42
  }
23
43
 
24
- const {
25
- nodeData,
26
- labels,
27
- onAction,
28
- purchaseState,
29
- variableDictionary,
30
- }: Props = $props();
31
-
32
44
  const ComponentTypes = {
33
- text: TextNode,
34
45
  stack: Stack,
46
+ text: TextNode,
35
47
  image: Image,
36
48
  button: ButtonNode,
37
49
  purchase_button: PurchaseButton,
38
50
  package: Package,
39
51
  footer: Footer,
52
+ timeline: Timeline,
40
53
  };
41
- const MyComponent = $derived(ComponentTypes[nodeData.type]);
54
+
55
+ /**
56
+ * This function returns the component class and the node data for a given paywall component.
57
+ * It first checks if the component type is supported and returns the corresponding component class.
58
+ * If not supported, it checks if the fallback component type is supported and returns the corresponding component class,
59
+ * finally it throws an error if the component type is not supported and the fallback component type is not supported.
60
+ * @param nodeData:PaywallComponent - the PaywallComponent object representing a Node in the paywall
61
+ * @returns [Component<SupportedComponents>, PaywallComponent] - a tuple containing the component class and the node data
62
+ * @throws Error - if the component type and the fallback component type are not supported
63
+ */
64
+ export const getComponentClass: (
65
+ nodeData: PaywallComponent,
66
+ ) => [Component<SupportedComponents>, PaywallComponent] = (
67
+ nodeData: PaywallComponent,
68
+ ) => {
69
+ if (ComponentTypes[nodeData.type]) {
70
+ return [
71
+ ComponentTypes[nodeData.type] as Component<SupportedComponents>,
72
+ nodeData,
73
+ ];
74
+ }
75
+
76
+ const { fallback } = nodeData;
77
+ if (fallback && ComponentTypes[fallback?.type]) {
78
+ return [
79
+ ComponentTypes[fallback.type] as Component<SupportedComponents>,
80
+ fallback,
81
+ ];
82
+ }
83
+
84
+ // manually throwing error for this specific case until
85
+ // it's handled with fallback components
86
+ throw new Error(`Invalid component type: ${nodeData.type}`);
87
+ };
88
+
89
+ const {
90
+ nodeData,
91
+ labels,
92
+ onAction,
93
+ purchaseState,
94
+ variableDictionary,
95
+ zStackChildStyles,
96
+ ...restProps
97
+ }: Props = $props();
98
+
99
+ const [ComponentToRender, dataToUse] = $derived(getComponentClass(nodeData));
42
100
  </script>
43
101
 
44
- <MyComponent
45
- {...(nodeData as any) || {}}
102
+ <ComponentToRender
103
+ {...(dataToUse as any) || {}}
46
104
  {labels}
47
105
  prefersDarkMode={$prefersDarkMode}
48
106
  {onAction}
49
107
  {purchaseState}
50
108
  {variableDictionary}
109
+ {zStackChildStyles}
110
+ {...restProps}
51
111
  >
52
- {#each nodeData.components as childData}
112
+ {#each nodeData.components as PaywallComponent[] as childData}
53
113
  <Self
54
114
  nodeData={childData}
55
115
  {labels}
@@ -58,4 +118,4 @@
58
118
  {variableDictionary}
59
119
  />
60
120
  {/each}
61
- </MyComponent>
121
+ </ComponentToRender>
@@ -1,9 +1,28 @@
1
1
  import { type ActionsProps, type ComponentLocalizations, type Extra, type PaywallComponent, type PurchaseStateProps, type SupportedActions } from "../../data/entities";
2
2
  import type { VariableDictionary } from "../../utils/variable-utils";
3
- declare const Node: import("svelte").Component<ActionsProps & PurchaseStateProps & {
3
+ import type { ZStackChildStyles } from "../stack/stack-utils";
4
+ import TextNode from "../text/TextNode.svelte";
5
+ import { Footer, Image, Package, PurchaseButton, Stack, Timeline } from "../..";
6
+ import ButtonNode from "../button/ButtonNode.svelte";
7
+ import type { Component } from "svelte";
8
+ type SupportedComponents = TextNode | Stack | Image | ButtonNode | PurchaseButton | Package | Footer | Timeline;
9
+ interface Props extends ActionsProps, PurchaseStateProps {
4
10
  nodeData: PaywallComponent;
5
11
  labels: ComponentLocalizations;
6
12
  onAction?: (action: SupportedActions, data?: Extra) => void;
7
13
  variableDictionary?: VariableDictionary;
8
- }, {}, "">;
14
+ zStackChildStyles?: ZStackChildStyles;
15
+ }
16
+ declare const Node: Component<Props, {
17
+ /**
18
+ * This function returns the component class and the node data for a given paywall component.
19
+ * It first checks if the component type is supported and returns the corresponding component class.
20
+ * If not supported, it checks if the fallback component type is supported and returns the corresponding component class,
21
+ * finally it throws an error if the component type is not supported and the fallback component type is not supported.
22
+ * @param nodeData:PaywallComponent - the PaywallComponent object representing a Node in the paywall
23
+ * @returns [Component<SupportedComponents>, PaywallComponent] - a tuple containing the component class and the node data
24
+ * @throws Error - if the component type and the fallback component type are not supported
25
+ */ getComponentClass: (nodeData: PaywallComponent) => [Component<SupportedComponents>, PaywallComponent];
26
+ }, "">;
27
+ type Node = ReturnType<typeof Node>;
9
28
  export default Node;
@@ -12,8 +12,15 @@
12
12
  variablesPastaPaywallData,
13
13
  stateTemplate,
14
14
  posterMakerTemplate,
15
+ e2eTestTemplate,
16
+ zStackTemplate,
17
+ colorModeOverrideTemplate,
18
+ errorPaywallData,
19
+ paywallWithFooter,
20
+ fallbackPaywallData,
15
21
  } from "../../stories/fixtures";
16
22
  import { fn } from "@storybook/test";
23
+ import type { VariableDictionary } from "../../utils/variable-utils";
17
24
 
18
25
  const { Story } = defineMeta({
19
26
  title: "Example/Paywall",
@@ -31,7 +38,7 @@
31
38
  paywallData: paywallData,
32
39
  onPurchaseClicked: fn(),
33
40
  onBackClicked: fn(),
34
- onNavigateToClicked: fn(),
41
+ onNavigateToUrlClicked: fn(),
35
42
  onRestorePurchasesClicked: fn(),
36
43
  }}
37
44
  />
@@ -43,7 +50,7 @@
43
50
  selectedLocale: "it_IT",
44
51
  onPurchaseClicked: fn(),
45
52
  onBackClicked: fn(),
46
- onNavigateToClicked: fn(),
53
+ onNavigateToUrlClicked: fn(),
47
54
  onRestorePurchasesClicked: fn(),
48
55
  }}
49
56
  />
@@ -55,7 +62,7 @@
55
62
  selectedLocale: "en_US",
56
63
  onPurchaseClicked: fn(),
57
64
  onBackClicked: fn(),
58
- onNavigateToClicked: fn(),
65
+ onNavigateToUrlClicked: fn(),
59
66
  onRestorePurchasesClicked: fn(),
60
67
  }}
61
68
  />
@@ -67,7 +74,7 @@
67
74
  selectedLocale: "en_US",
68
75
  onPurchaseClicked: fn(),
69
76
  onBackClicked: fn(),
70
- onNavigateToClicked: fn(),
77
+ onNavigateToUrlClicked: fn(),
71
78
  onRestorePurchasesClicked: fn(),
72
79
  }}
73
80
  />
@@ -79,7 +86,7 @@
79
86
  selectedLocale: "en_US",
80
87
  onPurchaseClicked: fn(),
81
88
  onBackClicked: fn(),
82
- onNavigateToClicked: fn(),
89
+ onNavigateToUrlClicked: fn(),
83
90
  onRestorePurchasesClicked: fn(),
84
91
  }}
85
92
  />
@@ -90,24 +97,24 @@
90
97
  selectedLocale: "en_US",
91
98
  onPurchaseClicked: fn(),
92
99
  onBackClicked: fn(),
93
- onNavigateToClicked: fn(),
100
+ onNavigateToUrlClicked: fn(),
94
101
  onRestorePurchasesClicked: fn(),
95
102
  variablesPerPackage: {
96
103
  trial: {
97
104
  product_name: "This was a variable: Product A",
98
105
  price: "$19.99",
99
106
  price_per_period: "$19.99/yr",
100
- },
107
+ } as VariableDictionary,
101
108
  $rc_weekly: {
102
109
  product_name: "This was a variable: Product B",
103
110
  price: "$29.99",
104
111
  price_per_period: "$29.99/yr",
105
- },
112
+ } as VariableDictionary,
106
113
  $rc_daily: {
107
114
  product_name: "This was a variable: Product C",
108
115
  price: "$39.99",
109
- price_per_period: "$39.99/yr",
110
- },
116
+ price_per_period: "$19.99/yr",
117
+ } as VariableDictionary,
111
118
  },
112
119
  }}
113
120
  />
@@ -119,7 +126,7 @@
119
126
  selectedLocale: "en_US",
120
127
  onPurchaseClicked: fn(),
121
128
  onBackClicked: fn(),
122
- onNavigateToClicked: fn(),
129
+ onNavigateToUrlClicked: fn(),
123
130
  onRestorePurchasesClicked: fn(),
124
131
  }}
125
132
  />
@@ -130,7 +137,7 @@
130
137
  paywallData: gradientPaywallData,
131
138
  onPurchaseClicked: fn(),
132
139
  onBackClicked: fn(),
133
- onNavigateToClicked: fn(),
140
+ onNavigateToUrlClicked: fn(),
134
141
  onRestorePurchasesClicked: fn(),
135
142
  }}
136
143
  />
@@ -141,7 +148,7 @@
141
148
  paywallData: stateTemplate,
142
149
  onPurchaseClicked: fn(),
143
150
  onBackClicked: fn(),
144
- onNavigateToClicked: fn(),
151
+ onNavigateToUrlClicked: fn(),
145
152
  onRestorePurchasesClicked: fn(),
146
153
  }}
147
154
  />
@@ -174,7 +181,7 @@
174
181
  },
175
182
  onPurchaseClicked: fn(),
176
183
  onBackClicked: fn(),
177
- onNavigateToClicked: fn(),
184
+ onNavigateToUrlClicked: fn(),
178
185
  onRestorePurchasesClicked: fn(),
179
186
  }}
180
187
  />
@@ -185,7 +192,78 @@
185
192
  paywallData: posterMakerTemplate,
186
193
  onPurchaseClicked: fn(),
187
194
  onBackClicked: fn(),
188
- onNavigateToClicked: fn(),
195
+ onNavigateToUrlClicked: fn(),
196
+ onRestorePurchasesClicked: fn(),
197
+ }}
198
+ />
199
+
200
+ <Story
201
+ name="E2E Test with variables"
202
+ args={{
203
+ paywallData: e2eTestTemplate,
204
+ onPurchaseClicked: fn(),
205
+ onBackClicked: fn(),
206
+ onNavigateToUrlClicked: fn(),
207
+ onRestorePurchasesClicked: fn(),
208
+ }}
209
+ />
210
+
211
+ <Story
212
+ name="Z Stack"
213
+ args={{
214
+ paywallData: zStackTemplate,
215
+ onPurchaseClicked: fn(),
216
+ onBackClicked: fn(),
217
+ onNavigateToUrlClicked: fn(),
218
+ onRestorePurchasesClicked: fn(),
219
+ }}
220
+ />
221
+
222
+ <Story
223
+ name="Color Mode Override"
224
+ args={{
225
+ paywallData: colorModeOverrideTemplate,
226
+ onPurchaseClicked: fn(),
227
+ onBackClicked: fn(),
228
+ onNavigateToUrlClicked: fn(),
229
+ onRestorePurchasesClicked: fn(),
230
+ preferredColorMode: "dark",
231
+ }}
232
+ />
233
+
234
+ <Story
235
+ name="Invalid component type"
236
+ args={{
237
+ paywallData: errorPaywallData,
238
+ onPurchaseClicked: fn(),
239
+ onBackClicked: fn(),
240
+ onNavigateToUrlClicked: fn(),
241
+ onRestorePurchasesClicked: fn(),
242
+ preferredColorMode: "dark",
243
+ onError: (error: unknown) => alert(`Error - ${error}`),
244
+ }}
245
+ />
246
+
247
+ <Story
248
+ name="Fallback Paywall"
249
+ args={{
250
+ paywallData: fallbackPaywallData,
251
+ onPurchaseClicked: fn(),
252
+ onBackClicked: fn(),
253
+ onNavigateToUrlClicked: fn(),
254
+ onRestorePurchasesClicked: fn(),
255
+ preferredColorMode: "dark",
256
+ onError: (error: unknown) => console.error(`Error - ${error}`),
257
+ }}
258
+ />
259
+
260
+ <Story
261
+ name="Sticky Footer"
262
+ args={{
263
+ paywallData: paywallWithFooter,
264
+ onPurchaseClicked: fn(),
265
+ onBackClicked: fn(),
266
+ onNavigateToUrlClicked: fn(),
189
267
  onRestorePurchasesClicked: fn(),
190
268
  }}
191
269
  />