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