@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.
- package/README.md +27 -14
- package/dist/assets/index-CEz-HnIH.js +11 -0
- package/dist/index.html +1 -1
- package/dist/lib/StudioApp.d.ts +4 -4
- package/dist/lib/components/PaywallToasts.d.ts +3 -0
- package/dist/lib/components/SurfaceCard.d.ts +4 -2
- package/dist/lib/components/{TopBar.d.ts → chrome/TopBar.d.ts} +1 -2
- package/dist/lib/components/icons.d.ts +0 -2
- package/dist/lib/components/{ActionMenu.d.ts → menus/ActionMenu.d.ts} +2 -1
- package/dist/lib/components/{CompareMenu.d.ts → menus/CompareMenu.d.ts} +1 -1
- package/dist/lib/components/{VariablesPanel.d.ts → panels/VariablesPanel.d.ts} +3 -3
- package/dist/lib/components/{DeviceChrome.d.ts → preview/DeviceChrome.d.ts} +1 -1
- package/dist/lib/components/{DeviceFrame.d.ts → preview/DeviceFrame.d.ts} +5 -2
- package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
- package/dist/lib/index.d.ts +14 -6
- package/dist/lib/index.js +1490 -998
- package/dist/lib/lib/actions.d.ts +1 -1
- package/dist/lib/lib/contract.d.ts +33 -0
- package/dist/lib/lib/devices.d.ts +1 -1
- package/dist/lib/lib/host.d.ts +15 -0
- package/dist/lib/lib/notices.d.ts +9 -0
- package/dist/lib/lib/preview.d.ts +2 -4
- package/dist/lib/lib/project.d.ts +2 -1
- package/dist/lib/lib/steps.d.ts +5 -0
- package/dist/lib/lib/studio-host.d.ts +34 -0
- package/dist/lib/lib/surfaces.d.ts +36 -0
- package/dist/lib/lib/variables.d.ts +12 -0
- package/dist/lib/products.js +26 -12
- package/dist/lib/screens/SurfaceEditor.d.ts +2 -3
- package/dist/lib/screens/SurfaceList.d.ts +2 -3
- package/package.json +5 -1
- package/src/StudioApp.tsx +25 -28
- package/src/components/PaywallToasts.tsx +162 -86
- package/src/components/SurfaceCard.tsx +9 -2
- package/src/components/chrome/TopBar.tsx +45 -0
- package/src/components/icons.tsx +0 -13
- package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +3 -3
- package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +2 -2
- package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
- package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
- package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
- package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
- package/src/components/preview/HostedIframe.tsx +46 -0
- package/src/index.ts +32 -12
- package/src/lib/actions.ts +1 -1
- package/src/lib/contract.ts +30 -0
- package/src/lib/devices.ts +5 -4
- package/src/lib/host.ts +79 -0
- package/src/lib/notices.ts +63 -0
- package/src/lib/preview.ts +8 -40
- package/src/lib/products.ts +20 -1
- package/src/lib/project.ts +2 -1
- package/src/lib/steps.ts +20 -0
- package/src/lib/studio-host.tsx +61 -0
- package/src/lib/surfaces.ts +43 -0
- package/src/lib/time.ts +1 -2
- package/src/lib/variables.ts +13 -0
- package/src/main.tsx +6 -5
- package/src/screens/SurfaceEditor.tsx +79 -70
- package/src/screens/SurfaceList.tsx +27 -12
- package/src/vite-env.d.ts +1 -0
- package/dist/assets/index-CVKQ82YR.js +0 -11
- package/dist/lib/lib/events.d.ts +0 -27
- package/dist/lib/lib/types.d.ts +0 -77
- package/src/components/TopBar.tsx +0 -41
- package/src/lib/events.ts +0 -86
- package/src/lib/types.ts +0 -87
- /package/dist/lib/components/{StudioShell.d.ts → chrome/StudioShell.d.ts} +0 -0
- /package/dist/lib/components/{Toolbar.d.ts → chrome/Toolbar.d.ts} +0 -0
- /package/dist/lib/components/{MissingProducts.d.ts → panels/MissingProducts.d.ts} +0 -0
- /package/dist/lib/components/{SidePanel.d.ts → panels/SidePanel.d.ts} +0 -0
- /package/src/components/{StudioShell.tsx → chrome/StudioShell.tsx} +0 -0
- /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
- /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
package/README.md
CHANGED
|
@@ -60,12 +60,25 @@ Everything renders from a `StudioSource` — `{ title, surfaces, diagnostics?,
|
|
|
60
60
|
samples?, previewUrl, capabilities? }`. Locally that's
|
|
61
61
|
`/__studio/project.json` (the dev server evaluates configs server-side and
|
|
62
62
|
ships sample device/user/params/product data alongside). A hosted studio
|
|
63
|
-
swaps the fetch, nothing else. `previewUrl(surface
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
swaps the fetch, nothing else. `previewUrl(surface)` decides what the preview
|
|
64
|
+
iframes load: `/preview/<kind>/<id>` mounts locally, published snapshot URLs
|
|
65
|
+
in the dashboard. Both carry `?transport=editor`, which makes the paywall
|
|
66
|
+
talk to its parent window, and the studio is that parent.
|
|
67
|
+
|
|
68
|
+
The studio is a paywall host in the SDK's sense, through `@superwall/host`.
|
|
69
|
+
Each `DeviceFrame` answers its paywall's `ping` with the same burst the web
|
|
70
|
+
host sends (`template_variables`, `experiment`, `products`,
|
|
71
|
+
`template_substitutions_prefix`, `paywall_open`), built from the host state
|
|
72
|
+
`SurfaceEditor` assembles: the API's device and user samples (or the host
|
|
73
|
+
package's defaults), the selected device frame's `platform`/`deviceModel`/
|
|
74
|
+
`osVersion`, the theme as `interfaceStyle`, the chosen locale as
|
|
75
|
+
`deviceLocale`, one product per slot with the catalogue's variables (or the
|
|
76
|
+
visual editor's example prices for a slot the catalogue cannot price), and
|
|
77
|
+
whatever the Variables panel edits on top. Every edit re-sends only what
|
|
78
|
+
changed; nothing reloads. Purchases, restores, permissions and callbacks come
|
|
79
|
+
back as prompts in the toasts and are answered with the messages the iOS SDK
|
|
80
|
+
sends. Nothing about this is specific to the studio: the paywall cannot tell
|
|
81
|
+
it from a device.
|
|
69
82
|
|
|
70
83
|
## Hosting
|
|
71
84
|
|
|
@@ -73,14 +86,11 @@ The dashboard opens a code-first paywall in this studio instead of the visual
|
|
|
73
86
|
editor. What the library gives a host:
|
|
74
87
|
|
|
75
88
|
- `snapshotPreviewUrl(urlOf)` — a `previewUrl` that resolves each surface to
|
|
76
|
-
its published snapshot URL
|
|
77
|
-
|
|
78
|
-
`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
prompts reach the host's toasts, and a `hello` message carries the
|
|
82
|
-
paywall's locales, so `SurfaceEditor` fills its locale switcher when the
|
|
83
|
-
host passes `locales: []`.
|
|
89
|
+
its published snapshot URL and adds `transport=editor`. Set
|
|
90
|
+
`paywallId`, `paywallIdentifier`, `products` and `locales` on each
|
|
91
|
+
`StudioSurface` from the paywall and version records; the studio hosts the
|
|
92
|
+
snapshot from them. `hostStateFor` and `hostPatch` are exported for a host
|
|
93
|
+
that wants to drive a `DeviceFrame` itself.
|
|
84
94
|
- One `StudioSurface` per version, told apart by `label` (`"v12 · live"`);
|
|
85
95
|
`StudioSource.compareHint` names what the compare menu offers, and
|
|
86
96
|
`SurfaceEditor`'s `actions` slot takes the host's own controls (a version
|
|
@@ -96,6 +106,9 @@ editor. What the library gives a host:
|
|
|
96
106
|
(the v2 API shape) to the variables a paywall reads (`price`, `periodly`,
|
|
97
107
|
`trialPeriodDays`, …). The CLI and the hosted studio share it, so the
|
|
98
108
|
Variables panel shows the same numbers in both.
|
|
109
|
+
- `@superwall/studio/contract` is a types-only entry: the action, status,
|
|
110
|
+
samples and app-scheme shapes the CLI implements for the framework's
|
|
111
|
+
preview server, importable from node without DOM types.
|
|
99
112
|
`@superwall/studio/styles.css` is the Tailwind source for hosts that run
|
|
100
113
|
their own v4 pipeline.
|
|
101
114
|
|