@superwall/studio 1.3.0 → 1.5.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.
Files changed (62) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/index-Bi2YHYVJ.js +11 -0
  3. package/dist/assets/index-DrsTCwot.css +1 -0
  4. package/dist/index.html +2 -2
  5. package/dist/lib/components/DownloadScreenshot.d.ts +6 -0
  6. package/dist/lib/components/PreviewOnDevice.d.ts +6 -0
  7. package/dist/lib/components/Tooltip.d.ts +5 -0
  8. package/dist/lib/components/chrome/Toolbar.d.ts +1 -0
  9. package/dist/lib/components/chrome/TopBar.d.ts +1 -0
  10. package/dist/lib/components/icons.d.ts +1 -0
  11. package/dist/lib/components/menus/CompareMenu.d.ts +2 -1
  12. package/dist/lib/components/preview/Canvas.d.ts +18 -0
  13. package/dist/lib/components/preview/DeviceFrame.d.ts +4 -4
  14. package/dist/lib/components/preview/ResizeHandles.d.ts +13 -0
  15. package/dist/lib/index.d.ts +5 -1
  16. package/dist/lib/index.js +2924 -1229
  17. package/dist/lib/lib/actions.d.ts +1 -0
  18. package/dist/lib/lib/canvas.d.ts +27 -0
  19. package/dist/lib/lib/contract.d.ts +7 -1
  20. package/dist/lib/lib/devices.d.ts +9 -0
  21. package/dist/lib/lib/host.d.ts +2 -1
  22. package/dist/lib/lib/notify.d.ts +4 -0
  23. package/dist/lib/lib/presentation.d.ts +23 -0
  24. package/dist/lib/lib/preview.d.ts +1 -0
  25. package/dist/lib/lib/project.d.ts +1 -0
  26. package/dist/lib/lib/scheme.d.ts +11 -0
  27. package/dist/lib/lib/surfaces.d.ts +26 -2
  28. package/dist/lib/studio.css +1 -1
  29. package/package.json +3 -2
  30. package/src/components/DownloadScreenshot.tsx +133 -0
  31. package/src/components/OpenInApp.tsx +5 -25
  32. package/src/components/PaywallToasts.tsx +5 -3
  33. package/src/components/PreviewOnDevice.tsx +133 -0
  34. package/src/components/SurfaceCard.tsx +1 -1
  35. package/src/components/Tooltip.tsx +27 -0
  36. package/src/components/chrome/Toolbar.tsx +47 -6
  37. package/src/components/chrome/TopBar.tsx +37 -3
  38. package/src/components/icons.tsx +6 -0
  39. package/src/components/menus/ActionMenu.tsx +8 -8
  40. package/src/components/menus/CompareMenu.tsx +49 -30
  41. package/src/components/panels/MissingProducts.tsx +1 -1
  42. package/src/components/preview/Canvas.tsx +426 -0
  43. package/src/components/preview/DeviceFrame.tsx +83 -74
  44. package/src/components/preview/ResizeHandles.tsx +205 -0
  45. package/src/index.ts +6 -0
  46. package/src/lib/actions.ts +7 -0
  47. package/src/lib/canvas.ts +60 -0
  48. package/src/lib/contract.ts +8 -1
  49. package/src/lib/devices.ts +52 -4
  50. package/src/lib/host.ts +7 -2
  51. package/src/lib/notify.tsx +31 -0
  52. package/src/lib/presentation.ts +102 -0
  53. package/src/lib/preview.ts +3 -0
  54. package/src/lib/project.ts +45 -1
  55. package/src/lib/scheme.ts +31 -0
  56. package/src/lib/surfaces.ts +42 -1
  57. package/src/main.tsx +5 -1
  58. package/src/screens/SurfaceEditor.tsx +219 -52
  59. package/src/screens/SurfaceList.tsx +2 -2
  60. package/src/styles.css +89 -8
  61. package/dist/assets/index-CEz-HnIH.js +0 -11
  62. package/dist/assets/index-_HCp6gCi.css +0 -1
@@ -0,0 +1,133 @@
1
+ import * as React from "react";
2
+ import { QRCodeSVG } from "qrcode.react";
3
+ import { useStudioMode } from "../lib/studio-host";
4
+ import { devServerLink, readScheme, storeScheme } from "../lib/scheme";
5
+ import type { StudioSource, StudioSurface } from "../lib/surfaces";
6
+
7
+ type LinkState =
8
+ | { status: "loading" }
9
+ | { status: "ready"; url: string }
10
+ | { status: "unavailable"; reason: string };
11
+
12
+ const askForScheme = (initial: string): string | undefined => {
13
+ const answer = window.prompt("Your app's URL scheme, so this can open it:", initial);
14
+ const trimmed = answer?.trim();
15
+ if (trimmed === undefined || trimmed === "") return undefined;
16
+ storeScheme(trimmed);
17
+ return trimmed;
18
+ };
19
+
20
+ export const PreviewOnDevice = ({
21
+ source,
22
+ surface,
23
+ }: {
24
+ source: StudioSource;
25
+ surface: StudioSurface;
26
+ }) => {
27
+ const hosted = useStudioMode() === "hosted";
28
+ const [open, setOpen] = React.useState(false);
29
+ const [scheme, setScheme] = React.useState(() => readScheme() ?? source.scheme);
30
+ const [link, setLink] = React.useState<LinkState>({ status: "loading" });
31
+
32
+ React.useEffect(() => {
33
+ if (!open) return;
34
+
35
+ // A hosted studio has no dev server to point at, so the host mints a link
36
+ // that opens the live paywall through the SDK's debugger instead.
37
+ if (hosted) {
38
+ const build = source.previewLink;
39
+ if (build === undefined) {
40
+ setLink({ status: "unavailable", reason: "This studio cannot open paywalls on a device." });
41
+ return;
42
+ }
43
+ let cancelled = false;
44
+ setLink({ status: "loading" });
45
+ build(surface).then(
46
+ (url) => {
47
+ if (!cancelled) setLink({ status: "ready", url });
48
+ },
49
+ (error: unknown) => {
50
+ if (!cancelled) setLink({ status: "unavailable", reason: String(error) });
51
+ },
52
+ );
53
+ return () => {
54
+ cancelled = true;
55
+ };
56
+ }
57
+
58
+ if (scheme === undefined) {
59
+ setLink({ status: "unavailable", reason: "Set your app's URL scheme to build a link." });
60
+ return;
61
+ }
62
+
63
+ setLink({
64
+ status: "ready",
65
+ url: devServerLink(scheme, source.networkOrigin ?? window.location.origin, surface.id),
66
+ });
67
+ }, [open, hosted, scheme, source, surface]);
68
+
69
+ return (
70
+ <>
71
+ <button className="sw-btn" type="button" onClick={() => setOpen(true)}>
72
+ Preview
73
+ </button>
74
+
75
+ {open && (
76
+ <div
77
+ className="fixed inset-0 z-50 flex items-center justify-center bg-ink/80 p-6"
78
+ role="dialog"
79
+ aria-modal="true"
80
+ aria-label="Preview on a device"
81
+ onClick={() => setOpen(false)}
82
+ >
83
+ <div
84
+ className="bg-bar flex w-[22rem] max-w-full flex-col items-center gap-4 rounded border border-cream/10 p-6 text-center"
85
+ onClick={(event) => event.stopPropagation()}
86
+ >
87
+ <div className="flex flex-col gap-1">
88
+ <span className="text-[0.9375rem] font-medium">Preview on a device</span>
89
+ <span className="text-[0.8125rem] text-cream/55">
90
+ {hosted
91
+ ? "Scan with the device that has your app installed. It opens the live paywall in the SDK's debugger."
92
+ : "Scan with the device that has your app installed. It opens this paywall against this machine's dev server."}
93
+ </span>
94
+ </div>
95
+
96
+ {link.status === "ready" ? (
97
+ <>
98
+ <div className="bg-cream rounded p-3">
99
+ <QRCodeSVG value={link.url} size={192} />
100
+ </div>
101
+ <code className="max-w-full font-mono text-[0.6875rem] break-all text-cream/55">
102
+ {link.url}
103
+ </code>
104
+ </>
105
+ ) : (
106
+ <div className="flex size-[216px] flex-none items-center justify-center rounded border border-cream/20 px-6 text-center text-[0.8125rem] text-cream/55">
107
+ {link.status === "loading" ? "Building a link…" : link.reason}
108
+ </div>
109
+ )}
110
+
111
+ <div className="flex items-center gap-2">
112
+ {!hosted && (
113
+ <button
114
+ className="sw-btn"
115
+ type="button"
116
+ onClick={() => {
117
+ const answer = askForScheme(scheme ?? "");
118
+ if (answer !== undefined) setScheme(answer);
119
+ }}
120
+ >
121
+ {scheme === undefined ? "Set URL scheme" : "Edit URL scheme"}
122
+ </button>
123
+ )}
124
+ <button className="sw-btn" type="button" onClick={() => setOpen(false)}>
125
+ Done
126
+ </button>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ )}
131
+ </>
132
+ );
133
+ };
@@ -56,7 +56,7 @@ export const SurfaceCard = ({
56
56
  }}
57
57
  >
58
58
  <div
59
- className="bg-panel relative aspect-[390/844] overflow-hidden border border-cream/20 transition-colors group-hover:border-cream/35"
59
+ className="bg-panel relative aspect-[390/844] overflow-hidden rounded border border-cream/20 transition-colors group-hover:border-cream/35"
60
60
  ref={previewRef}
61
61
  >
62
62
  {scale > 0 && (
@@ -0,0 +1,27 @@
1
+ import * as React from "react";
2
+
3
+ export const Tooltip = ({ hint, children }: { hint?: string; children: React.ReactNode }) => {
4
+ const [shown, setShown] = React.useState(false);
5
+
6
+ if (hint === undefined) return <>{children}</>;
7
+
8
+ return (
9
+ <span
10
+ className="relative inline-flex"
11
+ onMouseEnter={() => setShown(true)}
12
+ onMouseLeave={() => setShown(false)}
13
+ onFocus={() => setShown(true)}
14
+ onBlur={() => setShown(false)}
15
+ >
16
+ {children}
17
+ {shown && (
18
+ <span
19
+ role="tooltip"
20
+ className="bg-bar pointer-events-none absolute top-full right-0 z-50 mt-[calc(0.5rem+2px)] w-64 rounded border border-cream/10 px-3 py-2 text-left text-[0.75rem] leading-snug font-normal whitespace-normal text-cream/75"
21
+ >
22
+ {hint}
23
+ </span>
24
+ )}
25
+ </span>
26
+ );
27
+ };
@@ -1,10 +1,49 @@
1
1
  import * as React from "react";
2
2
 
3
- export const Toolbar = ({ children }: React.PropsWithChildren) => (
4
- <div className="bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5">
5
- {children}
6
- </div>
7
- );
3
+ const DIVIDER = "data-toolbar-divider";
4
+ const ORPHAN = "data-orphan";
5
+
6
+ const midline = (item: HTMLElement) => item.offsetTop + item.offsetHeight / 2;
7
+
8
+ const sameRow = (a: HTMLElement, b: HTMLElement) =>
9
+ Math.abs(midline(a) - midline(b)) <= Math.min(a.offsetHeight, b.offsetHeight) / 2 + 1;
10
+
11
+ export const markOrphanDividers = (toolbar: HTMLElement) => {
12
+ const items = [...toolbar.children].filter(
13
+ (child): child is HTMLElement => child instanceof HTMLElement,
14
+ );
15
+ items.forEach((item, index) => {
16
+ if (!item.hasAttribute(DIVIDER)) return;
17
+ const previous = items[index - 1];
18
+ const next = items[index + 1];
19
+ const startsRow = previous === undefined || !sameRow(previous, item);
20
+ const endsRow = next === undefined || !sameRow(item, next);
21
+ item.toggleAttribute(ORPHAN, startsRow || endsRow);
22
+ });
23
+ };
24
+
25
+ export const Toolbar = ({ children }: React.PropsWithChildren) => {
26
+ const [toolbar, setToolbar] = React.useState<HTMLDivElement | null>(null);
27
+
28
+ React.useLayoutEffect(() => {
29
+ if (!toolbar) return undefined;
30
+ const mark = () => markOrphanDividers(toolbar);
31
+ mark();
32
+ if (typeof ResizeObserver === "undefined") return undefined;
33
+ const observer = new ResizeObserver(mark);
34
+ observer.observe(toolbar);
35
+ return () => observer.disconnect();
36
+ }, [toolbar, children]);
37
+
38
+ return (
39
+ <div
40
+ className="bg-bar z-10 flex min-h-14 flex-none flex-wrap items-center justify-center gap-3 border-t border-cream/10 px-4 py-2.5"
41
+ ref={setToolbar}
42
+ >
43
+ {children}
44
+ </div>
45
+ );
46
+ };
8
47
 
9
48
  export const ToolbarGroup = ({ label, children }: React.PropsWithChildren<{ label: string }>) => (
10
49
  <div className="flex items-center gap-2.5">
@@ -13,4 +52,6 @@ export const ToolbarGroup = ({ label, children }: React.PropsWithChildren<{ labe
13
52
  </div>
14
53
  );
15
54
 
16
- export const ToolbarDivider = () => <span className="h-6 w-px bg-cream/10" />;
55
+ export const ToolbarDivider = () => (
56
+ <span className="h-6 w-px bg-cream/10 data-[orphan]:invisible" data-toolbar-divider="" />
57
+ );
@@ -1,6 +1,21 @@
1
1
  import * as React from "react";
2
2
  import { useStudioHome } from "../../lib/studio-host";
3
3
 
4
+ const CLEARANCE = 16;
5
+
6
+ export const titleFits = (bar: HTMLElement, title: HTMLElement) => {
7
+ const siblings = [...bar.children].filter(
8
+ (child): child is HTMLElement => child instanceof HTMLElement && child !== title,
9
+ );
10
+ const centre = bar.clientWidth / 2;
11
+ const half = title.scrollWidth / 2;
12
+ return siblings.every((sibling) => {
13
+ const start = sibling.offsetLeft;
14
+ const end = start + sibling.offsetWidth;
15
+ return end + CLEARANCE <= centre - half || start - CLEARANCE >= centre + half;
16
+ });
17
+ };
18
+
4
19
  export const TopBar = ({
5
20
  title,
6
21
  actions,
@@ -13,11 +28,26 @@ export const TopBar = ({
13
28
  label?: string;
14
29
  }) => {
15
30
  const home = useStudioHome();
31
+ const [bar, setBar] = React.useState<HTMLDivElement | null>(null);
32
+ const [titleElement, setTitleElement] = React.useState<HTMLSpanElement | null>(null);
33
+ const [fits, setFits] = React.useState(true);
34
+
35
+ React.useLayoutEffect(() => {
36
+ if (!bar || !titleElement) return undefined;
37
+ const measure = () => setFits(titleFits(bar, titleElement));
38
+ measure();
39
+ if (typeof ResizeObserver === "undefined") return undefined;
40
+ const observer = new ResizeObserver(measure);
41
+ observer.observe(bar);
42
+ for (const child of bar.children) observer.observe(child);
43
+ return () => observer.disconnect();
44
+ }, [bar, titleElement, title, actions]);
16
45
 
17
46
  return (
18
- <header className="relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink">
47
+ <header className="relative z-20 flex h-11 flex-none items-center border-b border-cream/10 bg-ink">
19
48
  <div
20
- className={`flex h-full w-full items-center px-3 ${inset ? "mx-auto max-w-[1080px] sm:px-0" : ""}`}
49
+ className={`relative flex h-full w-full items-center px-3 ${inset ? "mx-auto max-w-[1080px] sm:px-0" : ""}`}
50
+ ref={setBar}
21
51
  >
22
52
  <a
23
53
  className="flex items-center gap-3 text-[0.9375rem] font-semibold tracking-[0.01em]"
@@ -35,7 +65,11 @@ export const TopBar = ({
35
65
  <span className="h-4 w-px bg-cream/20" />
36
66
  <span className="font-normal">{label}</span>
37
67
  </a>
38
- <span className="absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block">
68
+ <span
69
+ className={`absolute left-1/2 -translate-x-1/2 text-sm font-medium whitespace-nowrap ${fits ? "" : "invisible"}`}
70
+ aria-hidden={fits ? undefined : true}
71
+ ref={setTitleElement}
72
+ >
39
73
  {title}
40
74
  </span>
41
75
  <div className="ml-auto flex items-center gap-2">{actions}</div>
@@ -21,6 +21,12 @@ export const ExternalIcon = () => (
21
21
  </Icon>
22
22
  );
23
23
 
24
+ export const SpinnerIcon = () => (
25
+ <svg className="sw-icon animate-spin" viewBox="0 0 24 24" aria-hidden="true">
26
+ <path d="M21 12a9 9 0 1 1-9-9" />
27
+ </svg>
28
+ );
29
+
24
30
  export const SunIcon = () => (
25
31
  <Icon>
26
32
  <circle cx="12" cy="12" r="4" />
@@ -10,8 +10,8 @@ import { type StudioActionName } from "../../lib/surfaces";
10
10
 
11
11
  const ACTIONS: readonly { name: StudioActionName; label: string; hint: string }[] = [
12
12
  { name: "push", label: "Push", hint: "New version, nothing live changes" },
13
- { name: "publish", label: "Publish", hint: "Push and make it live" },
14
13
  { name: "promote", label: "Promote", hint: "Make the latest push live" },
14
+ { name: "publish", label: "Publish", hint: "Push and make it live" },
15
15
  ];
16
16
 
17
17
  const labelFor = (name: StudioActionName): string =>
@@ -30,10 +30,10 @@ export type ActionProgress = {
30
30
  };
31
31
 
32
32
  const StepGlyph = ({ state }: { state: StudioStepState }) => {
33
- if (state === "active") return <span className="bg-accent h-2 w-2 animate-pulse" />;
34
- if (state === "done") return <span className="bg-accent h-2 w-2" />;
35
- if (state === "failed") return <span className="bg-red h-2 w-2" />;
36
- return <span className="bg-cream/55 h-2 w-2" />;
33
+ if (state === "active") return <span className="bg-accent h-2 w-2 rounded-full animate-pulse" />;
34
+ if (state === "done") return <span className="bg-accent h-2 w-2 rounded-full" />;
35
+ if (state === "failed") return <span className="bg-red h-2 w-2 rounded-full" />;
36
+ return <span className="bg-cream/55 h-2 w-2 rounded-full" />;
37
37
  };
38
38
 
39
39
  const ProgressPanel = ({ progress }: { progress: ActionProgress }) => {
@@ -126,7 +126,7 @@ export const ActionMenu = ({
126
126
  <div className="relative flex" ref={menuRef}>
127
127
  <button
128
128
  type="button"
129
- className="sw-btn sw-btn--primary disabled:cursor-not-allowed disabled:opacity-40"
129
+ className="sw-btn sw-btn--primary rounded-r-none disabled:cursor-not-allowed disabled:opacity-40"
130
130
  disabled={busy}
131
131
  title={blocked}
132
132
  onClick={() => (stopped ? onBlocked?.() : onRun(selected))}
@@ -135,7 +135,7 @@ export const ActionMenu = ({
135
135
  </button>
136
136
  <button
137
137
  type="button"
138
- className="sw-btn sw-btn--primary -ml-px w-6 !px-0 disabled:cursor-not-allowed disabled:opacity-40"
138
+ className="sw-btn sw-btn--primary -ml-px w-6 rounded-l-none !px-0 disabled:cursor-not-allowed disabled:opacity-40"
139
139
  aria-label="Choose action"
140
140
  aria-expanded={open}
141
141
  title={blocked}
@@ -146,7 +146,7 @@ export const ActionMenu = ({
146
146
  </button>
147
147
 
148
148
  {(showPanel || open) && (
149
- <div className="bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20">
149
+ <div className="bg-bar absolute top-full right-0 z-20 mt-[calc(0.5rem+2px)] overflow-hidden rounded border border-cream/20">
150
150
  {showPanel ? (
151
151
  <ProgressPanel progress={progress} />
152
152
  ) : (
@@ -36,13 +36,21 @@ const Row = ({
36
36
  </button>
37
37
  );
38
38
 
39
+ const Heading = ({ children }: React.PropsWithChildren) => (
40
+ <span className="block px-3 pt-2 pb-1 text-[0.6875rem] tracking-wide text-cream/45 uppercase">
41
+ {children}
42
+ </span>
43
+ );
44
+
39
45
  export const CompareMenu = ({
40
46
  active,
41
47
  options,
48
+ notice,
42
49
  onSelect,
43
50
  }: {
44
51
  active: CompareTarget | undefined;
45
52
  options: CompareOption[];
53
+ notice?: string;
46
54
  onSelect: (target: CompareTarget | undefined) => void;
47
55
  }) => {
48
56
  const [open, setOpen] = React.useState(false);
@@ -64,7 +72,11 @@ export const CompareMenu = ({
64
72
 
65
73
  const activeKey =
66
74
  active &&
67
- (active.type === "live" ? "live" : `surface:${active.surface.kind}/${active.surface.id}`);
75
+ (active.type === "version"
76
+ ? `version:${active.version}`
77
+ : active.type === "origin"
78
+ ? "origin"
79
+ : `surface:${active.surface.kind}/${active.surface.id}`);
68
80
 
69
81
  const choose = (target: CompareTarget | undefined) => {
70
82
  setOpen(false);
@@ -72,12 +84,22 @@ export const CompareMenu = ({
72
84
  };
73
85
 
74
86
  const needle = query.trim().toLowerCase();
75
- const live = options.filter((option) => option.key === "live");
76
- const paywalls = options
77
- .filter((option) => option.key !== "live")
78
- .filter(
79
- (option) => needle === "" || `${option.label} ${option.hint}`.toLowerCase().includes(needle),
80
- );
87
+ const matches = (option: CompareOption) =>
88
+ needle === "" || `${option.label} ${option.hint}`.toLowerCase().includes(needle);
89
+ const origins = options.filter((option) => option.target.type === "origin").filter(matches);
90
+ const versions = options.filter((option) => option.target.type === "version").filter(matches);
91
+ const paywalls = options.filter((option) => option.target.type === "surface").filter(matches);
92
+ const grouped = [origins, versions, paywalls].filter((group) => group.length > 0).length > 1;
93
+ const rows = (group: CompareOption[]) =>
94
+ group.map((option) => (
95
+ <Row
96
+ key={option.key}
97
+ label={option.label}
98
+ hint={option.hint}
99
+ selected={option.key === activeKey}
100
+ onSelect={() => choose(option.target)}
101
+ />
102
+ ));
81
103
 
82
104
  return (
83
105
  <div className="relative flex" ref={menuRef}>
@@ -93,46 +115,43 @@ export const CompareMenu = ({
93
115
  </button>
94
116
 
95
117
  {open && (
96
- <div className="bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20">
118
+ <div className="bg-bar absolute bottom-full left-0 z-20 mb-[calc(0.5rem+2px)] flex w-72 flex-col overflow-hidden rounded border border-cream/20">
97
119
  <div className="p-2">
98
120
  <input
99
121
  className="sw-input"
100
122
  type="search"
101
123
  value={query}
102
- placeholder="Search paywalls"
103
- aria-label="Search paywalls"
124
+ placeholder="Search versions and paywalls"
125
+ aria-label="Search versions and paywalls"
104
126
  onChange={(event) => setQuery(event.target.value)}
105
127
  />
106
128
  </div>
107
129
 
108
130
  <div className="max-h-64 overflow-y-auto">
109
- {paywalls.length === 0 ? (
131
+ {origins.length + versions.length + paywalls.length === 0 ? (
110
132
  <span className="block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45">
111
- {needle === "" ? "No other paywalls here." : `Nothing matches “${query.trim()}”.`}
133
+ {needle === ""
134
+ ? "No pushed versions or other paywalls here."
135
+ : `Nothing matches “${query.trim()}”.`}
112
136
  </span>
113
137
  ) : (
114
- paywalls.map((option) => (
115
- <Row
116
- key={option.key}
117
- label={option.label}
118
- hint={option.hint}
119
- selected={option.key === activeKey}
120
- onSelect={() => choose(option.target)}
121
- />
122
- ))
138
+ <>
139
+ {grouped && origins.length > 0 && <Heading>Rebuilt from</Heading>}
140
+ {rows(origins)}
141
+ {grouped && versions.length > 0 && <Heading>Versions</Heading>}
142
+ {rows(versions)}
143
+ {grouped && paywalls.length > 0 && <Heading>Paywalls</Heading>}
144
+ {rows(paywalls)}
145
+ </>
123
146
  )}
124
147
  </div>
125
148
 
126
149
  <div className="flex flex-col border-t border-cream/10">
127
- {live.map((option) => (
128
- <Row
129
- key={option.key}
130
- label={option.label}
131
- hint={option.hint}
132
- selected={option.key === activeKey}
133
- onSelect={() => choose(option.target)}
134
- />
135
- ))}
150
+ {notice && (
151
+ <span className="block px-3 pt-2 text-xs text-cream/55" role="status">
152
+ {notice}
153
+ </span>
154
+ )}
136
155
  <Row
137
156
  label="Off"
138
157
  hint="A single preview"
@@ -13,7 +13,7 @@ export const MissingProducts = ({
13
13
  aria-modal="true"
14
14
  aria-labelledby="sw-missing-products"
15
15
  >
16
- <div className="bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5">
16
+ <div className="bg-panel flex w-full max-w-md flex-col gap-4 rounded border border-cream/20 p-5">
17
17
  <div className="flex flex-col gap-1.5">
18
18
  <span id="sw-missing-products" className="text-[0.9375rem] font-medium text-cream">
19
19
  {missing.length === 1 ? "A product is missing" : `${missing.length} products are missing`}