@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/dist/lib/index.js
CHANGED
|
@@ -1,221 +1,597 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as n, jsxs as l, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
|
-
import { toast as
|
|
4
|
-
const
|
|
3
|
+
import { toast as U, Toaster as kt } from "sonner";
|
|
4
|
+
const It = ({
|
|
5
5
|
children: e,
|
|
6
|
-
position:
|
|
7
|
-
}) => /* @__PURE__ */
|
|
6
|
+
position: t = "fixed"
|
|
7
|
+
}) => /* @__PURE__ */ n(
|
|
8
8
|
"div",
|
|
9
9
|
{
|
|
10
|
-
className: `sw-studio bg-ink text-cream ${
|
|
10
|
+
className: `sw-studio bg-ink text-cream ${t} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
|
|
11
11
|
children: e
|
|
12
12
|
}
|
|
13
|
-
),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
13
|
+
), Et = { experimentId: "0", variantId: "0", campaignId: "0" }, R = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), Ge = (e = {}) => ({
|
|
14
|
+
paywallId: e.paywallId ?? "0",
|
|
15
|
+
paywallIdentifier: e.paywallIdentifier ?? "paywall",
|
|
16
|
+
device: R(e.device ?? {}),
|
|
17
|
+
user: R(e.user ?? {}),
|
|
18
|
+
params: R(e.params ?? {}),
|
|
19
|
+
products: e.products ?? [],
|
|
20
|
+
experiment: e.experiment ?? Et,
|
|
21
|
+
...e.introductoryOfferEligible === void 0 ? {} : { introductoryOfferEligible: e.introductoryOfferEligible }
|
|
22
|
+
}), $e = (e, t) => {
|
|
23
|
+
const a = {
|
|
24
|
+
...e,
|
|
25
|
+
paywallId: t.paywallId ?? e.paywallId,
|
|
26
|
+
paywallIdentifier: t.paywallIdentifier ?? e.paywallIdentifier,
|
|
27
|
+
device: t.device ? R({ ...e.device, ...t.device }) : e.device,
|
|
28
|
+
user: t.user ? R({ ...e.user, ...t.user }) : e.user,
|
|
29
|
+
params: t.params ? R({ ...e.params, ...t.params }) : e.params,
|
|
30
|
+
products: t.products ?? e.products,
|
|
31
|
+
experiment: t.experiment ?? e.experiment
|
|
32
|
+
};
|
|
33
|
+
return "introductoryOfferEligible" in t && (t.introductoryOfferEligible === void 0 ? delete a.introductoryOfferEligible : a.introductoryOfferEligible = t.introductoryOfferEligible), a;
|
|
34
|
+
}, ye = (e, t) => JSON.stringify(e) === JSON.stringify(t), ce = (e, t) => {
|
|
35
|
+
const a = {};
|
|
36
|
+
let r = !1;
|
|
37
|
+
for (const s of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]))
|
|
38
|
+
s in t ? ye(e[s], t[s]) || (a[s] = t[s], r = !0) : (a[s] = void 0, r = !0);
|
|
39
|
+
return r ? a : void 0;
|
|
40
|
+
}, Pt = (e, t) => {
|
|
41
|
+
const a = {}, r = ce(e.device, t.device);
|
|
42
|
+
r && (a.device = r);
|
|
43
|
+
const s = ce(e.user, t.user);
|
|
44
|
+
s && (a.user = s);
|
|
45
|
+
const i = ce(e.params, t.params);
|
|
46
|
+
return i && (a.params = i), ye(e.products, t.products) || (a.products = t.products), e.introductoryOfferEligible !== t.introductoryOfferEligible && (a.introductoryOfferEligible = t.introductoryOfferEligible), e.paywallId !== t.paywallId && (a.paywallId = t.paywallId), e.paywallIdentifier !== t.paywallIdentifier && (a.paywallIdentifier = t.paywallIdentifier), ye(e.experiment, t.experiment) || (a.experiment = t.experiment), a;
|
|
47
|
+
}, Ye = (e) => {
|
|
48
|
+
const t = e.variables.trialPeriodDays, a = typeof t == "number" ? t : typeof t == "string" ? Number(t) : 0;
|
|
49
|
+
return Number.isFinite(a) ? a : 0;
|
|
50
|
+
}, F = (e) => e.introductoryOfferEligible ?? e.products.some((t) => Ye(t) > 0), Ze = (e) => ({
|
|
51
|
+
event_name: "template_variables",
|
|
52
|
+
variables: {
|
|
53
|
+
device: e.device,
|
|
54
|
+
user: e.user,
|
|
55
|
+
params: e.params,
|
|
56
|
+
...e.products.length > 0 ? { products: e.products.map((t) => ({ [t.reference]: t.variables })) } : {}
|
|
57
|
+
}
|
|
58
|
+
}), Qe = (e) => ({
|
|
59
|
+
event_name: "experiment",
|
|
60
|
+
experimentId: e.experiment.experimentId,
|
|
61
|
+
variantId: e.experiment.variantId,
|
|
62
|
+
campaignId: e.experiment.campaignId
|
|
63
|
+
}), Xe = (e) => ({
|
|
64
|
+
event_name: "products",
|
|
65
|
+
products: e.products.map((t) => ({
|
|
66
|
+
product: t.reference,
|
|
67
|
+
productId: t.productId
|
|
68
|
+
}))
|
|
69
|
+
}), et = (e) => ({
|
|
70
|
+
event_name: "template_substitutions_prefix",
|
|
71
|
+
prefix: F(e) ? "freeTrial" : "default"
|
|
72
|
+
}), Ct = (e) => ({
|
|
73
|
+
event_name: "paywall_open",
|
|
74
|
+
paywall_id: e.paywallId,
|
|
75
|
+
paywall_identifier: e.paywallIdentifier
|
|
76
|
+
}), Ot = (e) => ({
|
|
77
|
+
event_name: "paywall_close",
|
|
78
|
+
paywall_id: e.paywallId,
|
|
79
|
+
paywall_identifier: e.paywallIdentifier
|
|
80
|
+
}), Mt = (e) => [
|
|
81
|
+
Ze(e),
|
|
82
|
+
Qe(e),
|
|
83
|
+
Xe(e),
|
|
84
|
+
et(e),
|
|
85
|
+
Ct(e)
|
|
86
|
+
], ee = (e) => ({
|
|
87
|
+
product: e.reference,
|
|
88
|
+
product_identifier: e.productId
|
|
89
|
+
}), $t = (e) => ({
|
|
90
|
+
event_name: "transaction_start",
|
|
91
|
+
...ee(e)
|
|
92
|
+
}), Tt = (e) => ({
|
|
93
|
+
event_name: "transaction_complete",
|
|
94
|
+
...ee(e)
|
|
95
|
+
}), Rt = (e) => ({
|
|
96
|
+
event_name: "transaction_abandon",
|
|
97
|
+
...ee(e)
|
|
98
|
+
}), Te = (e) => ({
|
|
99
|
+
event_name: "transaction_fail",
|
|
100
|
+
...ee(e)
|
|
101
|
+
}), At = () => ({
|
|
102
|
+
event_name: "transaction_restore"
|
|
103
|
+
}), Dt = (e, t) => ({
|
|
104
|
+
event_name: "freeTrial_start",
|
|
105
|
+
product_identifier: e.productId,
|
|
106
|
+
trial_end_date: t
|
|
107
|
+
}), Lt = () => ({ event_name: "restore_start" }), jt = () => ({
|
|
108
|
+
event_name: "restore_complete"
|
|
109
|
+
}), Re = () => ({ event_name: "restore_fail" }), Ut = (e) => ({
|
|
110
|
+
event_name: "permission_result",
|
|
111
|
+
permission_type: e.permissionType,
|
|
112
|
+
request_id: e.requestId,
|
|
113
|
+
status: e.status
|
|
114
|
+
}), Ft = (e) => ({
|
|
115
|
+
event_name: "callback_result",
|
|
116
|
+
request_id: e.requestId,
|
|
117
|
+
name: e.name,
|
|
118
|
+
status: e.status,
|
|
119
|
+
...e.data === void 0 ? {} : { data: e.data }
|
|
120
|
+
}), Ht = () => ({
|
|
121
|
+
event: () => {
|
|
122
|
+
},
|
|
123
|
+
purchase: () => "completed",
|
|
124
|
+
restore: () => "restored",
|
|
125
|
+
close: () => {
|
|
126
|
+
},
|
|
127
|
+
openUrl: () => {
|
|
128
|
+
},
|
|
129
|
+
custom: () => {
|
|
130
|
+
},
|
|
131
|
+
customPlacement: () => {
|
|
132
|
+
},
|
|
133
|
+
permission: () => "granted",
|
|
134
|
+
callback: () => ({ status: "success" })
|
|
135
|
+
}), Bt = 1440 * 60 * 1e3, te = (e, t, a) => {
|
|
136
|
+
new Promise((r) => r(e())).then(t, a);
|
|
137
|
+
}, ne = (e, t) => {
|
|
138
|
+
console.error(`[superwall host] ${e}`, t);
|
|
139
|
+
}, Vt = (e, t, a) => e.products.find((r) => r.reference === t) ?? e.products.find((r) => r.productId === a) ?? {
|
|
140
|
+
reference: t,
|
|
141
|
+
productId: a ?? t,
|
|
142
|
+
variables: {}
|
|
143
|
+
}, qt = (e, t) => {
|
|
144
|
+
const { delegate: a, send: r, now: s } = e, i = Vt(e.state(), t.product, t.product_identifier);
|
|
145
|
+
r([$t(i)]), te(
|
|
146
|
+
() => a.purchase(i),
|
|
147
|
+
(o) => {
|
|
148
|
+
if (o === "completed") {
|
|
149
|
+
const p = Ye(i), c = [Tt(i)];
|
|
150
|
+
F(e.state()) && p > 0 && c.push(Dt(i, s() + p * Bt)), r(c);
|
|
151
|
+
} else r(o === "abandoned" ? [Rt(i)] : [Te(i)]);
|
|
152
|
+
},
|
|
153
|
+
(o) => {
|
|
154
|
+
ne("purchase delegate threw", o), r([Te(i)]);
|
|
155
|
+
}
|
|
156
|
+
);
|
|
157
|
+
}, zt = (e) => {
|
|
158
|
+
const { delegate: t, send: a } = e;
|
|
159
|
+
a([Lt()]), te(
|
|
160
|
+
() => t.restore(),
|
|
161
|
+
(r) => {
|
|
162
|
+
a(r === "restored" ? [At(), jt()] : [Re()]);
|
|
163
|
+
},
|
|
164
|
+
(r) => {
|
|
165
|
+
ne("restore delegate threw", r), a([Re()]);
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}, Wt = (e, t) => {
|
|
169
|
+
const { delegate: a, send: r } = e, s = (i) => r([
|
|
170
|
+
Ut({
|
|
171
|
+
permissionType: t.permission_type,
|
|
172
|
+
requestId: t.request_id,
|
|
173
|
+
status: i
|
|
174
|
+
})
|
|
175
|
+
]);
|
|
176
|
+
te(
|
|
177
|
+
() => a.permission(t.permission_type),
|
|
178
|
+
s,
|
|
179
|
+
(i) => {
|
|
180
|
+
ne("permission delegate threw", i), s("denied");
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}, Kt = (e, t) => {
|
|
184
|
+
const { delegate: a, send: r } = e, s = (i) => r([
|
|
185
|
+
Ft({
|
|
186
|
+
requestId: t.request_id,
|
|
187
|
+
name: t.name,
|
|
188
|
+
status: i.status,
|
|
189
|
+
...i.data === void 0 ? {} : { data: i.data }
|
|
190
|
+
})
|
|
191
|
+
]);
|
|
192
|
+
te(
|
|
193
|
+
() => a.callback(t.name, t.variables ?? {}),
|
|
194
|
+
s,
|
|
195
|
+
(i) => {
|
|
196
|
+
ne("callback delegate threw", i), s({ status: "failure" });
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}, Ae = (e) => JSON.stringify([
|
|
200
|
+
e.device,
|
|
201
|
+
e.user,
|
|
202
|
+
e.params,
|
|
203
|
+
e.products.map((t) => [t.reference, t.variables])
|
|
204
|
+
]), De = (e) => JSON.stringify(e.products.map((t) => [t.reference, t.productId])), Le = (e) => JSON.stringify(e.experiment), Jt = (e) => {
|
|
205
|
+
let t = Ge(e.state);
|
|
206
|
+
const { delegate: a, send: r } = e, s = {
|
|
207
|
+
state: () => t,
|
|
208
|
+
delegate: a,
|
|
209
|
+
send: r,
|
|
210
|
+
now: e.now ?? Date.now
|
|
211
|
+
}, i = (c) => {
|
|
212
|
+
switch (c.event_name) {
|
|
213
|
+
case "ping":
|
|
214
|
+
r(Mt(t));
|
|
215
|
+
return;
|
|
216
|
+
case "purchase":
|
|
217
|
+
qt(s, c);
|
|
218
|
+
return;
|
|
219
|
+
case "restore":
|
|
220
|
+
zt(s);
|
|
221
|
+
return;
|
|
222
|
+
case "close":
|
|
223
|
+
a.close(), r([Ot(t)]);
|
|
224
|
+
return;
|
|
225
|
+
case "open_url":
|
|
226
|
+
a.openUrl(
|
|
227
|
+
c.url,
|
|
228
|
+
c.browser_type === "payment_sheet" ? "payment_sheet" : "in_app"
|
|
229
|
+
);
|
|
230
|
+
return;
|
|
231
|
+
case "open_url_external":
|
|
232
|
+
a.openUrl(c.url, "external");
|
|
233
|
+
return;
|
|
234
|
+
case "open_deep_link":
|
|
235
|
+
a.openUrl(c.link, "deep_link");
|
|
236
|
+
return;
|
|
237
|
+
case "custom":
|
|
238
|
+
a.custom(c.data);
|
|
239
|
+
return;
|
|
240
|
+
case "custom_placement":
|
|
241
|
+
a.customPlacement(c.name, c.params);
|
|
242
|
+
return;
|
|
243
|
+
case "user_attribute_updated":
|
|
244
|
+
t = $e(t, {
|
|
245
|
+
user: Object.fromEntries(c.attributes.map((h) => [h.key, h.value]))
|
|
246
|
+
});
|
|
247
|
+
return;
|
|
248
|
+
case "request_permission":
|
|
249
|
+
Wt(s, c);
|
|
250
|
+
return;
|
|
251
|
+
case "request_callback":
|
|
252
|
+
Kt(s, c);
|
|
253
|
+
return;
|
|
254
|
+
default:
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
return {
|
|
259
|
+
get state() {
|
|
260
|
+
return t;
|
|
261
|
+
},
|
|
262
|
+
receive: (c) => {
|
|
263
|
+
for (const h of c)
|
|
264
|
+
a.event(h), i(h);
|
|
265
|
+
},
|
|
266
|
+
update: (c) => {
|
|
267
|
+
const h = t;
|
|
268
|
+
t = $e(t, c);
|
|
269
|
+
const m = [];
|
|
270
|
+
Ae(h) !== Ae(t) && m.push(Ze(t)), Le(h) !== Le(t) && m.push(Qe(t)), De(h) !== De(t) && m.push(Xe(t)), F(h) !== F(t) && m.push(et(t)), m.length > 0 && r(m);
|
|
271
|
+
},
|
|
272
|
+
send: r
|
|
273
|
+
};
|
|
274
|
+
}, Gt = () => typeof localStorage < "u" && localStorage.getItem("SW_DEBUG_TRANSPORT") === "true", Yt = {
|
|
275
|
+
WebKit: "#9C27B0",
|
|
276
|
+
Android: "#4CAF50",
|
|
277
|
+
Editor: "#2196F3",
|
|
278
|
+
Transport: "#FF9800"
|
|
279
|
+
}, Zt = (e) => {
|
|
280
|
+
const t = Yt[e], a = (r, s, ...i) => {
|
|
281
|
+
if (!Gt() && r === "debug") return;
|
|
282
|
+
const o = `%c[${e}]%c ${s}`, p = [`color: ${t}; font-weight: bold`, "color: inherit"];
|
|
283
|
+
switch (r) {
|
|
284
|
+
case "error":
|
|
285
|
+
console.error(o, ...p, ...i);
|
|
286
|
+
break;
|
|
287
|
+
case "warn":
|
|
288
|
+
console.warn(o, ...p, ...i);
|
|
289
|
+
break;
|
|
290
|
+
case "info":
|
|
291
|
+
console.info(o, ...p, ...i);
|
|
292
|
+
break;
|
|
293
|
+
default:
|
|
294
|
+
console.log(o, ...p, ...i);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
return {
|
|
298
|
+
debug: (r, ...s) => a("debug", r, ...s),
|
|
299
|
+
info: (r, ...s) => a("info", r, ...s),
|
|
300
|
+
warn: (r, ...s) => a("warn", r, ...s),
|
|
301
|
+
error: (r, ...s) => a("error", r, ...s)
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
var Se = /* @__PURE__ */ ((e) => (e.ToPaywall = "to_paywall", e.FromPaywall = "from_paywall", e.ToPaywallUi = "to_paywall_ui", e.FromPaywallUi = "from_paywall_ui", e))(Se || {});
|
|
305
|
+
const Qt = (e, t) => {
|
|
306
|
+
const a = {
|
|
307
|
+
direction: t,
|
|
308
|
+
version: 1,
|
|
309
|
+
payload: { events: Array.isArray(e) ? e : [e] }
|
|
310
|
+
};
|
|
311
|
+
return JSON.stringify(a);
|
|
312
|
+
}, Xt = () => ({
|
|
313
|
+
parse: (e) => e
|
|
314
|
+
}), en = Zt("Transport"), tn = (e, t, a = Xt()) => {
|
|
315
|
+
try {
|
|
316
|
+
const r = a.parse(JSON.parse(e));
|
|
317
|
+
if (r.direction !== t)
|
|
318
|
+
throw new Error("Message direction incorrect");
|
|
319
|
+
return r.payload.events;
|
|
320
|
+
} catch (r) {
|
|
321
|
+
return en.error("Failed to parse incoming message", { message: e, error: r }), [];
|
|
322
|
+
}
|
|
323
|
+
}, nn = (e) => (t) => {
|
|
324
|
+
e.postMessage(Qt([...t], Se.ToPaywall), "*");
|
|
325
|
+
}, an = (e, t, a = {}) => {
|
|
326
|
+
const r = a.listen ?? window, s = (i) => {
|
|
327
|
+
if (i.source !== t || typeof i.data != "string") return;
|
|
328
|
+
const o = tn(i.data, Se.FromPaywall);
|
|
329
|
+
o.length > 0 && e.receive(o);
|
|
330
|
+
};
|
|
331
|
+
return r.addEventListener("message", s), () => r.removeEventListener("message", s);
|
|
332
|
+
}, rn = (e) => {
|
|
333
|
+
const { target: t, listen: a, ...r } = e, s = Jt({ ...r, send: nn(t) }), i = an(s, t, a ? { listen: a } : {});
|
|
334
|
+
return { host: s, detach: i };
|
|
335
|
+
}, de = 1440 * 60 * 1e3, pe = 60 * 1e3, tt = -18e3, ge = {
|
|
336
|
+
publicApiKey: "pk_8d21d5122bb23839a2de6c8c76975e74f85b43ab4476c039",
|
|
337
|
+
platform: "iOS",
|
|
338
|
+
appUserId: "44dd573cd1e849a6997a5eaf98298e47",
|
|
339
|
+
aliases: ["$SuperwallAlias:00EB5C40-68A7-4778-B634-F3714D2010B9"],
|
|
340
|
+
vendorId: "86A1F395-D3A3-4A1C-914A-5912EF0363E2",
|
|
341
|
+
appVersion: "8.4",
|
|
342
|
+
osVersion: "15.5.0",
|
|
343
|
+
deviceLocale: "en_US",
|
|
344
|
+
deviceModel: "iPhone10",
|
|
345
|
+
deviceLanguageCode: "en",
|
|
346
|
+
deviceCurrencyCode: "USD",
|
|
347
|
+
deviceCurrencySymbol: "$",
|
|
348
|
+
timezoneOffset: tt,
|
|
349
|
+
radioType: "Wifi",
|
|
350
|
+
interfaceStyle: "Dark",
|
|
351
|
+
isLowPowerModeEnabled: 0,
|
|
352
|
+
bundleId: "com.jakemor.fitnessai",
|
|
353
|
+
isMac: 0,
|
|
354
|
+
totalPaywallViews: 0,
|
|
355
|
+
interfaceType: "iphone"
|
|
356
|
+
}, L = (e) => String(e).padStart(2, "0"), je = (e) => {
|
|
357
|
+
const t = `${e.getUTCFullYear()}-${L(e.getUTCMonth() + 1)}-${L(e.getUTCDate())}`, a = `${L(e.getUTCHours())}:${L(e.getUTCMinutes())}:${L(e.getUTCSeconds())}`;
|
|
358
|
+
return { date: t, time: a, dateTime: `${t}T${a}` };
|
|
359
|
+
}, sn = (e, t = tt) => {
|
|
360
|
+
const a = e - 5 * de, r = e - 360 * pe, s = je(new Date(e)), i = je(new Date(e + t * 1e3));
|
|
361
|
+
return {
|
|
362
|
+
daysSinceInstall: Math.floor((e - a) / de),
|
|
363
|
+
minutesSinceInstall: Math.floor((e - a) / pe),
|
|
364
|
+
appInstallDate: new Date(a).toISOString(),
|
|
365
|
+
daysSinceLastPaywallView: Math.floor((e - r) / de),
|
|
366
|
+
minutesSinceLastPaywallView: Math.floor((e - r) / pe),
|
|
367
|
+
utcDate: s.date,
|
|
368
|
+
localDate: i.date,
|
|
369
|
+
utcTime: s.time,
|
|
370
|
+
localTime: i.time,
|
|
371
|
+
utcDateTime: s.dateTime,
|
|
372
|
+
localDateTime: i.dateTime
|
|
373
|
+
};
|
|
374
|
+
}, on = (e = Date.now()) => ({
|
|
375
|
+
...ge,
|
|
376
|
+
...sn(e, ge.timezoneOffset)
|
|
377
|
+
}), ln = {
|
|
378
|
+
appUserId: ge.appUserId,
|
|
379
|
+
email: "preview@example.com",
|
|
380
|
+
firstName: "John",
|
|
381
|
+
lastName: "Doe",
|
|
382
|
+
country: "US",
|
|
383
|
+
language: "en"
|
|
384
|
+
}, cn = {
|
|
385
|
+
$event_name: "campaign_trigger",
|
|
386
|
+
event_name: "campaign_trigger",
|
|
387
|
+
$is_standard_event: !1,
|
|
388
|
+
$is_feature_gatable: !1
|
|
389
|
+
}, y = ({ children: e }) => /* @__PURE__ */ n("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), nt = () => /* @__PURE__ */ l(y, { children: [
|
|
390
|
+
/* @__PURE__ */ n("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
|
|
391
|
+
/* @__PURE__ */ n("path", { d: "M21 3v6h-6" })
|
|
392
|
+
] }), G = () => /* @__PURE__ */ l(y, { children: [
|
|
393
|
+
/* @__PURE__ */ n("path", { d: "M15 3h6v6" }),
|
|
394
|
+
/* @__PURE__ */ n("path", { d: "M10 14 21 3" }),
|
|
395
|
+
/* @__PURE__ */ n("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
396
|
+
] }), dn = () => /* @__PURE__ */ l(y, { children: [
|
|
397
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "4" }),
|
|
398
|
+
/* @__PURE__ */ n("path", { d: "M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" })
|
|
399
|
+
] }), pn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), un = () => /* @__PURE__ */ l(y, { children: [
|
|
400
|
+
/* @__PURE__ */ n("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
|
|
401
|
+
/* @__PURE__ */ n("path", { d: "M14 2v4M8 10v4M16 18v4" })
|
|
402
|
+
] }), at = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12" }) }), rt = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m6 9 6 6 6-6" }) }), mn = () => /* @__PURE__ */ l(y, { children: [
|
|
403
|
+
/* @__PURE__ */ n("rect", { x: "3", y: "4", width: "18", height: "16" }),
|
|
404
|
+
/* @__PURE__ */ n("path", { d: "M12 4v16" })
|
|
405
|
+
] }), ue = () => /* @__PURE__ */ l(y, { children: [
|
|
406
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
|
|
407
|
+
/* @__PURE__ */ n("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
|
|
408
|
+
] }), me = () => /* @__PURE__ */ l(y, { children: [
|
|
409
|
+
/* @__PURE__ */ n("path", { d: "M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z" }),
|
|
410
|
+
/* @__PURE__ */ n("path", { d: "M12 9v4" }),
|
|
411
|
+
/* @__PURE__ */ n("path", { d: "M12 17h.01" })
|
|
412
|
+
] }), hn = () => /* @__PURE__ */ l(y, { children: [
|
|
413
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "12", r: "9" }),
|
|
414
|
+
/* @__PURE__ */ n("path", { d: "M12 11v5" }),
|
|
415
|
+
/* @__PURE__ */ n("path", { d: "M12 8h.01" })
|
|
416
|
+
] }), W = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), he = () => /* @__PURE__ */ l(y, { children: [
|
|
417
|
+
/* @__PURE__ */ n("circle", { cx: "9", cy: "20", r: "1" }),
|
|
418
|
+
/* @__PURE__ */ n("circle", { cx: "18", cy: "20", r: "1" }),
|
|
419
|
+
/* @__PURE__ */ n("path", { d: "M2 3h2.5l2.2 11.2a2 2 0 0 0 2 1.6h8.4a2 2 0 0 0 2-1.6L21 7H5.4" })
|
|
420
|
+
] }), fn = () => /* @__PURE__ */ l(y, { children: [
|
|
421
|
+
/* @__PURE__ */ n("path", { d: "M18 8a6 6 0 1 0-12 0c0 6-2 8-2 8h16s-2-2-2-8" }),
|
|
422
|
+
/* @__PURE__ */ n("path", { d: "M13.7 21a2 2 0 0 1-3.4 0" })
|
|
423
|
+
] }), bn = () => /* @__PURE__ */ n(y, { children: /* @__PURE__ */ n("path", { d: "m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1-5.4-2.9-5.4 2.9 1-6.1L3.2 9.5l6.1-.9L12 3Z" }) }), vn = () => /* @__PURE__ */ l(y, { children: [
|
|
424
|
+
/* @__PURE__ */ n("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
425
|
+
/* @__PURE__ */ n("circle", { cx: "12", cy: "7", r: "4" })
|
|
426
|
+
] }), wn = () => /* @__PURE__ */ l(y, { children: [
|
|
427
|
+
/* @__PURE__ */ n("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
|
|
428
|
+
/* @__PURE__ */ n("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
|
|
429
|
+
/* @__PURE__ */ n("path", { d: "m11 19-2 2 2 2" })
|
|
54
430
|
] }), Q = {
|
|
55
431
|
push: ["link", "build", "assets", "push", "source"],
|
|
56
432
|
publish: ["link", "build", "assets", "push", "source", "promote"],
|
|
57
433
|
promote: ["link", "promote"]
|
|
58
|
-
},
|
|
434
|
+
}, yn = {
|
|
59
435
|
link: "Find paywall",
|
|
60
436
|
build: "Build snapshot",
|
|
61
437
|
assets: "Sync assets",
|
|
62
438
|
push: "Push version",
|
|
63
439
|
source: "Push source",
|
|
64
440
|
promote: "Promote to live"
|
|
65
|
-
},
|
|
441
|
+
}, st = [
|
|
66
442
|
{ name: "push", label: "Push", hint: "New version, nothing live changes" },
|
|
67
443
|
{ name: "publish", label: "Publish", hint: "Push and make it live" },
|
|
68
444
|
{ name: "promote", label: "Promote", hint: "Make the latest push live" }
|
|
69
|
-
],
|
|
445
|
+
], xe = (e) => st.find((t) => t.name === e)?.label ?? e, it = {
|
|
70
446
|
push: "Pushing…",
|
|
71
447
|
publish: "Publishing…",
|
|
72
448
|
promote: "Promoting…"
|
|
73
|
-
},
|
|
74
|
-
const
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
449
|
+
}, gn = ({ state: e }) => e === "active" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2 animate-pulse" }) : e === "done" ? /* @__PURE__ */ n("span", { className: "bg-accent h-2 w-2" }) : e === "failed" ? /* @__PURE__ */ n("span", { className: "bg-red h-2 w-2" }) : /* @__PURE__ */ n("span", { className: "bg-cream/55 h-2 w-2" }), xn = ({ progress: e }) => {
|
|
450
|
+
const t = Q[e.action], a = t.filter((s) => e.steps[s] === "done").length, r = e.error !== void 0;
|
|
451
|
+
return /* @__PURE__ */ l("div", { className: "w-64", children: [
|
|
452
|
+
/* @__PURE__ */ l("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
|
|
453
|
+
/* @__PURE__ */ n("div", { className: "text-[0.8125rem] font-medium", children: r ? `${xe(e.action)} failed` : a === t.length ? `${xe(e.action)} complete` : it[e.action] }),
|
|
454
|
+
/* @__PURE__ */ n("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ n(
|
|
79
455
|
"div",
|
|
80
456
|
{
|
|
81
|
-
className: `h-full transition-[width] duration-300 ease-out ${
|
|
82
|
-
style: { width: `${
|
|
457
|
+
className: `h-full transition-[width] duration-300 ease-out ${r ? "bg-red" : "bg-accent"}`,
|
|
458
|
+
style: { width: `${a / t.length * 100}%` }
|
|
83
459
|
}
|
|
84
460
|
) })
|
|
85
461
|
] }),
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
462
|
+
/* @__PURE__ */ n("ul", { className: "m-0 list-none px-3 py-2", children: t.map((s, i) => {
|
|
463
|
+
const o = e.steps[s] ?? "pending";
|
|
464
|
+
return /* @__PURE__ */ l("li", { className: "flex items-center gap-2.5 py-1.5", children: [
|
|
465
|
+
/* @__PURE__ */ n(
|
|
90
466
|
"span",
|
|
91
467
|
{
|
|
92
|
-
className: `w-4 font-mono text-[0.625rem] tabular-nums ${
|
|
468
|
+
className: `w-4 font-mono text-[0.625rem] tabular-nums ${o === "pending" ? "text-cream/25" : "text-cream/55"}`,
|
|
93
469
|
children: String(i + 1).padStart(2, "0")
|
|
94
470
|
}
|
|
95
471
|
),
|
|
96
|
-
/* @__PURE__ */
|
|
472
|
+
/* @__PURE__ */ n(
|
|
97
473
|
"span",
|
|
98
474
|
{
|
|
99
|
-
className: `flex-1 text-[0.8125rem] ${
|
|
100
|
-
children:
|
|
475
|
+
className: `flex-1 text-[0.8125rem] ${o === "pending" ? "text-cream/40" : "text-cream"}`,
|
|
476
|
+
children: yn[s]
|
|
101
477
|
}
|
|
102
478
|
),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
] },
|
|
479
|
+
/* @__PURE__ */ n(gn, { state: o })
|
|
480
|
+
] }, s);
|
|
105
481
|
}) }),
|
|
106
|
-
e.error && /* @__PURE__ */
|
|
482
|
+
e.error && /* @__PURE__ */ n("div", { className: "text-red border-t border-cream/10 px-3 py-2.5 text-xs whitespace-pre-wrap", children: e.error })
|
|
107
483
|
] });
|
|
108
|
-
},
|
|
484
|
+
}, Nn = ({
|
|
109
485
|
progress: e,
|
|
110
|
-
blocked:
|
|
111
|
-
onRun:
|
|
112
|
-
onBlocked:
|
|
486
|
+
blocked: t,
|
|
487
|
+
onRun: a,
|
|
488
|
+
onBlocked: r
|
|
113
489
|
}) => {
|
|
114
|
-
const [
|
|
490
|
+
const [s, i] = d.useState("push"), [o, p] = d.useState(!1), c = d.useRef(null), h = t !== void 0, m = e !== void 0 && e.error === void 0 && Q[e.action].some((u) => e.steps[u] !== "done"), b = e !== void 0;
|
|
115
491
|
return d.useEffect(() => {
|
|
116
|
-
if (!
|
|
117
|
-
const
|
|
118
|
-
|
|
492
|
+
if (!o) return;
|
|
493
|
+
const u = (v) => {
|
|
494
|
+
c.current && !v.composedPath().includes(c.current) && p(!1);
|
|
119
495
|
};
|
|
120
|
-
return window.addEventListener("mousedown",
|
|
121
|
-
}, [
|
|
122
|
-
/* @__PURE__ */
|
|
496
|
+
return window.addEventListener("mousedown", u), () => window.removeEventListener("mousedown", u);
|
|
497
|
+
}, [o]), /* @__PURE__ */ l("div", { className: "relative flex", ref: c, children: [
|
|
498
|
+
/* @__PURE__ */ n(
|
|
123
499
|
"button",
|
|
124
500
|
{
|
|
125
501
|
type: "button",
|
|
126
502
|
className: "sw-btn sw-btn--primary disabled:cursor-not-allowed disabled:opacity-40",
|
|
127
|
-
disabled:
|
|
128
|
-
title:
|
|
129
|
-
onClick: () =>
|
|
130
|
-
children:
|
|
503
|
+
disabled: m,
|
|
504
|
+
title: t,
|
|
505
|
+
onClick: () => h ? r?.() : a(s),
|
|
506
|
+
children: m ? it[e.action] : xe(s)
|
|
131
507
|
}
|
|
132
508
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
509
|
+
/* @__PURE__ */ n(
|
|
134
510
|
"button",
|
|
135
511
|
{
|
|
136
512
|
type: "button",
|
|
137
513
|
className: "sw-btn sw-btn--primary -ml-px w-6 !px-0 disabled:cursor-not-allowed disabled:opacity-40",
|
|
138
514
|
"aria-label": "Choose action",
|
|
139
|
-
"aria-expanded":
|
|
140
|
-
title:
|
|
141
|
-
disabled:
|
|
142
|
-
onClick: () =>
|
|
143
|
-
children: /* @__PURE__ */
|
|
515
|
+
"aria-expanded": o,
|
|
516
|
+
title: t,
|
|
517
|
+
disabled: m,
|
|
518
|
+
onClick: () => p((u) => !u),
|
|
519
|
+
children: /* @__PURE__ */ n(rt, {})
|
|
144
520
|
}
|
|
145
521
|
),
|
|
146
|
-
(
|
|
522
|
+
(b || o) && /* @__PURE__ */ n("div", { className: "bg-bar absolute top-full right-0 z-20 mt-1 border border-cream/20", children: b ? /* @__PURE__ */ n(xn, { progress: e }) : /* @__PURE__ */ n("div", { className: "w-64", children: st.map((u) => /* @__PURE__ */ l(
|
|
147
523
|
"button",
|
|
148
524
|
{
|
|
149
525
|
type: "button",
|
|
150
526
|
className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
|
|
151
527
|
onClick: () => {
|
|
152
|
-
i(
|
|
528
|
+
i(u.name), p(!1);
|
|
153
529
|
},
|
|
154
530
|
children: [
|
|
155
|
-
/* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium", children: u.label }),
|
|
532
|
+
/* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: u.hint })
|
|
157
533
|
]
|
|
158
534
|
},
|
|
159
|
-
|
|
535
|
+
u.name
|
|
160
536
|
)) }) })
|
|
161
537
|
] });
|
|
162
|
-
},
|
|
538
|
+
}, fe = ({
|
|
163
539
|
label: e,
|
|
164
|
-
hint:
|
|
165
|
-
selected:
|
|
166
|
-
onSelect:
|
|
167
|
-
}) => /* @__PURE__ */
|
|
540
|
+
hint: t,
|
|
541
|
+
selected: a,
|
|
542
|
+
onSelect: r
|
|
543
|
+
}) => /* @__PURE__ */ l(
|
|
168
544
|
"button",
|
|
169
545
|
{
|
|
170
546
|
type: "button",
|
|
171
547
|
className: "flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-cream/5",
|
|
172
|
-
"aria-current":
|
|
173
|
-
onClick:
|
|
548
|
+
"aria-current": a || void 0,
|
|
549
|
+
onClick: r,
|
|
174
550
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
551
|
+
/* @__PURE__ */ l("span", { className: "flex max-w-full items-center gap-1.5 text-[0.8125rem] font-medium", children: [
|
|
552
|
+
/* @__PURE__ */ n("span", { className: "truncate", children: e }),
|
|
553
|
+
a && /* @__PURE__ */ n("span", { className: "bg-accent size-[5px] shrink-0 rounded-full", "aria-hidden": "true" })
|
|
178
554
|
] }),
|
|
179
|
-
/* @__PURE__ */
|
|
555
|
+
/* @__PURE__ */ n("span", { className: "max-w-full truncate text-xs text-cream/55", children: t })
|
|
180
556
|
]
|
|
181
557
|
}
|
|
182
|
-
),
|
|
558
|
+
), Sn = ({
|
|
183
559
|
active: e,
|
|
184
|
-
options:
|
|
185
|
-
onSelect:
|
|
560
|
+
options: t,
|
|
561
|
+
onSelect: a
|
|
186
562
|
}) => {
|
|
187
|
-
const [
|
|
563
|
+
const [r, s] = d.useState(!1), [i, o] = d.useState(""), p = d.useRef(null);
|
|
188
564
|
d.useEffect(() => {
|
|
189
|
-
if (!
|
|
190
|
-
const
|
|
191
|
-
|
|
565
|
+
if (!r) return;
|
|
566
|
+
const v = (N) => {
|
|
567
|
+
p.current && !N.composedPath().includes(p.current) && s(!1);
|
|
192
568
|
};
|
|
193
|
-
return window.addEventListener("mousedown",
|
|
194
|
-
}, [
|
|
195
|
-
|
|
196
|
-
}, [
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
(
|
|
569
|
+
return window.addEventListener("mousedown", v), () => window.removeEventListener("mousedown", v);
|
|
570
|
+
}, [r]), d.useEffect(() => {
|
|
571
|
+
r || o("");
|
|
572
|
+
}, [r]);
|
|
573
|
+
const c = e && (e.type === "live" ? "live" : `surface:${e.surface.kind}/${e.surface.id}`), h = (v) => {
|
|
574
|
+
s(!1), a(v);
|
|
575
|
+
}, m = i.trim().toLowerCase(), b = t.filter((v) => v.key === "live"), u = t.filter((v) => v.key !== "live").filter(
|
|
576
|
+
(v) => m === "" || `${v.label} ${v.hint}`.toLowerCase().includes(m)
|
|
201
577
|
);
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
578
|
+
return /* @__PURE__ */ l("div", { className: "relative flex", ref: p, children: [
|
|
579
|
+
/* @__PURE__ */ l(
|
|
204
580
|
"button",
|
|
205
581
|
{
|
|
206
582
|
type: "button",
|
|
207
583
|
className: "sw-btn",
|
|
208
584
|
"aria-pressed": e !== void 0,
|
|
209
|
-
"aria-expanded":
|
|
210
|
-
onClick: () =>
|
|
585
|
+
"aria-expanded": r,
|
|
586
|
+
onClick: () => s((v) => !v),
|
|
211
587
|
children: [
|
|
212
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ n(mn, {}),
|
|
213
589
|
"Compare"
|
|
214
590
|
]
|
|
215
591
|
}
|
|
216
592
|
),
|
|
217
|
-
|
|
218
|
-
/* @__PURE__ */
|
|
593
|
+
r && /* @__PURE__ */ l("div", { className: "bg-bar absolute bottom-full left-0 z-20 mb-1 flex w-72 flex-col border border-cream/20", children: [
|
|
594
|
+
/* @__PURE__ */ n("div", { className: "p-2", children: /* @__PURE__ */ n(
|
|
219
595
|
"input",
|
|
220
596
|
{
|
|
221
597
|
className: "sw-input",
|
|
@@ -223,49 +599,49 @@ const et = ({
|
|
|
223
599
|
value: i,
|
|
224
600
|
placeholder: "Search paywalls",
|
|
225
601
|
"aria-label": "Search paywalls",
|
|
226
|
-
onChange: (
|
|
602
|
+
onChange: (v) => o(v.target.value)
|
|
227
603
|
}
|
|
228
604
|
) }),
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
|
|
605
|
+
/* @__PURE__ */ n("div", { className: "max-h-64 overflow-y-auto", children: u.length === 0 ? /* @__PURE__ */ n("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: m === "" ? "No other paywalls here." : `Nothing matches “${i.trim()}”.` }) : u.map((v) => /* @__PURE__ */ n(
|
|
606
|
+
fe,
|
|
231
607
|
{
|
|
232
|
-
label:
|
|
233
|
-
hint:
|
|
234
|
-
selected:
|
|
235
|
-
onSelect: () =>
|
|
608
|
+
label: v.label,
|
|
609
|
+
hint: v.hint,
|
|
610
|
+
selected: v.key === c,
|
|
611
|
+
onSelect: () => h(v.target)
|
|
236
612
|
},
|
|
237
|
-
|
|
613
|
+
v.key
|
|
238
614
|
)) }),
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
|
|
241
|
-
|
|
615
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col border-t border-cream/10", children: [
|
|
616
|
+
b.map((v) => /* @__PURE__ */ n(
|
|
617
|
+
fe,
|
|
242
618
|
{
|
|
243
|
-
label:
|
|
244
|
-
hint:
|
|
245
|
-
selected:
|
|
246
|
-
onSelect: () =>
|
|
619
|
+
label: v.label,
|
|
620
|
+
hint: v.hint,
|
|
621
|
+
selected: v.key === c,
|
|
622
|
+
onSelect: () => h(v.target)
|
|
247
623
|
},
|
|
248
|
-
|
|
624
|
+
v.key
|
|
249
625
|
)),
|
|
250
|
-
/* @__PURE__ */
|
|
251
|
-
|
|
626
|
+
/* @__PURE__ */ n(
|
|
627
|
+
fe,
|
|
252
628
|
{
|
|
253
629
|
label: "Off",
|
|
254
630
|
hint: "A single preview",
|
|
255
631
|
selected: e === void 0,
|
|
256
|
-
onSelect: () =>
|
|
632
|
+
onSelect: () => h(void 0)
|
|
257
633
|
}
|
|
258
634
|
)
|
|
259
635
|
] })
|
|
260
636
|
] })
|
|
261
637
|
] });
|
|
262
|
-
},
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
265
|
-
/* @__PURE__ */
|
|
266
|
-
/* @__PURE__ */
|
|
267
|
-
] }),
|
|
268
|
-
/* @__PURE__ */
|
|
638
|
+
}, _n = () => /* @__PURE__ */ l("svg", { width: "19", height: "12", viewBox: "0 0 19 12", fill: "currentColor", "aria-hidden": "true", children: [
|
|
639
|
+
/* @__PURE__ */ n("rect", { x: "0", y: "7.5", width: "3.5", height: "4.5", rx: "1" }),
|
|
640
|
+
/* @__PURE__ */ n("rect", { x: "5", y: "5", width: "3.5", height: "7", rx: "1" }),
|
|
641
|
+
/* @__PURE__ */ n("rect", { x: "10", y: "2.5", width: "3.5", height: "9.5", rx: "1" }),
|
|
642
|
+
/* @__PURE__ */ n("rect", { x: "15", y: "0", width: "3.5", height: "12", rx: "1" })
|
|
643
|
+
] }), kn = () => /* @__PURE__ */ l("svg", { width: "27", height: "13", viewBox: "0 0 27 13", "aria-hidden": "true", children: [
|
|
644
|
+
/* @__PURE__ */ n(
|
|
269
645
|
"rect",
|
|
270
646
|
{
|
|
271
647
|
x: "0.5",
|
|
@@ -278,78 +654,78 @@ const et = ({
|
|
|
278
654
|
strokeOpacity: "0.35"
|
|
279
655
|
}
|
|
280
656
|
),
|
|
281
|
-
/* @__PURE__ */
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
] }),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
] }),
|
|
657
|
+
/* @__PURE__ */ n("path", { d: "M25 4.5v4a2.17 2.17 0 0 0 0-4Z", fill: "currentColor", fillOpacity: "0.4" }),
|
|
658
|
+
/* @__PURE__ */ n("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5", fill: "currentColor" })
|
|
659
|
+
] }), In = () => /* @__PURE__ */ l("span", { className: "flex items-center gap-[7px]", children: [
|
|
660
|
+
/* @__PURE__ */ n(_n, {}),
|
|
661
|
+
/* @__PURE__ */ n("span", { style: { fontSize: 12.5, fontWeight: 700, letterSpacing: "0.02em" }, children: "SW" }),
|
|
662
|
+
/* @__PURE__ */ n(kn, {})
|
|
663
|
+
] }), En = ({
|
|
288
664
|
spec: e,
|
|
289
|
-
width:
|
|
290
|
-
height:
|
|
291
|
-
landscape:
|
|
292
|
-
theme:
|
|
665
|
+
width: t,
|
|
666
|
+
height: a,
|
|
667
|
+
landscape: r,
|
|
668
|
+
theme: s
|
|
293
669
|
}) => {
|
|
294
|
-
const i =
|
|
295
|
-
return /* @__PURE__ */
|
|
670
|
+
const i = s === "dark" ? "rgba(255,255,255,0.95)" : "rgba(0,0,0,0.95)", o = Math.max(28, e.radius * 0.6);
|
|
671
|
+
return /* @__PURE__ */ l(
|
|
296
672
|
"div",
|
|
297
673
|
{
|
|
298
674
|
className: "pointer-events-none absolute inset-0 select-none",
|
|
299
|
-
style: { width:
|
|
675
|
+
style: { width: t, height: a, color: i },
|
|
300
676
|
"data-testid": "device-chrome",
|
|
301
677
|
children: [
|
|
302
|
-
!
|
|
678
|
+
!r && /* @__PURE__ */ l(
|
|
303
679
|
"div",
|
|
304
680
|
{
|
|
305
681
|
className: "absolute inset-x-0 top-0 flex items-center justify-between",
|
|
306
682
|
style: {
|
|
307
683
|
height: e.statusBarHeight,
|
|
308
|
-
paddingLeft:
|
|
309
|
-
paddingRight:
|
|
684
|
+
paddingLeft: o,
|
|
685
|
+
paddingRight: o,
|
|
310
686
|
fontFamily: '-apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif',
|
|
311
687
|
fontSize: 15,
|
|
312
688
|
fontWeight: 600,
|
|
313
689
|
letterSpacing: "-0.2px"
|
|
314
690
|
},
|
|
315
691
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ n("span", { children: "9:41" }),
|
|
693
|
+
/* @__PURE__ */ n(In, {})
|
|
318
694
|
]
|
|
319
695
|
}
|
|
320
696
|
),
|
|
321
|
-
e.cutout === "island" && (
|
|
697
|
+
e.cutout === "island" && (r ? /* @__PURE__ */ n(
|
|
322
698
|
"div",
|
|
323
699
|
{
|
|
324
700
|
className: "absolute rounded-full bg-black",
|
|
325
|
-
style: { left: 12, top: (
|
|
701
|
+
style: { left: 12, top: (a - 124) / 2, width: 36, height: 124 }
|
|
326
702
|
}
|
|
327
|
-
) : /* @__PURE__ */
|
|
703
|
+
) : /* @__PURE__ */ n(
|
|
328
704
|
"div",
|
|
329
705
|
{
|
|
330
706
|
className: "absolute rounded-full bg-black",
|
|
331
|
-
style: { left: (
|
|
707
|
+
style: { left: (t - 124) / 2, top: 12, width: 124, height: 36 }
|
|
332
708
|
}
|
|
333
709
|
)),
|
|
334
|
-
e.cutout === "punch" && (
|
|
710
|
+
e.cutout === "punch" && (r ? /* @__PURE__ */ n(
|
|
335
711
|
"div",
|
|
336
712
|
{
|
|
337
713
|
className: "absolute rounded-full bg-black",
|
|
338
|
-
style: { left: 16, top: (
|
|
714
|
+
style: { left: 16, top: (a - 13) / 2, width: 13, height: 13 }
|
|
339
715
|
}
|
|
340
|
-
) : /* @__PURE__ */
|
|
716
|
+
) : /* @__PURE__ */ n(
|
|
341
717
|
"div",
|
|
342
718
|
{
|
|
343
719
|
className: "absolute rounded-full bg-black",
|
|
344
|
-
style: { left: (
|
|
720
|
+
style: { left: (t - 13) / 2, top: 15, width: 13, height: 13 }
|
|
345
721
|
}
|
|
346
722
|
)),
|
|
347
|
-
e.homeIndicator && /* @__PURE__ */
|
|
723
|
+
e.homeIndicator && /* @__PURE__ */ n(
|
|
348
724
|
"div",
|
|
349
725
|
{
|
|
350
726
|
className: "absolute rounded-full",
|
|
351
727
|
style: {
|
|
352
|
-
width: Math.round(Math.min(
|
|
728
|
+
width: Math.round(Math.min(t, a) * 0.36),
|
|
353
729
|
height: 5,
|
|
354
730
|
left: "50%",
|
|
355
731
|
transform: "translateX(-50%)",
|
|
@@ -362,133 +738,119 @@ const et = ({
|
|
|
362
738
|
]
|
|
363
739
|
}
|
|
364
740
|
);
|
|
365
|
-
},
|
|
366
|
-
const
|
|
741
|
+
}, Pn = (e, t) => {
|
|
742
|
+
const a = d.useRef(void 0), r = d.useRef({ hostState: e, delegate: t }), s = d.useCallback((i) => {
|
|
743
|
+
if (a.current?.detach(), a.current = void 0, !i?.contentWindow) return;
|
|
744
|
+
const { host: o, detach: p } = rn({
|
|
745
|
+
target: i.contentWindow,
|
|
746
|
+
state: r.current.hostState,
|
|
747
|
+
delegate: r.current.delegate
|
|
748
|
+
});
|
|
749
|
+
a.current = { host: o, detach: p, sent: r.current.hostState };
|
|
750
|
+
}, []);
|
|
751
|
+
return d.useEffect(() => {
|
|
752
|
+
r.current = { hostState: e, delegate: t };
|
|
753
|
+
const i = a.current;
|
|
754
|
+
i && (i.host.update(Pt(i.sent, e)), i.sent = e);
|
|
755
|
+
}, [e, t]), s;
|
|
756
|
+
}, ot = ({ hostState: e, delegate: t, ...a }) => /* @__PURE__ */ n("iframe", { ...a, ref: Pn(e, t) }), Ue = 96, Cn = 250, lt = (e, t, a) => {
|
|
757
|
+
const [r, s] = d.useState(1);
|
|
367
758
|
return d.useLayoutEffect(() => {
|
|
368
759
|
const i = e.current;
|
|
369
760
|
if (!i) return;
|
|
370
|
-
const
|
|
371
|
-
const
|
|
761
|
+
const o = () => {
|
|
762
|
+
const c = i.getBoundingClientRect(), h = Math.min(
|
|
372
763
|
1,
|
|
373
|
-
(
|
|
374
|
-
(
|
|
764
|
+
(c.width - Ue) / t,
|
|
765
|
+
(c.height - Ue) / a
|
|
375
766
|
);
|
|
376
|
-
|
|
767
|
+
s(Math.max(0.1, h));
|
|
377
768
|
};
|
|
378
|
-
if (
|
|
379
|
-
const
|
|
380
|
-
return
|
|
381
|
-
}, [e,
|
|
382
|
-
},
|
|
769
|
+
if (o(), typeof ResizeObserver > "u") return;
|
|
770
|
+
const p = new ResizeObserver(o);
|
|
771
|
+
return p.observe(i), () => p.disconnect();
|
|
772
|
+
}, [e, t, a]), r;
|
|
773
|
+
}, On = ({
|
|
383
774
|
width: e,
|
|
384
|
-
height:
|
|
385
|
-
stageRef:
|
|
386
|
-
children:
|
|
775
|
+
height: t,
|
|
776
|
+
stageRef: a,
|
|
777
|
+
children: r
|
|
387
778
|
}) => {
|
|
388
|
-
const
|
|
389
|
-
return /* @__PURE__ */
|
|
779
|
+
const s = lt(a, e, t);
|
|
780
|
+
return /* @__PURE__ */ n(
|
|
390
781
|
"div",
|
|
391
782
|
{
|
|
392
783
|
className: "flex flex-none items-center justify-center overflow-hidden border border-dashed border-cream/20 p-6 text-center text-sm text-cream/55",
|
|
393
784
|
"data-testid": "device-placeholder",
|
|
394
|
-
style: { width: e *
|
|
395
|
-
children:
|
|
785
|
+
style: { width: e * s, height: t * s },
|
|
786
|
+
children: r
|
|
396
787
|
}
|
|
397
788
|
);
|
|
398
|
-
},
|
|
399
|
-
try {
|
|
400
|
-
const a = window.location.origin, r = new URL(n, a), i = new URL(s, a);
|
|
401
|
-
if (r.origin !== i.origin || r.pathname !== i.pathname) return !1;
|
|
402
|
-
const c = e?.contentWindow?.__swPreviewApply;
|
|
403
|
-
return typeof c != "function" ? !1 : (c(i.search), !0);
|
|
404
|
-
} catch {
|
|
405
|
-
return !1;
|
|
406
|
-
}
|
|
407
|
-
}, Nt = ({
|
|
789
|
+
}, Mn = ({
|
|
408
790
|
width: e,
|
|
409
|
-
height:
|
|
410
|
-
title:
|
|
411
|
-
src:
|
|
412
|
-
|
|
413
|
-
|
|
791
|
+
height: t,
|
|
792
|
+
title: a,
|
|
793
|
+
src: r,
|
|
794
|
+
hostState: s,
|
|
795
|
+
delegate: i,
|
|
796
|
+
stageRef: o,
|
|
797
|
+
reloadKey: p = 0,
|
|
414
798
|
chrome: c,
|
|
415
|
-
landscape:
|
|
416
|
-
theme:
|
|
799
|
+
landscape: h = !1,
|
|
800
|
+
theme: m = "light"
|
|
417
801
|
}) => {
|
|
418
|
-
const
|
|
419
|
-
{ mountSrc: a, currentSrc: a, generation: 0, ready: !0 }
|
|
420
|
-
]), m = d.useRef(w);
|
|
421
|
-
m.current = w;
|
|
422
|
-
const E = d.useRef(/* @__PURE__ */ new Map()), j = d.useRef(!1), L = d.useRef(i);
|
|
802
|
+
const b = lt(o, e, t), u = d.useRef(0), [v, N] = d.useState([{ src: r, generation: 0, ready: !0 }]), P = d.useRef(!1);
|
|
423
803
|
d.useEffect(() => {
|
|
424
|
-
if (!
|
|
425
|
-
|
|
804
|
+
if (!P.current) {
|
|
805
|
+
P.current = !0;
|
|
426
806
|
return;
|
|
427
807
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
b(
|
|
433
|
-
(O) => O.map(
|
|
434
|
-
(T) => T.generation === x.generation ? { ...T, currentSrc: a } : T
|
|
435
|
-
)
|
|
436
|
-
);
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
h.current += 1;
|
|
441
|
-
const S = {
|
|
442
|
-
mountSrc: a,
|
|
443
|
-
currentSrc: a,
|
|
444
|
-
generation: h.current,
|
|
445
|
-
ready: !1
|
|
446
|
-
};
|
|
447
|
-
b((x) => [...x.filter((M) => M.ready).slice(-1), S]);
|
|
448
|
-
}, [a, i]);
|
|
808
|
+
u.current += 1;
|
|
809
|
+
const g = { src: r, generation: u.current, ready: !1 };
|
|
810
|
+
N((S) => [...S.filter((k) => k.ready).slice(-1), g]);
|
|
811
|
+
}, [r, p]);
|
|
449
812
|
const C = (g) => {
|
|
450
813
|
window.setTimeout(() => {
|
|
451
|
-
|
|
452
|
-
},
|
|
453
|
-
},
|
|
454
|
-
return /* @__PURE__ */
|
|
814
|
+
N((S) => S.some((k) => k.generation === g) ? S.map((k) => k.generation === g ? { ...k, ready: !0 } : k).filter((k) => k.generation >= g) : S);
|
|
815
|
+
}, Cn);
|
|
816
|
+
}, ae = v.findLast((g) => g.ready), B = c ? c.radius * b : 0;
|
|
817
|
+
return /* @__PURE__ */ l(
|
|
455
818
|
"div",
|
|
456
819
|
{
|
|
457
820
|
className: `bg-panel relative flex-none overflow-hidden ${c ? "shadow-[0_0_0_1px] shadow-cream/25" : "border border-cream/20"}`,
|
|
458
821
|
"data-testid": "device-frame",
|
|
459
|
-
style: { width: e *
|
|
822
|
+
style: { width: e * b, height: t * b, borderRadius: B },
|
|
460
823
|
children: [
|
|
461
|
-
|
|
462
|
-
|
|
824
|
+
v.map((g) => /* @__PURE__ */ n(
|
|
825
|
+
ot,
|
|
463
826
|
{
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
src: g.mountSrc,
|
|
827
|
+
hostState: s,
|
|
828
|
+
delegate: i,
|
|
829
|
+
className: `absolute inset-0 origin-top-left border-0 bg-white transition-opacity duration-150 ${g === ae ? "opacity-100" : "opacity-0"}`,
|
|
830
|
+
title: a,
|
|
831
|
+
src: g.src,
|
|
470
832
|
width: e,
|
|
471
|
-
height:
|
|
472
|
-
style: { transform: `scale(${
|
|
833
|
+
height: t,
|
|
834
|
+
style: { transform: `scale(${b})` },
|
|
473
835
|
onLoad: () => {
|
|
474
836
|
g.ready || C(g.generation);
|
|
475
837
|
}
|
|
476
838
|
},
|
|
477
839
|
g.generation
|
|
478
840
|
)),
|
|
479
|
-
c && /* @__PURE__ */
|
|
841
|
+
c && /* @__PURE__ */ n(
|
|
480
842
|
"div",
|
|
481
843
|
{
|
|
482
844
|
className: "pointer-events-none absolute inset-0 origin-top-left",
|
|
483
|
-
style: { width: e, height:
|
|
484
|
-
children: /* @__PURE__ */
|
|
485
|
-
|
|
845
|
+
style: { width: e, height: t, transform: `scale(${b})` },
|
|
846
|
+
children: /* @__PURE__ */ n(
|
|
847
|
+
En,
|
|
486
848
|
{
|
|
487
849
|
spec: c,
|
|
488
850
|
width: e,
|
|
489
|
-
height:
|
|
490
|
-
landscape:
|
|
491
|
-
theme:
|
|
851
|
+
height: t,
|
|
852
|
+
landscape: h,
|
|
853
|
+
theme: m
|
|
492
854
|
}
|
|
493
855
|
)
|
|
494
856
|
}
|
|
@@ -496,494 +858,563 @@ const et = ({
|
|
|
496
858
|
]
|
|
497
859
|
}
|
|
498
860
|
);
|
|
499
|
-
},
|
|
861
|
+
}, $n = ({
|
|
500
862
|
paywall: e,
|
|
501
|
-
missing:
|
|
502
|
-
onDismiss:
|
|
503
|
-
}) => /* @__PURE__ */
|
|
863
|
+
missing: t,
|
|
864
|
+
onDismiss: a
|
|
865
|
+
}) => /* @__PURE__ */ n(
|
|
504
866
|
"div",
|
|
505
867
|
{
|
|
506
868
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-ink/70 p-6",
|
|
507
869
|
role: "dialog",
|
|
508
870
|
"aria-modal": "true",
|
|
509
871
|
"aria-labelledby": "sw-missing-products",
|
|
510
|
-
children: /* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
/* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ l("div", { className: "bg-panel flex w-full max-w-md flex-col gap-4 border border-cream/20 p-5", children: [
|
|
873
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-1.5", children: [
|
|
874
|
+
/* @__PURE__ */ n("span", { id: "sw-missing-products", className: "text-[0.9375rem] font-medium text-cream", children: t.length === 1 ? "A product is missing" : `${t.length} products are missing` }),
|
|
875
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-relaxed text-cream/60", children: `${e} declares ${t.length === 1 ? "a product" : "products"} Superwall has no record of. Every variable on ${t.length === 1 ? "it" : "them"} will be undefined here and on device.` })
|
|
514
876
|
] }),
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
/* @__PURE__ */
|
|
517
|
-
/* @__PURE__ */
|
|
518
|
-
] },
|
|
519
|
-
/* @__PURE__ */
|
|
877
|
+
/* @__PURE__ */ n("ul", { className: "flex flex-col gap-1.5 border-y border-cream/10 py-3", children: t.map((r) => /* @__PURE__ */ l("li", { className: "flex items-baseline justify-between gap-3", children: [
|
|
878
|
+
/* @__PURE__ */ n("span", { className: "font-mono text-[11px] text-cream/70", children: r.reference }),
|
|
879
|
+
/* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/40", children: r.identifier })
|
|
880
|
+
] }, r.reference)) }),
|
|
881
|
+
/* @__PURE__ */ l("span", { className: "text-xs text-cream/45", children: [
|
|
520
882
|
"Add ",
|
|
521
|
-
|
|
883
|
+
t.length === 1 ? "it" : "them",
|
|
522
884
|
" in the Superwall dashboard, or point the config at",
|
|
523
|
-
|
|
885
|
+
t.length === 1 ? " a product" : " products",
|
|
524
886
|
" that exists. Pushing is refused until then."
|
|
525
887
|
] }),
|
|
526
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ n("button", { type: "button", className: "sw-btn sw-btn--primary self-end", onClick: a, children: "View anyway" })
|
|
527
889
|
] })
|
|
528
890
|
}
|
|
529
|
-
),
|
|
891
|
+
), Tn = /* @__PURE__ */ new Set([
|
|
530
892
|
"ping",
|
|
531
893
|
"page_view",
|
|
532
894
|
"page_styles",
|
|
533
895
|
"has_set_dom",
|
|
534
896
|
"haptic_feedback",
|
|
535
897
|
"var_click",
|
|
536
|
-
"
|
|
537
|
-
"
|
|
538
|
-
|
|
539
|
-
"paywall_open",
|
|
540
|
-
"experiment",
|
|
541
|
-
"purchase"
|
|
542
|
-
]), _t = {
|
|
898
|
+
"purchase",
|
|
899
|
+
"restore"
|
|
900
|
+
]), Rn = {
|
|
543
901
|
open_url: ["url"],
|
|
544
902
|
open_url_external: ["url"],
|
|
545
|
-
open_deep_link: ["link"
|
|
546
|
-
custom_placement: ["name"
|
|
903
|
+
open_deep_link: ["link"],
|
|
904
|
+
custom_placement: ["name"],
|
|
547
905
|
custom: ["name", "data"],
|
|
548
|
-
request_permission: ["
|
|
906
|
+
request_permission: ["permission_type"],
|
|
549
907
|
request_callback: ["name"],
|
|
550
|
-
schedule_notification: ["title"]
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
908
|
+
schedule_notification: ["title"],
|
|
909
|
+
discount_redemption_result: ["code"]
|
|
910
|
+
}, An = /* @__PURE__ */ new Set(["close"]), Dn = /* @__PURE__ */ new Set([
|
|
911
|
+
"stripe_checkout_complete",
|
|
912
|
+
"post_checkout_complete"
|
|
913
|
+
]), Ln = (e) => {
|
|
914
|
+
for (const t of Rn[e.event_name] ?? []) {
|
|
915
|
+
const a = Reflect.get(e, t);
|
|
916
|
+
if (typeof a == "string" && a.length > 0) return a;
|
|
555
917
|
}
|
|
556
|
-
},
|
|
557
|
-
if (!
|
|
918
|
+
}, jn = (e) => {
|
|
919
|
+
if (!Tn.has(e.event_name))
|
|
558
920
|
return {
|
|
559
921
|
action: e.event_name,
|
|
560
|
-
subject:
|
|
561
|
-
tone:
|
|
922
|
+
subject: Ln(e),
|
|
923
|
+
tone: An.has(e.event_name) ? "warning" : Dn.has(e.event_name) ? "success" : "info"
|
|
562
924
|
};
|
|
563
|
-
},
|
|
925
|
+
}, Un = {
|
|
564
926
|
info: "text-cream/45",
|
|
565
927
|
success: "text-accent",
|
|
566
928
|
warning: "text-red"
|
|
567
|
-
},
|
|
568
|
-
purchase:
|
|
569
|
-
transaction_complete:
|
|
570
|
-
freeTrial_start:
|
|
571
|
-
transaction_abandon:
|
|
572
|
-
transaction_fail:
|
|
573
|
-
close:
|
|
574
|
-
restore:
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
929
|
+
}, Fn = {
|
|
930
|
+
purchase: he,
|
|
931
|
+
transaction_complete: ue,
|
|
932
|
+
freeTrial_start: ue,
|
|
933
|
+
transaction_abandon: me,
|
|
934
|
+
transaction_fail: me,
|
|
935
|
+
close: at,
|
|
936
|
+
restore: nt,
|
|
937
|
+
restore_complete: ue,
|
|
938
|
+
restore_fail: me,
|
|
939
|
+
open_url: G,
|
|
940
|
+
open_url_external: G,
|
|
941
|
+
open_deep_link: G,
|
|
942
|
+
initiate_web_checkout: he,
|
|
943
|
+
open_payment_sheet: he,
|
|
944
|
+
custom_placement: W,
|
|
945
|
+
custom: W,
|
|
946
|
+
request_permission: W,
|
|
947
|
+
request_callback: W,
|
|
948
|
+
schedule_notification: fn,
|
|
949
|
+
request_store_review: bn,
|
|
950
|
+
user_attribute_updated: vn
|
|
951
|
+
}, H = ({ children: e }) => /* @__PURE__ */ n("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs whitespace-nowrap", children: e }), _e = ({
|
|
588
952
|
action: e,
|
|
589
|
-
tone:
|
|
590
|
-
children:
|
|
591
|
-
actions:
|
|
953
|
+
tone: t,
|
|
954
|
+
children: a,
|
|
955
|
+
actions: r
|
|
592
956
|
}) => {
|
|
593
|
-
const
|
|
594
|
-
return /* @__PURE__ */
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
|
|
957
|
+
const s = Fn[e] ?? hn;
|
|
958
|
+
return /* @__PURE__ */ n("div", { className: "bg-panel font-sans w-[344px] border border-cream/15 p-3 shadow-[0_8px_24px_-8px] shadow-black/60", children: /* @__PURE__ */ l("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
|
|
959
|
+
/* @__PURE__ */ n("span", { className: `flex h-5 items-center justify-center ${Un[t]}`, children: /* @__PURE__ */ n(s, {}) }),
|
|
960
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: a }),
|
|
961
|
+
r && /* @__PURE__ */ n("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: r })
|
|
598
962
|
] }) });
|
|
599
|
-
},
|
|
963
|
+
}, Hn = ({ notice: e }) => /* @__PURE__ */ l(_e, { action: e.action, tone: e.tone, children: [
|
|
600
964
|
"Tap triggered a ",
|
|
601
|
-
/* @__PURE__ */
|
|
602
|
-
e.subject ? /* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ n(H, { children: e.action }),
|
|
966
|
+
e.subject ? /* @__PURE__ */ l(Z, { children: [
|
|
603
967
|
" for ",
|
|
604
|
-
/* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ n(H, { children: e.subject })
|
|
605
969
|
] }) : " action",
|
|
606
970
|
"."
|
|
607
|
-
] }),
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
return /* @__PURE__ */ o(he, { action: s?.action ?? "purchase", tone: s?.tone ?? "info", children: [
|
|
617
|
-
/* @__PURE__ */ t(H, { children: n }),
|
|
618
|
-
" ",
|
|
619
|
-
s?.label
|
|
620
|
-
] });
|
|
621
|
-
}, ye = {
|
|
622
|
-
purchase: { action: "purchase", verb: "purchase", no: "Abandon", yes: "Complete" },
|
|
623
|
-
permission: { action: "request_permission", verb: "permission", no: "Deny", yes: "Grant" },
|
|
624
|
-
callback: { action: "request_callback", verb: "callback", no: "Fail", yes: "Succeed" }
|
|
625
|
-
}, Tt = {
|
|
626
|
-
purchase: ["abandoned", "completed"],
|
|
627
|
-
permission: ["denied", "granted"],
|
|
628
|
-
callback: ["failure", "success"]
|
|
629
|
-
}, At = ({
|
|
630
|
-
kind: e,
|
|
631
|
-
subject: n,
|
|
971
|
+
] }), Bn = ({ choice: e, subject: t }) => /* @__PURE__ */ l(_e, { action: e.action, tone: e.tone, children: [
|
|
972
|
+
/* @__PURE__ */ n(H, { children: t }),
|
|
973
|
+
" ",
|
|
974
|
+
e.done
|
|
975
|
+
] }), Vn = ({
|
|
976
|
+
action: e,
|
|
977
|
+
verb: t,
|
|
978
|
+
subject: a,
|
|
979
|
+
choices: r,
|
|
632
980
|
onAnswer: s
|
|
633
|
-
}) =>
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
981
|
+
}) => /* @__PURE__ */ l(
|
|
982
|
+
_e,
|
|
983
|
+
{
|
|
984
|
+
action: e,
|
|
985
|
+
tone: "info",
|
|
986
|
+
actions: r.map((i) => /* @__PURE__ */ n(
|
|
987
|
+
"button",
|
|
988
|
+
{
|
|
989
|
+
type: "button",
|
|
990
|
+
className: i.primary ? "sw-btn sw-btn--primary" : "sw-btn",
|
|
991
|
+
onClick: () => s(i),
|
|
992
|
+
children: i.label
|
|
993
|
+
},
|
|
994
|
+
i.label
|
|
995
|
+
)),
|
|
996
|
+
children: [
|
|
997
|
+
"Tap triggered a ",
|
|
998
|
+
/* @__PURE__ */ n(H, { children: t }),
|
|
999
|
+
" for ",
|
|
1000
|
+
/* @__PURE__ */ n(H, { children: a }),
|
|
1001
|
+
"."
|
|
1002
|
+
]
|
|
1003
|
+
}
|
|
1004
|
+
), qn = [
|
|
1005
|
+
{
|
|
1006
|
+
label: "Abandon",
|
|
1007
|
+
value: "abandoned",
|
|
1008
|
+
action: "transaction_abandon",
|
|
1009
|
+
tone: "warning",
|
|
1010
|
+
done: "purchase abandoned."
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
label: "Fail",
|
|
1014
|
+
value: "failed",
|
|
1015
|
+
action: "transaction_fail",
|
|
1016
|
+
tone: "warning",
|
|
1017
|
+
done: "purchase failed."
|
|
1018
|
+
},
|
|
1019
|
+
{
|
|
1020
|
+
label: "Complete",
|
|
1021
|
+
value: "completed",
|
|
1022
|
+
primary: !0,
|
|
1023
|
+
action: "transaction_complete",
|
|
1024
|
+
tone: "success",
|
|
1025
|
+
done: "purchase completed."
|
|
1026
|
+
}
|
|
1027
|
+
], zn = [
|
|
1028
|
+
{
|
|
1029
|
+
label: "Nothing",
|
|
1030
|
+
value: "failed",
|
|
1031
|
+
action: "restore_fail",
|
|
1032
|
+
tone: "warning",
|
|
1033
|
+
done: "nothing to restore."
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
label: "Restore",
|
|
1037
|
+
value: "restored",
|
|
1038
|
+
primary: !0,
|
|
1039
|
+
action: "restore_complete",
|
|
1040
|
+
tone: "success",
|
|
1041
|
+
done: "restored."
|
|
1042
|
+
}
|
|
1043
|
+
], Wn = [
|
|
1044
|
+
{
|
|
1045
|
+
label: "Deny",
|
|
1046
|
+
value: "denied",
|
|
1047
|
+
action: "request_permission",
|
|
1048
|
+
tone: "warning",
|
|
1049
|
+
done: "denied."
|
|
1050
|
+
},
|
|
1051
|
+
{
|
|
1052
|
+
label: "Grant",
|
|
1053
|
+
value: "granted",
|
|
1054
|
+
primary: !0,
|
|
1055
|
+
action: "request_permission",
|
|
1056
|
+
tone: "success",
|
|
1057
|
+
done: "granted."
|
|
1058
|
+
}
|
|
1059
|
+
], Kn = [
|
|
1060
|
+
{ label: "Fail", value: "failure", action: "request_callback", tone: "warning", done: "failed." },
|
|
1061
|
+
{
|
|
1062
|
+
label: "Succeed",
|
|
1063
|
+
value: "success",
|
|
1064
|
+
primary: !0,
|
|
1065
|
+
action: "request_callback",
|
|
1066
|
+
tone: "success",
|
|
1067
|
+
done: "succeeded."
|
|
1068
|
+
}
|
|
1069
|
+
];
|
|
1070
|
+
let Jn = 0;
|
|
1071
|
+
const K = (e, t, a, r) => new Promise((s) => {
|
|
1072
|
+
const i = `${e}-${Jn += 1}`;
|
|
1073
|
+
U.custom(
|
|
1074
|
+
() => /* @__PURE__ */ n(
|
|
1075
|
+
Vn,
|
|
1076
|
+
{
|
|
1077
|
+
action: e,
|
|
1078
|
+
verb: t,
|
|
1079
|
+
subject: a,
|
|
1080
|
+
choices: r,
|
|
1081
|
+
onAnswer: (o) => {
|
|
1082
|
+
U.dismiss(i), U.custom(() => /* @__PURE__ */ n(Bn, { choice: o, subject: a })), s(o.value);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
),
|
|
1086
|
+
{ id: i, duration: Number.POSITIVE_INFINITY }
|
|
652
1087
|
);
|
|
653
|
-
},
|
|
1088
|
+
}), Gn = () => ({
|
|
1089
|
+
event: (e) => {
|
|
1090
|
+
const t = jn(e);
|
|
1091
|
+
t && U.custom(() => /* @__PURE__ */ n(Hn, { notice: t }));
|
|
1092
|
+
},
|
|
1093
|
+
purchase: (e) => K("purchase", "purchase", e.reference, qn),
|
|
1094
|
+
restore: () => K("restore", "restore", "purchases", zn),
|
|
1095
|
+
close: () => {
|
|
1096
|
+
},
|
|
1097
|
+
openUrl: () => {
|
|
1098
|
+
},
|
|
1099
|
+
custom: () => {
|
|
1100
|
+
},
|
|
1101
|
+
customPlacement: () => {
|
|
1102
|
+
},
|
|
1103
|
+
permission: (e) => K("request_permission", "permission", e, Wn),
|
|
1104
|
+
callback: (e) => K("request_callback", "callback", e, Kn).then((t) => ({ status: t }))
|
|
1105
|
+
}), Yn = () => d.useMemo(Gn, []), Zn = ({
|
|
654
1106
|
surfaceKey: e,
|
|
655
|
-
raised:
|
|
1107
|
+
raised: t = !1
|
|
656
1108
|
}) => (d.useEffect(() => {
|
|
657
|
-
|
|
658
|
-
}, [e]),
|
|
659
|
-
|
|
660
|
-
if (!De(a.data)) return;
|
|
661
|
-
if (a.data.type === "ask") {
|
|
662
|
-
const { id: i, kind: c, subject: f } = a.data, u = (l) => {
|
|
663
|
-
a.source?.postMessage(
|
|
664
|
-
{ channel: Ae, type: "answer", id: i, outcome: l },
|
|
665
|
-
"*"
|
|
666
|
-
), D.dismiss(i), D.custom(() => /* @__PURE__ */ t(Lt, { outcome: l, subject: f }));
|
|
667
|
-
};
|
|
668
|
-
D.custom(() => /* @__PURE__ */ t(At, { kind: c, subject: f, onAnswer: u }), {
|
|
669
|
-
id: i,
|
|
670
|
-
duration: Number.POSITIVE_INFINITY
|
|
671
|
-
});
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
if (a.data.type !== "event") return;
|
|
675
|
-
const r = Mt(a.data.message);
|
|
676
|
-
r && D.custom(() => /* @__PURE__ */ t(jt, { notice: r }));
|
|
677
|
-
};
|
|
678
|
-
return window.addEventListener("message", s), () => window.removeEventListener("message", s);
|
|
679
|
-
}, []), /* @__PURE__ */ t(
|
|
680
|
-
Xe,
|
|
1109
|
+
U.dismiss();
|
|
1110
|
+
}, [e]), /* @__PURE__ */ n(
|
|
1111
|
+
kt,
|
|
681
1112
|
{
|
|
682
1113
|
position: "top-center",
|
|
683
1114
|
swipeDirections: ["top"],
|
|
684
|
-
offset:
|
|
1115
|
+
offset: t ? 84 : 52,
|
|
685
1116
|
gap: 8,
|
|
686
1117
|
visibleToasts: 3,
|
|
687
1118
|
style: { zIndex: 5 },
|
|
688
1119
|
toastOptions: { unstyled: !0, classNames: { toast: "w-full" } }
|
|
689
1120
|
}
|
|
690
|
-
)),
|
|
1121
|
+
)), Qn = ({
|
|
691
1122
|
value: e,
|
|
692
|
-
options:
|
|
693
|
-
onChange:
|
|
694
|
-
label:
|
|
695
|
-
}) => /* @__PURE__ */
|
|
1123
|
+
options: t,
|
|
1124
|
+
onChange: a,
|
|
1125
|
+
label: r
|
|
1126
|
+
}) => /* @__PURE__ */ n("div", { className: "sw-segmented", role: "group", "aria-label": r, children: t.map((s) => /* @__PURE__ */ n(
|
|
696
1127
|
"button",
|
|
697
1128
|
{
|
|
698
1129
|
type: "button",
|
|
699
|
-
"aria-pressed":
|
|
700
|
-
onClick: () => s
|
|
701
|
-
children:
|
|
1130
|
+
"aria-pressed": s.value === e,
|
|
1131
|
+
onClick: () => a(s.value),
|
|
1132
|
+
children: s.label
|
|
702
1133
|
},
|
|
703
|
-
|
|
704
|
-
)) }),
|
|
1134
|
+
s.value
|
|
1135
|
+
)) }), Fe = ({
|
|
705
1136
|
value: e,
|
|
706
|
-
options:
|
|
707
|
-
onChange:
|
|
708
|
-
label:
|
|
709
|
-
}) => /* @__PURE__ */
|
|
1137
|
+
options: t,
|
|
1138
|
+
onChange: a,
|
|
1139
|
+
label: r
|
|
1140
|
+
}) => /* @__PURE__ */ n(
|
|
710
1141
|
"select",
|
|
711
1142
|
{
|
|
712
1143
|
className: "sw-select",
|
|
713
|
-
"aria-label":
|
|
1144
|
+
"aria-label": r,
|
|
714
1145
|
value: e,
|
|
715
|
-
onChange: (
|
|
716
|
-
children:
|
|
1146
|
+
onChange: (s) => a(s.target.value),
|
|
1147
|
+
children: t.map((s) => /* @__PURE__ */ n("option", { value: s.value, children: s.label }, s.value))
|
|
717
1148
|
}
|
|
718
|
-
),
|
|
1149
|
+
), Xn = ({
|
|
719
1150
|
checked: e,
|
|
720
|
-
onChange:
|
|
721
|
-
label:
|
|
722
|
-
}) => /* @__PURE__ */
|
|
1151
|
+
onChange: t,
|
|
1152
|
+
label: a
|
|
1153
|
+
}) => /* @__PURE__ */ n(
|
|
723
1154
|
"button",
|
|
724
1155
|
{
|
|
725
1156
|
type: "button",
|
|
726
1157
|
role: "switch",
|
|
727
1158
|
"aria-checked": e,
|
|
728
|
-
"aria-label":
|
|
1159
|
+
"aria-label": a,
|
|
729
1160
|
className: "sw-switch",
|
|
730
|
-
onClick: () =>
|
|
1161
|
+
onClick: () => t(!e)
|
|
731
1162
|
}
|
|
732
|
-
),
|
|
1163
|
+
), ea = ({
|
|
733
1164
|
open: e,
|
|
734
|
-
title:
|
|
735
|
-
onClose:
|
|
736
|
-
children:
|
|
737
|
-
}) => /* @__PURE__ */
|
|
1165
|
+
title: t,
|
|
1166
|
+
onClose: a,
|
|
1167
|
+
children: r
|
|
1168
|
+
}) => /* @__PURE__ */ n(
|
|
738
1169
|
"aside",
|
|
739
1170
|
{
|
|
740
1171
|
className: `flex-none overflow-hidden transition-[width] duration-200 ease-out motion-reduce:transition-none ${e ? "w-72" : "w-0"}`,
|
|
741
1172
|
"aria-hidden": !e,
|
|
742
1173
|
inert: !e,
|
|
743
|
-
children: /* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */
|
|
745
|
-
/* @__PURE__ */
|
|
746
|
-
/* @__PURE__ */
|
|
1174
|
+
children: /* @__PURE__ */ l("div", { className: "bg-bar flex h-full w-72 flex-col border-l border-cream/10", children: [
|
|
1175
|
+
/* @__PURE__ */ l("div", { className: "flex h-11 flex-none items-center justify-between border-b border-cream/10 px-3", children: [
|
|
1176
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: t }),
|
|
1177
|
+
/* @__PURE__ */ n(
|
|
747
1178
|
"button",
|
|
748
1179
|
{
|
|
749
1180
|
type: "button",
|
|
750
1181
|
className: "sw-btn sw-btn--icon border-transparent",
|
|
751
|
-
"aria-label": `Close ${
|
|
752
|
-
onClick:
|
|
753
|
-
children: /* @__PURE__ */
|
|
1182
|
+
"aria-label": `Close ${t.toLowerCase()}`,
|
|
1183
|
+
onClick: a,
|
|
1184
|
+
children: /* @__PURE__ */ n(at, {})
|
|
754
1185
|
}
|
|
755
1186
|
)
|
|
756
1187
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: r })
|
|
758
1189
|
] })
|
|
759
1190
|
}
|
|
760
|
-
),
|
|
761
|
-
/* @__PURE__ */
|
|
762
|
-
|
|
763
|
-
] }),
|
|
1191
|
+
), ta = ({ children: e }) => /* @__PURE__ */ n("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", children: e }), J = ({ label: e, children: t }) => /* @__PURE__ */ l("div", { className: "flex items-center gap-2.5", children: [
|
|
1192
|
+
/* @__PURE__ */ n("span", { className: "sw-tool-label", children: e }),
|
|
1193
|
+
t
|
|
1194
|
+
] }), He = () => /* @__PURE__ */ n("span", { className: "h-6 w-px bg-cream/10" }), ct = d.createContext(void 0), dt = () => {
|
|
1195
|
+
const e = d.useContext(ct);
|
|
1196
|
+
if (!e)
|
|
1197
|
+
throw new Error("Studio components must be rendered inside <StudioHostProvider>.");
|
|
1198
|
+
return e;
|
|
1199
|
+
}, na = ({
|
|
1200
|
+
mode: e,
|
|
1201
|
+
home: t,
|
|
1202
|
+
children: a
|
|
1203
|
+
}) => {
|
|
1204
|
+
const { href: r, navigate: s } = t, i = d.useMemo(
|
|
1205
|
+
() => ({ mode: e, home: { href: r, navigate: s } }),
|
|
1206
|
+
[e, r, s]
|
|
1207
|
+
);
|
|
1208
|
+
return /* @__PURE__ */ n(ct.Provider, { value: i, children: a });
|
|
1209
|
+
}, aa = () => dt().mode, ra = () => dt().home, pt = ({
|
|
764
1210
|
title: e,
|
|
765
|
-
|
|
766
|
-
actions: s,
|
|
1211
|
+
actions: t,
|
|
767
1212
|
inset: a = !1,
|
|
768
1213
|
label: r = "Studio"
|
|
769
|
-
}) =>
|
|
770
|
-
|
|
771
|
-
{
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
"
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1214
|
+
}) => {
|
|
1215
|
+
const s = ra();
|
|
1216
|
+
return /* @__PURE__ */ n("header", { className: "relative z-10 flex h-11 flex-none items-center border-b border-cream/10 bg-ink", children: /* @__PURE__ */ l(
|
|
1217
|
+
"div",
|
|
1218
|
+
{
|
|
1219
|
+
className: `flex h-full w-full items-center px-3 ${a ? "mx-auto max-w-[1080px] sm:px-0" : ""}`,
|
|
1220
|
+
children: [
|
|
1221
|
+
/* @__PURE__ */ l(
|
|
1222
|
+
"a",
|
|
1223
|
+
{
|
|
1224
|
+
className: "flex items-center gap-3 text-[0.9375rem] font-semibold tracking-[0.01em]",
|
|
1225
|
+
href: s.href,
|
|
1226
|
+
onClick: (i) => {
|
|
1227
|
+
i.button === 0 && (i.metaKey || i.ctrlKey || i.shiftKey || i.altKey || (i.preventDefault(), s.navigate()));
|
|
1228
|
+
},
|
|
1229
|
+
children: [
|
|
1230
|
+
/* @__PURE__ */ l("span", { className: "whitespace-nowrap", children: [
|
|
1231
|
+
/* @__PURE__ */ n("em", { className: "text-accent not-italic", children: "$UPER" }),
|
|
1232
|
+
"WALL"
|
|
1233
|
+
] }),
|
|
1234
|
+
/* @__PURE__ */ n("span", { className: "h-4 w-px bg-cream/20" }),
|
|
1235
|
+
/* @__PURE__ */ n("span", { className: "font-normal", children: r })
|
|
1236
|
+
]
|
|
1237
|
+
}
|
|
1238
|
+
),
|
|
1239
|
+
/* @__PURE__ */ n("span", { className: "absolute left-1/2 hidden -translate-x-1/2 text-sm font-medium whitespace-nowrap sm:block", children: e }),
|
|
1240
|
+
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-2", children: t })
|
|
1241
|
+
]
|
|
1242
|
+
}
|
|
1243
|
+
) });
|
|
1244
|
+
}, sa = [
|
|
797
1245
|
{ key: "user", label: "User", blurb: "Attributes your app sets" },
|
|
798
1246
|
{ key: "device", label: "Device", blurb: "Platform, locale, OS — the SDK fills these in" },
|
|
799
1247
|
{ key: "params", label: "Params", blurb: "Passed in at the placement" },
|
|
800
1248
|
{ key: "products", label: "Products", blurb: "Store data for this paywall's products" }
|
|
801
|
-
],
|
|
1249
|
+
], Be = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ia = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, be = (e) => e.slice(e.indexOf(".") + 1), oa = ({
|
|
802
1250
|
row: e,
|
|
803
|
-
override:
|
|
804
|
-
onChange:
|
|
1251
|
+
override: t,
|
|
1252
|
+
onChange: a
|
|
805
1253
|
}) => {
|
|
806
|
-
const
|
|
807
|
-
return /* @__PURE__ */
|
|
808
|
-
/* @__PURE__ */
|
|
809
|
-
/* @__PURE__ */
|
|
810
|
-
|
|
1254
|
+
const r = t !== void 0, s = r ? t : e.value;
|
|
1255
|
+
return /* @__PURE__ */ l("div", { className: "flex flex-col gap-1 py-1.5", children: [
|
|
1256
|
+
/* @__PURE__ */ l("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
1257
|
+
/* @__PURE__ */ n("span", { className: "truncate font-mono text-[11px] text-cream/70", children: e.path }),
|
|
1258
|
+
r && /* @__PURE__ */ n(
|
|
811
1259
|
"button",
|
|
812
1260
|
{
|
|
813
1261
|
type: "button",
|
|
814
1262
|
className: "shrink-0 text-[11px] text-cream/40 hover:text-cream",
|
|
815
1263
|
"aria-label": `Reset ${e.path}`,
|
|
816
|
-
onClick: () =>
|
|
1264
|
+
onClick: () => a(void 0),
|
|
817
1265
|
children: "Reset"
|
|
818
1266
|
}
|
|
819
1267
|
)
|
|
820
1268
|
] }),
|
|
821
|
-
typeof
|
|
1269
|
+
typeof s == "boolean" ? /* @__PURE__ */ n("span", { className: "flex h-7 items-center", children: /* @__PURE__ */ n(
|
|
822
1270
|
"button",
|
|
823
1271
|
{
|
|
824
1272
|
type: "button",
|
|
825
1273
|
className: "sw-switch",
|
|
826
1274
|
role: "switch",
|
|
827
|
-
"aria-checked":
|
|
1275
|
+
"aria-checked": s,
|
|
828
1276
|
"aria-label": e.path,
|
|
829
|
-
onClick: () =>
|
|
1277
|
+
onClick: () => a(!s)
|
|
830
1278
|
}
|
|
831
|
-
) }) : /* @__PURE__ */
|
|
1279
|
+
) }) : /* @__PURE__ */ n(
|
|
832
1280
|
"input",
|
|
833
1281
|
{
|
|
834
1282
|
className: "sw-input w-full",
|
|
835
1283
|
"aria-label": e.path,
|
|
836
|
-
value:
|
|
837
|
-
placeholder:
|
|
1284
|
+
value: Be(s),
|
|
1285
|
+
placeholder: Be(e.value),
|
|
838
1286
|
onChange: (i) => {
|
|
839
|
-
const
|
|
840
|
-
|
|
1287
|
+
const o = i.target.value;
|
|
1288
|
+
a(o === "" ? void 0 : ia(o));
|
|
841
1289
|
}
|
|
842
1290
|
}
|
|
843
1291
|
)
|
|
844
1292
|
] });
|
|
845
|
-
},
|
|
1293
|
+
}, la = ({
|
|
846
1294
|
label: e,
|
|
847
|
-
blurb:
|
|
848
|
-
rows:
|
|
849
|
-
overrideOf:
|
|
850
|
-
onChange:
|
|
1295
|
+
blurb: t,
|
|
1296
|
+
rows: a,
|
|
1297
|
+
overrideOf: r,
|
|
1298
|
+
onChange: s
|
|
851
1299
|
}) => {
|
|
852
|
-
const [i,
|
|
853
|
-
return /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
1300
|
+
const [i, o] = d.useState(!1), p = a.filter((c) => r(c.path) !== void 0).length;
|
|
1301
|
+
return /* @__PURE__ */ l("section", { className: "border-b border-cream/10 last:border-b-0", children: [
|
|
1302
|
+
/* @__PURE__ */ l(
|
|
855
1303
|
"button",
|
|
856
1304
|
{
|
|
857
1305
|
type: "button",
|
|
858
1306
|
className: "flex w-full items-center gap-2 py-3 text-left",
|
|
859
1307
|
"aria-expanded": i,
|
|
860
|
-
onClick: () =>
|
|
1308
|
+
onClick: () => o((c) => !c),
|
|
861
1309
|
children: [
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
/* @__PURE__ */
|
|
865
|
-
/* @__PURE__ */
|
|
1310
|
+
/* @__PURE__ */ l("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
1311
|
+
/* @__PURE__ */ l("span", { className: "flex items-baseline gap-2", children: [
|
|
1312
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] font-medium text-cream", children: e }),
|
|
1313
|
+
/* @__PURE__ */ n("span", { className: "text-xs text-cream/40", children: p > 0 ? /* @__PURE__ */ n("span", { className: "text-accent", children: `${p} set` }) : a.length || null })
|
|
866
1314
|
] }),
|
|
867
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ n("span", { className: "truncate text-xs text-cream/55", children: t })
|
|
868
1316
|
] }),
|
|
869
|
-
/* @__PURE__ */
|
|
1317
|
+
/* @__PURE__ */ n(
|
|
870
1318
|
"span",
|
|
871
1319
|
{
|
|
872
1320
|
className: `ml-auto shrink-0 text-cream/40 transition-transform ${i ? "" : "-rotate-90"}`,
|
|
873
1321
|
"aria-hidden": "true",
|
|
874
|
-
children: /* @__PURE__ */
|
|
1322
|
+
children: /* @__PURE__ */ n(rt, {})
|
|
875
1323
|
}
|
|
876
1324
|
)
|
|
877
1325
|
]
|
|
878
1326
|
}
|
|
879
1327
|
),
|
|
880
|
-
i && (
|
|
881
|
-
|
|
1328
|
+
i && (a.length === 0 ? /* @__PURE__ */ n("span", { className: "block pb-3 text-xs text-cream/35", children: "Nothing here for this paywall." }) : /* @__PURE__ */ n("div", { className: "flex flex-col pb-2", children: a.map((c) => /* @__PURE__ */ n(
|
|
1329
|
+
oa,
|
|
882
1330
|
{
|
|
883
|
-
row:
|
|
884
|
-
override:
|
|
885
|
-
onChange: (
|
|
1331
|
+
row: c,
|
|
1332
|
+
override: r(c.path),
|
|
1333
|
+
onChange: (h) => s(c.path, h)
|
|
886
1334
|
},
|
|
887
|
-
|
|
1335
|
+
c.path
|
|
888
1336
|
)) }))
|
|
889
1337
|
] });
|
|
890
|
-
},
|
|
1338
|
+
}, ca = ({
|
|
891
1339
|
overrides: e,
|
|
892
|
-
groups:
|
|
893
|
-
onChange:
|
|
1340
|
+
groups: t,
|
|
1341
|
+
onChange: a
|
|
894
1342
|
}) => {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
897
|
-
const
|
|
898
|
-
|
|
1343
|
+
const r = (s, i, o) => {
|
|
1344
|
+
if (s !== "products") {
|
|
1345
|
+
const b = { ...e[s] };
|
|
1346
|
+
o === void 0 ? delete b[be(i)] : b[be(i)] = o, a({ ...e, [s]: b });
|
|
899
1347
|
return;
|
|
900
1348
|
}
|
|
901
|
-
const [,
|
|
902
|
-
|
|
903
|
-
const
|
|
904
|
-
Object.keys(
|
|
1349
|
+
const [, p = "", c = ""] = i.split("."), h = { ...e.products?.[p] };
|
|
1350
|
+
o === void 0 ? delete h[c] : h[c] = o;
|
|
1351
|
+
const m = { ...e.products, [p]: h };
|
|
1352
|
+
Object.keys(h).length === 0 && delete m[p], a({ ...e, products: m });
|
|
905
1353
|
};
|
|
906
|
-
return /* @__PURE__ */
|
|
907
|
-
|
|
1354
|
+
return /* @__PURE__ */ n("div", { className: "flex flex-col", children: sa.map((s) => /* @__PURE__ */ n(
|
|
1355
|
+
la,
|
|
908
1356
|
{
|
|
909
|
-
label:
|
|
910
|
-
blurb:
|
|
911
|
-
rows:
|
|
912
|
-
overrideOf: (i) =>
|
|
913
|
-
onChange: (i,
|
|
1357
|
+
label: s.label,
|
|
1358
|
+
blurb: s.blurb,
|
|
1359
|
+
rows: t[s.key] ?? [],
|
|
1360
|
+
overrideOf: (i) => s.key === "products" ? e.products?.[i.split(".")[1] ?? ""]?.[i.split(".")[2] ?? ""] : e[s.key]?.[be(i)],
|
|
1361
|
+
onChange: (i, o) => r(s.key, i, o)
|
|
914
1362
|
},
|
|
915
|
-
|
|
1363
|
+
s.key
|
|
916
1364
|
)) });
|
|
917
|
-
},
|
|
918
|
-
const n = new URLSearchParams();
|
|
919
|
-
e.theme && n.set("theme", e.theme), e.locale && n.set("locale", e.locale);
|
|
920
|
-
for (const [s, a] of [
|
|
921
|
-
["sw_device", e.device],
|
|
922
|
-
["sw_user", e.user],
|
|
923
|
-
["sw_params", e.params],
|
|
924
|
-
["sw_products", e.products]
|
|
925
|
-
])
|
|
926
|
-
a && Object.keys(a).length > 0 && n.set(s, JSON.stringify(a));
|
|
927
|
-
return e.trialEligible !== void 0 && n.set("sw_trial", e.trialEligible ? "1" : "0"), n;
|
|
928
|
-
}, $ = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, He = (e) => `/preview${$(e)}?sw_preview=1`, bn = (e, n) => {
|
|
929
|
-
const s = Ue(n).toString();
|
|
930
|
-
return `/preview${$(e)}${s ? `?${s}` : ""}`;
|
|
931
|
-
}, Fe = (e, n) => {
|
|
932
|
-
const s = Ue(n).toString();
|
|
933
|
-
return s ? `${e}${e.includes("?") ? "&" : "?"}${s}` : e;
|
|
934
|
-
}, Gt = (e) => /[?&]sw_preview=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}sw_preview=1`, wn = (e) => (n, s) => Fe(Gt(e(n)), s), Zt = async (e, n, s) => {
|
|
1365
|
+
}, O = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, ke = (e) => /[?&]transport=editor(?:&|$)/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}transport=editor`, Ma = (e) => ke(`/preview${O(e)}`), $a = (e) => (t) => ke(e(t)), da = async (e, t, a) => {
|
|
935
1366
|
try {
|
|
936
|
-
const
|
|
1367
|
+
const r = await fetch("/__studio/action", {
|
|
937
1368
|
method: "POST",
|
|
938
1369
|
headers: { "Content-Type": "application/json" },
|
|
939
1370
|
body: JSON.stringify({
|
|
940
|
-
action:
|
|
1371
|
+
action: t,
|
|
941
1372
|
kind: e.kind,
|
|
942
1373
|
id: e.id,
|
|
943
1374
|
project: e.project
|
|
944
1375
|
})
|
|
945
1376
|
});
|
|
946
|
-
if (!
|
|
947
|
-
return await
|
|
948
|
-
const
|
|
949
|
-
let
|
|
950
|
-
const
|
|
951
|
-
if (!
|
|
952
|
-
const
|
|
953
|
-
|
|
1377
|
+
if (!r.body)
|
|
1378
|
+
return await r.json();
|
|
1379
|
+
const s = r.body.getReader(), i = new TextDecoder();
|
|
1380
|
+
let o = "", p;
|
|
1381
|
+
const c = (h) => {
|
|
1382
|
+
if (!h.trim()) return;
|
|
1383
|
+
const m = JSON.parse(h);
|
|
1384
|
+
m.result ? p = m.result : m.step && m.state && a?.(m.step, m.state);
|
|
954
1385
|
};
|
|
955
1386
|
for (; ; ) {
|
|
956
|
-
const { done:
|
|
957
|
-
if (
|
|
958
|
-
|
|
959
|
-
const
|
|
1387
|
+
const { done: h, value: m } = await s.read();
|
|
1388
|
+
if (h) break;
|
|
1389
|
+
o += i.decode(m, { stream: !0 });
|
|
1390
|
+
const b = o.split(`
|
|
960
1391
|
`);
|
|
961
|
-
|
|
962
|
-
for (const
|
|
1392
|
+
o = b.pop() ?? "";
|
|
1393
|
+
for (const u of b) c(u);
|
|
963
1394
|
}
|
|
964
|
-
return
|
|
965
|
-
} catch (
|
|
966
|
-
return { ok: !1, error:
|
|
1395
|
+
return c(o), p ?? { ok: !1, error: "The dev server closed without a result." };
|
|
1396
|
+
} catch (r) {
|
|
1397
|
+
return { ok: !1, error: r instanceof Error ? r.message : String(r) };
|
|
967
1398
|
}
|
|
968
|
-
},
|
|
1399
|
+
}, Ne = async (e) => {
|
|
969
1400
|
try {
|
|
970
|
-
return await (await fetch(`/__studio/status${
|
|
971
|
-
} catch (
|
|
972
|
-
return { unreachable:
|
|
1401
|
+
return await (await fetch(`/__studio/status${O(e)}`)).json();
|
|
1402
|
+
} catch (t) {
|
|
1403
|
+
return { unreachable: t instanceof Error ? t.message : String(t) };
|
|
973
1404
|
}
|
|
974
|
-
},
|
|
1405
|
+
}, pa = async () => {
|
|
975
1406
|
try {
|
|
976
|
-
const
|
|
977
|
-
return typeof
|
|
1407
|
+
const t = await (await fetch("/__studio/samples.json")).json();
|
|
1408
|
+
return typeof t == "object" && t !== null ? t : {};
|
|
978
1409
|
} catch (e) {
|
|
979
1410
|
return { unreachable: e instanceof Error ? e.message : String(e) };
|
|
980
1411
|
}
|
|
981
|
-
},
|
|
1412
|
+
}, ve = {
|
|
982
1413
|
radius: 54,
|
|
983
1414
|
cutout: "island",
|
|
984
1415
|
statusBarHeight: 64,
|
|
985
1416
|
homeIndicator: !0
|
|
986
|
-
},
|
|
1417
|
+
}, X = [
|
|
987
1418
|
{
|
|
988
1419
|
id: "iphone-se",
|
|
989
1420
|
name: "iPhone SE",
|
|
@@ -998,7 +1429,7 @@ const et = ({
|
|
|
998
1429
|
width: 402,
|
|
999
1430
|
height: 874,
|
|
1000
1431
|
device: { platform: "iOS", deviceModel: "iPhone18,3", osVersion: "26.0" },
|
|
1001
|
-
chrome:
|
|
1432
|
+
chrome: ve
|
|
1002
1433
|
},
|
|
1003
1434
|
{
|
|
1004
1435
|
id: "iphone-air",
|
|
@@ -1006,7 +1437,7 @@ const et = ({
|
|
|
1006
1437
|
width: 420,
|
|
1007
1438
|
height: 912,
|
|
1008
1439
|
device: { platform: "iOS", deviceModel: "iPhone18,4", osVersion: "26.0" },
|
|
1009
|
-
chrome:
|
|
1440
|
+
chrome: ve
|
|
1010
1441
|
},
|
|
1011
1442
|
{
|
|
1012
1443
|
id: "iphone-17-pro-max",
|
|
@@ -1014,7 +1445,7 @@ const et = ({
|
|
|
1014
1445
|
width: 440,
|
|
1015
1446
|
height: 956,
|
|
1016
1447
|
device: { platform: "iOS", deviceModel: "iPhone18,2", osVersion: "26.0" },
|
|
1017
|
-
chrome:
|
|
1448
|
+
chrome: ve
|
|
1018
1449
|
},
|
|
1019
1450
|
{
|
|
1020
1451
|
id: "pixel-10",
|
|
@@ -1054,135 +1485,183 @@ const et = ({
|
|
|
1054
1485
|
width: 1440,
|
|
1055
1486
|
height: 900
|
|
1056
1487
|
}
|
|
1057
|
-
],
|
|
1488
|
+
], ut = "iphone-17", Ve = "responsive", ua = { width: 393, height: 852 }, ma = X.find((e) => e.id === ut) ?? X[0], ha = (e) => X.find((t) => t.id === e) ?? ma, mt = () => ({
|
|
1489
|
+
device: on(),
|
|
1490
|
+
user: ln,
|
|
1491
|
+
params: cn
|
|
1492
|
+
}), ht = ({
|
|
1493
|
+
surface: e,
|
|
1494
|
+
defaults: t,
|
|
1495
|
+
sourceSamples: a,
|
|
1496
|
+
samples: r,
|
|
1497
|
+
frame: s,
|
|
1498
|
+
theme: i,
|
|
1499
|
+
locale: o,
|
|
1500
|
+
edited: p
|
|
1501
|
+
}) => {
|
|
1502
|
+
const c = {
|
|
1503
|
+
...t.device,
|
|
1504
|
+
...a?.device,
|
|
1505
|
+
...r.device,
|
|
1506
|
+
...s,
|
|
1507
|
+
interfaceStyle: i === "dark" ? "Dark" : "Light",
|
|
1508
|
+
...o ? { deviceLocale: o, deviceLanguageCode: o.split(/[-_]/)[0] } : {},
|
|
1509
|
+
...p.device
|
|
1510
|
+
}, h = {
|
|
1511
|
+
...t.user,
|
|
1512
|
+
...a?.user,
|
|
1513
|
+
...r.user,
|
|
1514
|
+
...p.user
|
|
1515
|
+
}, m = {
|
|
1516
|
+
...t.params,
|
|
1517
|
+
...a?.params,
|
|
1518
|
+
...p.params
|
|
1519
|
+
}, b = Object.entries(e.products ?? {}).map(
|
|
1520
|
+
([u, v]) => ({
|
|
1521
|
+
reference: u,
|
|
1522
|
+
productId: v,
|
|
1523
|
+
variables: {
|
|
1524
|
+
...r.products?.[v],
|
|
1525
|
+
...p.products?.[u]
|
|
1526
|
+
}
|
|
1527
|
+
})
|
|
1528
|
+
);
|
|
1529
|
+
return Ge({
|
|
1530
|
+
paywallId: e.paywallId ?? "0",
|
|
1531
|
+
paywallIdentifier: e.paywallIdentifier ?? e.id,
|
|
1532
|
+
device: c,
|
|
1533
|
+
user: h,
|
|
1534
|
+
params: m,
|
|
1535
|
+
products: b,
|
|
1536
|
+
introductoryOfferEligible: p.introductoryOfferEligible
|
|
1537
|
+
});
|
|
1538
|
+
}, ft = (e) => e.capabilities?.actions === !0, fa = (e, t) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : t, qe = ({
|
|
1058
1539
|
label: e,
|
|
1059
|
-
value:
|
|
1060
|
-
onCommit:
|
|
1540
|
+
value: t,
|
|
1541
|
+
onCommit: a
|
|
1061
1542
|
}) => {
|
|
1062
|
-
const [
|
|
1543
|
+
const [r, s] = d.useState(String(t));
|
|
1063
1544
|
return d.useEffect(() => {
|
|
1064
|
-
|
|
1065
|
-
}, [
|
|
1545
|
+
s(String(t));
|
|
1546
|
+
}, [t]), /* @__PURE__ */ n(
|
|
1066
1547
|
"input",
|
|
1067
1548
|
{
|
|
1068
1549
|
className: "sw-input w-16 text-center",
|
|
1069
1550
|
type: "number",
|
|
1070
1551
|
"aria-label": e,
|
|
1071
|
-
value:
|
|
1072
|
-
onChange: (
|
|
1552
|
+
value: r,
|
|
1553
|
+
onChange: (o) => s(o.target.value),
|
|
1073
1554
|
onBlur: () => {
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1555
|
+
const o = fa(Number(r), t);
|
|
1556
|
+
s(String(o)), a(o);
|
|
1076
1557
|
},
|
|
1077
|
-
onKeyDown: (
|
|
1078
|
-
|
|
1558
|
+
onKeyDown: (o) => {
|
|
1559
|
+
o.key === "Enter" && o.target.blur();
|
|
1079
1560
|
}
|
|
1080
1561
|
}
|
|
1081
1562
|
);
|
|
1082
|
-
},
|
|
1563
|
+
}, ze = ({
|
|
1083
1564
|
label: e,
|
|
1084
|
-
width:
|
|
1085
|
-
height:
|
|
1086
|
-
title:
|
|
1087
|
-
src:
|
|
1088
|
-
|
|
1565
|
+
width: t,
|
|
1566
|
+
height: a,
|
|
1567
|
+
title: r,
|
|
1568
|
+
src: s,
|
|
1569
|
+
hostState: i,
|
|
1570
|
+
delegate: o,
|
|
1571
|
+
reloadKey: p,
|
|
1089
1572
|
empty: c,
|
|
1090
|
-
chrome:
|
|
1091
|
-
landscape:
|
|
1092
|
-
theme:
|
|
1573
|
+
chrome: h,
|
|
1574
|
+
landscape: m,
|
|
1575
|
+
theme: b
|
|
1093
1576
|
}) => {
|
|
1094
|
-
const
|
|
1095
|
-
return /* @__PURE__ */
|
|
1096
|
-
e && /* @__PURE__ */
|
|
1097
|
-
|
|
1098
|
-
|
|
1577
|
+
const u = d.useRef(null);
|
|
1578
|
+
return /* @__PURE__ */ n("div", { className: "flex min-h-0 min-w-0 flex-1 flex-col items-center justify-center", ref: u, children: /* @__PURE__ */ l("div", { className: "flex flex-col gap-2", children: [
|
|
1579
|
+
e && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: e }),
|
|
1580
|
+
s ? /* @__PURE__ */ n(
|
|
1581
|
+
Mn,
|
|
1099
1582
|
{
|
|
1100
|
-
width:
|
|
1101
|
-
height:
|
|
1102
|
-
title:
|
|
1103
|
-
src:
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1583
|
+
width: t,
|
|
1584
|
+
height: a,
|
|
1585
|
+
title: r,
|
|
1586
|
+
src: s,
|
|
1587
|
+
hostState: i,
|
|
1588
|
+
delegate: o,
|
|
1589
|
+
stageRef: u,
|
|
1590
|
+
reloadKey: p,
|
|
1591
|
+
chrome: h,
|
|
1592
|
+
landscape: m,
|
|
1593
|
+
theme: b
|
|
1109
1594
|
}
|
|
1110
|
-
) : /* @__PURE__ */
|
|
1595
|
+
) : /* @__PURE__ */ n(On, { width: t, height: a, stageRef: u, children: c ?? "Nothing live yet — publish to compare against production." })
|
|
1111
1596
|
] }) });
|
|
1112
|
-
},
|
|
1597
|
+
}, we = (e) => e.label ?? `${e.kind}/${e.id}`, ba = ({
|
|
1113
1598
|
source: e,
|
|
1114
|
-
surface:
|
|
1115
|
-
samples:
|
|
1116
|
-
onBack: a,
|
|
1599
|
+
surface: t,
|
|
1600
|
+
samples: a,
|
|
1117
1601
|
actions: r
|
|
1118
1602
|
}) => {
|
|
1119
|
-
const [
|
|
1120
|
-
d.useEffect(() => () => window.clearTimeout(
|
|
1121
|
-
const
|
|
1122
|
-
d.useEffect(() => {
|
|
1123
|
-
const p = (v) => {
|
|
1124
|
-
const N = It(v.data);
|
|
1125
|
-
N && We(N);
|
|
1126
|
-
};
|
|
1127
|
-
return window.addEventListener("message", p), () => window.removeEventListener("message", p);
|
|
1128
|
-
}, []);
|
|
1129
|
-
const me = n.locales.length > 0 ? n.locales : qe;
|
|
1603
|
+
const [s, i] = d.useState(ut), [o, p] = d.useState(ua), [c, h] = d.useState("light"), [m, b] = d.useState(void 0), [u, v] = d.useState({}), [N, P] = d.useState(!1), [C, ae] = d.useState(void 0), [B, g] = d.useState(0), [S, k] = d.useState(!1), [V, Ie] = d.useState({}), [vt, A] = d.useState(void 0), re = d.useRef(void 0);
|
|
1604
|
+
d.useEffect(() => () => window.clearTimeout(re.current), []);
|
|
1605
|
+
const q = ft(e), Ee = Yn(), T = d.useMemo(mt, [t]), Pe = t.locales;
|
|
1130
1606
|
d.useEffect(() => {
|
|
1131
|
-
if (!
|
|
1132
|
-
let
|
|
1133
|
-
return
|
|
1134
|
-
|
|
1607
|
+
if (!q) return;
|
|
1608
|
+
let f = !1;
|
|
1609
|
+
return Ne(t).then((w) => {
|
|
1610
|
+
f || Ie(w);
|
|
1135
1611
|
}), () => {
|
|
1136
|
-
|
|
1612
|
+
f = !0;
|
|
1137
1613
|
};
|
|
1138
|
-
}, [
|
|
1139
|
-
const
|
|
1140
|
-
window.clearTimeout(
|
|
1141
|
-
const
|
|
1614
|
+
}, [q, t]);
|
|
1615
|
+
const wt = async (f) => {
|
|
1616
|
+
window.clearTimeout(re.current), A({ action: f, steps: {} });
|
|
1617
|
+
const w = await da(t, f, (x, _) => {
|
|
1142
1618
|
A(
|
|
1143
|
-
(
|
|
1144
|
-
...
|
|
1145
|
-
steps: { ...
|
|
1146
|
-
} :
|
|
1619
|
+
(E) => E?.action === f ? {
|
|
1620
|
+
...E,
|
|
1621
|
+
steps: { ...E.steps, [x]: _ === "start" ? "active" : "done" }
|
|
1622
|
+
} : E
|
|
1147
1623
|
);
|
|
1148
1624
|
});
|
|
1149
|
-
if (
|
|
1150
|
-
const
|
|
1151
|
-
Q[
|
|
1625
|
+
if (w.ok) {
|
|
1626
|
+
const x = Object.fromEntries(
|
|
1627
|
+
Q[f].map((_) => [_, "done"])
|
|
1152
1628
|
);
|
|
1153
|
-
A({ action:
|
|
1629
|
+
A({ action: f, steps: x }), Ie(await Ne(t)), re.current = window.setTimeout(() => A(void 0), 1600);
|
|
1154
1630
|
} else
|
|
1155
|
-
A((
|
|
1156
|
-
if (!
|
|
1157
|
-
const _ = { ...
|
|
1158
|
-
for (const
|
|
1159
|
-
_[
|
|
1160
|
-
return { ...
|
|
1631
|
+
A((x) => {
|
|
1632
|
+
if (!x) return x;
|
|
1633
|
+
const _ = { ...x.steps };
|
|
1634
|
+
for (const E of Q[f])
|
|
1635
|
+
_[E] === "active" && (_[E] = "failed");
|
|
1636
|
+
return { ...x, steps: _, error: w.error };
|
|
1161
1637
|
});
|
|
1162
|
-
},
|
|
1163
|
-
|
|
1164
|
-
|
|
1638
|
+
}, D = s === Ve, M = ha(s), se = D ? o : { width: M.width, height: M.height }, I = S ? { width: se.height, height: se.width } : se, yt = () => {
|
|
1639
|
+
const f = e.standaloneUrl?.(t);
|
|
1640
|
+
if (f === void 0) return;
|
|
1641
|
+
if (I.width > 768) {
|
|
1642
|
+
window.open(f, "_blank");
|
|
1165
1643
|
return;
|
|
1166
1644
|
}
|
|
1167
|
-
const
|
|
1645
|
+
const w = Math.max(0, window.screen.width / 2 - I.width / 2), x = Math.max(0, window.screen.height / 2 - I.height / 2);
|
|
1168
1646
|
window.open(
|
|
1169
|
-
|
|
1647
|
+
f,
|
|
1170
1648
|
"superwall-preview",
|
|
1171
|
-
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${
|
|
1172
|
-
) || window.open(
|
|
1173
|
-
},
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1649
|
+
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${I.width},height=${I.height},top=${x},left=${w}`
|
|
1650
|
+
) || window.open(f, "_blank");
|
|
1651
|
+
}, ie = d.useMemo(
|
|
1652
|
+
() => ht({
|
|
1653
|
+
surface: t,
|
|
1654
|
+
defaults: T,
|
|
1655
|
+
sourceSamples: e.samples,
|
|
1656
|
+
samples: a,
|
|
1657
|
+
frame: D ? void 0 : M.device,
|
|
1658
|
+
theme: c,
|
|
1659
|
+
locale: m,
|
|
1660
|
+
edited: u
|
|
1661
|
+
}),
|
|
1662
|
+
[t, T, e.samples, a, D, M.device, c, m, u]
|
|
1663
|
+
), Ce = D ? void 0 : M.chrome, gt = e.previewUrl(t), xt = V.liveUrl ? ke(V.liveUrl) : void 0, Oe = [
|
|
1664
|
+
...q ? [
|
|
1186
1665
|
{
|
|
1187
1666
|
key: "live",
|
|
1188
1667
|
label: "Live version",
|
|
@@ -1190,154 +1669,158 @@ const et = ({
|
|
|
1190
1669
|
target: { type: "live" }
|
|
1191
1670
|
}
|
|
1192
1671
|
] : [],
|
|
1193
|
-
...e.surfaces.map((
|
|
1194
|
-
key: `surface:${
|
|
1195
|
-
label:
|
|
1672
|
+
...e.surfaces.map((f, w) => ({
|
|
1673
|
+
key: `surface:${w}`,
|
|
1674
|
+
label: we(f),
|
|
1196
1675
|
hint: e.compareHint ?? "Local preview",
|
|
1197
|
-
target: { type: "surface", surface:
|
|
1198
|
-
})).filter((
|
|
1199
|
-
],
|
|
1676
|
+
target: { type: "surface", surface: f }
|
|
1677
|
+
})).filter((f) => f.target.surface !== t)
|
|
1678
|
+
], $ = C && (C.type === "live" ? {
|
|
1200
1679
|
label: "Live",
|
|
1201
|
-
src:
|
|
1202
|
-
title: `${
|
|
1203
|
-
empty:
|
|
1680
|
+
src: xt,
|
|
1681
|
+
title: `${t.id} live`,
|
|
1682
|
+
empty: V.unreachable ? `Couldn't read the live version — ${V.unreachable}` : void 0
|
|
1204
1683
|
} : {
|
|
1205
|
-
label:
|
|
1206
|
-
src: e.previewUrl(C.surface
|
|
1207
|
-
title: `${
|
|
1208
|
-
}),
|
|
1209
|
-
const
|
|
1684
|
+
label: we(C.surface),
|
|
1685
|
+
src: e.previewUrl(C.surface),
|
|
1686
|
+
title: `${we(C.surface)} preview`
|
|
1687
|
+
}), Nt = d.useMemo(() => {
|
|
1688
|
+
const f = (w, x) => Object.entries(x ?? {}).map(([_, E]) => ({ path: `${w}.${_}`, value: E })).toSorted((_, E) => _.path.localeCompare(E.path));
|
|
1210
1689
|
return {
|
|
1211
|
-
user:
|
|
1212
|
-
device:
|
|
1690
|
+
user: f("user", { ...T.user, ...e.samples?.user, ...a.user }),
|
|
1691
|
+
device: f("device", {
|
|
1692
|
+
...T.device,
|
|
1213
1693
|
...e.samples?.device,
|
|
1214
|
-
...
|
|
1215
|
-
...
|
|
1694
|
+
...a.device,
|
|
1695
|
+
...M.device
|
|
1216
1696
|
}),
|
|
1217
|
-
params:
|
|
1218
|
-
products: Object.entries(
|
|
1219
|
-
([
|
|
1697
|
+
params: f("params", { ...T.params, ...e.samples?.params }),
|
|
1698
|
+
products: Object.entries(t.products ?? {}).flatMap(
|
|
1699
|
+
([w, x]) => f(`products.${w}`, a.products?.[x])
|
|
1220
1700
|
)
|
|
1221
1701
|
};
|
|
1222
|
-
}, [e.samples,
|
|
1223
|
-
d.useEffect(() =>
|
|
1224
|
-
const
|
|
1225
|
-
return /* @__PURE__ */
|
|
1226
|
-
/* @__PURE__ */
|
|
1227
|
-
|
|
1702
|
+
}, [T, e.samples, a, M.device, t.products]), z = d.useMemo(() => a.products ? Object.entries(t.products ?? {}).filter(([, f]) => a.products?.[f] === void 0).map(([f, w]) => ({ reference: f, identifier: w })) : [], [a.products, t.products]), [St, oe] = d.useState(!1);
|
|
1703
|
+
d.useEffect(() => oe(!1), [t]);
|
|
1704
|
+
const le = a.unreachable, _t = z.length === 0, Me = Object.keys(u.user ?? {}).length + Object.keys(u.params ?? {}).length + Object.keys(u.device ?? {}).length;
|
|
1705
|
+
return /* @__PURE__ */ l(Z, { children: [
|
|
1706
|
+
/* @__PURE__ */ n(
|
|
1707
|
+
Zn,
|
|
1228
1708
|
{
|
|
1229
|
-
surfaceKey: `${
|
|
1230
|
-
raised: !!
|
|
1709
|
+
surfaceKey: `${t.project ?? ""}/${t.id}`,
|
|
1710
|
+
raised: !!le
|
|
1231
1711
|
}
|
|
1232
1712
|
),
|
|
1233
|
-
|
|
1234
|
-
|
|
1713
|
+
z.length > 0 && !St && /* @__PURE__ */ n(
|
|
1714
|
+
$n,
|
|
1235
1715
|
{
|
|
1236
|
-
paywall:
|
|
1237
|
-
missing:
|
|
1238
|
-
onDismiss: () =>
|
|
1716
|
+
paywall: t.id,
|
|
1717
|
+
missing: z,
|
|
1718
|
+
onDismiss: () => oe(!0)
|
|
1239
1719
|
}
|
|
1240
1720
|
),
|
|
1241
|
-
|
|
1721
|
+
le && /* @__PURE__ */ l("div", { className: "border-b border-cream/10 bg-red/10 px-4 py-1.5 text-[0.8125rem] text-cream/75", children: [
|
|
1242
1722
|
"Couldn't check this paywall's products — ",
|
|
1243
|
-
|
|
1723
|
+
le
|
|
1244
1724
|
] }),
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
|
|
1725
|
+
/* @__PURE__ */ n(
|
|
1726
|
+
pt,
|
|
1247
1727
|
{
|
|
1248
|
-
title: `${
|
|
1249
|
-
|
|
1250
|
-
actions: /* @__PURE__ */ o(U, { children: [
|
|
1728
|
+
title: `${t.project ?? e.title} / ${t.id}${t.label ? ` · ${t.label}` : ""}`,
|
|
1729
|
+
actions: /* @__PURE__ */ l(Z, { children: [
|
|
1251
1730
|
r,
|
|
1252
|
-
/* @__PURE__ */
|
|
1731
|
+
/* @__PURE__ */ n(
|
|
1253
1732
|
"button",
|
|
1254
1733
|
{
|
|
1255
1734
|
type: "button",
|
|
1256
1735
|
className: "sw-btn sw-btn--icon",
|
|
1257
1736
|
"aria-label": "Reload preview",
|
|
1258
|
-
onClick: () => g((
|
|
1259
|
-
children: /* @__PURE__ */
|
|
1737
|
+
onClick: () => g((f) => f + 1),
|
|
1738
|
+
children: /* @__PURE__ */ n(nt, {})
|
|
1260
1739
|
}
|
|
1261
1740
|
),
|
|
1262
|
-
/* @__PURE__ */
|
|
1741
|
+
e.standaloneUrl && /* @__PURE__ */ n(
|
|
1263
1742
|
"button",
|
|
1264
1743
|
{
|
|
1265
1744
|
type: "button",
|
|
1266
1745
|
className: "sw-btn sw-btn--icon",
|
|
1267
1746
|
"aria-label": "Open preview",
|
|
1268
|
-
onClick:
|
|
1269
|
-
children: /* @__PURE__ */
|
|
1747
|
+
onClick: yt,
|
|
1748
|
+
children: /* @__PURE__ */ n(G, {})
|
|
1270
1749
|
}
|
|
1271
1750
|
),
|
|
1272
|
-
|
|
1273
|
-
|
|
1751
|
+
q && /* @__PURE__ */ n(
|
|
1752
|
+
Nn,
|
|
1274
1753
|
{
|
|
1275
|
-
progress:
|
|
1276
|
-
blocked:
|
|
1277
|
-
onRun:
|
|
1278
|
-
onBlocked: () =>
|
|
1754
|
+
progress: vt,
|
|
1755
|
+
blocked: _t ? void 0 : `Superwall has no product for ${z.map((f) => f.reference).join(", ")}`,
|
|
1756
|
+
onRun: wt,
|
|
1757
|
+
onBlocked: () => oe(!1)
|
|
1279
1758
|
}
|
|
1280
1759
|
)
|
|
1281
1760
|
] })
|
|
1282
1761
|
}
|
|
1283
1762
|
),
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1286
|
-
|
|
1287
|
-
|
|
1763
|
+
/* @__PURE__ */ l("div", { className: "flex min-h-0 flex-1", children: [
|
|
1764
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1", children: [
|
|
1765
|
+
$ && /* @__PURE__ */ n(
|
|
1766
|
+
ze,
|
|
1288
1767
|
{
|
|
1289
|
-
label:
|
|
1290
|
-
width:
|
|
1291
|
-
height:
|
|
1292
|
-
title:
|
|
1293
|
-
src:
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1768
|
+
label: $.label,
|
|
1769
|
+
width: I.width,
|
|
1770
|
+
height: I.height,
|
|
1771
|
+
title: $.title,
|
|
1772
|
+
src: $.src,
|
|
1773
|
+
hostState: ie,
|
|
1774
|
+
delegate: Ee,
|
|
1775
|
+
reloadKey: B,
|
|
1776
|
+
empty: "empty" in $ ? $.empty : void 0,
|
|
1777
|
+
chrome: Ce,
|
|
1297
1778
|
landscape: S,
|
|
1298
|
-
theme:
|
|
1779
|
+
theme: c
|
|
1299
1780
|
}
|
|
1300
1781
|
),
|
|
1301
|
-
/* @__PURE__ */
|
|
1302
|
-
|
|
1782
|
+
/* @__PURE__ */ n(
|
|
1783
|
+
ze,
|
|
1303
1784
|
{
|
|
1304
|
-
label:
|
|
1305
|
-
width:
|
|
1306
|
-
height:
|
|
1307
|
-
title: `${
|
|
1308
|
-
src:
|
|
1309
|
-
|
|
1310
|
-
|
|
1785
|
+
label: $ ? t.label ?? "Local" : void 0,
|
|
1786
|
+
width: I.width,
|
|
1787
|
+
height: I.height,
|
|
1788
|
+
title: `${t.id} preview`,
|
|
1789
|
+
src: gt,
|
|
1790
|
+
hostState: ie,
|
|
1791
|
+
delegate: Ee,
|
|
1792
|
+
reloadKey: B,
|
|
1793
|
+
chrome: Ce,
|
|
1311
1794
|
landscape: S,
|
|
1312
|
-
theme:
|
|
1795
|
+
theme: c
|
|
1313
1796
|
}
|
|
1314
1797
|
)
|
|
1315
1798
|
] }),
|
|
1316
|
-
/* @__PURE__ */
|
|
1799
|
+
/* @__PURE__ */ n(ea, { open: N, title: "Variables", onClose: () => P(!1), children: /* @__PURE__ */ n(ca, { overrides: u, groups: Nt, onChange: v }) })
|
|
1317
1800
|
] }),
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
/* @__PURE__ */
|
|
1320
|
-
|
|
1801
|
+
/* @__PURE__ */ l(ta, { children: [
|
|
1802
|
+
/* @__PURE__ */ n(J, { label: "Intro offer", children: /* @__PURE__ */ n(
|
|
1803
|
+
Xn,
|
|
1321
1804
|
{
|
|
1322
|
-
label: "
|
|
1323
|
-
checked:
|
|
1324
|
-
onChange: (
|
|
1805
|
+
label: "Introductory offer",
|
|
1806
|
+
checked: F(ie),
|
|
1807
|
+
onChange: (f) => v((w) => ({ ...w, introductoryOfferEligible: f }))
|
|
1325
1808
|
}
|
|
1326
1809
|
) }),
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1329
|
-
|
|
1810
|
+
/* @__PURE__ */ l(J, { label: "Theme", children: [
|
|
1811
|
+
/* @__PURE__ */ n(
|
|
1812
|
+
Qn,
|
|
1330
1813
|
{
|
|
1331
1814
|
label: "Theme",
|
|
1332
|
-
value:
|
|
1815
|
+
value: c,
|
|
1333
1816
|
options: [
|
|
1334
|
-
{ value: "light", label: /* @__PURE__ */
|
|
1335
|
-
{ value: "dark", label: /* @__PURE__ */
|
|
1817
|
+
{ value: "light", label: /* @__PURE__ */ n(dn, {}) },
|
|
1818
|
+
{ value: "dark", label: /* @__PURE__ */ n(pn, {}) }
|
|
1336
1819
|
],
|
|
1337
1820
|
onChange: h
|
|
1338
1821
|
}
|
|
1339
1822
|
),
|
|
1340
|
-
/* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ n(
|
|
1341
1824
|
"button",
|
|
1342
1825
|
{
|
|
1343
1826
|
type: "button",
|
|
@@ -1345,402 +1828,411 @@ const et = ({
|
|
|
1345
1828
|
"aria-label": "Rotate device",
|
|
1346
1829
|
"aria-pressed": S,
|
|
1347
1830
|
title: S ? "Back to portrait" : "Rotate to landscape",
|
|
1348
|
-
onClick: () =>
|
|
1349
|
-
children: /* @__PURE__ */
|
|
1831
|
+
onClick: () => k((f) => !f),
|
|
1832
|
+
children: /* @__PURE__ */ n(
|
|
1350
1833
|
"span",
|
|
1351
1834
|
{
|
|
1352
1835
|
className: `flex transition-transform duration-200 ${S ? "-rotate-90" : ""}`,
|
|
1353
|
-
children: /* @__PURE__ */
|
|
1836
|
+
children: /* @__PURE__ */ n(wn, {})
|
|
1354
1837
|
}
|
|
1355
1838
|
)
|
|
1356
1839
|
}
|
|
1357
1840
|
)
|
|
1358
1841
|
] }),
|
|
1359
|
-
/* @__PURE__ */
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
|
|
1842
|
+
/* @__PURE__ */ n(He, {}),
|
|
1843
|
+
/* @__PURE__ */ l(J, { label: "Device", children: [
|
|
1844
|
+
/* @__PURE__ */ n(
|
|
1845
|
+
Fe,
|
|
1363
1846
|
{
|
|
1364
1847
|
label: "Device",
|
|
1365
|
-
value:
|
|
1848
|
+
value: s,
|
|
1366
1849
|
options: [
|
|
1367
|
-
...
|
|
1368
|
-
{ value:
|
|
1850
|
+
...X.map((f) => ({ value: f.id, label: f.name })),
|
|
1851
|
+
{ value: Ve, label: "Responsive" }
|
|
1369
1852
|
],
|
|
1370
|
-
onChange:
|
|
1853
|
+
onChange: i
|
|
1371
1854
|
}
|
|
1372
1855
|
),
|
|
1373
|
-
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
|
|
1856
|
+
D && /* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
|
|
1857
|
+
/* @__PURE__ */ n(
|
|
1858
|
+
qe,
|
|
1376
1859
|
{
|
|
1377
1860
|
label: "Preview width",
|
|
1378
|
-
value:
|
|
1379
|
-
onCommit: (
|
|
1861
|
+
value: I.width,
|
|
1862
|
+
onCommit: (f) => p((w) => ({ ...w, width: f }))
|
|
1380
1863
|
}
|
|
1381
1864
|
),
|
|
1382
|
-
/* @__PURE__ */
|
|
1383
|
-
/* @__PURE__ */
|
|
1384
|
-
|
|
1865
|
+
/* @__PURE__ */ n("span", { className: "text-cream/55", children: "×" }),
|
|
1866
|
+
/* @__PURE__ */ n(
|
|
1867
|
+
qe,
|
|
1385
1868
|
{
|
|
1386
1869
|
label: "Preview height",
|
|
1387
|
-
value:
|
|
1388
|
-
onCommit: (
|
|
1870
|
+
value: I.height,
|
|
1871
|
+
onCommit: (f) => p((w) => ({ ...w, height: f }))
|
|
1389
1872
|
}
|
|
1390
1873
|
)
|
|
1391
1874
|
] })
|
|
1392
1875
|
] }),
|
|
1393
|
-
|
|
1394
|
-
|
|
1876
|
+
Pe.length > 1 && /* @__PURE__ */ n(J, { label: "Locale", children: /* @__PURE__ */ n(
|
|
1877
|
+
Fe,
|
|
1395
1878
|
{
|
|
1396
1879
|
label: "Locale",
|
|
1397
|
-
value:
|
|
1880
|
+
value: m ?? "default",
|
|
1398
1881
|
options: [
|
|
1399
1882
|
{ value: "default", label: "Device" },
|
|
1400
|
-
...
|
|
1883
|
+
...Pe.map((f) => ({ value: f, label: f }))
|
|
1401
1884
|
],
|
|
1402
|
-
onChange: (
|
|
1885
|
+
onChange: (f) => b(f === "default" ? void 0 : f)
|
|
1403
1886
|
}
|
|
1404
1887
|
) }),
|
|
1405
|
-
/* @__PURE__ */
|
|
1406
|
-
|
|
1407
|
-
/* @__PURE__ */
|
|
1888
|
+
/* @__PURE__ */ n(He, {}),
|
|
1889
|
+
Oe.length > 0 && /* @__PURE__ */ n(Sn, { active: C, options: Oe, onSelect: ae }),
|
|
1890
|
+
/* @__PURE__ */ l(
|
|
1408
1891
|
"button",
|
|
1409
1892
|
{
|
|
1410
1893
|
type: "button",
|
|
1411
1894
|
className: "sw-btn",
|
|
1412
|
-
"aria-expanded":
|
|
1413
|
-
onClick: () =>
|
|
1895
|
+
"aria-expanded": N,
|
|
1896
|
+
onClick: () => P((f) => !f),
|
|
1414
1897
|
children: [
|
|
1415
|
-
/* @__PURE__ */
|
|
1898
|
+
/* @__PURE__ */ n(un, {}),
|
|
1416
1899
|
"Variables",
|
|
1417
|
-
|
|
1900
|
+
Me > 0 && /* @__PURE__ */ n("span", { className: "text-accent", children: Me })
|
|
1418
1901
|
]
|
|
1419
1902
|
}
|
|
1420
1903
|
)
|
|
1421
1904
|
] })
|
|
1422
1905
|
] });
|
|
1423
|
-
},
|
|
1906
|
+
}, bt = "superwall-device-scheme", va = () => {
|
|
1424
1907
|
try {
|
|
1425
|
-
return window.localStorage.getItem(
|
|
1908
|
+
return window.localStorage.getItem(bt) ?? void 0;
|
|
1426
1909
|
} catch {
|
|
1427
1910
|
return;
|
|
1428
1911
|
}
|
|
1429
|
-
},
|
|
1912
|
+
}, wa = (e) => {
|
|
1430
1913
|
try {
|
|
1431
|
-
window.localStorage.setItem(
|
|
1914
|
+
window.localStorage.setItem(bt, e);
|
|
1432
1915
|
} catch {
|
|
1433
1916
|
}
|
|
1434
|
-
},
|
|
1435
|
-
const [
|
|
1436
|
-
const
|
|
1437
|
-
if (!(
|
|
1438
|
-
return
|
|
1439
|
-
},
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1442
|
-
const
|
|
1443
|
-
|
|
1917
|
+
}, We = (e, t) => `${e}://?superwall_dev=${encodeURIComponent(t)}`, ya = ({ origin: e, scheme: t }) => {
|
|
1918
|
+
const [a, r] = d.useState(va), s = a ?? t, i = (p) => {
|
|
1919
|
+
const h = window.prompt("Your app's URL scheme, so this can open it:", p)?.trim();
|
|
1920
|
+
if (!(h === void 0 || h === ""))
|
|
1921
|
+
return r(h), wa(h), h;
|
|
1922
|
+
}, o = (p) => {
|
|
1923
|
+
if (s !== void 0) return;
|
|
1924
|
+
p.preventDefault();
|
|
1925
|
+
const c = i("");
|
|
1926
|
+
c !== void 0 && window.location.assign(We(c, e));
|
|
1444
1927
|
};
|
|
1445
|
-
return /* @__PURE__ */
|
|
1446
|
-
|
|
1928
|
+
return /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
1929
|
+
s !== void 0 && /* @__PURE__ */ n(
|
|
1447
1930
|
"button",
|
|
1448
1931
|
{
|
|
1449
1932
|
className: "sw-btn sw-btn--icon",
|
|
1450
1933
|
type: "button",
|
|
1451
1934
|
"aria-label": "Edit app URL scheme",
|
|
1452
|
-
onClick: () => i(
|
|
1453
|
-
children: /* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1935
|
+
onClick: () => i(s),
|
|
1936
|
+
children: /* @__PURE__ */ l("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
|
|
1937
|
+
/* @__PURE__ */ n("path", { d: "M12 20h9" }),
|
|
1938
|
+
/* @__PURE__ */ n("path", { d: "M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
1456
1939
|
] })
|
|
1457
1940
|
}
|
|
1458
1941
|
),
|
|
1459
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ n(
|
|
1460
1943
|
"a",
|
|
1461
1944
|
{
|
|
1462
1945
|
className: "sw-btn sw-btn--primary",
|
|
1463
|
-
href:
|
|
1464
|
-
onClick:
|
|
1946
|
+
href: s === void 0 ? "#" : We(s, e),
|
|
1947
|
+
onClick: o,
|
|
1465
1948
|
children: "Open In App"
|
|
1466
1949
|
}
|
|
1467
1950
|
)
|
|
1468
1951
|
] });
|
|
1469
|
-
},
|
|
1952
|
+
}, ga = [
|
|
1470
1953
|
[60, "second"],
|
|
1471
1954
|
[60, "minute"],
|
|
1472
1955
|
[24, "hour"],
|
|
1473
1956
|
[7, "day"],
|
|
1474
1957
|
[4.348, "week"],
|
|
1475
|
-
[12, "month"]
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
const
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
a /= i;
|
|
1958
|
+
[12, "month"]
|
|
1959
|
+
], xa = (e, t = Date.now()) => {
|
|
1960
|
+
const a = Date.parse(e);
|
|
1961
|
+
if (Number.isNaN(a)) return;
|
|
1962
|
+
let r = Math.max(0, (t - a) / 1e3);
|
|
1963
|
+
const s = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
|
|
1964
|
+
for (const [i, o] of ga) {
|
|
1965
|
+
if (r < i) return s.format(-Math.round(r), o);
|
|
1966
|
+
r /= i;
|
|
1485
1967
|
}
|
|
1486
|
-
|
|
1487
|
-
|
|
1968
|
+
return s.format(-Math.round(r), "year");
|
|
1969
|
+
}, Ke = 390, Na = 844, Sa = (e) => {
|
|
1970
|
+
const [t, a] = d.useState(0);
|
|
1488
1971
|
return d.useLayoutEffect(() => {
|
|
1489
|
-
const
|
|
1490
|
-
if (!
|
|
1491
|
-
const
|
|
1492
|
-
if (
|
|
1493
|
-
const i = new ResizeObserver(
|
|
1494
|
-
return i.observe(
|
|
1495
|
-
}, [e]),
|
|
1496
|
-
},
|
|
1972
|
+
const r = e.current;
|
|
1973
|
+
if (!r) return;
|
|
1974
|
+
const s = () => a(r.getBoundingClientRect().width);
|
|
1975
|
+
if (s(), typeof ResizeObserver > "u") return;
|
|
1976
|
+
const i = new ResizeObserver(s);
|
|
1977
|
+
return i.observe(r), () => i.disconnect();
|
|
1978
|
+
}, [e]), t;
|
|
1979
|
+
}, _a = ({
|
|
1497
1980
|
surface: e,
|
|
1498
|
-
status:
|
|
1499
|
-
previewSrc:
|
|
1500
|
-
|
|
1501
|
-
|
|
1981
|
+
status: t,
|
|
1982
|
+
previewSrc: a,
|
|
1983
|
+
hostState: r,
|
|
1984
|
+
onOpen: s,
|
|
1985
|
+
href: i
|
|
1502
1986
|
}) => {
|
|
1503
|
-
const
|
|
1504
|
-
return /* @__PURE__ */
|
|
1987
|
+
const o = d.useRef(null), p = Sa(o), c = p > 0 ? p / Ke : 0, h = d.useMemo(Ht, []);
|
|
1988
|
+
return /* @__PURE__ */ l(
|
|
1505
1989
|
"a",
|
|
1506
1990
|
{
|
|
1507
1991
|
className: "group block",
|
|
1508
|
-
href:
|
|
1509
|
-
onClick: (
|
|
1510
|
-
|
|
1992
|
+
href: i ?? O(e),
|
|
1993
|
+
onClick: (m) => {
|
|
1994
|
+
m.metaKey || m.ctrlKey || (m.preventDefault(), s());
|
|
1511
1995
|
},
|
|
1512
1996
|
children: [
|
|
1513
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ n(
|
|
1514
1998
|
"div",
|
|
1515
1999
|
{
|
|
1516
2000
|
className: "bg-panel relative aspect-[390/844] overflow-hidden border border-cream/20 transition-colors group-hover:border-cream/35",
|
|
1517
|
-
ref:
|
|
1518
|
-
children:
|
|
1519
|
-
|
|
2001
|
+
ref: o,
|
|
2002
|
+
children: c > 0 && /* @__PURE__ */ n(
|
|
2003
|
+
ot,
|
|
1520
2004
|
{
|
|
2005
|
+
hostState: r,
|
|
2006
|
+
delegate: h,
|
|
1521
2007
|
className: "pointer-events-none block origin-top-left border-0 bg-white",
|
|
1522
2008
|
title: `${e.project ? `${e.project}/` : ""}${e.id} preview`,
|
|
1523
|
-
src:
|
|
2009
|
+
src: a,
|
|
1524
2010
|
loading: "lazy",
|
|
1525
2011
|
tabIndex: -1,
|
|
1526
|
-
width:
|
|
1527
|
-
height:
|
|
1528
|
-
style: { transform: `scale(${
|
|
2012
|
+
width: Ke,
|
|
2013
|
+
height: Na,
|
|
2014
|
+
style: { transform: `scale(${c})` }
|
|
1529
2015
|
}
|
|
1530
2016
|
)
|
|
1531
2017
|
}
|
|
1532
2018
|
),
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
e.project && /* @__PURE__ */
|
|
2019
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-between gap-2 pt-2.5", children: [
|
|
2020
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-0.5", children: [
|
|
2021
|
+
/* @__PURE__ */ l("span", { className: "text-sm font-medium", children: [
|
|
2022
|
+
e.project && /* @__PURE__ */ l("span", { className: "text-cream/45", children: [
|
|
1537
2023
|
e.project,
|
|
1538
2024
|
"/"
|
|
1539
2025
|
] }),
|
|
1540
2026
|
e.id,
|
|
1541
|
-
e.platforms && e.platforms.length > 0 && /* @__PURE__ */
|
|
2027
|
+
e.platforms && e.platforms.length > 0 && /* @__PURE__ */ l("span", { className: "text-cream/45", children: [
|
|
1542
2028
|
" · ",
|
|
1543
2029
|
e.platforms.join(" · ")
|
|
1544
2030
|
] })
|
|
1545
2031
|
] }),
|
|
1546
|
-
|
|
2032
|
+
t && /* @__PURE__ */ n("span", { className: "text-xs text-cream/55", children: t.updatedAt ? `Edited ${xa(t.updatedAt)}` : "Not published" })
|
|
1547
2033
|
] }),
|
|
1548
|
-
|
|
2034
|
+
t?.paywallId && /* @__PURE__ */ n("span", { className: `text-xs ${t.active ? "text-accent" : "text-cream/55"}`, children: t.active ? "Active" : "Inactive" })
|
|
1549
2035
|
] })
|
|
1550
2036
|
]
|
|
1551
2037
|
}
|
|
1552
2038
|
);
|
|
1553
2039
|
};
|
|
1554
|
-
let
|
|
1555
|
-
const
|
|
2040
|
+
let Je = 0;
|
|
2041
|
+
const ka = ({
|
|
1556
2042
|
source: e,
|
|
1557
|
-
onOpen:
|
|
1558
|
-
device: s = !1
|
|
2043
|
+
onOpen: t
|
|
1559
2044
|
}) => {
|
|
1560
|
-
const
|
|
2045
|
+
const a = aa() === "device", r = ft(e), [s, i] = d.useState({}), o = d.useMemo(mt, [e]);
|
|
1561
2046
|
d.useEffect(() => {
|
|
1562
|
-
if (
|
|
1563
|
-
let
|
|
1564
|
-
for (const
|
|
1565
|
-
|
|
1566
|
-
|
|
2047
|
+
if (!r) return;
|
|
2048
|
+
let b = !1;
|
|
2049
|
+
for (const u of e.surfaces)
|
|
2050
|
+
Ne(u).then((v) => {
|
|
2051
|
+
b || i((N) => ({ ...N, [O(u)]: v }));
|
|
1567
2052
|
});
|
|
1568
2053
|
return () => {
|
|
1569
|
-
|
|
2054
|
+
b = !0;
|
|
1570
2055
|
};
|
|
1571
|
-
}, [e]);
|
|
1572
|
-
const [
|
|
2056
|
+
}, [e, r]);
|
|
2057
|
+
const [p, c] = d.useState({}), h = d.useRef(null);
|
|
1573
2058
|
d.useLayoutEffect(() => {
|
|
1574
|
-
const
|
|
1575
|
-
if (!
|
|
1576
|
-
|
|
1577
|
-
const
|
|
1578
|
-
|
|
2059
|
+
const b = h.current;
|
|
2060
|
+
if (!b) return;
|
|
2061
|
+
b.scrollTop = Je;
|
|
2062
|
+
const u = () => {
|
|
2063
|
+
Je = b.scrollTop;
|
|
1579
2064
|
};
|
|
1580
|
-
return
|
|
1581
|
-
|
|
2065
|
+
return b.addEventListener("scroll", u, { passive: !0 }), () => {
|
|
2066
|
+
u(), b.removeEventListener("scroll", u);
|
|
1582
2067
|
};
|
|
1583
2068
|
}, []);
|
|
1584
|
-
const
|
|
2069
|
+
const m = [
|
|
1585
2070
|
["Paywalls", "paywall"],
|
|
1586
2071
|
["Funnels", "funnel"]
|
|
1587
|
-
].map(([
|
|
1588
|
-
const
|
|
2072
|
+
].map(([b, u]) => {
|
|
2073
|
+
const v = e.surfaces.filter((P) => P.kind === u), N = (p[u] ?? "").trim().toLowerCase();
|
|
1589
2074
|
return {
|
|
1590
|
-
label:
|
|
1591
|
-
kind:
|
|
1592
|
-
all:
|
|
1593
|
-
needle:
|
|
1594
|
-
surfaces:
|
|
1595
|
-
(
|
|
2075
|
+
label: b,
|
|
2076
|
+
kind: u,
|
|
2077
|
+
all: v,
|
|
2078
|
+
needle: N,
|
|
2079
|
+
surfaces: v.filter(
|
|
2080
|
+
(P) => N === "" || `${P.project ?? ""} ${P.id}`.toLowerCase().includes(N)
|
|
1596
2081
|
)
|
|
1597
2082
|
};
|
|
1598
|
-
}).filter((
|
|
1599
|
-
return /* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
|
|
2083
|
+
}).filter((b) => b.all.length > 0);
|
|
2084
|
+
return /* @__PURE__ */ l(Z, { children: [
|
|
2085
|
+
/* @__PURE__ */ n(
|
|
2086
|
+
pt,
|
|
1602
2087
|
{
|
|
1603
2088
|
title: e.title,
|
|
1604
|
-
onHome: () => {
|
|
1605
|
-
},
|
|
1606
2089
|
inset: !0,
|
|
1607
|
-
label:
|
|
1608
|
-
actions:
|
|
2090
|
+
label: a ? "Preview" : void 0,
|
|
2091
|
+
actions: a ? /* @__PURE__ */ n(ya, { origin: window.location.origin, scheme: e.scheme }) : void 0
|
|
1609
2092
|
}
|
|
1610
2093
|
),
|
|
1611
|
-
/* @__PURE__ */
|
|
1612
|
-
e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */
|
|
2094
|
+
/* @__PURE__ */ n("div", { className: "flex-1 overflow-y-auto px-3 pt-6 pb-16 sm:px-6 sm:pt-10", ref: h, children: /* @__PURE__ */ l("div", { className: "mx-auto max-w-[1080px]", children: [
|
|
2095
|
+
e.diagnostics && e.diagnostics.length > 0 && /* @__PURE__ */ n("div", { className: "border-red bg-red/10 mb-6 border-l-2 px-4 py-3 text-[0.8125rem] whitespace-pre-wrap", children: e.diagnostics.join(`
|
|
1613
2096
|
`) }),
|
|
1614
|
-
|
|
1615
|
-
/* @__PURE__ */
|
|
1616
|
-
/* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
|
|
2097
|
+
m.map((b) => /* @__PURE__ */ l("section", { className: "mt-10 first:mt-0", children: [
|
|
2098
|
+
/* @__PURE__ */ l("div", { className: "mb-4 flex items-center gap-2", children: [
|
|
2099
|
+
/* @__PURE__ */ n("span", { className: "text-[1.0625rem] font-medium", children: b.label }),
|
|
2100
|
+
/* @__PURE__ */ n("span", { className: "text-[0.8125rem] text-cream/55 tabular-nums", children: b.surfaces.length }),
|
|
2101
|
+
b.all.length > 1 && /* @__PURE__ */ n(
|
|
1619
2102
|
"input",
|
|
1620
2103
|
{
|
|
1621
2104
|
className: "sw-input ml-auto w-48",
|
|
1622
2105
|
type: "search",
|
|
1623
|
-
value:
|
|
1624
|
-
placeholder: `Search ${
|
|
1625
|
-
"aria-label": `Search ${
|
|
1626
|
-
onChange: (
|
|
2106
|
+
value: p[b.kind] ?? "",
|
|
2107
|
+
placeholder: `Search ${b.label.toLowerCase()}`,
|
|
2108
|
+
"aria-label": `Search ${b.label.toLowerCase()}`,
|
|
2109
|
+
onChange: (u) => c((v) => ({ ...v, [b.kind]: u.target.value }))
|
|
1627
2110
|
}
|
|
1628
2111
|
)
|
|
1629
2112
|
] }),
|
|
1630
|
-
/* @__PURE__ */
|
|
1631
|
-
|
|
2113
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-[repeat(auto-fill,minmax(200px,1fr))] sm:gap-6", children: b.surfaces.map((u) => /* @__PURE__ */ n(
|
|
2114
|
+
_a,
|
|
1632
2115
|
{
|
|
1633
|
-
surface:
|
|
1634
|
-
status:
|
|
1635
|
-
previewSrc: e.previewUrl(
|
|
1636
|
-
|
|
1637
|
-
|
|
2116
|
+
surface: u,
|
|
2117
|
+
status: s[O(u)],
|
|
2118
|
+
previewSrc: e.previewUrl(u),
|
|
2119
|
+
hostState: ht({
|
|
2120
|
+
surface: u,
|
|
2121
|
+
defaults: o,
|
|
2122
|
+
sourceSamples: e.samples,
|
|
2123
|
+
samples: {},
|
|
2124
|
+
theme: "light",
|
|
2125
|
+
edited: {}
|
|
2126
|
+
}),
|
|
2127
|
+
onOpen: () => t(u),
|
|
2128
|
+
href: a ? O(u) : void 0
|
|
1638
2129
|
},
|
|
1639
|
-
|
|
2130
|
+
O(u)
|
|
1640
2131
|
)) }),
|
|
1641
|
-
|
|
1642
|
-
] },
|
|
1643
|
-
e.surfaces.length === 0 && /* @__PURE__ */
|
|
2132
|
+
b.surfaces.length === 0 && /* @__PURE__ */ n("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(p[b.kind] ?? "").trim()}”.` })
|
|
2133
|
+
] }, b.kind)),
|
|
2134
|
+
e.surfaces.length === 0 && /* @__PURE__ */ l("div", { className: "border border-dashed border-cream/20 p-12 text-center text-cream/55", children: [
|
|
1644
2135
|
"No paywalls yet — create",
|
|
1645
2136
|
" ",
|
|
1646
|
-
/* @__PURE__ */
|
|
2137
|
+
/* @__PURE__ */ n("code", { className: "font-mono text-[0.8125rem] text-cream", children: "superwall/paywalls/<id>/app/page.tsx" }),
|
|
1647
2138
|
" ",
|
|
1648
2139
|
"and it appears here."
|
|
1649
2140
|
] })
|
|
1650
2141
|
] }) }),
|
|
1651
|
-
!
|
|
2142
|
+
!a && /* @__PURE__ */ n("footer", { className: "bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55", children: "Previews run against a real SDK host — you choose the outcomes. Edit files under superwall/ and they update live." })
|
|
1652
2143
|
] });
|
|
1653
|
-
},
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
2144
|
+
}, Ia = (e, t) => {
|
|
2145
|
+
const a = t.match(/^\/(?:([a-z0-9-]+)\/)?(paywall|funnel)\/([a-z0-9-]+)\/?$/);
|
|
2146
|
+
if (a)
|
|
1656
2147
|
return e.find(
|
|
1657
|
-
(
|
|
2148
|
+
(r) => r.kind === a[2] && r.id === a[3] && (a[1] === void 0 || r.project === a[1])
|
|
1658
2149
|
);
|
|
1659
|
-
},
|
|
2150
|
+
}, Ta = ({
|
|
1660
2151
|
source: e,
|
|
1661
|
-
|
|
1662
|
-
openPreview: s = (a) => window.location.assign(a)
|
|
2152
|
+
mode: t = "local"
|
|
1663
2153
|
}) => {
|
|
1664
|
-
const [a, r] = d.useState(() => window.location.pathname), [
|
|
2154
|
+
const [a, r] = d.useState(() => window.location.pathname), [s, i] = d.useState({});
|
|
1665
2155
|
d.useEffect(() => {
|
|
1666
|
-
const
|
|
1667
|
-
return window.addEventListener("popstate",
|
|
2156
|
+
const m = () => r(window.location.pathname);
|
|
2157
|
+
return window.addEventListener("popstate", m), () => window.removeEventListener("popstate", m);
|
|
1668
2158
|
}, []), d.useEffect(() => {
|
|
1669
2159
|
if (e.capabilities?.actions !== !0) return;
|
|
1670
|
-
let
|
|
1671
|
-
return
|
|
1672
|
-
|
|
2160
|
+
let m = !1;
|
|
2161
|
+
return pa().then((b) => {
|
|
2162
|
+
m || i(b);
|
|
1673
2163
|
}), () => {
|
|
1674
|
-
|
|
2164
|
+
m = !0;
|
|
1675
2165
|
};
|
|
1676
2166
|
}, [e.capabilities?.actions]);
|
|
1677
|
-
const
|
|
1678
|
-
window.history.pushState(null, "",
|
|
1679
|
-
},
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
) : /* @__PURE__ */ t(
|
|
1689
|
-
dn,
|
|
1690
|
-
{
|
|
1691
|
-
source: e,
|
|
1692
|
-
device: n,
|
|
1693
|
-
onOpen: (l) => n ? s(He(l)) : f($(l))
|
|
1694
|
-
}
|
|
1695
|
-
) });
|
|
1696
|
-
}, hn = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((n) => typeof n == "string"), B = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), mn = (e) => {
|
|
1697
|
-
if (!B(e)) return;
|
|
1698
|
-
const n = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
|
|
1699
|
-
if (!(!n || typeof e.id != "string"))
|
|
2167
|
+
const o = t === "device" ? "/device" : "/", p = d.useCallback((m) => {
|
|
2168
|
+
window.history.pushState(null, "", m), r(m);
|
|
2169
|
+
}, []), c = d.useMemo(
|
|
2170
|
+
() => ({ href: o, navigate: () => p(o) }),
|
|
2171
|
+
[o, p]
|
|
2172
|
+
), h = Ia(e.surfaces, a);
|
|
2173
|
+
return /* @__PURE__ */ n(na, { mode: t, home: c, children: /* @__PURE__ */ n(It, { children: h ? /* @__PURE__ */ n(ba, { source: e, surface: h, samples: s }) : /* @__PURE__ */ n(ka, { source: e, onOpen: (m) => p(O(m)) }) }) });
|
|
2174
|
+
}, Ea = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((t) => typeof t == "string"), j = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Y = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Pa = (e) => {
|
|
2175
|
+
if (!j(e)) return;
|
|
2176
|
+
const t = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
|
|
2177
|
+
if (!(!t || typeof e.id != "string"))
|
|
1700
2178
|
return {
|
|
1701
|
-
kind:
|
|
2179
|
+
kind: t,
|
|
1702
2180
|
id: e.id,
|
|
1703
2181
|
...typeof e.project == "string" ? { project: e.project } : {},
|
|
1704
2182
|
routes: Y(e.routes) ? e.routes : [],
|
|
1705
|
-
products:
|
|
2183
|
+
products: Ea(e.products) ? e.products : {},
|
|
1706
2184
|
locales: Y(e.locales) ? e.locales : [],
|
|
1707
2185
|
...Y(e.platforms) ? { platforms: e.platforms } : {},
|
|
1708
2186
|
paywallId: typeof e.paywallId == "string" ? e.paywallId : void 0
|
|
1709
2187
|
};
|
|
1710
|
-
},
|
|
1711
|
-
if (!
|
|
2188
|
+
}, Ra = (e) => {
|
|
2189
|
+
if (!j(e))
|
|
1712
2190
|
throw new Error("project payload is not an object");
|
|
1713
|
-
const
|
|
2191
|
+
const t = Array.isArray(e.surfaces) ? e.surfaces.map(Pa).filter((i) => i !== void 0) : [], a = j(e.capabilities) ? e.capabilities : {}, r = j(e.samples) ? e.samples : {}, s = (i) => j(r[i]) ? r[i] : {};
|
|
1714
2192
|
return {
|
|
1715
2193
|
title: typeof e.title == "string" ? e.title : "superwall",
|
|
1716
2194
|
scheme: typeof e.scheme == "string" ? e.scheme : void 0,
|
|
1717
|
-
surfaces:
|
|
2195
|
+
surfaces: t,
|
|
1718
2196
|
diagnostics: Y(e.diagnostics) ? e.diagnostics : [],
|
|
1719
2197
|
samples: {
|
|
1720
|
-
device:
|
|
1721
|
-
user:
|
|
1722
|
-
params:
|
|
2198
|
+
device: s("device"),
|
|
2199
|
+
user: s("user"),
|
|
2200
|
+
params: s("params")
|
|
1723
2201
|
},
|
|
1724
|
-
capabilities: { actions:
|
|
2202
|
+
capabilities: { actions: a.actions === !0 }
|
|
1725
2203
|
};
|
|
1726
2204
|
};
|
|
1727
2205
|
export {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
2206
|
+
ut as DEFAULT_DEVICE_ID,
|
|
2207
|
+
Mn as DeviceFrame,
|
|
2208
|
+
ot as HostedIframe,
|
|
2209
|
+
Zn as PaywallToasts,
|
|
2210
|
+
X as STUDIO_DEVICES,
|
|
2211
|
+
Qn as Segmented,
|
|
2212
|
+
Fe as Select,
|
|
2213
|
+
Ta as StudioApp,
|
|
2214
|
+
na as StudioHostProvider,
|
|
2215
|
+
It as StudioShell,
|
|
2216
|
+
ba as SurfaceEditor,
|
|
2217
|
+
ka as SurfaceList,
|
|
2218
|
+
Xn as Switch,
|
|
2219
|
+
pt as TopBar,
|
|
2220
|
+
ca as VariablesPanel,
|
|
2221
|
+
Ma as buildPreviewPath,
|
|
2222
|
+
Ge as createHostState,
|
|
2223
|
+
Gn as createStudioDelegate,
|
|
2224
|
+
ha as deviceById,
|
|
2225
|
+
Pt as diffHostState,
|
|
2226
|
+
ft as hasActions,
|
|
2227
|
+
F as hasIntroductoryOffer,
|
|
2228
|
+
ht as hostStateFor,
|
|
2229
|
+
ke as hostedUrl,
|
|
2230
|
+
Ra as parseProjectPayload,
|
|
2231
|
+
Ht as silentDelegate,
|
|
2232
|
+
$a as snapshotPreviewUrl,
|
|
2233
|
+
mt as studioDefaults,
|
|
2234
|
+
O as surfacePath,
|
|
2235
|
+
Yn as useStudioDelegate,
|
|
2236
|
+
ra as useStudioHome,
|
|
2237
|
+
aa as useStudioMode
|
|
1746
2238
|
};
|