@superwall/studio 1.2.0 → 1.3.0-beta.4

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 (74) hide show
  1. package/README.md +27 -14
  2. package/dist/assets/index-CEz-HnIH.js +11 -0
  3. package/dist/index.html +1 -1
  4. package/dist/lib/StudioApp.d.ts +4 -4
  5. package/dist/lib/components/PaywallToasts.d.ts +3 -0
  6. package/dist/lib/components/SurfaceCard.d.ts +4 -2
  7. package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +1 -2
  8. package/dist/lib/components/icons.d.ts +0 -2
  9. package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
  10. package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
  11. package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
  12. package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
  13. package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
  14. package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
  15. package/dist/lib/index.d.ts +14 -6
  16. package/dist/lib/index.js +1490 -998
  17. package/dist/lib/lib/actions.d.ts +1 -1
  18. package/dist/lib/lib/contract.d.ts +33 -0
  19. package/dist/lib/lib/devices.d.ts +1 -1
  20. package/dist/lib/lib/host.d.ts +15 -0
  21. package/dist/lib/lib/notices.d.ts +9 -0
  22. package/dist/lib/lib/preview.d.ts +2 -4
  23. package/dist/lib/lib/project.d.ts +2 -1
  24. package/dist/lib/lib/steps.d.ts +5 -0
  25. package/dist/lib/lib/studio-host.d.ts +34 -0
  26. package/dist/lib/lib/surfaces.d.ts +36 -0
  27. package/dist/lib/lib/variables.d.ts +12 -0
  28. package/dist/lib/products.js +26 -12
  29. package/dist/lib/screens/SurfaceEditor.d.ts +2 -3
  30. package/dist/lib/screens/SurfaceList.d.ts +2 -3
  31. package/package.json +5 -1
  32. package/src/StudioApp.tsx +25 -28
  33. package/src/components/PaywallToasts.tsx +162 -86
  34. package/src/components/SurfaceCard.tsx +9 -2
  35. package/src/components/chrome/TopBar.tsx +45 -0
  36. package/src/components/icons.tsx +0 -13
  37. package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
  38. package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
  39. package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
  40. package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
  41. package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
  42. package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
  43. package/src/components/preview/HostedIframe.tsx +46 -0
  44. package/src/index.ts +32 -12
  45. package/src/lib/actions.ts +1 -1
  46. package/src/lib/contract.ts +30 -0
  47. package/src/lib/devices.ts +5 -4
  48. package/src/lib/host.ts +79 -0
  49. package/src/lib/notices.ts +63 -0
  50. package/src/lib/preview.ts +8 -40
  51. package/src/lib/products.ts +20 -1
  52. package/src/lib/project.ts +2 -1
  53. package/src/lib/steps.ts +20 -0
  54. package/src/lib/studio-host.tsx +61 -0
  55. package/src/lib/surfaces.ts +43 -0
  56. package/src/lib/time.ts +1 -2
  57. package/src/lib/variables.ts +13 -0
  58. package/src/main.tsx +6 -5
  59. package/src/screens/SurfaceEditor.tsx +79 -70
  60. package/src/screens/SurfaceList.tsx +27 -12
  61. package/src/vite-env.d.ts +1 -0
  62. package/dist/assets/index-CVKQ82YR.js +0 -11
  63. package/dist/lib/lib/events.d.ts +0 -27
  64. package/dist/lib/lib/types.d.ts +0 -77
  65. package/src/components/TopBar.tsx +0 -41
  66. package/src/lib/events.ts +0 -86
  67. package/src/lib/types.ts +0 -87
  68. /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
  69. /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
  70. /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
  71. /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
  72. /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
  73. /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
  74. /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
package/dist/index.html CHANGED
@@ -14,7 +14,7 @@
14
14
  <style>
15
15
  body { margin: 0; background: #1a1918; }
16
16
  </style>
17
- <script type="module" crossorigin src="/__studio/assets/index-CVKQ82YR.js"></script>
17
+ <script type="module" crossorigin src="/__studio/assets/index-CEz-HnIH.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/__studio/assets/index-_HCp6gCi.css">
19
19
  </head>
20
20
  <body>
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
- import type { StudioSource } from "./lib/types";
3
- export declare const StudioApp: ({ source, device, openPreview, }: {
2
+ import { type StudioMode } from "./lib/studio-host";
3
+ import type { StudioSource } from "./lib/surfaces";
4
+ export declare const StudioApp: ({ source, mode, }: {
4
5
  source: StudioSource;
5
- device?: boolean;
6
- openPreview?: (url: string) => void;
6
+ mode?: StudioMode;
7
7
  }) => React.JSX.Element;
@@ -1,4 +1,7 @@
1
1
  import * as React from "react";
2
+ import type { HostDelegate } from "@superwall/host";
3
+ export declare const createStudioDelegate: () => HostDelegate;
4
+ export declare const useStudioDelegate: () => HostDelegate;
2
5
  export declare const PaywallToasts: ({ surfaceKey, raised, }: {
3
6
  surfaceKey: string;
4
7
  raised?: boolean;
@@ -1,9 +1,11 @@
1
1
  import * as React from "react";
2
- import type { StudioStatus, StudioSurface } from "../lib/types";
3
- export declare const SurfaceCard: ({ surface, status, previewSrc, onOpen, href, }: {
2
+ import { type HostState } from "@superwall/host";
3
+ import type { StudioStatus, StudioSurface } from "../lib/surfaces";
4
+ export declare const SurfaceCard: ({ surface, status, previewSrc, hostState, onOpen, href, }: {
4
5
  surface: StudioSurface;
5
6
  status?: StudioStatus;
6
7
  previewSrc: string;
8
+ hostState: HostState;
7
9
  onOpen: () => void;
8
10
  href?: string;
9
11
  }) => React.JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
- export declare const TopBar: ({ title, onHome, actions, inset, label, }: {
2
+ export declare const TopBar: ({ title, actions, inset, label, }: {
3
3
  title: string;
4
- onHome: () => void;
5
4
  actions?: React.ReactNode;
6
5
  inset?: boolean;
7
6
  label?: string;
@@ -1,10 +1,8 @@
1
1
  import * as React from "react";
2
- export declare const ChevronLeftIcon: () => React.JSX.Element;
3
2
  export declare const RotateIcon: () => React.JSX.Element;
4
3
  export declare const ExternalIcon: () => React.JSX.Element;
5
4
  export declare const SunIcon: () => React.JSX.Element;
6
5
  export declare const MoonIcon: () => React.JSX.Element;
7
- export declare const ResetIcon: () => React.JSX.Element;
8
6
  export declare const SlidersIcon: () => React.JSX.Element;
9
7
  export declare const CloseIcon: () => React.JSX.Element;
10
8
  export declare const ChevronDownIcon: () => React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
- import { type StudioActionName, type StudioActionStep, type StudioStepState } from "../lib/types";
2
+ import { type StudioActionStep, type StudioStepState } from "../../lib/steps";
3
+ import { type StudioActionName } from "../../lib/surfaces";
3
4
  export type ActionProgress = {
4
5
  action: StudioActionName;
5
6
  steps: Partial<Record<StudioActionStep, StudioStepState>>;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { CompareTarget } from "../lib/types";
2
+ import type { CompareTarget } from "../../lib/surfaces";
3
3
  export type CompareOption = {
4
4
  key: string;
5
5
  label: string;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import type { PreviewOverrides } from "../lib/types";
2
+ import type { VariableOverrides } from "../../lib/variables";
3
3
  export type VariableGroup = "user" | "device" | "params" | "products";
4
4
  export type VariableRow = {
5
5
  path: string;
@@ -7,7 +7,7 @@ export type VariableRow = {
7
7
  };
8
8
  export type VariableGroups = Partial<Record<VariableGroup, VariableRow[]>>;
9
9
  export declare const VariablesPanel: ({ overrides, groups, onChange, }: {
10
- overrides: PreviewOverrides;
10
+ overrides: VariableOverrides;
11
11
  groups: VariableGroups;
12
- onChange: (overrides: PreviewOverrides) => void;
12
+ onChange: (overrides: VariableOverrides) => void;
13
13
  }) => React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { DeviceChromeSpec } from "../lib/devices";
1
+ import type { DeviceChromeSpec } from "../../lib/devices";
2
2
  /**
3
3
  * Drawn in device pixels over the preview iframe; the frame scales the whole
4
4
  * layer. Everything is pointer-events-none so taps land on the paywall.
@@ -1,15 +1,18 @@
1
1
  import * as React from "react";
2
- import type { DeviceChromeSpec } from "../lib/devices";
2
+ import type { HostDelegate, HostState } from "@superwall/host";
3
+ import type { DeviceChromeSpec } from "../../lib/devices";
3
4
  export declare const DevicePlaceholder: ({ width, height, stageRef, children, }: React.PropsWithChildren<{
4
5
  width: number;
5
6
  height: number;
6
7
  stageRef: React.RefObject<HTMLElement | null>;
7
8
  }>) => React.JSX.Element;
8
- export declare const DeviceFrame: ({ width, height, title, src, stageRef, reloadKey, chrome, landscape, theme, }: {
9
+ export declare const DeviceFrame: ({ width, height, title, src, hostState, delegate, stageRef, reloadKey, chrome, landscape, theme, }: {
9
10
  width: number;
10
11
  height: number;
11
12
  title: string;
12
13
  src: string;
14
+ hostState: HostState;
15
+ delegate: HostDelegate;
13
16
  stageRef: React.RefObject<HTMLElement | null>;
14
17
  reloadKey?: number;
15
18
  chrome?: DeviceChromeSpec;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ import { type HostDelegate, type HostState } from "@superwall/host";
3
+ export type HostedIframeProps = React.ComponentPropsWithoutRef<"iframe"> & {
4
+ hostState: HostState;
5
+ delegate: HostDelegate;
6
+ };
7
+ export declare const HostedIframe: ({ hostState, delegate, ...iframe }: HostedIframeProps) => React.JSX.Element;
@@ -2,13 +2,21 @@ import "./styles.css";
2
2
  export { StudioApp } from "./StudioApp";
3
3
  export { SurfaceEditor } from "./screens/SurfaceEditor";
4
4
  export { SurfaceList } from "./screens/SurfaceList";
5
- export { DeviceFrame } from "./components/DeviceFrame";
6
- export { StudioShell } from "./components/StudioShell";
7
- export { TopBar } from "./components/TopBar";
8
- export { VariablesPanel } from "./components/VariablesPanel";
5
+ export { DeviceFrame } from "./components/preview/DeviceFrame";
6
+ export { HostedIframe } from "./components/preview/HostedIframe";
7
+ export { PaywallToasts, createStudioDelegate, useStudioDelegate } from "./components/PaywallToasts";
8
+ export { StudioShell } from "./components/chrome/StudioShell";
9
+ export { TopBar } from "./components/chrome/TopBar";
10
+ export { VariablesPanel } from "./components/panels/VariablesPanel";
9
11
  export { Segmented, Select, Switch } from "./components/controls";
10
12
  export { DEFAULT_DEVICE_ID, deviceById, STUDIO_DEVICES } from "./lib/devices";
11
13
  export type { StudioDevice } from "./lib/devices";
12
- export { buildPreviewPath, snapshotPreviewUrl, withOverrides, withPreviewOptIn, } from "./lib/preview";
14
+ export { hostStateFor, studioDefaults } from "./lib/host";
15
+ export { hasActions } from "./lib/surfaces";
16
+ export { StudioHostProvider, useStudioHome, useStudioMode, type StudioHome, type StudioMode, } from "./lib/studio-host";
17
+ export { createHostState, diffHostState, hasIntroductoryOffer, silentDelegate, type HostDelegate, type HostProduct, type HostState, } from "@superwall/host";
18
+ export type { HostInputs } from "./lib/host";
19
+ export { buildPreviewPath, hostedUrl, snapshotPreviewUrl, surfacePath } from "./lib/preview";
13
20
  export { parseProjectPayload, type StudioProjectPayload } from "./lib/project";
14
- export type { PreviewOverrides, PreviewUrlBuilder, SampleDefaults, Samples, StudioSource, StudioSurface, StudioSurfaceKind, } from "./lib/types";
21
+ export type { AppScheme, PreviewUrlBuilder, Samples, StudioActionName, StudioActionProgress, StudioActionResult, StudioSource, StudioStatus, StudioSurface, StudioSurfaceKind, } from "./lib/surfaces";
22
+ export type { SampleDefaults, VariableOverrides } from "./lib/variables";