@revenuecat/purchases-ui-js 3.0.1 → 3.1.0

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.
@@ -0,0 +1,31 @@
1
+ <script module lang="ts">
2
+ import { defineMeta } from "@storybook/addon-svelte-csf";
3
+
4
+ import Screen from "./Screen.svelte";
5
+ import { paywallData, uiConfigData } from "../../stories/fixtures";
6
+ import type { WorkflowScreen } from "../../types/workflow";
7
+
8
+ const defaultScreen: WorkflowScreen = {
9
+ ...paywallData,
10
+ asset_base_url: "https://assets.pawwalls.com",
11
+ config: {},
12
+ localized_strings: {},
13
+ localized_strings_by_tier: {},
14
+ name: "Demo Screen",
15
+ offering_id: "demo_offering",
16
+ revision: 1,
17
+ template_name: "stack",
18
+ };
19
+
20
+ const { Story } = defineMeta({
21
+ title: "Components/Screen",
22
+ component: Screen,
23
+ args: {
24
+ paywallComponents: defaultScreen,
25
+ selectedLocale: defaultScreen.default_locale,
26
+ uiConfig: uiConfigData,
27
+ },
28
+ });
29
+ </script>
30
+
31
+ <Story name="Default" />
@@ -0,0 +1,19 @@
1
+ import Screen from "./Screen.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 Screen: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
16
+ [evt: string]: CustomEvent<any>;
17
+ }, {}, {}, string>;
18
+ type Screen = InstanceType<typeof Screen>;
19
+ export default Screen;
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import Paywall, {
3
+ type UIConfig,
4
+ } from "../paywall/Paywall.svelte";
5
+ import type { WorkflowScreen } from "../../types/workflow";
6
+ import { VARIABLES } from "../paywall/fixtures/variables";
7
+ interface Props {
8
+ paywallComponents: WorkflowScreen | null | undefined;
9
+ selectedLocale?: string;
10
+ uiConfig: UIConfig;
11
+ onActionTriggered?: (actionId: string) => void;
12
+ onPurchaseClicked?: (
13
+ packageId: string,
14
+ actionId: string,
15
+ ) => void | Promise<void>;
16
+ containerId?: string;
17
+ }
18
+ const {
19
+ paywallComponents,
20
+ selectedLocale = "en_US",
21
+ uiConfig,
22
+ onActionTriggered,
23
+ onPurchaseClicked,
24
+ containerId = "screen-container",
25
+ }: Props = $props();
26
+ </script>
27
+
28
+ <div id={containerId} class="paywall-container">
29
+ {#if paywallComponents}
30
+ <Paywall
31
+ paywallData={paywallComponents}
32
+ {selectedLocale}
33
+ {uiConfig}
34
+ variablesPerPackage={VARIABLES}
35
+ onNavigateToUrlClicked={() => {}}
36
+ onVisitCustomerCenterClicked={() => {}}
37
+ onBackClicked={() => {}}
38
+ onRestorePurchasesClicked={() => {}}
39
+ onActionTriggered={(actionId: string) => {
40
+ onActionTriggered?.(actionId);
41
+ }}
42
+ {onPurchaseClicked}
43
+ onError={(error) => {
44
+ console.error("Paywall error:", error);
45
+ }}
46
+ />
47
+ {:else}
48
+ <div>
49
+ <p>No paywall data provided</p>
50
+ </div>
51
+ {/if}
52
+ </div>
@@ -0,0 +1,13 @@
1
+ import { type UIConfig } from "../paywall/Paywall.svelte";
2
+ import type { WorkflowScreen } from "../../types/workflow";
3
+ interface Props {
4
+ paywallComponents: WorkflowScreen | null | undefined;
5
+ selectedLocale?: string;
6
+ uiConfig: UIConfig;
7
+ onActionTriggered?: (actionId: string) => void;
8
+ onPurchaseClicked?: (packageId: string, actionId: string) => void | Promise<void>;
9
+ containerId?: string;
10
+ }
11
+ declare const Screen: import("svelte").Component<Props, {}, "">;
12
+ type Screen = ReturnType<typeof Screen>;
13
+ export default Screen;
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export { default as PurchaseButton } from "./components/purchase-button/Purchase
11
11
  export { default as Stack } from "./components/stack/Stack.svelte";
12
12
  export { default as Text } from "./components/text/Text.svelte";
13
13
  export { default as Timeline } from "./components/timeline/Timeline.svelte";
14
+ export { default as Screen } from "./components/workflows/Screen.svelte";
14
15
  export { default as Video } from "./components/video/Video.svelte";
15
16
  export * from "./types";
16
17
  export { type PaywallData } from "./types/paywall";
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { default as PurchaseButton } from "./components/purchase-button/Purchase
12
12
  export { default as Stack } from "./components/stack/Stack.svelte";
13
13
  export { default as Text } from "./components/text/Text.svelte";
14
14
  export { default as Timeline } from "./components/timeline/Timeline.svelte";
15
+ export { default as Screen } from "./components/workflows/Screen.svelte";
15
16
  export { default as Video } from "./components/video/Video.svelte";
16
17
  export * from "./types";
17
18
  export {} from "./types/paywall";
@@ -0,0 +1,15 @@
1
+ import type { PaywallData } from "./paywall";
2
+ /**
3
+ * Represents a screen/paywall configuration in a workflow.
4
+ * Extends core PaywallData with workflow-specific metadata.
5
+ */
6
+ export interface WorkflowScreen extends PaywallData {
7
+ asset_base_url: string;
8
+ config: Record<string, unknown>;
9
+ localized_strings: Record<string, Record<string, string>>;
10
+ localized_strings_by_tier: Record<string, Record<string, string>>;
11
+ name: string;
12
+ offering_id: string | null;
13
+ revision: number;
14
+ template_name: string;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
package/dist/types.d.ts CHANGED
@@ -119,4 +119,4 @@ export declare enum StackDistribution {
119
119
  center = "center",
120
120
  end = "flex-end"
121
121
  }
122
- export {};
122
+ export type { WorkflowScreen } from "./types/workflow";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@revenuecat/purchases-ui-js",
3
3
  "description": "Web components for Paywalls. Powered by RevenueCat",
4
4
  "private": false,
5
- "version": "3.0.1",
5
+ "version": "3.1.0",
6
6
  "author": {
7
7
  "name": "RevenueCat, Inc."
8
8
  },