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