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