@superwall/studio 1.5.0 → 1.6.1
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/dist/assets/index-CTn2zVi-.js +11 -0
- package/dist/index.html +1 -1
- package/dist/lib/index.js +498 -499
- package/package.json +2 -2
- package/src/components/preview/Canvas.tsx +9 -13
- package/dist/assets/index-Bi2YHYVJ.js +0 -11
package/dist/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as r, jsxs as b, Fragment as
|
|
1
|
+
import { jsx as r, jsxs as b, Fragment as ne } from "react/jsx-runtime";
|
|
2
2
|
import * as m from "react";
|
|
3
|
-
import
|
|
4
|
-
import { toast as pe, Toaster as
|
|
3
|
+
import F from "react";
|
|
4
|
+
import { toast as pe, Toaster as Ln } from "sonner";
|
|
5
5
|
const Tn = ({
|
|
6
6
|
children: e,
|
|
7
7
|
position: t = "fixed"
|
|
@@ -11,7 +11,7 @@ const Tn = ({
|
|
|
11
11
|
className: `sw-studio bg-ink text-cream ${t} inset-0 flex flex-col font-sans text-[0.9375rem] tracking-[-0.01em] antialiased`,
|
|
12
12
|
children: e
|
|
13
13
|
}
|
|
14
|
-
), Dn = { experimentId: "0", variantId: "0", campaignId: "0" }, me = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)),
|
|
14
|
+
), Dn = { experimentId: "0", variantId: "0", campaignId: "0" }, me = (e) => Object.fromEntries(Object.entries(e).filter(([, t]) => t !== void 0)), Bt = (e = {}) => ({
|
|
15
15
|
paywallId: e.paywallId ?? "0",
|
|
16
16
|
paywallIdentifier: e.paywallIdentifier ?? "paywall",
|
|
17
17
|
device: me(e.device ?? {}),
|
|
@@ -20,7 +20,7 @@ const Tn = ({
|
|
|
20
20
|
products: e.products ?? [],
|
|
21
21
|
experiment: e.experiment ?? Dn,
|
|
22
22
|
...e.introductoryOfferEligible === void 0 ? {} : { introductoryOfferEligible: e.introductoryOfferEligible }
|
|
23
|
-
}),
|
|
23
|
+
}), ut = (e, t) => {
|
|
24
24
|
const n = {
|
|
25
25
|
...e,
|
|
26
26
|
paywallId: t.paywallId ?? e.paywallId,
|
|
@@ -32,23 +32,23 @@ const Tn = ({
|
|
|
32
32
|
experiment: t.experiment ?? e.experiment
|
|
33
33
|
};
|
|
34
34
|
return "introductoryOfferEligible" in t && (t.introductoryOfferEligible === void 0 ? delete n.introductoryOfferEligible : n.introductoryOfferEligible = t.introductoryOfferEligible), n;
|
|
35
|
-
},
|
|
35
|
+
}, qe = (e, t) => JSON.stringify(e) === JSON.stringify(t), ze = (e, t) => {
|
|
36
36
|
const n = {};
|
|
37
37
|
let s = !1;
|
|
38
38
|
for (const a of /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]))
|
|
39
|
-
a in t ?
|
|
39
|
+
a in t ? qe(e[a], t[a]) || (n[a] = t[a], s = !0) : (n[a] = void 0, s = !0);
|
|
40
40
|
return s ? n : void 0;
|
|
41
41
|
}, $n = (e, t) => {
|
|
42
|
-
const n = {}, s =
|
|
42
|
+
const n = {}, s = ze(e.device, t.device);
|
|
43
43
|
s && (n.device = s);
|
|
44
|
-
const a =
|
|
44
|
+
const a = ze(e.user, t.user);
|
|
45
45
|
a && (n.user = a);
|
|
46
|
-
const d =
|
|
47
|
-
return d && (n.params = d),
|
|
48
|
-
},
|
|
46
|
+
const d = ze(e.params, t.params);
|
|
47
|
+
return d && (n.params = d), qe(e.products, t.products) || (n.products = t.products), e.introductoryOfferEligible !== t.introductoryOfferEligible && (n.introductoryOfferEligible = t.introductoryOfferEligible), e.paywallId !== t.paywallId && (n.paywallId = t.paywallId), e.paywallIdentifier !== t.paywallIdentifier && (n.paywallIdentifier = t.paywallIdentifier), qe(e.experiment, t.experiment) || (n.experiment = t.experiment), n;
|
|
48
|
+
}, Ht = (e) => {
|
|
49
49
|
const t = e.variables.trialPeriodDays, n = typeof t == "number" ? t : typeof t == "string" ? Number(t) : 0;
|
|
50
50
|
return Number.isFinite(n) ? n : 0;
|
|
51
|
-
},
|
|
51
|
+
}, ve = (e) => e.introductoryOfferEligible ?? e.products.some((t) => Ht(t) > 0), jt = (e) => ({
|
|
52
52
|
event_name: "template_variables",
|
|
53
53
|
variables: {
|
|
54
54
|
device: e.device,
|
|
@@ -56,20 +56,20 @@ const Tn = ({
|
|
|
56
56
|
params: e.params,
|
|
57
57
|
...e.products.length > 0 ? { products: e.products.map((t) => ({ [t.reference]: t.variables })) } : {}
|
|
58
58
|
}
|
|
59
|
-
}),
|
|
59
|
+
}), Vt = (e) => ({
|
|
60
60
|
event_name: "experiment",
|
|
61
61
|
experimentId: e.experiment.experimentId,
|
|
62
62
|
variantId: e.experiment.variantId,
|
|
63
63
|
campaignId: e.experiment.campaignId
|
|
64
|
-
}),
|
|
64
|
+
}), Wt = (e) => ({
|
|
65
65
|
event_name: "products",
|
|
66
66
|
products: e.products.map((t) => ({
|
|
67
67
|
product: t.reference,
|
|
68
68
|
productId: t.productId
|
|
69
69
|
}))
|
|
70
|
-
}),
|
|
70
|
+
}), Yt = (e) => ({
|
|
71
71
|
event_name: "template_substitutions_prefix",
|
|
72
|
-
prefix:
|
|
72
|
+
prefix: ve(e) ? "freeTrial" : "default"
|
|
73
73
|
}), Fn = (e) => ({
|
|
74
74
|
event_name: "paywall_open",
|
|
75
75
|
paywall_id: e.paywallId,
|
|
@@ -79,10 +79,10 @@ const Tn = ({
|
|
|
79
79
|
paywall_id: e.paywallId,
|
|
80
80
|
paywall_identifier: e.paywallIdentifier
|
|
81
81
|
}), zn = (e) => [
|
|
82
|
-
Ht(e),
|
|
83
82
|
jt(e),
|
|
84
83
|
Vt(e),
|
|
85
84
|
Wt(e),
|
|
85
|
+
Yt(e),
|
|
86
86
|
Fn(e)
|
|
87
87
|
], Le = (e) => ({
|
|
88
88
|
product: e.reference,
|
|
@@ -96,7 +96,7 @@ const Tn = ({
|
|
|
96
96
|
}), jn = (e) => ({
|
|
97
97
|
event_name: "transaction_abandon",
|
|
98
98
|
...Le(e)
|
|
99
|
-
}),
|
|
99
|
+
}), ht = (e) => ({
|
|
100
100
|
event_name: "transaction_fail",
|
|
101
101
|
...Le(e)
|
|
102
102
|
}), Vn = () => ({
|
|
@@ -107,7 +107,7 @@ const Tn = ({
|
|
|
107
107
|
trial_end_date: t
|
|
108
108
|
}), Yn = () => ({ event_name: "restore_start" }), Kn = () => ({
|
|
109
109
|
event_name: "restore_complete"
|
|
110
|
-
}),
|
|
110
|
+
}), pt = () => ({ event_name: "restore_fail" }), Qn = (e) => ({
|
|
111
111
|
event_name: "permission_result",
|
|
112
112
|
permission_type: e.permissionType,
|
|
113
113
|
request_id: e.requestId,
|
|
@@ -133,9 +133,9 @@ const Tn = ({
|
|
|
133
133
|
},
|
|
134
134
|
permission: () => "granted",
|
|
135
135
|
callback: () => ({ status: "success" })
|
|
136
|
-
}), qn = 1440 * 60 * 1e3,
|
|
136
|
+
}), qn = 1440 * 60 * 1e3, Te = (e, t, n) => {
|
|
137
137
|
new Promise((s) => s(e())).then(t, n);
|
|
138
|
-
},
|
|
138
|
+
}, De = (e, t) => {
|
|
139
139
|
console.error(`[superwall host] ${e}`, t);
|
|
140
140
|
}, Zn = (e, t, n) => e.products.find((s) => s.reference === t) ?? e.products.find((s) => s.productId === n) ?? {
|
|
141
141
|
reference: t,
|
|
@@ -143,27 +143,27 @@ const Tn = ({
|
|
|
143
143
|
variables: {}
|
|
144
144
|
}, Jn = (e, t) => {
|
|
145
145
|
const { delegate: n, send: s, now: a } = e, d = Zn(e.state(), t.product, t.product_identifier);
|
|
146
|
-
s([Bn(d)]),
|
|
146
|
+
s([Bn(d)]), Te(
|
|
147
147
|
() => n.purchase(d),
|
|
148
148
|
(h) => {
|
|
149
149
|
if (h === "completed") {
|
|
150
|
-
const p =
|
|
151
|
-
|
|
152
|
-
} else s(h === "abandoned" ? [jn(d)] : [
|
|
150
|
+
const p = Ht(d), o = [Hn(d)];
|
|
151
|
+
ve(e.state()) && p > 0 && o.push(Wn(d, a() + p * qn)), s(o);
|
|
152
|
+
} else s(h === "abandoned" ? [jn(d)] : [ht(d)]);
|
|
153
153
|
},
|
|
154
154
|
(h) => {
|
|
155
|
-
|
|
155
|
+
De("purchase delegate threw", h), s([ht(d)]);
|
|
156
156
|
}
|
|
157
157
|
);
|
|
158
158
|
}, er = (e) => {
|
|
159
159
|
const { delegate: t, send: n } = e;
|
|
160
|
-
n([Yn()]),
|
|
160
|
+
n([Yn()]), Te(
|
|
161
161
|
() => t.restore(),
|
|
162
162
|
(s) => {
|
|
163
|
-
n(s === "restored" ? [Vn(), Kn()] : [
|
|
163
|
+
n(s === "restored" ? [Vn(), Kn()] : [pt()]);
|
|
164
164
|
},
|
|
165
165
|
(s) => {
|
|
166
|
-
|
|
166
|
+
De("restore delegate threw", s), n([pt()]);
|
|
167
167
|
}
|
|
168
168
|
);
|
|
169
169
|
}, tr = (e, t) => {
|
|
@@ -174,11 +174,11 @@ const Tn = ({
|
|
|
174
174
|
status: d
|
|
175
175
|
})
|
|
176
176
|
]);
|
|
177
|
-
|
|
177
|
+
Te(
|
|
178
178
|
() => n.permission(t.permission_type),
|
|
179
179
|
a,
|
|
180
180
|
(d) => {
|
|
181
|
-
|
|
181
|
+
De("permission delegate threw", d), a("denied");
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
}, nr = (e, t) => {
|
|
@@ -190,20 +190,20 @@ const Tn = ({
|
|
|
190
190
|
...d.data === void 0 ? {} : { data: d.data }
|
|
191
191
|
})
|
|
192
192
|
]);
|
|
193
|
-
|
|
193
|
+
Te(
|
|
194
194
|
() => n.callback(t.name, t.variables ?? {}),
|
|
195
195
|
a,
|
|
196
196
|
(d) => {
|
|
197
|
-
|
|
197
|
+
De("callback delegate threw", d), a({ status: "failure" });
|
|
198
198
|
}
|
|
199
199
|
);
|
|
200
|
-
},
|
|
200
|
+
}, mt = (e) => JSON.stringify([
|
|
201
201
|
e.device,
|
|
202
202
|
e.user,
|
|
203
203
|
e.params,
|
|
204
204
|
e.products.map((t) => [t.reference, t.variables])
|
|
205
|
-
]),
|
|
206
|
-
let t =
|
|
205
|
+
]), ft = (e) => JSON.stringify(e.products.map((t) => [t.reference, t.productId])), gt = (e) => JSON.stringify(e.experiment), rr = (e) => {
|
|
206
|
+
let t = Bt(e.state);
|
|
207
207
|
const { delegate: n, send: s } = e, a = {
|
|
208
208
|
state: () => t,
|
|
209
209
|
delegate: n,
|
|
@@ -242,7 +242,7 @@ const Tn = ({
|
|
|
242
242
|
n.customPlacement(o.name, o.params);
|
|
243
243
|
return;
|
|
244
244
|
case "user_attribute_updated":
|
|
245
|
-
t =
|
|
245
|
+
t = ut(t, {
|
|
246
246
|
user: Object.fromEntries(o.attributes.map((l) => [l.key, l.value]))
|
|
247
247
|
});
|
|
248
248
|
return;
|
|
@@ -266,9 +266,9 @@ const Tn = ({
|
|
|
266
266
|
},
|
|
267
267
|
update: (o) => {
|
|
268
268
|
const l = t;
|
|
269
|
-
t =
|
|
269
|
+
t = ut(t, o);
|
|
270
270
|
const i = [];
|
|
271
|
-
|
|
271
|
+
mt(l) !== mt(t) && i.push(jt(t)), gt(l) !== gt(t) && i.push(Vt(t)), ft(l) !== ft(t) && i.push(Wt(t)), ve(l) !== ve(t) && i.push(Yt(t)), i.length > 0 && s(i);
|
|
272
272
|
},
|
|
273
273
|
send: s
|
|
274
274
|
};
|
|
@@ -276,6 +276,7 @@ const Tn = ({
|
|
|
276
276
|
WebKit: "#9C27B0",
|
|
277
277
|
Android: "#4CAF50",
|
|
278
278
|
Editor: "#2196F3",
|
|
279
|
+
Web: "#00BCD4",
|
|
279
280
|
Transport: "#FF9800"
|
|
280
281
|
}, ir = (e) => {
|
|
281
282
|
const t = or[e], n = (s, a, ...d) => {
|
|
@@ -302,7 +303,7 @@ const Tn = ({
|
|
|
302
303
|
error: (s, ...a) => n("error", s, ...a)
|
|
303
304
|
};
|
|
304
305
|
};
|
|
305
|
-
var
|
|
306
|
+
var st = /* @__PURE__ */ ((e) => (e.ToPaywall = "to_paywall", e.FromPaywall = "from_paywall", e.ToPaywallUi = "to_paywall_ui", e.FromPaywallUi = "from_paywall_ui", e))(st || {});
|
|
306
307
|
const ar = (e, t) => {
|
|
307
308
|
const n = {
|
|
308
309
|
direction: t,
|
|
@@ -322,18 +323,18 @@ const ar = (e, t) => {
|
|
|
322
323
|
return cr.error("Failed to parse incoming message", { message: e, error: s }), [];
|
|
323
324
|
}
|
|
324
325
|
}, ur = (e) => (t) => {
|
|
325
|
-
e.postMessage(ar([...t],
|
|
326
|
+
e.postMessage(ar([...t], st.ToPaywall), "*");
|
|
326
327
|
}, hr = (e, t, n = {}) => {
|
|
327
328
|
const s = n.listen ?? window, a = (d) => {
|
|
328
329
|
if (d.source !== t || typeof d.data != "string") return;
|
|
329
|
-
const h = dr(d.data,
|
|
330
|
+
const h = dr(d.data, st.FromPaywall);
|
|
330
331
|
h.length > 0 && e.receive(h);
|
|
331
332
|
};
|
|
332
333
|
return s.addEventListener("message", a), () => s.removeEventListener("message", a);
|
|
333
334
|
}, pr = (e) => {
|
|
334
335
|
const { target: t, listen: n, ...s } = e, a = rr({ ...s, send: ur(t) }), d = hr(a, t, n ? { listen: n } : {});
|
|
335
336
|
return { host: a, detach: d };
|
|
336
|
-
},
|
|
337
|
+
}, Be = 1440 * 60 * 1e3, He = 60 * 1e3, Kt = -18e3, Ze = {
|
|
337
338
|
publicApiKey: "pk_3f9c2a71e4b8d05c6a1f7e9b2d4c8a6e0f5b3d7c9a1e4f68",
|
|
338
339
|
platform: "iOS",
|
|
339
340
|
appUserId: "44dd573cd1e849a6997a5eaf98298e47",
|
|
@@ -346,7 +347,7 @@ const ar = (e, t) => {
|
|
|
346
347
|
deviceLanguageCode: "en",
|
|
347
348
|
deviceCurrencyCode: "USD",
|
|
348
349
|
deviceCurrencySymbol: "$",
|
|
349
|
-
timezoneOffset:
|
|
350
|
+
timezoneOffset: Kt,
|
|
350
351
|
radioType: "Wifi",
|
|
351
352
|
interfaceStyle: "Dark",
|
|
352
353
|
isLowPowerModeEnabled: 0,
|
|
@@ -354,17 +355,17 @@ const ar = (e, t) => {
|
|
|
354
355
|
isMac: 0,
|
|
355
356
|
totalPaywallViews: 0,
|
|
356
357
|
interfaceType: "iphone"
|
|
357
|
-
},
|
|
358
|
-
const t = `${e.getUTCFullYear()}-${
|
|
358
|
+
}, we = (e) => String(e).padStart(2, "0"), wt = (e) => {
|
|
359
|
+
const t = `${e.getUTCFullYear()}-${we(e.getUTCMonth() + 1)}-${we(e.getUTCDate())}`, n = `${we(e.getUTCHours())}:${we(e.getUTCMinutes())}:${we(e.getUTCSeconds())}`;
|
|
359
360
|
return { date: t, time: n, dateTime: `${t}T${n}` };
|
|
360
|
-
}, mr = (e, t =
|
|
361
|
-
const n = e - 5 *
|
|
361
|
+
}, mr = (e, t = Kt) => {
|
|
362
|
+
const n = e - 5 * Be, s = e - 360 * He, a = wt(new Date(e)), d = wt(new Date(e + t * 1e3));
|
|
362
363
|
return {
|
|
363
|
-
daysSinceInstall: Math.floor((e - n) /
|
|
364
|
-
minutesSinceInstall: Math.floor((e - n) /
|
|
364
|
+
daysSinceInstall: Math.floor((e - n) / Be),
|
|
365
|
+
minutesSinceInstall: Math.floor((e - n) / He),
|
|
365
366
|
appInstallDate: new Date(n).toISOString(),
|
|
366
|
-
daysSinceLastPaywallView: Math.floor((e - s) /
|
|
367
|
-
minutesSinceLastPaywallView: Math.floor((e - s) /
|
|
367
|
+
daysSinceLastPaywallView: Math.floor((e - s) / Be),
|
|
368
|
+
minutesSinceLastPaywallView: Math.floor((e - s) / He),
|
|
368
369
|
utcDate: a.date,
|
|
369
370
|
localDate: d.date,
|
|
370
371
|
utcTime: a.time,
|
|
@@ -373,10 +374,10 @@ const ar = (e, t) => {
|
|
|
373
374
|
localDateTime: d.dateTime
|
|
374
375
|
};
|
|
375
376
|
}, fr = (e = Date.now()) => ({
|
|
376
|
-
...
|
|
377
|
-
...mr(e,
|
|
377
|
+
...Ze,
|
|
378
|
+
...mr(e, Ze.timezoneOffset)
|
|
378
379
|
}), gr = {
|
|
379
|
-
appUserId:
|
|
380
|
+
appUserId: Ze.appUserId,
|
|
380
381
|
email: "preview@example.com",
|
|
381
382
|
firstName: "John",
|
|
382
383
|
lastName: "Doe",
|
|
@@ -387,10 +388,10 @@ const ar = (e, t) => {
|
|
|
387
388
|
event_name: "campaign_trigger",
|
|
388
389
|
$is_standard_event: !1,
|
|
389
390
|
$is_feature_gatable: !1
|
|
390
|
-
}, U = ({ children: e }) => /* @__PURE__ */ r("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }),
|
|
391
|
+
}, U = ({ children: e }) => /* @__PURE__ */ r("svg", { className: "sw-icon", viewBox: "0 0 24 24", "aria-hidden": "true", children: e }), Qt = () => /* @__PURE__ */ b(U, { children: [
|
|
391
392
|
/* @__PURE__ */ r("path", { d: "M21 12a9 9 0 1 1-2.64-6.36" }),
|
|
392
393
|
/* @__PURE__ */ r("path", { d: "M21 3v6h-6" })
|
|
393
|
-
] }),
|
|
394
|
+
] }), Me = () => /* @__PURE__ */ b(U, { children: [
|
|
394
395
|
/* @__PURE__ */ r("path", { d: "M15 3h6v6" }),
|
|
395
396
|
/* @__PURE__ */ r("path", { d: "M10 14 21 3" }),
|
|
396
397
|
/* @__PURE__ */ r("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
|
|
@@ -400,21 +401,21 @@ const ar = (e, t) => {
|
|
|
400
401
|
] }), yr = () => /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) }), xr = () => /* @__PURE__ */ b(U, { children: [
|
|
401
402
|
/* @__PURE__ */ r("path", { d: "M21 4h-7M10 4H3M21 12h-9M8 12H3M21 20h-5M12 20H3" }),
|
|
402
403
|
/* @__PURE__ */ r("path", { d: "M14 2v4M8 10v4M16 18v4" })
|
|
403
|
-
] }),
|
|
404
|
+
] }), Gt = () => /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r("path", { d: "M18 6 6 18M6 6l12 12" }) }), Xt = () => /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r("path", { d: "m6 9 6 6 6-6" }) }), Er = () => /* @__PURE__ */ b(U, { children: [
|
|
404
405
|
/* @__PURE__ */ r("rect", { x: "3", y: "4", width: "18", height: "16" }),
|
|
405
406
|
/* @__PURE__ */ r("path", { d: "M12 4v16" })
|
|
406
|
-
] }),
|
|
407
|
+
] }), Ie = () => /* @__PURE__ */ b(U, { children: [
|
|
407
408
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "9" }),
|
|
408
409
|
/* @__PURE__ */ r("path", { d: "m8.5 12 2.5 2.5 4.5-5" })
|
|
409
|
-
] }),
|
|
410
|
+
] }), _e = () => /* @__PURE__ */ b(U, { children: [
|
|
410
411
|
/* @__PURE__ */ r("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" }),
|
|
411
412
|
/* @__PURE__ */ r("path", { d: "M12 9v4" }),
|
|
412
413
|
/* @__PURE__ */ r("path", { d: "M12 17h.01" })
|
|
413
|
-
] }),
|
|
414
|
+
] }), qt = () => /* @__PURE__ */ b(U, { children: [
|
|
414
415
|
/* @__PURE__ */ r("circle", { cx: "12", cy: "12", r: "9" }),
|
|
415
416
|
/* @__PURE__ */ r("path", { d: "M12 11v5" }),
|
|
416
417
|
/* @__PURE__ */ r("path", { d: "M12 8h.01" })
|
|
417
|
-
] }),
|
|
418
|
+
] }), Ne = () => /* @__PURE__ */ r(U, { children: /* @__PURE__ */ r("path", { d: "M13 2 4.5 13H11l-1 9 8.5-11H12l1-9Z" }) }), je = () => /* @__PURE__ */ b(U, { children: [
|
|
418
419
|
/* @__PURE__ */ r("circle", { cx: "9", cy: "20", r: "1" }),
|
|
419
420
|
/* @__PURE__ */ r("circle", { cx: "18", cy: "20", r: "1" }),
|
|
420
421
|
/* @__PURE__ */ r("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" })
|
|
@@ -428,7 +429,7 @@ const ar = (e, t) => {
|
|
|
428
429
|
/* @__PURE__ */ r("rect", { x: "4", y: "2", width: "10", height: "16", rx: "2" }),
|
|
429
430
|
/* @__PURE__ */ r("path", { d: "M17 12a5 5 0 0 1-5 9H9" }),
|
|
430
431
|
/* @__PURE__ */ r("path", { d: "m11 19-2 2 2 2" })
|
|
431
|
-
] }),
|
|
432
|
+
] }), Re = {
|
|
432
433
|
push: ["link", "build", "assets", "push", "source"],
|
|
433
434
|
publish: ["link", "build", "assets", "push", "source", "promote"],
|
|
434
435
|
promote: ["link", "promote"]
|
|
@@ -439,19 +440,19 @@ const ar = (e, t) => {
|
|
|
439
440
|
push: "Push version",
|
|
440
441
|
source: "Push source",
|
|
441
442
|
promote: "Promote to live"
|
|
442
|
-
},
|
|
443
|
+
}, Zt = [
|
|
443
444
|
{ name: "push", label: "Push", hint: "New version, nothing live changes" },
|
|
444
445
|
{ name: "promote", label: "Promote", hint: "Make the latest push live" },
|
|
445
446
|
{ name: "publish", label: "Publish", hint: "Push and make it live" }
|
|
446
|
-
],
|
|
447
|
+
], Je = (e) => Zt.find((t) => t.name === e)?.label ?? e, Jt = {
|
|
447
448
|
push: "Pushing…",
|
|
448
449
|
publish: "Publishing…",
|
|
449
450
|
promote: "Promoting…"
|
|
450
451
|
}, _r = ({ state: e }) => e === "active" ? /* @__PURE__ */ r("span", { className: "bg-accent h-2 w-2 rounded-full animate-pulse" }) : e === "done" ? /* @__PURE__ */ r("span", { className: "bg-accent h-2 w-2 rounded-full" }) : e === "failed" ? /* @__PURE__ */ r("span", { className: "bg-red h-2 w-2 rounded-full" }) : /* @__PURE__ */ r("span", { className: "bg-cream/55 h-2 w-2 rounded-full" }), kr = ({ progress: e }) => {
|
|
451
|
-
const t =
|
|
452
|
+
const t = Re[e.action], n = t.filter((a) => e.steps[a] === "done").length, s = e.error !== void 0;
|
|
452
453
|
return /* @__PURE__ */ b("div", { className: "w-64", children: [
|
|
453
454
|
/* @__PURE__ */ b("div", { className: "border-b border-cream/10 px-3 py-2.5", children: [
|
|
454
|
-
/* @__PURE__ */ r("div", { className: "text-[0.8125rem] font-medium", children: s ? `${
|
|
455
|
+
/* @__PURE__ */ r("div", { className: "text-[0.8125rem] font-medium", children: s ? `${Je(e.action)} failed` : n === t.length ? `${Je(e.action)} complete` : Jt[e.action] }),
|
|
455
456
|
/* @__PURE__ */ r("div", { className: "mt-2 h-0.5 w-full bg-cream/10", children: /* @__PURE__ */ r(
|
|
456
457
|
"div",
|
|
457
458
|
{
|
|
@@ -488,7 +489,7 @@ const ar = (e, t) => {
|
|
|
488
489
|
onRun: n,
|
|
489
490
|
onBlocked: s
|
|
490
491
|
}) => {
|
|
491
|
-
const [a, d] = m.useState("push"), [h, p] = m.useState(!1), o = m.useRef(null), l = t !== void 0, i = e !== void 0 && e.error === void 0 &&
|
|
492
|
+
const [a, d] = m.useState("push"), [h, p] = m.useState(!1), o = m.useRef(null), l = t !== void 0, i = e !== void 0 && e.error === void 0 && Re[e.action].some((u) => e.steps[u] !== "done"), c = e !== void 0;
|
|
492
493
|
return m.useEffect(() => {
|
|
493
494
|
if (!h) return;
|
|
494
495
|
const u = (g) => {
|
|
@@ -504,7 +505,7 @@ const ar = (e, t) => {
|
|
|
504
505
|
disabled: i,
|
|
505
506
|
title: t,
|
|
506
507
|
onClick: () => l ? s?.() : n(a),
|
|
507
|
-
children: i ?
|
|
508
|
+
children: i ? Jt[e.action] : Je(a)
|
|
508
509
|
}
|
|
509
510
|
),
|
|
510
511
|
/* @__PURE__ */ r(
|
|
@@ -517,10 +518,10 @@ const ar = (e, t) => {
|
|
|
517
518
|
title: t,
|
|
518
519
|
disabled: i,
|
|
519
520
|
onClick: () => p((u) => !u),
|
|
520
|
-
children: /* @__PURE__ */ r(
|
|
521
|
+
children: /* @__PURE__ */ r(Xt, {})
|
|
521
522
|
}
|
|
522
523
|
),
|
|
523
|
-
(c || h) && /* @__PURE__ */ r("div", { className: "bg-bar absolute top-full right-0 z-20 mt-[calc(0.5rem+2px)] overflow-hidden rounded border border-cream/20", children: c ? /* @__PURE__ */ r(kr, { progress: e }) : /* @__PURE__ */ r("div", { className: "w-64", children:
|
|
524
|
+
(c || h) && /* @__PURE__ */ r("div", { className: "bg-bar absolute top-full right-0 z-20 mt-[calc(0.5rem+2px)] overflow-hidden rounded border border-cream/20", children: c ? /* @__PURE__ */ r(kr, { progress: e }) : /* @__PURE__ */ r("div", { className: "w-64", children: Zt.map((u) => /* @__PURE__ */ b(
|
|
524
525
|
"button",
|
|
525
526
|
{
|
|
526
527
|
type: "button",
|
|
@@ -536,7 +537,7 @@ const ar = (e, t) => {
|
|
|
536
537
|
u.name
|
|
537
538
|
)) }) })
|
|
538
539
|
] });
|
|
539
|
-
},
|
|
540
|
+
}, bt = ({
|
|
540
541
|
label: e,
|
|
541
542
|
hint: t,
|
|
542
543
|
selected: n,
|
|
@@ -556,7 +557,7 @@ const ar = (e, t) => {
|
|
|
556
557
|
/* @__PURE__ */ r("span", { className: "max-w-full truncate text-xs text-cream/55", children: t })
|
|
557
558
|
]
|
|
558
559
|
}
|
|
559
|
-
),
|
|
560
|
+
), Ve = ({ children: e }) => /* @__PURE__ */ r("span", { className: "block px-3 pt-2 pb-1 text-[0.6875rem] tracking-wide text-cream/45 uppercase", children: e }), Rr = ({
|
|
560
561
|
active: e,
|
|
561
562
|
options: t,
|
|
562
563
|
notice: n,
|
|
@@ -575,7 +576,7 @@ const ar = (e, t) => {
|
|
|
575
576
|
const l = e && (e.type === "version" ? `version:${e.version}` : e.type === "origin" ? "origin" : `surface:${e.surface.kind}/${e.surface.id}`), i = (E) => {
|
|
576
577
|
d(!1), s(E);
|
|
577
578
|
}, c = h.trim().toLowerCase(), u = (E) => c === "" || `${E.label} ${E.hint}`.toLowerCase().includes(c), g = t.filter((E) => E.target.type === "origin").filter(u), f = t.filter((E) => E.target.type === "version").filter(u), v = t.filter((E) => E.target.type === "surface").filter(u), w = [g, f, v].filter((E) => E.length > 0).length > 1, C = (E) => E.map((x) => /* @__PURE__ */ r(
|
|
578
|
-
|
|
579
|
+
bt,
|
|
579
580
|
{
|
|
580
581
|
label: x.label,
|
|
581
582
|
hint: x.hint,
|
|
@@ -611,18 +612,18 @@ const ar = (e, t) => {
|
|
|
611
612
|
onChange: (E) => p(E.target.value)
|
|
612
613
|
}
|
|
613
614
|
) }),
|
|
614
|
-
/* @__PURE__ */ r("div", { className: "max-h-64 overflow-y-auto", children: g.length + f.length + v.length === 0 ? /* @__PURE__ */ r("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: c === "" ? "No pushed versions or other paywalls here." : `Nothing matches “${h.trim()}”.` }) : /* @__PURE__ */ b(
|
|
615
|
-
w && g.length > 0 && /* @__PURE__ */ r(
|
|
615
|
+
/* @__PURE__ */ r("div", { className: "max-h-64 overflow-y-auto", children: g.length + f.length + v.length === 0 ? /* @__PURE__ */ r("span", { className: "block px-3 pt-2 pb-4 text-[0.8125rem] text-cream/45", children: c === "" ? "No pushed versions or other paywalls here." : `Nothing matches “${h.trim()}”.` }) : /* @__PURE__ */ b(ne, { children: [
|
|
616
|
+
w && g.length > 0 && /* @__PURE__ */ r(Ve, { children: "Rebuilt from" }),
|
|
616
617
|
C(g),
|
|
617
|
-
w && f.length > 0 && /* @__PURE__ */ r(
|
|
618
|
+
w && f.length > 0 && /* @__PURE__ */ r(Ve, { children: "Versions" }),
|
|
618
619
|
C(f),
|
|
619
|
-
w && v.length > 0 && /* @__PURE__ */ r(
|
|
620
|
+
w && v.length > 0 && /* @__PURE__ */ r(Ve, { children: "Paywalls" }),
|
|
620
621
|
C(v)
|
|
621
622
|
] }) }),
|
|
622
623
|
/* @__PURE__ */ b("div", { className: "flex flex-col border-t border-cream/10", children: [
|
|
623
624
|
n && /* @__PURE__ */ r("span", { className: "block px-3 pt-2 text-xs text-cream/55", role: "status", children: n }),
|
|
624
625
|
/* @__PURE__ */ r(
|
|
625
|
-
|
|
626
|
+
bt,
|
|
626
627
|
{
|
|
627
628
|
label: "Off",
|
|
628
629
|
hint: "A single preview",
|
|
@@ -633,23 +634,23 @@ const ar = (e, t) => {
|
|
|
633
634
|
] })
|
|
634
635
|
] })
|
|
635
636
|
] });
|
|
636
|
-
}, Or = 0.1,
|
|
637
|
+
}, Or = 0.1, Ar = 4, ue = { top: 48, right: 48, bottom: 48, left: 48 }, vt = 1.25, ot = (e) => Math.min(Ar, Math.max(Or, e)), Lr = (e, t) => {
|
|
637
638
|
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
638
639
|
return { scale: 1, x: 0, y: 0 };
|
|
639
|
-
const n =
|
|
640
|
-
return
|
|
641
|
-
},
|
|
640
|
+
const n = en(t), s = ot(Math.min(1, n.width / e.width, n.height / e.height));
|
|
641
|
+
return tn(s, e, t);
|
|
642
|
+
}, en = (e) => ({
|
|
642
643
|
width: e.width - ue.left - ue.right,
|
|
643
644
|
height: e.height - ue.top - ue.bottom
|
|
644
|
-
}),
|
|
645
|
-
const s =
|
|
645
|
+
}), tn = (e, t, n) => {
|
|
646
|
+
const s = en(n);
|
|
646
647
|
return {
|
|
647
648
|
scale: e,
|
|
648
649
|
x: ue.left + (s.width - t.width * e) / 2,
|
|
649
650
|
y: ue.top + (s.height - t.height * e) / 2
|
|
650
651
|
};
|
|
651
|
-
},
|
|
652
|
-
const s =
|
|
652
|
+
}, We = (e, t, n) => {
|
|
653
|
+
const s = ot(e.scale * t), a = s / e.scale;
|
|
653
654
|
return {
|
|
654
655
|
scale: s,
|
|
655
656
|
x: n.x - (n.x - e.x) * a,
|
|
@@ -659,19 +660,19 @@ const ar = (e, t) => {
|
|
|
659
660
|
...e,
|
|
660
661
|
x: e.x + t,
|
|
661
662
|
y: e.y + n
|
|
662
|
-
}), Tr = (e, t) =>
|
|
663
|
-
|
|
664
|
-
Math.max(
|
|
665
|
-
),
|
|
663
|
+
}), Tr = (e, t) => ot(Math.round((t === 1 ? e * vt : e / vt) * 100) / 100), Dr = (e) => `${Math.round(e * 100)}%`, $r = 0.01, yt = { min: 0.6, max: 1.6 }, Fr = 4, Ur = "data-studio-grab", nn = m.createContext(1), zr = () => m.useContext(nn), Ye = (e, t) => Math.hypot(e.x - t.x, e.y - t.y), xt = (e, t) => ({ x: (e.x + t.x) / 2, y: (e.y + t.y) / 2 }), Br = (e) => Math.min(
|
|
664
|
+
yt.max,
|
|
665
|
+
Math.max(yt.min, Math.exp(-e * $r))
|
|
666
|
+
), Et = (e) => e.ctrlKey || e.metaKey, Hr = (e) => {
|
|
666
667
|
e.preventDefault(), e.stopPropagation();
|
|
667
|
-
},
|
|
668
|
+
}, rn = (e) => e instanceof HTMLElement && (e.isContentEditable || /^(input|textarea|select)$/i.test(e.tagName)), jr = (e) => {
|
|
668
669
|
try {
|
|
669
670
|
return e.contentDocument ? e.contentWindow : null;
|
|
670
671
|
} catch {
|
|
671
672
|
return null;
|
|
672
673
|
}
|
|
673
|
-
}, Vr = (e) => typeof e == "object" && e !== null && e.nodeType === 1,
|
|
674
|
-
const n =
|
|
674
|
+
}, Vr = (e) => typeof e == "object" && e !== null && e.nodeType === 1, St = (e, t) => e.ownerDocument.defaultView?.getComputedStyle(e)[t] || ("style" in e ? e.style[t] : ""), Wr = (e, t) => {
|
|
675
|
+
const n = St(e, t === "y" ? "overflowY" : "overflowX"), s = St(e, t === "y" ? "overscrollBehaviorY" : "overscrollBehaviorX");
|
|
675
676
|
return /(contain|none)/.test(s) ? !0 : (t === "y" ? e.scrollHeight - e.clientHeight : e.scrollWidth - e.clientWidth) > 0 ? /(auto|scroll|hidden|clip)/.test(n) || e === e.ownerDocument.scrollingElement : !1;
|
|
676
677
|
}, Yr = (e) => {
|
|
677
678
|
if (e.defaultPrevented) return !0;
|
|
@@ -679,7 +680,7 @@ const ar = (e, t) => {
|
|
|
679
680
|
for (let n = Vr(e.target) ? e.target : null; n; n = n.parentElement)
|
|
680
681
|
if (Wr(n, t)) return !0;
|
|
681
682
|
return !1;
|
|
682
|
-
},
|
|
683
|
+
}, Nt = (e) => {
|
|
683
684
|
const [t, n] = m.useState({ width: 0, height: 0 });
|
|
684
685
|
return m.useLayoutEffect(() => {
|
|
685
686
|
if (!e) return;
|
|
@@ -695,7 +696,7 @@ const ar = (e, t) => {
|
|
|
695
696
|
const [e, t] = m.useState(!1);
|
|
696
697
|
return m.useEffect(() => {
|
|
697
698
|
const n = (d) => {
|
|
698
|
-
d.code !== "Space" || d.repeat ||
|
|
699
|
+
d.code !== "Space" || d.repeat || rn(d.target) || (d.preventDefault(), t(!0));
|
|
699
700
|
}, s = (d) => {
|
|
700
701
|
d.code === "Space" && t(!1);
|
|
701
702
|
}, a = () => t(!1);
|
|
@@ -709,9 +710,9 @@ const ar = (e, t) => {
|
|
|
709
710
|
onZoom: n,
|
|
710
711
|
children: s
|
|
711
712
|
}) => {
|
|
712
|
-
const [a, d] = m.useState(null), [h, p] = m.useState(null), [o, l] = m.useState({ kind: "fit" }), [i, c] = m.useState(!1), u =
|
|
713
|
+
const [a, d] = m.useState(null), [h, p] = m.useState(null), [o, l] = m.useState({ kind: "fit" }), [i, c] = m.useState(!1), u = Nt(a), g = Nt(h), f = Qr(), v = o.kind === "fit" ? Lr(g, u) : o.transform, w = Kr(v), C = m.useRef(/* @__PURE__ */ new Map()), E = m.useRef(null), x = m.useRef(e), S = m.useCallback((N) => {
|
|
713
714
|
l({ kind: "manual", transform: N });
|
|
714
|
-
}, []), _ = m.useCallback(() => l({ kind: "fit" }), []),
|
|
715
|
+
}, []), _ = m.useCallback(() => l({ kind: "fit" }), []), A = m.useCallback(
|
|
715
716
|
(N, M) => {
|
|
716
717
|
const k = a?.getBoundingClientRect();
|
|
717
718
|
return { x: N - (k?.left ?? 0), y: M - (k?.top ?? 0) };
|
|
@@ -719,26 +720,26 @@ const ar = (e, t) => {
|
|
|
719
720
|
[a]
|
|
720
721
|
), D = m.useCallback(
|
|
721
722
|
(N, M) => {
|
|
722
|
-
N.preventDefault(), S(
|
|
723
|
+
N.preventDefault(), S(We(w.current, Br(N.deltaY), M));
|
|
723
724
|
},
|
|
724
725
|
[S, w]
|
|
725
726
|
), Y = m.useCallback(
|
|
726
727
|
(N) => {
|
|
727
728
|
const M = { x: u.width / 2, y: u.height / 2 }, k = Tr(w.current.scale, N);
|
|
728
|
-
S(
|
|
729
|
+
S(We(w.current, k / w.current.scale, M));
|
|
729
730
|
},
|
|
730
731
|
[S, w, u]
|
|
731
732
|
), Q = m.useCallback(() => {
|
|
732
|
-
S(
|
|
733
|
-
}, [S, g, u]),
|
|
733
|
+
S(tn(1, g, u));
|
|
734
|
+
}, [S, g, u]), ee = m.useCallback(() => S(w.current), [S, w]), z = m.useCallback(
|
|
734
735
|
(N, M) => S(ce(w.current, N, M)),
|
|
735
736
|
[S, w]
|
|
736
737
|
);
|
|
737
|
-
m.useImperativeHandle(t, () => ({ zoomStep: Y, actualSize: Q, fit: _, hold:
|
|
738
|
+
m.useImperativeHandle(t, () => ({ zoomStep: Y, actualSize: Q, fit: _, hold: ee, pan: z }), [
|
|
738
739
|
Y,
|
|
739
740
|
Q,
|
|
740
741
|
_,
|
|
741
|
-
|
|
742
|
+
ee,
|
|
742
743
|
z
|
|
743
744
|
]), m.useEffect(() => {
|
|
744
745
|
n?.({ scale: v.scale, fitted: o.kind === "fit" });
|
|
@@ -747,59 +748,57 @@ const ar = (e, t) => {
|
|
|
747
748
|
}, [e, _]), m.useEffect(() => {
|
|
748
749
|
if (!a) return;
|
|
749
750
|
const N = (M) => {
|
|
750
|
-
if (
|
|
751
|
-
D(M,
|
|
751
|
+
if (Et(M)) {
|
|
752
|
+
D(M, A(M.clientX, M.clientY));
|
|
752
753
|
return;
|
|
753
754
|
}
|
|
754
755
|
M.preventDefault(), S(ce(w.current, -M.deltaX, -M.deltaY));
|
|
755
756
|
};
|
|
756
757
|
return a.addEventListener("wheel", N, { passive: !1 }), () => a.removeEventListener("wheel", N);
|
|
757
|
-
}, [a, S, w,
|
|
758
|
+
}, [a, S, w, A, D]), m.useEffect(() => {
|
|
758
759
|
if (!h) return;
|
|
759
760
|
const N = /* @__PURE__ */ new Map(), M = (P) => {
|
|
760
761
|
N.get(P)?.(), N.delete(P);
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
const
|
|
762
|
+
const $ = jr(P);
|
|
763
|
+
if (!$) return;
|
|
764
|
+
const H = new AbortController(), { signal: j } = H, oe = (O) => {
|
|
765
|
+
if (Et(O)) {
|
|
766
|
+
const V = P.getBoundingClientRect(), ge = w.current.scale;
|
|
766
767
|
D(
|
|
767
|
-
|
|
768
|
-
|
|
768
|
+
O,
|
|
769
|
+
A(V.left + O.clientX * ge, V.top + O.clientY * ge)
|
|
769
770
|
);
|
|
770
771
|
return;
|
|
771
772
|
}
|
|
772
|
-
Yr(
|
|
773
|
+
Yr(O) || (O.preventDefault(), S(ce(w.current, -O.deltaX, -O.deltaY)));
|
|
773
774
|
};
|
|
774
|
-
let
|
|
775
|
-
const
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
},
|
|
779
|
-
|
|
780
|
-
},
|
|
781
|
-
if (!
|
|
782
|
-
const
|
|
783
|
-
if (!
|
|
784
|
-
if (
|
|
785
|
-
|
|
775
|
+
let R = null, se = null;
|
|
776
|
+
const le = (O) => {
|
|
777
|
+
const V = P.contentDocument;
|
|
778
|
+
V && (se?.remove(), se = null, O && (se = V.createElement("style"), se.setAttribute(Ur, ""), se.textContent = "*, *::before, *::after { cursor: grabbing !important; }", (V.head ?? V.documentElement).appendChild(se)));
|
|
779
|
+
}, xe = (O) => {
|
|
780
|
+
O.pointerType !== "mouse" || O.button !== 1 || (O.preventDefault(), R = { at: { x: O.screenX, y: O.screenY }, panning: !1 });
|
|
781
|
+
}, $e = (O) => {
|
|
782
|
+
if (!R) return;
|
|
783
|
+
const V = { x: O.screenX, y: O.screenY };
|
|
784
|
+
if (!R.panning) {
|
|
785
|
+
if (Ye(R.at, V) < Fr) return;
|
|
786
|
+
R.panning = !0, c(!0), le(!0);
|
|
786
787
|
}
|
|
787
|
-
|
|
788
|
-
},
|
|
789
|
-
|
|
788
|
+
O.preventDefault(), S(ce(w.current, V.x - R.at.x, V.y - R.at.y)), R.at = V;
|
|
789
|
+
}, fe = () => {
|
|
790
|
+
R?.panning && (c(!1), le(!1), $.addEventListener("click", Hr, { capture: !0, once: !0, signal: j })), R = null;
|
|
790
791
|
};
|
|
791
|
-
|
|
792
|
-
R.removeEventListener("wheel", V), R.removeEventListener("pointerdown", ye), R.removeEventListener("pointermove", le), R.removeEventListener("pointerup", oe), R.removeEventListener("pointercancel", oe);
|
|
793
|
-
});
|
|
792
|
+
$.addEventListener("wheel", oe, { passive: !1, signal: j }), $.addEventListener("pointerdown", xe, { signal: j }), $.addEventListener("pointermove", $e, { signal: j }), $.addEventListener("pointerup", fe, { signal: j }), $.addEventListener("pointercancel", fe, { signal: j }), N.set(P, () => H.abort());
|
|
794
793
|
}, k = (P) => {
|
|
795
794
|
P.target instanceof HTMLIFrameElement && M(P.target);
|
|
796
795
|
};
|
|
797
796
|
return h.querySelectorAll("iframe").forEach(M), h.addEventListener("load", k, !0), () => {
|
|
798
797
|
h.removeEventListener("load", k, !0), N.forEach((P) => P());
|
|
799
798
|
};
|
|
800
|
-
}, [h, S, w,
|
|
799
|
+
}, [h, S, w, A, D]), m.useEffect(() => {
|
|
801
800
|
const N = (M) => {
|
|
802
|
-
if (!(!(M.metaKey || M.ctrlKey) ||
|
|
801
|
+
if (!(!(M.metaKey || M.ctrlKey) || rn(M.target))) {
|
|
803
802
|
if (M.key === "=" || M.key === "+") Y(1);
|
|
804
803
|
else if (M.key === "-") Y(-1);
|
|
805
804
|
else if (M.key === "0") _();
|
|
@@ -810,7 +809,7 @@ const ar = (e, t) => {
|
|
|
810
809
|
};
|
|
811
810
|
return window.addEventListener("keydown", N), () => window.removeEventListener("keydown", N);
|
|
812
811
|
}, [Y, _, Q]);
|
|
813
|
-
const
|
|
812
|
+
const te = (N) => {
|
|
814
813
|
if (!(N.pointerType === "mouse" && N.button !== 0 && N.button !== 1)) {
|
|
815
814
|
N.button === 1 && N.preventDefault();
|
|
816
815
|
try {
|
|
@@ -820,30 +819,30 @@ const ar = (e, t) => {
|
|
|
820
819
|
}
|
|
821
820
|
if (C.current.set(N.pointerId, { x: N.clientX, y: N.clientY }), c(!0), C.current.size === 2) {
|
|
822
821
|
const [M, k] = [...C.current.values()];
|
|
823
|
-
E.current = { span:
|
|
822
|
+
E.current = { span: Ye(M, k), midpoint: xt(M, k) };
|
|
824
823
|
}
|
|
825
824
|
}
|
|
826
|
-
},
|
|
825
|
+
}, re = (N) => {
|
|
827
826
|
const M = C.current.get(N.pointerId);
|
|
828
827
|
if (!M) return;
|
|
829
828
|
const k = { x: N.clientX, y: N.clientY };
|
|
830
829
|
if (C.current.set(N.pointerId, k), C.current.size >= 2 && E.current) {
|
|
831
|
-
const [P,
|
|
830
|
+
const [P, $] = [...C.current.values()], H = { span: Ye(P, $), midpoint: xt(P, $) }, j = We(
|
|
832
831
|
w.current,
|
|
833
|
-
|
|
834
|
-
|
|
832
|
+
H.span / E.current.span,
|
|
833
|
+
A(E.current.midpoint.x, E.current.midpoint.y)
|
|
835
834
|
);
|
|
836
835
|
S(
|
|
837
836
|
ce(
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
837
|
+
j,
|
|
838
|
+
H.midpoint.x - E.current.midpoint.x,
|
|
839
|
+
H.midpoint.y - E.current.midpoint.y
|
|
841
840
|
)
|
|
842
|
-
), E.current =
|
|
841
|
+
), E.current = H;
|
|
843
842
|
return;
|
|
844
843
|
}
|
|
845
844
|
S(ce(w.current, k.x - M.x, k.y - M.y));
|
|
846
|
-
},
|
|
845
|
+
}, B = (N) => {
|
|
847
846
|
C.current.delete(N.pointerId), C.current.size < 2 && (E.current = null), C.current.size === 0 && c(!1);
|
|
848
847
|
};
|
|
849
848
|
return /* @__PURE__ */ r(
|
|
@@ -854,10 +853,10 @@ const ar = (e, t) => {
|
|
|
854
853
|
"data-panning": f || void 0,
|
|
855
854
|
"data-dragging": i || void 0,
|
|
856
855
|
ref: d,
|
|
857
|
-
onPointerDown:
|
|
858
|
-
onPointerMove:
|
|
859
|
-
onPointerUp:
|
|
860
|
-
onPointerCancel:
|
|
856
|
+
onPointerDown: te,
|
|
857
|
+
onPointerMove: re,
|
|
858
|
+
onPointerUp: B,
|
|
859
|
+
onPointerCancel: B,
|
|
861
860
|
onContextMenu: (N) => {
|
|
862
861
|
i && N.preventDefault();
|
|
863
862
|
},
|
|
@@ -870,7 +869,7 @@ const ar = (e, t) => {
|
|
|
870
869
|
style: {
|
|
871
870
|
transform: `translate(${v.x}px, ${v.y}px) scale(${v.scale})`
|
|
872
871
|
},
|
|
873
|
-
children: /* @__PURE__ */ r(
|
|
872
|
+
children: /* @__PURE__ */ r(nn.Provider, { value: v.scale, children: s })
|
|
874
873
|
}
|
|
875
874
|
)
|
|
876
875
|
}
|
|
@@ -993,7 +992,7 @@ const ar = (e, t) => {
|
|
|
993
992
|
const d = n.current;
|
|
994
993
|
d && (d.host.update($n(d.sent, e)), d.sent = e);
|
|
995
994
|
}, [e, t]), a;
|
|
996
|
-
},
|
|
995
|
+
}, sn = ({ hostState: e, delegate: t, ...n }) => /* @__PURE__ */ r("iframe", { ...n, ref: es(e, t) }), ts = 15, ns = 70, Ct = { width: 80, height: 60 }, rs = 600, ss = (e, t) => {
|
|
997
996
|
const n = 0.1 * (e / t) + 0.035;
|
|
998
997
|
return Math.round((100 - n * 100) * 10) / 10;
|
|
999
998
|
}, os = (e, t) => {
|
|
@@ -1026,8 +1025,8 @@ const ar = (e, t) => {
|
|
|
1026
1025
|
return d(e.height ?? ns, !1);
|
|
1027
1026
|
case "popup":
|
|
1028
1027
|
return a(
|
|
1029
|
-
e.width ??
|
|
1030
|
-
e.height ??
|
|
1028
|
+
e.width ?? Ct.width,
|
|
1029
|
+
e.height ?? Ct.height
|
|
1031
1030
|
);
|
|
1032
1031
|
default:
|
|
1033
1032
|
return;
|
|
@@ -1082,11 +1081,11 @@ const ar = (e, t) => {
|
|
|
1082
1081
|
}
|
|
1083
1082
|
c.current += 1;
|
|
1084
1083
|
const _ = { src: s, generation: c.current, ready: !1 };
|
|
1085
|
-
g((
|
|
1084
|
+
g((A) => [...A.filter((D) => D.ready).slice(-1), _]);
|
|
1086
1085
|
}, [s, h]);
|
|
1087
1086
|
const v = (_) => {
|
|
1088
1087
|
window.setTimeout(() => {
|
|
1089
|
-
g((
|
|
1088
|
+
g((A) => A.some((D) => D.generation === _) ? A.map((D) => D.generation === _ ? { ...D, ready: !0 } : D).filter((D) => D.generation >= _) : A);
|
|
1090
1089
|
}, cs);
|
|
1091
1090
|
}, w = u.findLast((_) => _.ready), C = os(o, { width: e, height: t }), E = l ? 0 : p?.navigationBarHeight ?? 0, x = C ?? {
|
|
1092
1091
|
x: 0,
|
|
@@ -1139,7 +1138,7 @@ const ar = (e, t) => {
|
|
|
1139
1138
|
boxShadow: C ? "0 0 40px rgba(0,0,0,0.25)" : void 0
|
|
1140
1139
|
},
|
|
1141
1140
|
children: u.map((_) => /* @__PURE__ */ r(
|
|
1142
|
-
|
|
1141
|
+
sn,
|
|
1143
1142
|
{
|
|
1144
1143
|
hostState: a,
|
|
1145
1144
|
delegate: d,
|
|
@@ -1288,7 +1287,7 @@ const ar = (e, t) => {
|
|
|
1288
1287
|
}, i = (c) => {
|
|
1289
1288
|
h.current?.pointerId === c.pointerId && (c.stopPropagation(), p());
|
|
1290
1289
|
};
|
|
1291
|
-
return /* @__PURE__ */ r(
|
|
1290
|
+
return /* @__PURE__ */ r(ne, { children: hs.map((c) => /* @__PURE__ */ r(
|
|
1292
1291
|
"div",
|
|
1293
1292
|
{
|
|
1294
1293
|
role: "separator",
|
|
@@ -1373,49 +1372,49 @@ const ar = (e, t) => {
|
|
|
1373
1372
|
success: "text-accent",
|
|
1374
1373
|
warning: "text-red"
|
|
1375
1374
|
}, Es = {
|
|
1376
|
-
purchase:
|
|
1377
|
-
transaction_complete:
|
|
1378
|
-
freeTrial_start:
|
|
1379
|
-
transaction_abandon:
|
|
1380
|
-
transaction_fail:
|
|
1381
|
-
close:
|
|
1382
|
-
restore:
|
|
1383
|
-
restore_complete:
|
|
1384
|
-
restore_fail:
|
|
1385
|
-
open_url:
|
|
1386
|
-
open_url_external:
|
|
1387
|
-
open_deep_link:
|
|
1388
|
-
initiate_web_checkout:
|
|
1389
|
-
open_payment_sheet:
|
|
1390
|
-
custom_placement:
|
|
1391
|
-
custom:
|
|
1392
|
-
request_permission:
|
|
1393
|
-
request_callback:
|
|
1375
|
+
purchase: je,
|
|
1376
|
+
transaction_complete: Ie,
|
|
1377
|
+
freeTrial_start: Ie,
|
|
1378
|
+
transaction_abandon: _e,
|
|
1379
|
+
transaction_fail: _e,
|
|
1380
|
+
close: Gt,
|
|
1381
|
+
restore: Qt,
|
|
1382
|
+
restore_complete: Ie,
|
|
1383
|
+
restore_fail: _e,
|
|
1384
|
+
open_url: Me,
|
|
1385
|
+
open_url_external: Me,
|
|
1386
|
+
open_deep_link: Me,
|
|
1387
|
+
initiate_web_checkout: je,
|
|
1388
|
+
open_payment_sheet: je,
|
|
1389
|
+
custom_placement: Ne,
|
|
1390
|
+
custom: Ne,
|
|
1391
|
+
request_permission: Ne,
|
|
1392
|
+
request_callback: Ne,
|
|
1394
1393
|
schedule_notification: Sr,
|
|
1395
1394
|
request_store_review: Nr,
|
|
1396
1395
|
user_attribute_updated: Cr
|
|
1397
|
-
},
|
|
1396
|
+
}, ye = ({ children: e }) => /* @__PURE__ */ r("span", { className: "bg-accent/15 text-accent px-1.5 py-px font-mono text-xs break-all", children: e }), it = ({
|
|
1398
1397
|
action: e,
|
|
1399
1398
|
tone: t,
|
|
1400
1399
|
children: n,
|
|
1401
1400
|
actions: s
|
|
1402
1401
|
}) => {
|
|
1403
|
-
const a = Es[e] ??
|
|
1402
|
+
const a = Es[e] ?? qt;
|
|
1404
1403
|
return /* @__PURE__ */ r("div", { className: "bg-panel font-sans w-[344px] max-w-[calc(100vw-32px)] rounded border border-cream/15 p-3", children: /* @__PURE__ */ b("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
|
|
1405
1404
|
/* @__PURE__ */ r("span", { className: `flex h-5 items-center justify-center ${xs[t]}`, children: /* @__PURE__ */ r(a, {}) }),
|
|
1406
1405
|
/* @__PURE__ */ r("span", { className: "min-w-0 text-[0.8125rem] leading-5 font-medium break-words text-cream", children: n }),
|
|
1407
1406
|
s && /* @__PURE__ */ r("div", { className: "col-start-2 mt-2.5 flex justify-end gap-2", children: s })
|
|
1408
1407
|
] }) });
|
|
1409
|
-
}, Ss = ({ notice: e }) => /* @__PURE__ */ b(
|
|
1408
|
+
}, Ss = ({ notice: e }) => /* @__PURE__ */ b(it, { action: e.action, tone: e.tone, children: [
|
|
1410
1409
|
"Tap triggered a ",
|
|
1411
|
-
/* @__PURE__ */ r(
|
|
1412
|
-
e.subject ? /* @__PURE__ */ b(
|
|
1410
|
+
/* @__PURE__ */ r(ye, { children: e.action }),
|
|
1411
|
+
e.subject ? /* @__PURE__ */ b(ne, { children: [
|
|
1413
1412
|
" for ",
|
|
1414
|
-
/* @__PURE__ */ r(
|
|
1413
|
+
/* @__PURE__ */ r(ye, { children: e.subject })
|
|
1415
1414
|
] }) : " action",
|
|
1416
1415
|
"."
|
|
1417
|
-
] }), Ns = ({ choice: e, subject: t }) => /* @__PURE__ */ b(
|
|
1418
|
-
/* @__PURE__ */ r(
|
|
1416
|
+
] }), Ns = ({ choice: e, subject: t }) => /* @__PURE__ */ b(it, { action: e.action, tone: e.tone, children: [
|
|
1417
|
+
/* @__PURE__ */ r(ye, { children: t }),
|
|
1419
1418
|
" ",
|
|
1420
1419
|
e.done
|
|
1421
1420
|
] }), Cs = ({
|
|
@@ -1425,7 +1424,7 @@ const ar = (e, t) => {
|
|
|
1425
1424
|
choices: s,
|
|
1426
1425
|
onAnswer: a
|
|
1427
1426
|
}) => /* @__PURE__ */ b(
|
|
1428
|
-
|
|
1427
|
+
it,
|
|
1429
1428
|
{
|
|
1430
1429
|
action: e,
|
|
1431
1430
|
tone: "info",
|
|
@@ -1441,9 +1440,9 @@ const ar = (e, t) => {
|
|
|
1441
1440
|
)),
|
|
1442
1441
|
children: [
|
|
1443
1442
|
"Tap triggered a ",
|
|
1444
|
-
/* @__PURE__ */ r(
|
|
1443
|
+
/* @__PURE__ */ r(ye, { children: t }),
|
|
1445
1444
|
" for ",
|
|
1446
|
-
/* @__PURE__ */ r(
|
|
1445
|
+
/* @__PURE__ */ r(ye, { children: n }),
|
|
1447
1446
|
"."
|
|
1448
1447
|
]
|
|
1449
1448
|
}
|
|
@@ -1514,7 +1513,7 @@ const ar = (e, t) => {
|
|
|
1514
1513
|
}
|
|
1515
1514
|
];
|
|
1516
1515
|
let Ps = 0;
|
|
1517
|
-
const
|
|
1516
|
+
const Ce = (e, t, n, s) => new Promise((a) => {
|
|
1518
1517
|
const d = `${e}-${Ps += 1}`;
|
|
1519
1518
|
pe.custom(
|
|
1520
1519
|
() => /* @__PURE__ */ r(
|
|
@@ -1536,8 +1535,8 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1536
1535
|
const t = ys(e);
|
|
1537
1536
|
t && pe.custom(() => /* @__PURE__ */ r(Ss, { notice: t }));
|
|
1538
1537
|
},
|
|
1539
|
-
purchase: (e) =>
|
|
1540
|
-
restore: () =>
|
|
1538
|
+
purchase: (e) => Ce("purchase", "purchase", e.reference, Ms),
|
|
1539
|
+
restore: () => Ce("restore", "restore", "purchases", Is),
|
|
1541
1540
|
close: () => {
|
|
1542
1541
|
},
|
|
1543
1542
|
openUrl: () => {
|
|
@@ -1546,15 +1545,15 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1546
1545
|
},
|
|
1547
1546
|
customPlacement: () => {
|
|
1548
1547
|
},
|
|
1549
|
-
permission: (e) =>
|
|
1550
|
-
callback: (e) =>
|
|
1551
|
-
}), Os = () => m.useMemo(Rs, []),
|
|
1548
|
+
permission: (e) => Ce("request_permission", "permission", e, _s),
|
|
1549
|
+
callback: (e) => Ce("request_callback", "callback", e, ks).then((t) => ({ status: t }))
|
|
1550
|
+
}), Os = () => m.useMemo(Rs, []), As = ({
|
|
1552
1551
|
surfaceKey: e,
|
|
1553
1552
|
raised: t = !1
|
|
1554
1553
|
}) => (m.useEffect(() => {
|
|
1555
1554
|
pe.dismiss();
|
|
1556
1555
|
}, [e]), /* @__PURE__ */ r(
|
|
1557
|
-
|
|
1556
|
+
Ln,
|
|
1558
1557
|
{
|
|
1559
1558
|
position: "top-center",
|
|
1560
1559
|
swipeDirections: ["top"],
|
|
@@ -1564,9 +1563,9 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1564
1563
|
style: { zIndex: 5 },
|
|
1565
1564
|
toastOptions: { unstyled: !0, classNames: { toast: "w-full" } }
|
|
1566
1565
|
}
|
|
1567
|
-
)),
|
|
1566
|
+
)), Ls = ({ hint: e, children: t }) => {
|
|
1568
1567
|
const [n, s] = m.useState(!1);
|
|
1569
|
-
return e === void 0 ? /* @__PURE__ */ r(
|
|
1568
|
+
return e === void 0 ? /* @__PURE__ */ r(ne, { children: t }) : /* @__PURE__ */ b(
|
|
1570
1569
|
"span",
|
|
1571
1570
|
{
|
|
1572
1571
|
className: "relative inline-flex",
|
|
@@ -1587,7 +1586,7 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1587
1586
|
]
|
|
1588
1587
|
}
|
|
1589
1588
|
);
|
|
1590
|
-
},
|
|
1589
|
+
}, Z = (e) => `${e.project ? `/${e.project}` : ""}/${e.kind}/${e.id}`, at = (e) => /[?&]transport=editor(?:&|$)/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}transport=editor`, Ts = (e) => `/__studio/original${Z(e)}`, Bo = (e) => at(`/preview${Z(e)}`), Ho = (e) => (t) => at(e(t)), Ds = async (e, t, n) => {
|
|
1591
1590
|
try {
|
|
1592
1591
|
const s = await fetch("/__studio/action", {
|
|
1593
1592
|
method: "POST",
|
|
@@ -1621,14 +1620,14 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1621
1620
|
} catch (s) {
|
|
1622
1621
|
return { ok: !1, error: s instanceof Error ? s.message : String(s) };
|
|
1623
1622
|
}
|
|
1624
|
-
},
|
|
1623
|
+
}, et = async (e) => {
|
|
1625
1624
|
try {
|
|
1626
|
-
return await (await fetch(`/__studio/status${
|
|
1625
|
+
return await (await fetch(`/__studio/status${Z(e)}`)).json();
|
|
1627
1626
|
} catch (t) {
|
|
1628
1627
|
return { unreachable: t instanceof Error ? t.message : String(t) };
|
|
1629
1628
|
}
|
|
1630
1629
|
}, $s = async (e) => {
|
|
1631
|
-
const n = await (await fetch(`/__studio/screenshot${
|
|
1630
|
+
const n = await (await fetch(`/__studio/screenshot${Z(e)}`)).json();
|
|
1632
1631
|
if (n.unreachable !== void 0) throw new Error(n.unreachable);
|
|
1633
1632
|
return n.url;
|
|
1634
1633
|
}, Fs = async () => {
|
|
@@ -1643,17 +1642,17 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1643
1642
|
success: "text-accent",
|
|
1644
1643
|
warning: "text-red"
|
|
1645
1644
|
}, zs = {
|
|
1646
|
-
info:
|
|
1647
|
-
success:
|
|
1648
|
-
warning:
|
|
1649
|
-
},
|
|
1645
|
+
info: qt,
|
|
1646
|
+
success: Ie,
|
|
1647
|
+
warning: _e
|
|
1648
|
+
}, Mt = (e, t = "info") => {
|
|
1650
1649
|
const n = zs[t];
|
|
1651
1650
|
pe.custom(() => /* @__PURE__ */ r("div", { className: "bg-panel font-sans w-[344px] rounded border border-cream/15 p-3", children: /* @__PURE__ */ b("div", { className: "grid grid-cols-[14px_1fr] items-start gap-x-2.5", children: [
|
|
1652
1651
|
/* @__PURE__ */ r("span", { className: `flex h-5 items-center justify-center ${Us[t]}`, children: /* @__PURE__ */ r(n, {}) }),
|
|
1653
1652
|
/* @__PURE__ */ r("span", { className: "text-[0.8125rem] leading-5 font-medium text-cream", children: e })
|
|
1654
1653
|
] }) }));
|
|
1655
|
-
},
|
|
1656
|
-
const e = m.useContext(
|
|
1654
|
+
}, on = m.createContext(void 0), an = () => {
|
|
1655
|
+
const e = m.useContext(on);
|
|
1657
1656
|
if (!e)
|
|
1658
1657
|
throw new Error("Studio components must be rendered inside <StudioHostProvider>.");
|
|
1659
1658
|
return e;
|
|
@@ -1666,19 +1665,19 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1666
1665
|
() => ({ mode: e, home: { href: s, navigate: a } }),
|
|
1667
1666
|
[e, s, a]
|
|
1668
1667
|
);
|
|
1669
|
-
return /* @__PURE__ */ r(
|
|
1670
|
-
},
|
|
1668
|
+
return /* @__PURE__ */ r(on.Provider, { value: d, children: n });
|
|
1669
|
+
}, lt = () => an().mode, Hs = () => an().home, js = {
|
|
1671
1670
|
checking: "Looking for a screenshot…",
|
|
1672
1671
|
none: "This paywall has no live version yet. Screenshots are captured from the published document, so promote a pushed version before downloading one.",
|
|
1673
1672
|
unreachable: "Couldn't reach the screenshot service."
|
|
1674
|
-
},
|
|
1673
|
+
}, It = (e, t) => {
|
|
1675
1674
|
const n = document.createElement("a");
|
|
1676
1675
|
n.href = e, t === void 0 ? (n.target = "_blank", n.rel = "noreferrer") : n.download = t, n.click();
|
|
1677
1676
|
}, Vs = ({
|
|
1678
1677
|
source: e,
|
|
1679
1678
|
surface: t
|
|
1680
1679
|
}) => {
|
|
1681
|
-
const n =
|
|
1680
|
+
const n = lt() === "hosted", [s, a] = m.useState({ status: "checking" }), [d, h] = m.useState(!1), p = n ? e.screenshotUrl : $s;
|
|
1682
1681
|
m.useEffect(() => {
|
|
1683
1682
|
if (p === void 0) {
|
|
1684
1683
|
a({ status: "none" });
|
|
@@ -1704,16 +1703,16 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1704
1703
|
h(!0);
|
|
1705
1704
|
try {
|
|
1706
1705
|
const c = await fetch(
|
|
1707
|
-
n ? s.url : `/__studio/screenshot${
|
|
1706
|
+
n ? s.url : `/__studio/screenshot${Z(t)}?download=1`
|
|
1708
1707
|
);
|
|
1709
1708
|
if (!c.ok)
|
|
1710
1709
|
throw new Error(
|
|
1711
1710
|
`${n ? "the image host" : "the dev server"} answered ${c.status}`
|
|
1712
1711
|
);
|
|
1713
1712
|
const u = URL.createObjectURL(await c.blob());
|
|
1714
|
-
|
|
1713
|
+
It(u, `${t.id}.png`), URL.revokeObjectURL(u);
|
|
1715
1714
|
} catch (c) {
|
|
1716
|
-
n ? (
|
|
1715
|
+
n ? (It(s.url), Mt("Opened the screenshot in a new tab — save it from there.")) : Mt(
|
|
1717
1716
|
`Couldn't download the screenshot — ${c instanceof Error ? c.message : String(c)}`,
|
|
1718
1717
|
"warning"
|
|
1719
1718
|
);
|
|
@@ -1722,7 +1721,7 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1722
1721
|
}
|
|
1723
1722
|
}
|
|
1724
1723
|
}, l = s.status !== "ready" || d, i = d || s.status === "ready" ? void 0 : s.status === "unreachable" ? s.reason : js[s.status];
|
|
1725
|
-
return /* @__PURE__ */ r(
|
|
1724
|
+
return /* @__PURE__ */ r(Ls, { hint: i, children: /* @__PURE__ */ r(
|
|
1726
1725
|
"button",
|
|
1727
1726
|
{
|
|
1728
1727
|
className: `sw-btn sw-btn--icon${l ? " sw-btn--blocked" : ""}`,
|
|
@@ -1741,20 +1740,20 @@ const Ne = (e, t, n, s) => new Promise((a) => {
|
|
|
1741
1740
|
}
|
|
1742
1741
|
) });
|
|
1743
1742
|
};
|
|
1744
|
-
var Ws = Object.defineProperty,
|
|
1743
|
+
var Ws = Object.defineProperty, Oe = Object.getOwnPropertySymbols, ln = Object.prototype.hasOwnProperty, cn = Object.prototype.propertyIsEnumerable, _t = (e, t, n) => t in e ? Ws(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, tt = (e, t) => {
|
|
1745
1744
|
for (var n in t || (t = {}))
|
|
1746
|
-
|
|
1747
|
-
if (
|
|
1748
|
-
for (var n of
|
|
1749
|
-
|
|
1745
|
+
ln.call(t, n) && _t(e, n, t[n]);
|
|
1746
|
+
if (Oe)
|
|
1747
|
+
for (var n of Oe(t))
|
|
1748
|
+
cn.call(t, n) && _t(e, n, t[n]);
|
|
1750
1749
|
return e;
|
|
1751
|
-
},
|
|
1750
|
+
}, nt = (e, t) => {
|
|
1752
1751
|
var n = {};
|
|
1753
1752
|
for (var s in e)
|
|
1754
|
-
|
|
1755
|
-
if (e != null &&
|
|
1756
|
-
for (var s of
|
|
1757
|
-
t.indexOf(s) < 0 &&
|
|
1753
|
+
ln.call(e, s) && t.indexOf(s) < 0 && (n[s] = e[s]);
|
|
1754
|
+
if (e != null && Oe)
|
|
1755
|
+
for (var s of Oe(e))
|
|
1756
|
+
t.indexOf(s) < 0 && cn.call(e, s) && (n[s] = e[s]);
|
|
1758
1757
|
return n;
|
|
1759
1758
|
};
|
|
1760
1759
|
var ae;
|
|
@@ -1939,8 +1938,8 @@ var ae;
|
|
|
1939
1938
|
for (let x = 0, S = 0; x < c; x++) {
|
|
1940
1939
|
let _ = o.slice(S, S + v - u + (x < f ? 0 : 1));
|
|
1941
1940
|
S += _.length;
|
|
1942
|
-
const
|
|
1943
|
-
x < f && _.push(0), w.push(_.concat(
|
|
1941
|
+
const A = I.reedSolomonComputeRemainder(_, C);
|
|
1942
|
+
x < f && _.push(0), w.push(_.concat(A));
|
|
1944
1943
|
}
|
|
1945
1944
|
let E = [];
|
|
1946
1945
|
for (let x = 0; x < w[0].length; x++)
|
|
@@ -2157,7 +2156,7 @@ var ae;
|
|
|
2157
2156
|
if (!p)
|
|
2158
2157
|
throw new Error("Assertion error");
|
|
2159
2158
|
}
|
|
2160
|
-
const d = class
|
|
2159
|
+
const d = class L {
|
|
2161
2160
|
/*-- Constructor (low level) and fields --*/
|
|
2162
2161
|
// Creates a new QR Code segment with the given attributes and data.
|
|
2163
2162
|
// The character count (numChars) must agree with the mode and the bit buffer length,
|
|
@@ -2175,36 +2174,36 @@ var ae;
|
|
|
2175
2174
|
let l = [];
|
|
2176
2175
|
for (const i of o)
|
|
2177
2176
|
n(i, 8, l);
|
|
2178
|
-
return new
|
|
2177
|
+
return new L(L.Mode.BYTE, o.length, l);
|
|
2179
2178
|
}
|
|
2180
2179
|
// Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
|
2181
2180
|
static makeNumeric(o) {
|
|
2182
|
-
if (!
|
|
2181
|
+
if (!L.isNumeric(o))
|
|
2183
2182
|
throw new RangeError("String contains non-numeric characters");
|
|
2184
2183
|
let l = [];
|
|
2185
2184
|
for (let i = 0; i < o.length; ) {
|
|
2186
2185
|
const c = Math.min(o.length - i, 3);
|
|
2187
2186
|
n(parseInt(o.substring(i, i + c), 10), c * 3 + 1, l), i += c;
|
|
2188
2187
|
}
|
|
2189
|
-
return new
|
|
2188
|
+
return new L(L.Mode.NUMERIC, o.length, l);
|
|
2190
2189
|
}
|
|
2191
2190
|
// Returns a segment representing the given text string encoded in alphanumeric mode.
|
|
2192
2191
|
// The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
|
2193
2192
|
// dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
2194
2193
|
static makeAlphanumeric(o) {
|
|
2195
|
-
if (!
|
|
2194
|
+
if (!L.isAlphanumeric(o))
|
|
2196
2195
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
2197
2196
|
let l = [], i;
|
|
2198
2197
|
for (i = 0; i + 2 <= o.length; i += 2) {
|
|
2199
|
-
let c =
|
|
2200
|
-
c +=
|
|
2198
|
+
let c = L.ALPHANUMERIC_CHARSET.indexOf(o.charAt(i)) * 45;
|
|
2199
|
+
c += L.ALPHANUMERIC_CHARSET.indexOf(o.charAt(i + 1)), n(c, 11, l);
|
|
2201
2200
|
}
|
|
2202
|
-
return i < o.length && n(
|
|
2201
|
+
return i < o.length && n(L.ALPHANUMERIC_CHARSET.indexOf(o.charAt(i)), 6, l), new L(L.Mode.ALPHANUMERIC, o.length, l);
|
|
2203
2202
|
}
|
|
2204
2203
|
// Returns a new mutable list of zero or more segments to represent the given Unicode text string.
|
|
2205
2204
|
// The result may use various segment modes and switch modes to optimize the length of the bit stream.
|
|
2206
2205
|
static makeSegments(o) {
|
|
2207
|
-
return o == "" ? [] :
|
|
2206
|
+
return o == "" ? [] : L.isNumeric(o) ? [L.makeNumeric(o)] : L.isAlphanumeric(o) ? [L.makeAlphanumeric(o)] : [L.makeBytes(L.toUtf8ByteArray(o))];
|
|
2208
2207
|
}
|
|
2209
2208
|
// Returns a segment representing an Extended Channel Interpretation
|
|
2210
2209
|
// (ECI) designator with the given assignment value.
|
|
@@ -2220,18 +2219,18 @@ var ae;
|
|
|
2220
2219
|
n(6, 3, l), n(o, 21, l);
|
|
2221
2220
|
else
|
|
2222
2221
|
throw new RangeError("ECI assignment value out of range");
|
|
2223
|
-
return new
|
|
2222
|
+
return new L(L.Mode.ECI, 0, l);
|
|
2224
2223
|
}
|
|
2225
2224
|
// Tests whether the given string can be encoded as a segment in numeric mode.
|
|
2226
2225
|
// A string is encodable iff each character is in the range 0 to 9.
|
|
2227
2226
|
static isNumeric(o) {
|
|
2228
|
-
return
|
|
2227
|
+
return L.NUMERIC_REGEX.test(o);
|
|
2229
2228
|
}
|
|
2230
2229
|
// Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
|
2231
2230
|
// A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
|
2232
2231
|
// (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
|
2233
2232
|
static isAlphanumeric(o) {
|
|
2234
|
-
return
|
|
2233
|
+
return L.ALPHANUMERIC_REGEX.test(o);
|
|
2235
2234
|
}
|
|
2236
2235
|
/*-- Methods --*/
|
|
2237
2236
|
// Returns a new copy of the data bits of this segment.
|
|
@@ -2298,8 +2297,8 @@ var Ys = {
|
|
|
2298
2297
|
M: he.QrCode.Ecc.MEDIUM,
|
|
2299
2298
|
Q: he.QrCode.Ecc.QUARTILE,
|
|
2300
2299
|
H: he.QrCode.Ecc.HIGH
|
|
2301
|
-
},
|
|
2302
|
-
function
|
|
2300
|
+
}, dn = 128, un = "L", hn = "#FFFFFF", pn = "#000000", mn = !1, fn = 1, Ks = 4, Qs = 0, Gs = 0.1;
|
|
2301
|
+
function gn(e, t = 0) {
|
|
2303
2302
|
const n = [];
|
|
2304
2303
|
return e.forEach(function(s, a) {
|
|
2305
2304
|
let d = null;
|
|
@@ -2322,7 +2321,7 @@ function fn(e, t = 0) {
|
|
|
2322
2321
|
});
|
|
2323
2322
|
}), n.join("");
|
|
2324
2323
|
}
|
|
2325
|
-
function
|
|
2324
|
+
function wn(e, t) {
|
|
2326
2325
|
return e.slice().map((n, s) => s < t.y || s >= t.y + t.h ? n : n.map((a, d) => d < t.x || d >= t.x + t.w ? a : !1));
|
|
2327
2326
|
}
|
|
2328
2327
|
function Xs(e, t, n, s) {
|
|
@@ -2340,7 +2339,7 @@ function Xs(e, t, n, s) {
|
|
|
2340
2339
|
function qs(e, t) {
|
|
2341
2340
|
return t != null ? Math.max(Math.floor(t), 0) : e ? Ks : Qs;
|
|
2342
2341
|
}
|
|
2343
|
-
function
|
|
2342
|
+
function bn({
|
|
2344
2343
|
value: e,
|
|
2345
2344
|
level: t,
|
|
2346
2345
|
minVersion: n,
|
|
@@ -2350,7 +2349,7 @@ function wn({
|
|
|
2350
2349
|
size: h,
|
|
2351
2350
|
boostLevel: p
|
|
2352
2351
|
}) {
|
|
2353
|
-
let o =
|
|
2352
|
+
let o = F.useMemo(() => {
|
|
2354
2353
|
const f = (Array.isArray(e) ? e : [e]).reduce((v, w) => (v.push(...he.QrSegment.makeSegments(w)), v), []);
|
|
2355
2354
|
return he.QrCode.encodeSegments(
|
|
2356
2355
|
f,
|
|
@@ -2361,7 +2360,7 @@ function wn({
|
|
|
2361
2360
|
p
|
|
2362
2361
|
);
|
|
2363
2362
|
}, [e, t, n, p]);
|
|
2364
|
-
const { cells: l, margin: i, numCells: c, calculatedImageSettings: u } =
|
|
2363
|
+
const { cells: l, margin: i, numCells: c, calculatedImageSettings: u } = F.useMemo(() => {
|
|
2365
2364
|
let g = o.getModules();
|
|
2366
2365
|
const f = qs(s, a), v = g.length + f * 2, w = Xs(
|
|
2367
2366
|
g,
|
|
@@ -2391,20 +2390,20 @@ var Zs = (function() {
|
|
|
2391
2390
|
return !1;
|
|
2392
2391
|
}
|
|
2393
2392
|
return !0;
|
|
2394
|
-
})(), Js =
|
|
2393
|
+
})(), Js = F.forwardRef(
|
|
2395
2394
|
function(t, n) {
|
|
2396
2395
|
const s = t, {
|
|
2397
2396
|
value: a,
|
|
2398
|
-
size: d =
|
|
2399
|
-
level: h =
|
|
2400
|
-
bgColor: p =
|
|
2401
|
-
fgColor: o =
|
|
2402
|
-
includeMargin: l =
|
|
2403
|
-
minVersion: i =
|
|
2397
|
+
size: d = dn,
|
|
2398
|
+
level: h = un,
|
|
2399
|
+
bgColor: p = hn,
|
|
2400
|
+
fgColor: o = pn,
|
|
2401
|
+
includeMargin: l = mn,
|
|
2402
|
+
minVersion: i = fn,
|
|
2404
2403
|
boostLevel: c,
|
|
2405
2404
|
marginSize: u,
|
|
2406
2405
|
imageSettings: g
|
|
2407
|
-
} = s, v =
|
|
2406
|
+
} = s, v = nt(s, [
|
|
2408
2407
|
"value",
|
|
2409
2408
|
"size",
|
|
2410
2409
|
"level",
|
|
@@ -2415,12 +2414,12 @@ var Zs = (function() {
|
|
|
2415
2414
|
"boostLevel",
|
|
2416
2415
|
"marginSize",
|
|
2417
2416
|
"imageSettings"
|
|
2418
|
-
]), { style: w } = v, C =
|
|
2419
|
-
(
|
|
2420
|
-
x.current =
|
|
2417
|
+
]), { style: w } = v, C = nt(v, ["style"]), E = g?.src, x = F.useRef(null), S = F.useRef(null), _ = F.useCallback(
|
|
2418
|
+
(B) => {
|
|
2419
|
+
x.current = B, typeof n == "function" ? n(B) : n && (n.current = B);
|
|
2421
2420
|
},
|
|
2422
2421
|
[n]
|
|
2423
|
-
), [
|
|
2422
|
+
), [A, D] = F.useState(!1), { margin: Y, cells: Q, numCells: ee, calculatedImageSettings: z } = bn({
|
|
2424
2423
|
value: a,
|
|
2425
2424
|
level: h,
|
|
2426
2425
|
minVersion: i,
|
|
@@ -2430,23 +2429,23 @@ var Zs = (function() {
|
|
|
2430
2429
|
imageSettings: g,
|
|
2431
2430
|
size: d
|
|
2432
2431
|
});
|
|
2433
|
-
|
|
2432
|
+
F.useEffect(() => {
|
|
2434
2433
|
if (x.current != null) {
|
|
2435
|
-
const
|
|
2434
|
+
const B = x.current, K = B.getContext("2d");
|
|
2436
2435
|
if (!K)
|
|
2437
2436
|
return;
|
|
2438
|
-
let
|
|
2437
|
+
let J = Q;
|
|
2439
2438
|
const N = S.current, M = z != null && N !== null && N.complete && N.naturalHeight !== 0 && N.naturalWidth !== 0;
|
|
2440
|
-
M && z.excavation != null && (
|
|
2439
|
+
M && z.excavation != null && (J = wn(
|
|
2441
2440
|
Q,
|
|
2442
2441
|
z.excavation
|
|
2443
2442
|
));
|
|
2444
2443
|
const k = window.devicePixelRatio || 1;
|
|
2445
|
-
|
|
2446
|
-
const P = d /
|
|
2447
|
-
K.scale(P, P), K.fillStyle = p, K.fillRect(0, 0,
|
|
2448
|
-
|
|
2449
|
-
|
|
2444
|
+
B.height = B.width = d * k;
|
|
2445
|
+
const P = d / ee * k;
|
|
2446
|
+
K.scale(P, P), K.fillStyle = p, K.fillRect(0, 0, ee, ee), K.fillStyle = o, Zs ? K.fill(new Path2D(gn(J, Y))) : Q.forEach(function($, H) {
|
|
2447
|
+
$.forEach(function(j, oe) {
|
|
2448
|
+
j && K.fillRect(oe + Y, H + Y, 1, 1);
|
|
2450
2449
|
});
|
|
2451
2450
|
}), z && (K.globalAlpha = z.opacity), M && K.drawImage(
|
|
2452
2451
|
N,
|
|
@@ -2456,12 +2455,12 @@ var Zs = (function() {
|
|
|
2456
2455
|
z.h
|
|
2457
2456
|
);
|
|
2458
2457
|
}
|
|
2459
|
-
}),
|
|
2458
|
+
}), F.useEffect(() => {
|
|
2460
2459
|
D(!1);
|
|
2461
2460
|
}, [E]);
|
|
2462
|
-
const
|
|
2463
|
-
let
|
|
2464
|
-
return E != null && (
|
|
2461
|
+
const te = tt({ height: d, width: d }, w);
|
|
2462
|
+
let re = null;
|
|
2463
|
+
return E != null && (re = /* @__PURE__ */ F.createElement(
|
|
2465
2464
|
"img",
|
|
2466
2465
|
{
|
|
2467
2466
|
src: E,
|
|
@@ -2473,34 +2472,34 @@ var Zs = (function() {
|
|
|
2473
2472
|
ref: S,
|
|
2474
2473
|
crossOrigin: z?.crossOrigin
|
|
2475
2474
|
}
|
|
2476
|
-
)), /* @__PURE__ */
|
|
2475
|
+
)), /* @__PURE__ */ F.createElement(F.Fragment, null, /* @__PURE__ */ F.createElement(
|
|
2477
2476
|
"canvas",
|
|
2478
|
-
|
|
2479
|
-
style:
|
|
2477
|
+
tt({
|
|
2478
|
+
style: te,
|
|
2480
2479
|
height: d,
|
|
2481
2480
|
width: d,
|
|
2482
2481
|
ref: _,
|
|
2483
2482
|
role: "img"
|
|
2484
2483
|
}, C)
|
|
2485
|
-
),
|
|
2484
|
+
), re);
|
|
2486
2485
|
}
|
|
2487
2486
|
);
|
|
2488
2487
|
Js.displayName = "QRCodeCanvas";
|
|
2489
|
-
var
|
|
2488
|
+
var vn = F.forwardRef(
|
|
2490
2489
|
function(t, n) {
|
|
2491
2490
|
const s = t, {
|
|
2492
2491
|
value: a,
|
|
2493
|
-
size: d =
|
|
2494
|
-
level: h =
|
|
2495
|
-
bgColor: p =
|
|
2496
|
-
fgColor: o =
|
|
2497
|
-
includeMargin: l =
|
|
2498
|
-
minVersion: i =
|
|
2492
|
+
size: d = dn,
|
|
2493
|
+
level: h = un,
|
|
2494
|
+
bgColor: p = hn,
|
|
2495
|
+
fgColor: o = pn,
|
|
2496
|
+
includeMargin: l = mn,
|
|
2497
|
+
minVersion: i = fn,
|
|
2499
2498
|
boostLevel: c,
|
|
2500
2499
|
title: u,
|
|
2501
2500
|
marginSize: g,
|
|
2502
2501
|
imageSettings: f
|
|
2503
|
-
} = s, v =
|
|
2502
|
+
} = s, v = nt(s, [
|
|
2504
2503
|
"value",
|
|
2505
2504
|
"size",
|
|
2506
2505
|
"level",
|
|
@@ -2512,7 +2511,7 @@ var bn = $.forwardRef(
|
|
|
2512
2511
|
"title",
|
|
2513
2512
|
"marginSize",
|
|
2514
2513
|
"imageSettings"
|
|
2515
|
-
]), { margin: w, cells: C, numCells: E, calculatedImageSettings: x } =
|
|
2514
|
+
]), { margin: w, cells: C, numCells: E, calculatedImageSettings: x } = bn({
|
|
2516
2515
|
value: a,
|
|
2517
2516
|
level: h,
|
|
2518
2517
|
minVersion: i,
|
|
@@ -2523,10 +2522,10 @@ var bn = $.forwardRef(
|
|
|
2523
2522
|
size: d
|
|
2524
2523
|
});
|
|
2525
2524
|
let S = C, _ = null;
|
|
2526
|
-
f != null && x != null && (x.excavation != null && (S =
|
|
2525
|
+
f != null && x != null && (x.excavation != null && (S = wn(
|
|
2527
2526
|
C,
|
|
2528
2527
|
x.excavation
|
|
2529
|
-
)), _ = /* @__PURE__ */
|
|
2528
|
+
)), _ = /* @__PURE__ */ F.createElement(
|
|
2530
2529
|
"image",
|
|
2531
2530
|
{
|
|
2532
2531
|
href: f.src,
|
|
@@ -2539,18 +2538,18 @@ var bn = $.forwardRef(
|
|
|
2539
2538
|
crossOrigin: x.crossOrigin
|
|
2540
2539
|
}
|
|
2541
2540
|
));
|
|
2542
|
-
const
|
|
2543
|
-
return /* @__PURE__ */
|
|
2541
|
+
const A = gn(S, w);
|
|
2542
|
+
return /* @__PURE__ */ F.createElement(
|
|
2544
2543
|
"svg",
|
|
2545
|
-
|
|
2544
|
+
tt({
|
|
2546
2545
|
height: d,
|
|
2547
2546
|
width: d,
|
|
2548
2547
|
viewBox: `0 0 ${E} ${E}`,
|
|
2549
2548
|
ref: n,
|
|
2550
2549
|
role: "img"
|
|
2551
2550
|
}, v),
|
|
2552
|
-
!!u && /* @__PURE__ */
|
|
2553
|
-
/* @__PURE__ */
|
|
2551
|
+
!!u && /* @__PURE__ */ F.createElement("title", null, u),
|
|
2552
|
+
/* @__PURE__ */ F.createElement(
|
|
2554
2553
|
"path",
|
|
2555
2554
|
{
|
|
2556
2555
|
fill: p,
|
|
@@ -2558,35 +2557,35 @@ var bn = $.forwardRef(
|
|
|
2558
2557
|
shapeRendering: "crispEdges"
|
|
2559
2558
|
}
|
|
2560
2559
|
),
|
|
2561
|
-
/* @__PURE__ */
|
|
2560
|
+
/* @__PURE__ */ F.createElement("path", { fill: o, d: A, shapeRendering: "crispEdges" }),
|
|
2562
2561
|
_
|
|
2563
2562
|
);
|
|
2564
2563
|
}
|
|
2565
2564
|
);
|
|
2566
|
-
|
|
2567
|
-
const
|
|
2565
|
+
vn.displayName = "QRCodeSVG";
|
|
2566
|
+
const yn = "superwall-device-scheme", xn = () => {
|
|
2568
2567
|
try {
|
|
2569
|
-
return window.localStorage.getItem(
|
|
2568
|
+
return window.localStorage.getItem(yn) ?? void 0;
|
|
2570
2569
|
} catch {
|
|
2571
2570
|
return;
|
|
2572
2571
|
}
|
|
2573
|
-
},
|
|
2572
|
+
}, En = (e) => {
|
|
2574
2573
|
try {
|
|
2575
|
-
window.localStorage.setItem(
|
|
2574
|
+
window.localStorage.setItem(yn, e);
|
|
2576
2575
|
} catch {
|
|
2577
2576
|
}
|
|
2578
|
-
},
|
|
2577
|
+
}, rt = (e, t, n) => {
|
|
2579
2578
|
const s = n === void 0 ? "" : `&superwall_dev_surface=${encodeURIComponent(n)}`;
|
|
2580
2579
|
return `${e}://?superwall_dev=${encodeURIComponent(t)}${s}`;
|
|
2581
2580
|
}, eo = (e) => {
|
|
2582
2581
|
const n = window.prompt("Your app's URL scheme, so this can open it:", e)?.trim();
|
|
2583
2582
|
if (!(n === void 0 || n === ""))
|
|
2584
|
-
return
|
|
2583
|
+
return En(n), n;
|
|
2585
2584
|
}, to = ({
|
|
2586
2585
|
source: e,
|
|
2587
2586
|
surface: t
|
|
2588
2587
|
}) => {
|
|
2589
|
-
const n =
|
|
2588
|
+
const n = lt() === "hosted", [s, a] = m.useState(!1), [d, h] = m.useState(() => xn() ?? e.scheme), [p, o] = m.useState({ status: "loading" });
|
|
2590
2589
|
return m.useEffect(() => {
|
|
2591
2590
|
if (s) {
|
|
2592
2591
|
if (n) {
|
|
@@ -2613,10 +2612,10 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2613
2612
|
}
|
|
2614
2613
|
o({
|
|
2615
2614
|
status: "ready",
|
|
2616
|
-
url:
|
|
2615
|
+
url: rt(d, e.networkOrigin ?? window.location.origin, t.id)
|
|
2617
2616
|
});
|
|
2618
2617
|
}
|
|
2619
|
-
}, [s, n, d, e, t]), /* @__PURE__ */ b(
|
|
2618
|
+
}, [s, n, d, e, t]), /* @__PURE__ */ b(ne, { children: [
|
|
2620
2619
|
/* @__PURE__ */ r("button", { className: "sw-btn", type: "button", onClick: () => a(!0), children: "Preview" }),
|
|
2621
2620
|
s && /* @__PURE__ */ r(
|
|
2622
2621
|
"div",
|
|
@@ -2636,8 +2635,8 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2636
2635
|
/* @__PURE__ */ r("span", { className: "text-[0.9375rem] font-medium", children: "Preview on a device" }),
|
|
2637
2636
|
/* @__PURE__ */ r("span", { className: "text-[0.8125rem] text-cream/55", children: n ? "Scan with the device that has your app installed. It opens the live paywall in the SDK's debugger." : "Scan with the device that has your app installed. It opens this paywall against this machine's dev server." })
|
|
2638
2637
|
] }),
|
|
2639
|
-
p.status === "ready" ? /* @__PURE__ */ b(
|
|
2640
|
-
/* @__PURE__ */ r("div", { className: "bg-cream rounded p-3", children: /* @__PURE__ */ r(
|
|
2638
|
+
p.status === "ready" ? /* @__PURE__ */ b(ne, { children: [
|
|
2639
|
+
/* @__PURE__ */ r("div", { className: "bg-cream rounded p-3", children: /* @__PURE__ */ r(vn, { value: p.url, size: 192 }) }),
|
|
2641
2640
|
/* @__PURE__ */ r("code", { className: "max-w-full font-mono text-[0.6875rem] break-all text-cream/55", children: p.url })
|
|
2642
2641
|
] }) : /* @__PURE__ */ r("div", { className: "flex size-[216px] flex-none items-center justify-center rounded border border-cream/20 px-6 text-center text-[0.8125rem] text-cream/55", children: p.status === "loading" ? "Building a link…" : p.reason }),
|
|
2643
2642
|
/* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
@@ -2675,7 +2674,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2675
2674
|
children: a.label
|
|
2676
2675
|
},
|
|
2677
2676
|
a.value
|
|
2678
|
-
)) }),
|
|
2677
|
+
)) }), kt = ({
|
|
2679
2678
|
value: e,
|
|
2680
2679
|
options: t,
|
|
2681
2680
|
onChange: n,
|
|
@@ -2724,20 +2723,20 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2724
2723
|
className: "sw-btn sw-btn--icon border-transparent",
|
|
2725
2724
|
"aria-label": `Close ${t.toLowerCase()}`,
|
|
2726
2725
|
onClick: n,
|
|
2727
|
-
children: /* @__PURE__ */ r(
|
|
2726
|
+
children: /* @__PURE__ */ r(Gt, {})
|
|
2728
2727
|
}
|
|
2729
2728
|
)
|
|
2730
2729
|
] }),
|
|
2731
2730
|
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto px-4 py-2", children: s })
|
|
2732
2731
|
] })
|
|
2733
2732
|
}
|
|
2734
|
-
), oo = "data-toolbar-divider", io = "data-orphan",
|
|
2733
|
+
), oo = "data-toolbar-divider", io = "data-orphan", Pt = (e) => e.offsetTop + e.offsetHeight / 2, Rt = (e, t) => Math.abs(Pt(e) - Pt(t)) <= Math.min(e.offsetHeight, t.offsetHeight) / 2 + 1, ao = (e) => {
|
|
2735
2734
|
const t = [...e.children].filter(
|
|
2736
2735
|
(n) => n instanceof HTMLElement
|
|
2737
2736
|
);
|
|
2738
2737
|
t.forEach((n, s) => {
|
|
2739
2738
|
if (!n.hasAttribute(oo)) return;
|
|
2740
|
-
const a = t[s - 1], d = t[s + 1], h = a === void 0 || !
|
|
2739
|
+
const a = t[s - 1], d = t[s + 1], h = a === void 0 || !Rt(a, n), p = d === void 0 || !Rt(n, d);
|
|
2741
2740
|
n.toggleAttribute(io, h || p);
|
|
2742
2741
|
});
|
|
2743
2742
|
}, lo = ({ children: e }) => {
|
|
@@ -2756,18 +2755,18 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2756
2755
|
children: e
|
|
2757
2756
|
}
|
|
2758
2757
|
);
|
|
2759
|
-
},
|
|
2758
|
+
}, be = ({ label: e, children: t }) => /* @__PURE__ */ b("div", { className: "flex items-center gap-2.5", children: [
|
|
2760
2759
|
/* @__PURE__ */ r("span", { className: "sw-tool-label", children: e }),
|
|
2761
2760
|
t
|
|
2762
|
-
] }),
|
|
2761
|
+
] }), Ot = () => /* @__PURE__ */ r("span", { className: "h-6 w-px bg-cream/10 data-[orphan]:invisible", "data-toolbar-divider": "" }), At = 16, co = (e, t) => {
|
|
2763
2762
|
const n = [...e.children].filter(
|
|
2764
2763
|
(d) => d instanceof HTMLElement && d !== t
|
|
2765
2764
|
), s = e.clientWidth / 2, a = t.scrollWidth / 2;
|
|
2766
2765
|
return n.every((d) => {
|
|
2767
2766
|
const h = d.offsetLeft;
|
|
2768
|
-
return h + d.offsetWidth +
|
|
2767
|
+
return h + d.offsetWidth + At <= s - a || h - At >= s + a;
|
|
2769
2768
|
});
|
|
2770
|
-
},
|
|
2769
|
+
}, Sn = ({
|
|
2771
2770
|
title: e,
|
|
2772
2771
|
actions: t,
|
|
2773
2772
|
inset: n = !1,
|
|
@@ -2824,7 +2823,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2824
2823
|
{ key: "device", label: "Device", blurb: "Platform, locale, OS — the SDK fills these in" },
|
|
2825
2824
|
{ key: "params", label: "Params", blurb: "Passed in at the placement" },
|
|
2826
2825
|
{ key: "products", label: "Products", blurb: "Store data for this paywall's products" }
|
|
2827
|
-
], Lt = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ho = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e,
|
|
2826
|
+
], Lt = (e) => e == null ? "" : typeof e == "string" ? e : JSON.stringify(e), ho = (e) => e === "true" ? !0 : e === "false" ? !1 : e.trim() !== "" && Number.isFinite(Number(e)) ? Number(e) : e, Ke = (e) => e.slice(e.indexOf(".") + 1), po = ({
|
|
2828
2827
|
row: e,
|
|
2829
2828
|
override: t,
|
|
2830
2829
|
onChange: n
|
|
@@ -2897,7 +2896,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2897
2896
|
{
|
|
2898
2897
|
className: `ml-auto shrink-0 text-cream/40 transition-transform ${d ? "" : "-rotate-90"}`,
|
|
2899
2898
|
"aria-hidden": "true",
|
|
2900
|
-
children: /* @__PURE__ */ r(
|
|
2899
|
+
children: /* @__PURE__ */ r(Xt, {})
|
|
2901
2900
|
}
|
|
2902
2901
|
)
|
|
2903
2902
|
]
|
|
@@ -2921,7 +2920,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2921
2920
|
const s = (a, d, h) => {
|
|
2922
2921
|
if (a !== "products") {
|
|
2923
2922
|
const c = { ...e[a] };
|
|
2924
|
-
h === void 0 ? delete c[
|
|
2923
|
+
h === void 0 ? delete c[Ke(d)] : c[Ke(d)] = h, n({ ...e, [a]: c });
|
|
2925
2924
|
return;
|
|
2926
2925
|
}
|
|
2927
2926
|
const [, p = "", o = ""] = d.split("."), l = { ...e.products?.[p] };
|
|
@@ -2935,17 +2934,17 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2935
2934
|
label: a.label,
|
|
2936
2935
|
blurb: a.blurb,
|
|
2937
2936
|
rows: t[a.key] ?? [],
|
|
2938
|
-
overrideOf: (d) => a.key === "products" ? e.products?.[d.split(".")[1] ?? ""]?.[d.split(".")[2] ?? ""] : e[a.key]?.[
|
|
2937
|
+
overrideOf: (d) => a.key === "products" ? e.products?.[d.split(".")[1] ?? ""]?.[d.split(".")[2] ?? ""] : e[a.key]?.[Ke(d)],
|
|
2939
2938
|
onChange: (d, h) => s(a.key, d, h)
|
|
2940
2939
|
},
|
|
2941
2940
|
a.key
|
|
2942
2941
|
)) });
|
|
2943
|
-
},
|
|
2942
|
+
}, Qe = {
|
|
2944
2943
|
radius: 54,
|
|
2945
2944
|
cutout: "island",
|
|
2946
2945
|
statusBarHeight: 64,
|
|
2947
2946
|
homeIndicator: !0
|
|
2948
|
-
},
|
|
2947
|
+
}, Ae = [
|
|
2949
2948
|
{
|
|
2950
2949
|
id: "iphone-se",
|
|
2951
2950
|
name: "iPhone SE",
|
|
@@ -2960,7 +2959,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2960
2959
|
width: 402,
|
|
2961
2960
|
height: 874,
|
|
2962
2961
|
device: { platform: "iOS", deviceModel: "iPhone18,3", osVersion: "26.0" },
|
|
2963
|
-
chrome:
|
|
2962
|
+
chrome: Qe
|
|
2964
2963
|
},
|
|
2965
2964
|
{
|
|
2966
2965
|
id: "iphone-air",
|
|
@@ -2968,7 +2967,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2968
2967
|
width: 420,
|
|
2969
2968
|
height: 912,
|
|
2970
2969
|
device: { platform: "iOS", deviceModel: "iPhone18,4", osVersion: "26.0" },
|
|
2971
|
-
chrome:
|
|
2970
|
+
chrome: Qe
|
|
2972
2971
|
},
|
|
2973
2972
|
{
|
|
2974
2973
|
id: "iphone-17-pro-max",
|
|
@@ -2976,7 +2975,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
2976
2975
|
width: 440,
|
|
2977
2976
|
height: 956,
|
|
2978
2977
|
device: { platform: "iOS", deviceModel: "iPhone18,2", osVersion: "26.0" },
|
|
2979
|
-
chrome:
|
|
2978
|
+
chrome: Qe
|
|
2980
2979
|
},
|
|
2981
2980
|
{
|
|
2982
2981
|
id: "pixel-10",
|
|
@@ -3028,22 +3027,22 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3028
3027
|
width: 1440,
|
|
3029
3028
|
height: 900
|
|
3030
3029
|
}
|
|
3031
|
-
],
|
|
3032
|
-
const t = e.chrome?.statusBarHeight ?? 0, n = e.device === void 0 ?
|
|
3030
|
+
], Nn = "iphone-17", go = (e) => e !== void 0 && e.length > 0 && e.every((t) => t.toLowerCase() === "web"), wo = (e, t) => t ? void 0 : e.chrome, Ge = { iOS: 84, Android: 104, tablet: 66, desktop: 52 }, bo = (e) => {
|
|
3031
|
+
const t = e.chrome?.statusBarHeight ?? 0, n = e.device === void 0 ? Ge.desktop : e.width >= 600 ? Ge.tablet : Ge[e.device.platform];
|
|
3033
3032
|
return { width: e.width, height: e.height - t - n };
|
|
3034
3033
|
}, vo = {
|
|
3035
3034
|
platform: "iOS",
|
|
3036
3035
|
deviceModel: "Mac",
|
|
3037
3036
|
osVersion: "26.0",
|
|
3038
3037
|
interfaceType: "mac"
|
|
3039
|
-
}, yo = (e, t) => t ? { ...e.device, platform: "web" } : e.device ?? vo,
|
|
3038
|
+
}, yo = (e, t) => t ? { ...e.device, platform: "web" } : e.device ?? vo, Tt = "responsive", xo = { width: 393, height: 852 }, Eo = Ae.find((e) => e.id === Nn) ?? Ae[0], So = (e) => Ae.find((t) => t.id === e) ?? Eo, Cn = () => ({
|
|
3040
3039
|
device: fr(),
|
|
3041
3040
|
user: gr,
|
|
3042
3041
|
params: wr
|
|
3043
|
-
}),
|
|
3042
|
+
}), Mn = (e) => {
|
|
3044
3043
|
const { publicApiKey: t, ...n } = e;
|
|
3045
3044
|
return n;
|
|
3046
|
-
},
|
|
3045
|
+
}, In = ({
|
|
3047
3046
|
surface: e,
|
|
3048
3047
|
defaults: t,
|
|
3049
3048
|
sourceSamples: n,
|
|
@@ -3053,7 +3052,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3053
3052
|
locale: h,
|
|
3054
3053
|
edited: p
|
|
3055
3054
|
}) => {
|
|
3056
|
-
const o =
|
|
3055
|
+
const o = Mn({
|
|
3057
3056
|
...t.device,
|
|
3058
3057
|
...n?.device,
|
|
3059
3058
|
...s.device,
|
|
@@ -3080,7 +3079,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3080
3079
|
}
|
|
3081
3080
|
})
|
|
3082
3081
|
);
|
|
3083
|
-
return
|
|
3082
|
+
return Bt({
|
|
3084
3083
|
paywallId: e.paywallId ?? "0",
|
|
3085
3084
|
paywallIdentifier: e.paywallIdentifier ?? e.id,
|
|
3086
3085
|
device: o,
|
|
@@ -3096,14 +3095,14 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3096
3095
|
"android-views": "Android Views",
|
|
3097
3096
|
"react-native": "React Native",
|
|
3098
3097
|
flutter: "Flutter"
|
|
3099
|
-
},
|
|
3098
|
+
}, ke = (e) => "path" in e, Dt = (e) => e.origin !== void 0 && (!ke(e.origin) || e.origin.screenshot !== void 0), _n = (e) => e.capabilities?.actions === !0, Co = [
|
|
3100
3099
|
[60, "second"],
|
|
3101
3100
|
[60, "minute"],
|
|
3102
3101
|
[24, "hour"],
|
|
3103
3102
|
[7, "day"],
|
|
3104
3103
|
[4.348, "week"],
|
|
3105
3104
|
[12, "month"]
|
|
3106
|
-
],
|
|
3105
|
+
], kn = (e, t = Date.now()) => {
|
|
3107
3106
|
const n = Date.parse(e);
|
|
3108
3107
|
if (Number.isNaN(n)) return;
|
|
3109
3108
|
let s = Math.max(0, (t - n) / 1e3);
|
|
@@ -3113,7 +3112,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3113
3112
|
s /= d;
|
|
3114
3113
|
}
|
|
3115
3114
|
return a.format(-Math.round(s), "year");
|
|
3116
|
-
},
|
|
3115
|
+
}, Pn = (e, t) => Number.isFinite(e) ? Math.min(3e3, Math.max(200, Math.round(e))) : t, $t = ({
|
|
3117
3116
|
label: e,
|
|
3118
3117
|
value: t,
|
|
3119
3118
|
onCommit: n
|
|
@@ -3130,7 +3129,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3130
3129
|
value: s,
|
|
3131
3130
|
onChange: (h) => a(h.target.value),
|
|
3132
3131
|
onBlur: () => {
|
|
3133
|
-
const h =
|
|
3132
|
+
const h = Pn(Number(s), t);
|
|
3134
3133
|
a(String(h)), n(h);
|
|
3135
3134
|
},
|
|
3136
3135
|
onKeyDown: (h) => {
|
|
@@ -3138,7 +3137,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3138
3137
|
}
|
|
3139
3138
|
}
|
|
3140
3139
|
);
|
|
3141
|
-
},
|
|
3140
|
+
}, Ft = ({
|
|
3142
3141
|
label: e,
|
|
3143
3142
|
width: t,
|
|
3144
3143
|
height: n,
|
|
@@ -3205,7 +3204,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3205
3204
|
{
|
|
3206
3205
|
size: { width: t, height: n },
|
|
3207
3206
|
scale: w,
|
|
3208
|
-
clamp:
|
|
3207
|
+
clamp: Pn,
|
|
3209
3208
|
onResize: f,
|
|
3210
3209
|
onDragStart: () => v?.current?.hold(),
|
|
3211
3210
|
onShift: (x, S) => v?.current?.pan(x, S)
|
|
@@ -3213,155 +3212,155 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3213
3212
|
)
|
|
3214
3213
|
] })
|
|
3215
3214
|
] });
|
|
3216
|
-
},
|
|
3215
|
+
}, Xe = (e) => e.label ?? `${e.kind}/${e.id}`, Mo = ({
|
|
3217
3216
|
source: e,
|
|
3218
3217
|
surface: t,
|
|
3219
3218
|
samples: n,
|
|
3220
3219
|
actions: s
|
|
3221
3220
|
}) => {
|
|
3222
|
-
const [a, d] = m.useState(
|
|
3223
|
-
() =>
|
|
3224
|
-
), [E, x] = m.useState(0), [S, _] = m.useState(!1),
|
|
3225
|
-
m.useEffect(() => () => window.clearTimeout(
|
|
3226
|
-
const
|
|
3221
|
+
const [a, d] = m.useState(Nn), [h, p] = m.useState(xo), [o, l] = m.useState("light"), [i, c] = m.useState(void 0), [u, g] = m.useState({}), [f, v] = m.useState(!1), [w, C] = m.useState(
|
|
3222
|
+
() => Dt(t) && new URLSearchParams(window.location.search).get("compare") === "origin" ? { type: "origin" } : void 0
|
|
3223
|
+
), [E, x] = m.useState(0), [S, _] = m.useState(!1), A = m.useRef(null), [D, Y] = m.useState({ scale: 1, fitted: !0 }), [Q, ee] = m.useState({}), [z, te] = m.useState(void 0), re = m.useRef(void 0);
|
|
3224
|
+
m.useEffect(() => () => window.clearTimeout(re.current), []);
|
|
3225
|
+
const B = _n(e), K = Os(), J = m.useMemo(Cn, [t]), N = t.locales;
|
|
3227
3226
|
m.useEffect(() => {
|
|
3228
|
-
if (!
|
|
3227
|
+
if (!B) return;
|
|
3229
3228
|
let y = !1;
|
|
3230
|
-
return
|
|
3231
|
-
y ||
|
|
3229
|
+
return et(t).then((T) => {
|
|
3230
|
+
y || ee(T);
|
|
3232
3231
|
}), () => {
|
|
3233
3232
|
y = !0;
|
|
3234
3233
|
};
|
|
3235
|
-
}, [
|
|
3234
|
+
}, [B, t]);
|
|
3236
3235
|
const M = async (y) => {
|
|
3237
|
-
window.clearTimeout(
|
|
3238
|
-
const T = await Ds(t, y, (W,
|
|
3239
|
-
|
|
3240
|
-
(
|
|
3241
|
-
...
|
|
3242
|
-
steps: { ...
|
|
3243
|
-
} :
|
|
3236
|
+
window.clearTimeout(re.current), te({ action: y, steps: {} });
|
|
3237
|
+
const T = await Ds(t, y, (W, G) => {
|
|
3238
|
+
te(
|
|
3239
|
+
(q) => q?.action === y ? {
|
|
3240
|
+
...q,
|
|
3241
|
+
steps: { ...q.steps, [W]: G === "start" ? "active" : "done" }
|
|
3242
|
+
} : q
|
|
3244
3243
|
);
|
|
3245
3244
|
});
|
|
3246
3245
|
if (T.ok) {
|
|
3247
3246
|
const W = Object.fromEntries(
|
|
3248
|
-
|
|
3247
|
+
Re[y].map((G) => [G, "done"])
|
|
3249
3248
|
);
|
|
3250
|
-
|
|
3249
|
+
te({ action: y, steps: W }), ee(await et(t)), re.current = window.setTimeout(() => te(void 0), 1600);
|
|
3251
3250
|
} else
|
|
3252
|
-
|
|
3251
|
+
te((W) => {
|
|
3253
3252
|
if (!W) return W;
|
|
3254
|
-
const
|
|
3255
|
-
for (const
|
|
3256
|
-
|
|
3257
|
-
return { ...W, steps:
|
|
3253
|
+
const G = { ...W.steps };
|
|
3254
|
+
for (const q of Re[y])
|
|
3255
|
+
G[q] === "active" && (G[q] = "failed");
|
|
3256
|
+
return { ...W, steps: G, error: T.error };
|
|
3258
3257
|
});
|
|
3259
|
-
}, k = a ===
|
|
3258
|
+
}, k = a === Tt, P = So(a), $ = go(t.platforms), H = m.useMemo(() => yo(P, $), [P, $]), j = k ? h : $ ? bo(P) : { width: P.width, height: P.height }, oe = $ ? void 0 : t.presentation, R = S ? { width: j.height, height: j.width } : j, se = () => {
|
|
3260
3259
|
const y = e.standaloneUrl?.(t);
|
|
3261
3260
|
if (y === void 0) return;
|
|
3262
|
-
if (
|
|
3261
|
+
if (R.width > 768) {
|
|
3263
3262
|
window.open(y, "_blank");
|
|
3264
3263
|
return;
|
|
3265
3264
|
}
|
|
3266
|
-
const T = Math.max(0, window.screen.width / 2 -
|
|
3265
|
+
const T = Math.max(0, window.screen.width / 2 - R.width / 2), W = Math.max(0, window.screen.height / 2 - R.height / 2);
|
|
3267
3266
|
window.open(
|
|
3268
3267
|
y,
|
|
3269
3268
|
"superwall-preview",
|
|
3270
|
-
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${
|
|
3269
|
+
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${R.width},height=${R.height},top=${W},left=${T}`
|
|
3271
3270
|
) || window.open(y, "_blank");
|
|
3272
3271
|
}, le = m.useMemo(
|
|
3273
|
-
() =>
|
|
3272
|
+
() => In({
|
|
3274
3273
|
surface: t,
|
|
3275
|
-
defaults:
|
|
3274
|
+
defaults: J,
|
|
3276
3275
|
sourceSamples: e.samples,
|
|
3277
3276
|
samples: n,
|
|
3278
|
-
frame: k ? void 0 :
|
|
3277
|
+
frame: k ? void 0 : H,
|
|
3279
3278
|
theme: o,
|
|
3280
3279
|
locale: i,
|
|
3281
3280
|
edited: u
|
|
3282
3281
|
}),
|
|
3283
|
-
[t,
|
|
3284
|
-
),
|
|
3282
|
+
[t, J, e.samples, n, k, H, o, i, u]
|
|
3283
|
+
), xe = k ? void 0 : wo(P, $), $e = e.previewUrl(t), fe = Q.versions ?? [], O = (y) => `v${y.version}${y.live ? " · live" : ""}`, V = (y) => {
|
|
3285
3284
|
if (y.live) return "What SDKs receive today";
|
|
3286
|
-
const T = y.pushedAt ?
|
|
3285
|
+
const T = y.pushedAt ? kn(y.pushedAt) : void 0;
|
|
3287
3286
|
return T ? `Pushed ${T}` : "Pushed snapshot";
|
|
3288
|
-
},
|
|
3289
|
-
...t.origin &&
|
|
3287
|
+
}, ge = [
|
|
3288
|
+
...t.origin && Dt(t) ? [
|
|
3290
3289
|
{
|
|
3291
3290
|
key: "origin",
|
|
3292
3291
|
label: "Original",
|
|
3293
|
-
hint:
|
|
3292
|
+
hint: ke(t.origin) ? `${No[t.origin.framework]} screen ${t.origin.path}, as captured in the simulator` : `Dashboard paywall ${t.origin.paywallId}, as it serves today`,
|
|
3294
3293
|
target: { type: "origin" }
|
|
3295
3294
|
}
|
|
3296
3295
|
] : [],
|
|
3297
|
-
...
|
|
3296
|
+
...fe.map((y) => ({
|
|
3298
3297
|
key: `version:${y.version}`,
|
|
3299
|
-
label:
|
|
3300
|
-
hint:
|
|
3298
|
+
label: O(y),
|
|
3299
|
+
hint: V(y),
|
|
3301
3300
|
target: { type: "version", version: y.version }
|
|
3302
3301
|
})),
|
|
3303
3302
|
...e.surfaces.map((y) => ({
|
|
3304
3303
|
key: `surface:${y.kind}/${y.id}`,
|
|
3305
|
-
label:
|
|
3304
|
+
label: Xe(y),
|
|
3306
3305
|
hint: e.compareHint ?? "Local preview",
|
|
3307
3306
|
target: { type: "surface", surface: y }
|
|
3308
3307
|
})).filter((y) => y.target.surface !== t)
|
|
3309
|
-
],
|
|
3310
|
-
label:
|
|
3311
|
-
src:
|
|
3308
|
+
], ct = Q.unreachable ? `Couldn't read the pushed versions — ${Q.unreachable}` : void 0, Ee = w?.type === "version" ? fe.find((y) => y.version === w.version) : void 0, X = w && (w.type === "version" ? {
|
|
3309
|
+
label: Ee ? O(Ee) : `v${w.version}`,
|
|
3310
|
+
src: Ee ? at(Ee.url) : void 0,
|
|
3312
3311
|
title: `${t.id} v${w.version}`,
|
|
3313
|
-
empty:
|
|
3312
|
+
empty: ct ?? "This version is no longer on the dashboard."
|
|
3314
3313
|
} : w.type === "origin" ? {
|
|
3315
3314
|
label: "Original",
|
|
3316
|
-
...t.origin &&
|
|
3315
|
+
...t.origin && ke(t.origin) ? { image: t.origin.screenshot ? Ts(t) : void 0 } : { src: t.origin?.url },
|
|
3317
3316
|
title: `${t.id} original`,
|
|
3318
|
-
empty: t.origin &&
|
|
3317
|
+
empty: t.origin && ke(t.origin) ? "The original's screenshot is missing — capture it again with `superwall migrate --screen <path> --screenshot <file>`." : "This paywall was not rebuilt from a dashboard paywall or a native screen."
|
|
3319
3318
|
} : {
|
|
3320
|
-
label:
|
|
3319
|
+
label: Xe(w.surface),
|
|
3321
3320
|
src: e.previewUrl(w.surface),
|
|
3322
|
-
title: `${
|
|
3321
|
+
title: `${Xe(w.surface)} preview`
|
|
3323
3322
|
}), Rn = m.useMemo(() => {
|
|
3324
|
-
const y = (T, W) => Object.entries(W ?? {}).map(([
|
|
3323
|
+
const y = (T, W) => Object.entries(W ?? {}).map(([G, q]) => ({ path: `${T}.${G}`, value: q })).toSorted((G, q) => G.path.localeCompare(q.path));
|
|
3325
3324
|
return {
|
|
3326
|
-
user: y("user", { ...
|
|
3325
|
+
user: y("user", { ...J.user, ...e.samples?.user, ...n.user }),
|
|
3327
3326
|
device: y(
|
|
3328
3327
|
"device",
|
|
3329
|
-
|
|
3330
|
-
...
|
|
3328
|
+
Mn({
|
|
3329
|
+
...J.device,
|
|
3331
3330
|
...e.samples?.device,
|
|
3332
3331
|
...n.device,
|
|
3333
|
-
...
|
|
3332
|
+
...H
|
|
3334
3333
|
})
|
|
3335
3334
|
),
|
|
3336
|
-
params: y("params", { ...
|
|
3335
|
+
params: y("params", { ...J.params, ...e.samples?.params }),
|
|
3337
3336
|
products: Object.entries(t.products ?? {}).flatMap(
|
|
3338
3337
|
([T, W]) => y(`products.${T}`, n.products?.[W])
|
|
3339
3338
|
)
|
|
3340
3339
|
};
|
|
3341
|
-
}, [
|
|
3342
|
-
m.useEffect(() =>
|
|
3343
|
-
const
|
|
3344
|
-
return /* @__PURE__ */ b(
|
|
3340
|
+
}, [J, e.samples, n, H, t.products]), Se = m.useMemo(() => n.products ? Object.entries(t.products ?? {}).filter(([, y]) => n.products?.[y] === void 0).map(([y, T]) => ({ reference: y, identifier: T })) : [], [n.products, t.products]), [On, Fe] = m.useState(!1);
|
|
3341
|
+
m.useEffect(() => Fe(!1), [t]);
|
|
3342
|
+
const Ue = n.unreachable, An = Se.length === 0, dt = Object.keys(u.user ?? {}).length + Object.keys(u.params ?? {}).length + Object.keys(u.device ?? {}).length;
|
|
3343
|
+
return /* @__PURE__ */ b(ne, { children: [
|
|
3345
3344
|
/* @__PURE__ */ r(
|
|
3346
|
-
|
|
3345
|
+
As,
|
|
3347
3346
|
{
|
|
3348
3347
|
surfaceKey: `${t.project ?? ""}/${t.id}`,
|
|
3349
|
-
raised:
|
|
3348
|
+
raised: !!Ue
|
|
3350
3349
|
}
|
|
3351
3350
|
),
|
|
3352
|
-
|
|
3351
|
+
Se.length > 0 && !On && /* @__PURE__ */ r(
|
|
3353
3352
|
ms,
|
|
3354
3353
|
{
|
|
3355
3354
|
paywall: t.id,
|
|
3356
|
-
missing:
|
|
3357
|
-
onDismiss: () =>
|
|
3355
|
+
missing: Se,
|
|
3356
|
+
onDismiss: () => Fe(!0)
|
|
3358
3357
|
}
|
|
3359
3358
|
),
|
|
3360
3359
|
/* @__PURE__ */ r(
|
|
3361
|
-
|
|
3360
|
+
Sn,
|
|
3362
3361
|
{
|
|
3363
3362
|
title: `${t.project ?? e.title} / ${t.id}${t.label ? ` · ${t.label}` : ""}`,
|
|
3364
|
-
actions: /* @__PURE__ */ b(
|
|
3363
|
+
actions: /* @__PURE__ */ b(ne, { children: [
|
|
3365
3364
|
s,
|
|
3366
3365
|
/* @__PURE__ */ r(
|
|
3367
3366
|
"button",
|
|
@@ -3370,7 +3369,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3370
3369
|
className: "sw-btn sw-btn--icon",
|
|
3371
3370
|
"aria-label": "Reload preview",
|
|
3372
3371
|
onClick: () => x((y) => y + 1),
|
|
3373
|
-
children: /* @__PURE__ */ r(
|
|
3372
|
+
children: /* @__PURE__ */ r(Qt, {})
|
|
3374
3373
|
}
|
|
3375
3374
|
),
|
|
3376
3375
|
e.standaloneUrl && /* @__PURE__ */ r(
|
|
@@ -3379,32 +3378,32 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3379
3378
|
type: "button",
|
|
3380
3379
|
className: "sw-btn sw-btn--icon",
|
|
3381
3380
|
"aria-label": "Open preview",
|
|
3382
|
-
onClick:
|
|
3383
|
-
children: /* @__PURE__ */ r(
|
|
3381
|
+
onClick: se,
|
|
3382
|
+
children: /* @__PURE__ */ r(Me, {})
|
|
3384
3383
|
}
|
|
3385
3384
|
),
|
|
3386
3385
|
/* @__PURE__ */ r(Vs, { source: e, surface: t }),
|
|
3387
3386
|
/* @__PURE__ */ r(to, { source: e, surface: t }),
|
|
3388
|
-
|
|
3387
|
+
B && /* @__PURE__ */ r(
|
|
3389
3388
|
Pr,
|
|
3390
3389
|
{
|
|
3391
3390
|
progress: z,
|
|
3392
|
-
blocked:
|
|
3391
|
+
blocked: An ? void 0 : `Superwall has no product for ${Se.map((y) => y.reference).join(", ")}`,
|
|
3393
3392
|
onRun: M,
|
|
3394
|
-
onBlocked: () =>
|
|
3393
|
+
onBlocked: () => Fe(!1)
|
|
3395
3394
|
}
|
|
3396
3395
|
)
|
|
3397
3396
|
] })
|
|
3398
3397
|
}
|
|
3399
3398
|
),
|
|
3400
|
-
|
|
3399
|
+
Ue && /* @__PURE__ */ b(
|
|
3401
3400
|
"div",
|
|
3402
3401
|
{
|
|
3403
3402
|
role: "status",
|
|
3404
3403
|
className: "relative z-10 flex-none border-b border-cream/10 bg-[color-mix(in_srgb,var(--color-red)_10%,var(--color-ink))] px-4 py-1.5 text-[0.8125rem] text-cream/75",
|
|
3405
3404
|
children: [
|
|
3406
3405
|
"Couldn't check this paywall's products — ",
|
|
3407
|
-
|
|
3406
|
+
Ue
|
|
3408
3407
|
]
|
|
3409
3408
|
}
|
|
3410
3409
|
),
|
|
@@ -3412,51 +3411,51 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3412
3411
|
/* @__PURE__ */ b(
|
|
3413
3412
|
Gr,
|
|
3414
3413
|
{
|
|
3415
|
-
ref:
|
|
3414
|
+
ref: A,
|
|
3416
3415
|
onZoom: Y,
|
|
3417
3416
|
fitKey: [
|
|
3418
3417
|
a,
|
|
3419
|
-
k ? "" : `${
|
|
3420
|
-
|
|
3421
|
-
|
|
3418
|
+
k ? "" : `${R.width}x${R.height}`,
|
|
3419
|
+
X ? "compare" : "single",
|
|
3420
|
+
oe?.style ?? ""
|
|
3422
3421
|
].join(":"),
|
|
3423
3422
|
children: [
|
|
3424
|
-
|
|
3425
|
-
|
|
3423
|
+
X && /* @__PURE__ */ r(
|
|
3424
|
+
Ft,
|
|
3426
3425
|
{
|
|
3427
|
-
label:
|
|
3428
|
-
width:
|
|
3429
|
-
height:
|
|
3430
|
-
title:
|
|
3431
|
-
src: "src" in
|
|
3432
|
-
image: "image" in
|
|
3433
|
-
presentation: w?.type === "surface" &&
|
|
3426
|
+
label: X.label,
|
|
3427
|
+
width: R.width,
|
|
3428
|
+
height: R.height,
|
|
3429
|
+
title: X.title,
|
|
3430
|
+
src: "src" in X ? X.src : void 0,
|
|
3431
|
+
image: "image" in X ? X.image : void 0,
|
|
3432
|
+
presentation: w?.type === "surface" && !$ ? w.surface.presentation : oe,
|
|
3434
3433
|
hostState: le,
|
|
3435
3434
|
delegate: K,
|
|
3436
3435
|
reloadKey: E,
|
|
3437
|
-
empty: "empty" in
|
|
3438
|
-
chrome:
|
|
3436
|
+
empty: "empty" in X ? X.empty : void 0,
|
|
3437
|
+
chrome: xe,
|
|
3439
3438
|
landscape: S,
|
|
3440
3439
|
theme: o
|
|
3441
3440
|
}
|
|
3442
3441
|
),
|
|
3443
3442
|
/* @__PURE__ */ r(
|
|
3444
|
-
|
|
3443
|
+
Ft,
|
|
3445
3444
|
{
|
|
3446
|
-
label:
|
|
3447
|
-
width:
|
|
3448
|
-
height:
|
|
3445
|
+
label: X ? t.label ?? "Local" : void 0,
|
|
3446
|
+
width: R.width,
|
|
3447
|
+
height: R.height,
|
|
3449
3448
|
title: `${t.id} preview`,
|
|
3450
|
-
src:
|
|
3451
|
-
presentation:
|
|
3449
|
+
src: $e,
|
|
3450
|
+
presentation: oe,
|
|
3452
3451
|
hostState: le,
|
|
3453
3452
|
delegate: K,
|
|
3454
3453
|
reloadKey: E,
|
|
3455
|
-
chrome:
|
|
3454
|
+
chrome: xe,
|
|
3456
3455
|
landscape: S,
|
|
3457
3456
|
theme: o,
|
|
3458
3457
|
onResize: k ? (y) => p(S ? { width: y.height, height: y.width } : y) : void 0,
|
|
3459
|
-
canvas:
|
|
3458
|
+
canvas: A
|
|
3460
3459
|
}
|
|
3461
3460
|
)
|
|
3462
3461
|
]
|
|
@@ -3465,15 +3464,15 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3465
3464
|
/* @__PURE__ */ r(so, { open: f, title: "Variables", onClose: () => v(!1), children: /* @__PURE__ */ r(fo, { overrides: u, groups: Rn, onChange: g }) })
|
|
3466
3465
|
] }),
|
|
3467
3466
|
/* @__PURE__ */ b(lo, { children: [
|
|
3468
|
-
/* @__PURE__ */ r(
|
|
3467
|
+
/* @__PURE__ */ r(be, { label: "Intro offer", children: /* @__PURE__ */ r(
|
|
3469
3468
|
ro,
|
|
3470
3469
|
{
|
|
3471
3470
|
label: "Introductory offer",
|
|
3472
|
-
checked:
|
|
3471
|
+
checked: ve(le),
|
|
3473
3472
|
onChange: (y) => g((T) => ({ ...T, introductoryOfferEligible: y }))
|
|
3474
3473
|
}
|
|
3475
3474
|
) }),
|
|
3476
|
-
/* @__PURE__ */ b(
|
|
3475
|
+
/* @__PURE__ */ b(be, { label: "Theme", children: [
|
|
3477
3476
|
/* @__PURE__ */ r(
|
|
3478
3477
|
no,
|
|
3479
3478
|
{
|
|
@@ -3505,14 +3504,14 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3505
3504
|
}
|
|
3506
3505
|
)
|
|
3507
3506
|
] }),
|
|
3508
|
-
/* @__PURE__ */ r(
|
|
3509
|
-
/* @__PURE__ */ r(
|
|
3507
|
+
/* @__PURE__ */ r(Ot, {}),
|
|
3508
|
+
/* @__PURE__ */ r(be, { label: "Zoom", children: /* @__PURE__ */ b("div", { className: "sw-stepper", role: "group", "aria-label": "Zoom", children: [
|
|
3510
3509
|
/* @__PURE__ */ r(
|
|
3511
3510
|
"button",
|
|
3512
3511
|
{
|
|
3513
3512
|
type: "button",
|
|
3514
3513
|
"aria-label": "Zoom out",
|
|
3515
|
-
onClick: () =>
|
|
3514
|
+
onClick: () => A.current?.zoomStep(-1),
|
|
3516
3515
|
children: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M5 12h14" }) })
|
|
3517
3516
|
}
|
|
3518
3517
|
),
|
|
@@ -3523,47 +3522,47 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3523
3522
|
className: "min-w-12 px-2 font-mono text-xs tabular-nums",
|
|
3524
3523
|
"aria-label": "Fit to view",
|
|
3525
3524
|
"aria-pressed": D.fitted,
|
|
3526
|
-
onClick: () =>
|
|
3525
|
+
onClick: () => A.current?.fit(),
|
|
3527
3526
|
children: Dr(D.scale)
|
|
3528
3527
|
}
|
|
3529
3528
|
),
|
|
3530
|
-
/* @__PURE__ */ r("button", { type: "button", "aria-label": "Zoom in", onClick: () =>
|
|
3529
|
+
/* @__PURE__ */ r("button", { type: "button", "aria-label": "Zoom in", onClick: () => A.current?.zoomStep(1), children: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ r("path", { d: "M12 5v14M5 12h14" }) }) })
|
|
3531
3530
|
] }) }),
|
|
3532
|
-
/* @__PURE__ */ b(
|
|
3531
|
+
/* @__PURE__ */ b(be, { label: "Device", children: [
|
|
3533
3532
|
/* @__PURE__ */ r(
|
|
3534
|
-
|
|
3533
|
+
kt,
|
|
3535
3534
|
{
|
|
3536
3535
|
label: "Device",
|
|
3537
3536
|
value: a,
|
|
3538
3537
|
options: [
|
|
3539
|
-
...
|
|
3540
|
-
{ value:
|
|
3538
|
+
...Ae.map((y) => ({ value: y.id, label: y.name })),
|
|
3539
|
+
{ value: Tt, label: "Responsive" }
|
|
3541
3540
|
],
|
|
3542
3541
|
onChange: d
|
|
3543
3542
|
}
|
|
3544
3543
|
),
|
|
3545
3544
|
k && /* @__PURE__ */ b("span", { className: "flex items-center gap-1.5", children: [
|
|
3546
3545
|
/* @__PURE__ */ r(
|
|
3547
|
-
|
|
3546
|
+
$t,
|
|
3548
3547
|
{
|
|
3549
3548
|
label: "Preview width",
|
|
3550
|
-
value:
|
|
3549
|
+
value: R.width,
|
|
3551
3550
|
onCommit: (y) => p((T) => ({ ...T, width: y }))
|
|
3552
3551
|
}
|
|
3553
3552
|
),
|
|
3554
3553
|
/* @__PURE__ */ r("span", { className: "text-cream/55", children: "×" }),
|
|
3555
3554
|
/* @__PURE__ */ r(
|
|
3556
|
-
|
|
3555
|
+
$t,
|
|
3557
3556
|
{
|
|
3558
3557
|
label: "Preview height",
|
|
3559
|
-
value:
|
|
3558
|
+
value: R.height,
|
|
3560
3559
|
onCommit: (y) => p((T) => ({ ...T, height: y }))
|
|
3561
3560
|
}
|
|
3562
3561
|
)
|
|
3563
3562
|
] })
|
|
3564
3563
|
] }),
|
|
3565
|
-
N.length > 1 && /* @__PURE__ */ r(
|
|
3566
|
-
|
|
3564
|
+
N.length > 1 && /* @__PURE__ */ r(be, { label: "Locale", children: /* @__PURE__ */ r(
|
|
3565
|
+
kt,
|
|
3567
3566
|
{
|
|
3568
3567
|
label: "Locale",
|
|
3569
3568
|
value: i ?? "default",
|
|
@@ -3574,13 +3573,13 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3574
3573
|
onChange: (y) => c(y === "default" ? void 0 : y)
|
|
3575
3574
|
}
|
|
3576
3575
|
) }),
|
|
3577
|
-
/* @__PURE__ */ r(
|
|
3578
|
-
(
|
|
3576
|
+
/* @__PURE__ */ r(Ot, {}),
|
|
3577
|
+
(B || ge.length > 0) && /* @__PURE__ */ r(
|
|
3579
3578
|
Rr,
|
|
3580
3579
|
{
|
|
3581
3580
|
active: w,
|
|
3582
|
-
options:
|
|
3583
|
-
notice:
|
|
3581
|
+
options: ge,
|
|
3582
|
+
notice: ct,
|
|
3584
3583
|
onSelect: C
|
|
3585
3584
|
}
|
|
3586
3585
|
),
|
|
@@ -3594,22 +3593,22 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3594
3593
|
children: [
|
|
3595
3594
|
/* @__PURE__ */ r(xr, {}),
|
|
3596
3595
|
"Variables",
|
|
3597
|
-
|
|
3596
|
+
dt > 0 && /* @__PURE__ */ r("span", { className: "text-accent", children: dt })
|
|
3598
3597
|
]
|
|
3599
3598
|
}
|
|
3600
3599
|
)
|
|
3601
3600
|
] })
|
|
3602
3601
|
] });
|
|
3603
3602
|
}, Io = ({ origin: e, scheme: t }) => {
|
|
3604
|
-
const [n, s] = m.useState(
|
|
3603
|
+
const [n, s] = m.useState(xn), a = n ?? t, d = (p) => {
|
|
3605
3604
|
const l = window.prompt("Your app's URL scheme, so this can open it:", p)?.trim();
|
|
3606
3605
|
if (!(l === void 0 || l === ""))
|
|
3607
|
-
return s(l),
|
|
3606
|
+
return s(l), En(l), l;
|
|
3608
3607
|
}, h = (p) => {
|
|
3609
3608
|
if (a !== void 0) return;
|
|
3610
3609
|
p.preventDefault();
|
|
3611
3610
|
const o = d("");
|
|
3612
|
-
o !== void 0 && window.location.assign(
|
|
3611
|
+
o !== void 0 && window.location.assign(rt(o, e));
|
|
3613
3612
|
};
|
|
3614
3613
|
return /* @__PURE__ */ b("div", { className: "flex items-center gap-2", children: [
|
|
3615
3614
|
a !== void 0 && /* @__PURE__ */ r(
|
|
@@ -3629,13 +3628,13 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3629
3628
|
"a",
|
|
3630
3629
|
{
|
|
3631
3630
|
className: "sw-btn sw-btn--primary",
|
|
3632
|
-
href: a === void 0 ? "#" :
|
|
3631
|
+
href: a === void 0 ? "#" : rt(a, e),
|
|
3633
3632
|
onClick: h,
|
|
3634
3633
|
children: "Open In App"
|
|
3635
3634
|
}
|
|
3636
3635
|
)
|
|
3637
3636
|
] });
|
|
3638
|
-
},
|
|
3637
|
+
}, Ut = 390, _o = 844, ko = (e) => {
|
|
3639
3638
|
const [t, n] = m.useState(0);
|
|
3640
3639
|
return m.useLayoutEffect(() => {
|
|
3641
3640
|
const s = e.current;
|
|
@@ -3653,12 +3652,12 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3653
3652
|
onOpen: a,
|
|
3654
3653
|
href: d
|
|
3655
3654
|
}) => {
|
|
3656
|
-
const h = m.useRef(null), p = ko(h), o = p > 0 ? p /
|
|
3655
|
+
const h = m.useRef(null), p = ko(h), o = p > 0 ? p / Ut : 0, l = m.useMemo(Xn, []);
|
|
3657
3656
|
return /* @__PURE__ */ b(
|
|
3658
3657
|
"a",
|
|
3659
3658
|
{
|
|
3660
3659
|
className: "group block",
|
|
3661
|
-
href: d ??
|
|
3660
|
+
href: d ?? Z(e),
|
|
3662
3661
|
onClick: (i) => {
|
|
3663
3662
|
i.metaKey || i.ctrlKey || (i.preventDefault(), a());
|
|
3664
3663
|
},
|
|
@@ -3669,7 +3668,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3669
3668
|
className: "bg-panel relative aspect-[390/844] overflow-hidden rounded border border-cream/20 transition-colors group-hover:border-cream/35",
|
|
3670
3669
|
ref: h,
|
|
3671
3670
|
children: o > 0 && /* @__PURE__ */ r(
|
|
3672
|
-
|
|
3671
|
+
sn,
|
|
3673
3672
|
{
|
|
3674
3673
|
hostState: s,
|
|
3675
3674
|
delegate: l,
|
|
@@ -3678,7 +3677,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3678
3677
|
src: n,
|
|
3679
3678
|
loading: "lazy",
|
|
3680
3679
|
tabIndex: -1,
|
|
3681
|
-
width:
|
|
3680
|
+
width: Ut,
|
|
3682
3681
|
height: _o,
|
|
3683
3682
|
style: { transform: `scale(${o})` }
|
|
3684
3683
|
}
|
|
@@ -3698,7 +3697,7 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3698
3697
|
e.platforms.join(" · ")
|
|
3699
3698
|
] })
|
|
3700
3699
|
] }),
|
|
3701
|
-
t && /* @__PURE__ */ r("span", { className: "text-xs text-cream/55", children: t.updatedAt ? `Edited ${
|
|
3700
|
+
t && /* @__PURE__ */ r("span", { className: "text-xs text-cream/55", children: t.updatedAt ? `Edited ${kn(t.updatedAt)}` : "Not published" })
|
|
3702
3701
|
] }),
|
|
3703
3702
|
t?.paywallId && /* @__PURE__ */ r("span", { className: `text-xs ${t.active ? "text-accent" : "text-cream/55"}`, children: t.active ? "Active" : "Inactive" })
|
|
3704
3703
|
] })
|
|
@@ -3706,18 +3705,18 @@ const vn = "superwall-device-scheme", yn = () => {
|
|
|
3706
3705
|
}
|
|
3707
3706
|
);
|
|
3708
3707
|
};
|
|
3709
|
-
let
|
|
3708
|
+
let zt = 0;
|
|
3710
3709
|
const Ro = ({
|
|
3711
3710
|
source: e,
|
|
3712
3711
|
onOpen: t
|
|
3713
3712
|
}) => {
|
|
3714
|
-
const n =
|
|
3713
|
+
const n = lt() === "device", s = _n(e), [a, d] = m.useState({}), h = m.useMemo(Cn, [e]);
|
|
3715
3714
|
m.useEffect(() => {
|
|
3716
3715
|
if (!s) return;
|
|
3717
3716
|
let c = !1;
|
|
3718
3717
|
for (const u of e.surfaces)
|
|
3719
|
-
|
|
3720
|
-
c || d((f) => ({ ...f, [
|
|
3718
|
+
et(u).then((g) => {
|
|
3719
|
+
c || d((f) => ({ ...f, [Z(u)]: g }));
|
|
3721
3720
|
});
|
|
3722
3721
|
return () => {
|
|
3723
3722
|
c = !0;
|
|
@@ -3727,9 +3726,9 @@ const Ro = ({
|
|
|
3727
3726
|
m.useLayoutEffect(() => {
|
|
3728
3727
|
const c = l.current;
|
|
3729
3728
|
if (!c) return;
|
|
3730
|
-
c.scrollTop =
|
|
3729
|
+
c.scrollTop = zt;
|
|
3731
3730
|
const u = () => {
|
|
3732
|
-
|
|
3731
|
+
zt = c.scrollTop;
|
|
3733
3732
|
};
|
|
3734
3733
|
return c.addEventListener("scroll", u, { passive: !0 }), () => {
|
|
3735
3734
|
u(), c.removeEventListener("scroll", u);
|
|
@@ -3750,9 +3749,9 @@ const Ro = ({
|
|
|
3750
3749
|
)
|
|
3751
3750
|
};
|
|
3752
3751
|
}).filter((c) => c.all.length > 0);
|
|
3753
|
-
return /* @__PURE__ */ b(
|
|
3752
|
+
return /* @__PURE__ */ b(ne, { children: [
|
|
3754
3753
|
/* @__PURE__ */ r(
|
|
3755
|
-
|
|
3754
|
+
Sn,
|
|
3756
3755
|
{
|
|
3757
3756
|
title: e.title,
|
|
3758
3757
|
inset: !0,
|
|
@@ -3783,9 +3782,9 @@ const Ro = ({
|
|
|
3783
3782
|
Po,
|
|
3784
3783
|
{
|
|
3785
3784
|
surface: u,
|
|
3786
|
-
status: a[
|
|
3785
|
+
status: a[Z(u)],
|
|
3787
3786
|
previewSrc: e.previewUrl(u),
|
|
3788
|
-
hostState:
|
|
3787
|
+
hostState: In({
|
|
3789
3788
|
surface: u,
|
|
3790
3789
|
defaults: h,
|
|
3791
3790
|
sourceSamples: e.samples,
|
|
@@ -3794,9 +3793,9 @@ const Ro = ({
|
|
|
3794
3793
|
edited: {}
|
|
3795
3794
|
}),
|
|
3796
3795
|
onOpen: () => t(u),
|
|
3797
|
-
href: n ?
|
|
3796
|
+
href: n ? Z(u) : void 0
|
|
3798
3797
|
},
|
|
3799
|
-
|
|
3798
|
+
Z(u)
|
|
3800
3799
|
)) }),
|
|
3801
3800
|
c.surfaces.length === 0 && /* @__PURE__ */ r("span", { className: "block text-[0.8125rem] text-cream/45", children: `Nothing matches “${(p[c.kind] ?? "").trim()}”.` })
|
|
3802
3801
|
] }, c.kind)),
|
|
@@ -3839,8 +3838,8 @@ const Ro = ({
|
|
|
3839
3838
|
() => ({ href: h, navigate: () => p(h) }),
|
|
3840
3839
|
[h, p]
|
|
3841
3840
|
), l = Oo(e.surfaces, n);
|
|
3842
|
-
return /* @__PURE__ */ r(Bs, { mode: t, home: o, children: /* @__PURE__ */ r(Tn, { children: l ? /* @__PURE__ */ r(Mo, { source: e, surface: l, samples: a }) : /* @__PURE__ */ r(Ro, { source: e, onOpen: (i) => p(
|
|
3843
|
-
},
|
|
3841
|
+
return /* @__PURE__ */ r(Bs, { mode: t, home: o, children: /* @__PURE__ */ r(Tn, { children: l ? /* @__PURE__ */ r(Mo, { source: e, surface: l, samples: a }) : /* @__PURE__ */ r(Ro, { source: e, onOpen: (i) => p(Z(i)) }) }) });
|
|
3842
|
+
}, Ao = (e) => typeof e == "object" && e !== null && !Array.isArray(e) && Object.values(e).every((t) => typeof t == "string"), ie = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Pe = (e) => Array.isArray(e) && e.every((t) => typeof t == "string"), Lo = (e) => {
|
|
3844
3843
|
if (!ie(e)) return;
|
|
3845
3844
|
const t = e.kind === "paywall" || e.kind === "funnel" ? e.kind : void 0;
|
|
3846
3845
|
if (!t || typeof e.id != "string") return;
|
|
@@ -3851,10 +3850,10 @@ const Ro = ({
|
|
|
3851
3850
|
kind: t,
|
|
3852
3851
|
id: e.id,
|
|
3853
3852
|
...typeof e.project == "string" ? { project: e.project } : {},
|
|
3854
|
-
routes:
|
|
3855
|
-
products:
|
|
3856
|
-
locales:
|
|
3857
|
-
...
|
|
3853
|
+
routes: Pe(e.routes) ? e.routes : [],
|
|
3854
|
+
products: Ao(e.products) ? e.products : {},
|
|
3855
|
+
locales: Pe(e.locales) ? e.locales : [],
|
|
3856
|
+
...Pe(e.platforms) ? { platforms: e.platforms } : {},
|
|
3858
3857
|
...n === void 0 ? {} : { presentation: n },
|
|
3859
3858
|
paywallId: typeof e.paywallId == "string" ? e.paywallId : void 0,
|
|
3860
3859
|
...s === void 0 ? {} : { origin: s }
|
|
@@ -3878,13 +3877,13 @@ const Ro = ({
|
|
|
3878
3877
|
}, Yo = (e) => {
|
|
3879
3878
|
if (!ie(e))
|
|
3880
3879
|
throw new Error("project payload is not an object");
|
|
3881
|
-
const t = Array.isArray(e.surfaces) ? e.surfaces.map(
|
|
3880
|
+
const t = Array.isArray(e.surfaces) ? e.surfaces.map(Lo).filter((d) => d !== void 0) : [], n = ie(e.capabilities) ? e.capabilities : {}, s = ie(e.samples) ? e.samples : {}, a = (d) => ie(s[d]) ? s[d] : {};
|
|
3882
3881
|
return {
|
|
3883
3882
|
title: typeof e.title == "string" ? e.title : "superwall",
|
|
3884
3883
|
scheme: typeof e.scheme == "string" ? e.scheme : void 0,
|
|
3885
3884
|
networkOrigin: typeof e.networkOrigin == "string" ? e.networkOrigin : void 0,
|
|
3886
3885
|
surfaces: t,
|
|
3887
|
-
diagnostics:
|
|
3886
|
+
diagnostics: Pe(e.diagnostics) ? e.diagnostics : [],
|
|
3888
3887
|
samples: {
|
|
3889
3888
|
device: a("device"),
|
|
3890
3889
|
user: a("user"),
|
|
@@ -3894,40 +3893,40 @@ const Ro = ({
|
|
|
3894
3893
|
};
|
|
3895
3894
|
};
|
|
3896
3895
|
export {
|
|
3897
|
-
|
|
3896
|
+
Nn as DEFAULT_DEVICE_ID,
|
|
3898
3897
|
us as DeviceFrame,
|
|
3899
3898
|
Vs as DownloadScreenshot,
|
|
3900
|
-
|
|
3901
|
-
|
|
3899
|
+
sn as HostedIframe,
|
|
3900
|
+
As as PaywallToasts,
|
|
3902
3901
|
to as PreviewOnDevice,
|
|
3903
|
-
|
|
3902
|
+
Ae as STUDIO_DEVICES,
|
|
3904
3903
|
no as Segmented,
|
|
3905
|
-
|
|
3904
|
+
kt as Select,
|
|
3906
3905
|
Wo as StudioApp,
|
|
3907
3906
|
Bs as StudioHostProvider,
|
|
3908
3907
|
Tn as StudioShell,
|
|
3909
3908
|
Mo as SurfaceEditor,
|
|
3910
3909
|
Ro as SurfaceList,
|
|
3911
3910
|
ro as Switch,
|
|
3912
|
-
|
|
3913
|
-
|
|
3911
|
+
Ls as Tooltip,
|
|
3912
|
+
Sn as TopBar,
|
|
3914
3913
|
fo as VariablesPanel,
|
|
3915
3914
|
Bo as buildPreviewPath,
|
|
3916
|
-
|
|
3915
|
+
Bt as createHostState,
|
|
3917
3916
|
Rs as createStudioDelegate,
|
|
3918
|
-
|
|
3917
|
+
rt as devServerLink,
|
|
3919
3918
|
So as deviceById,
|
|
3920
3919
|
$n as diffHostState,
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3920
|
+
_n as hasActions,
|
|
3921
|
+
ve as hasIntroductoryOffer,
|
|
3922
|
+
In as hostStateFor,
|
|
3923
|
+
at as hostedUrl,
|
|
3925
3924
|
Yo as parseProjectPayload,
|
|
3926
3925
|
Xn as silentDelegate,
|
|
3927
3926
|
Ho as snapshotPreviewUrl,
|
|
3928
|
-
|
|
3929
|
-
|
|
3927
|
+
Cn as studioDefaults,
|
|
3928
|
+
Z as surfacePath,
|
|
3930
3929
|
Os as useStudioDelegate,
|
|
3931
3930
|
Hs as useStudioHome,
|
|
3932
|
-
|
|
3931
|
+
lt as useStudioMode
|
|
3933
3932
|
};
|