@vuetify/one 2.6.4 → 2.6.6
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/{auth-CcaMo2zh.js → auth-Bwo9TDIn.js} +243 -211
- package/dist/index.d.ts +21 -3
- package/dist/index.js +664 -625
- package/dist/stores/auth.js +2 -1
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useRoute as
|
|
5
|
-
const _ =
|
|
6
|
-
const e =
|
|
1
|
+
import { merge as O } from "lodash-es";
|
|
2
|
+
import { defineStore as L } from "pinia";
|
|
3
|
+
import { ref as T, reactive as z, watch as I, toRefs as M, computed as m, shallowRef as U, nextTick as X } from "vue";
|
|
4
|
+
import { useRoute as Y, useRouter as J } from "vue-router";
|
|
5
|
+
const _ = L("queue", () => {
|
|
6
|
+
const e = T([]);
|
|
7
7
|
function s(o) {
|
|
8
|
-
const
|
|
9
|
-
e.value.push(
|
|
8
|
+
const c = typeof o == "string" ? { text: o } : o;
|
|
9
|
+
e.value.push(c);
|
|
10
10
|
}
|
|
11
11
|
function t(o) {
|
|
12
12
|
s({
|
|
@@ -21,55 +21,14 @@ const _ = $("queue", () => {
|
|
|
21
21
|
show: s,
|
|
22
22
|
showError: t
|
|
23
23
|
};
|
|
24
|
-
}),
|
|
25
|
-
state: () => ({
|
|
26
|
-
url: ""
|
|
27
|
-
}),
|
|
28
|
-
actions: {
|
|
29
|
-
async fetch(e, s = {}) {
|
|
30
|
-
const t = await fetch(`${this.url}${e}`, {
|
|
31
|
-
credentials: "include",
|
|
32
|
-
...s
|
|
33
|
-
});
|
|
34
|
-
if (!t.ok)
|
|
35
|
-
throw new Error(await t.text());
|
|
36
|
-
return t.status === 204 ? {} : t.json();
|
|
37
|
-
},
|
|
38
|
-
async post(e, s, t = {}) {
|
|
39
|
-
return this.fetch(e, {
|
|
40
|
-
method: "POST",
|
|
41
|
-
headers: {
|
|
42
|
-
"Content-Type": "application/json"
|
|
43
|
-
},
|
|
44
|
-
body: JSON.stringify(s),
|
|
45
|
-
...t
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
async form(e, s, t = {}) {
|
|
49
|
-
return this.fetch(e, {
|
|
50
|
-
method: "POST",
|
|
51
|
-
body: s,
|
|
52
|
-
...t
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
async get(e, s = {}) {
|
|
56
|
-
return this.fetch(e, s);
|
|
57
|
-
},
|
|
58
|
-
async delete(e, s = {}) {
|
|
59
|
-
return this.fetch(e, {
|
|
60
|
-
method: "DELETE",
|
|
61
|
-
...s
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}), Y = [
|
|
24
|
+
}), G = [
|
|
66
25
|
(e) => (e.v || (e.pwaRefresh = !0, typeof e.api == "boolean" && (e.api = e.api ? "inline" : "link-only"), typeof e.rtl == "boolean" && (e.direction = e.rtl ? "rtl" : "ltr", delete e.rtl), typeof e.theme == "object" && (e.mixedTheme = e.theme.mixed, e.theme = e.theme.system ? "system" : e.theme.dark ? "dark" : "light"), Array.isArray(e.notifications) && (e.notifications = { read: e.notifications }), typeof e.last == "object" && (e.notifications = e.notifications || {}, e.notifications.last = e.last, delete e.last), e.v = 1), e),
|
|
67
26
|
(e) => (e.v === 1 && (Array.isArray(e.composition) && (e.composition = "composition"), Array.isArray(e.notifications?.last?.banner) || (e.notifications = e.notifications || {}, e.notifications.last = e.notifications.last || {}, e.notifications.last.banner = []), e.v = 2), e),
|
|
68
27
|
(e) => (e.v === 2 && (e.syncSettings = !0, e.disableAds = !1, e.v = 3), e),
|
|
69
28
|
(e) => (e.v === 3 && (e.quickbar = !1, e.v = 4), e),
|
|
70
29
|
(e) => (e.v === 4 && (e.suits = { show: !1, elements: ["app-bar"], suit: "" }, e.notifications = e.notifications || {}, e.notifications.banners = !0, e.v = 5), e)
|
|
71
30
|
];
|
|
72
|
-
function
|
|
31
|
+
function K(e) {
|
|
73
32
|
return {
|
|
74
33
|
version: 6,
|
|
75
34
|
ecosystem: {
|
|
@@ -128,12 +87,24 @@ function G(e) {
|
|
|
128
87
|
}
|
|
129
88
|
};
|
|
130
89
|
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
90
|
+
function F(e) {
|
|
91
|
+
return {
|
|
92
|
+
...e,
|
|
93
|
+
version: 7,
|
|
94
|
+
ecosystem: {
|
|
95
|
+
...e.ecosystem,
|
|
96
|
+
mcp: {
|
|
97
|
+
seen: !1
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function Z(e) {
|
|
103
|
+
const s = G.reduce((o, c) => c(o), e), t = K(s);
|
|
104
|
+
return F(t);
|
|
134
105
|
}
|
|
135
|
-
const W = typeof window < "u",
|
|
136
|
-
version:
|
|
106
|
+
const W = typeof window < "u", E = {
|
|
107
|
+
version: 7,
|
|
137
108
|
ecosystem: {
|
|
138
109
|
bin: {
|
|
139
110
|
wordWrap: !1
|
|
@@ -155,6 +126,9 @@ const W = typeof window < "u", P = {
|
|
|
155
126
|
favorites: [],
|
|
156
127
|
slashSearch: !1,
|
|
157
128
|
railDrawer: !1
|
|
129
|
+
},
|
|
130
|
+
mcp: {
|
|
131
|
+
seen: !1
|
|
158
132
|
}
|
|
159
133
|
},
|
|
160
134
|
one: {
|
|
@@ -188,26 +162,33 @@ const W = typeof window < "u", P = {
|
|
|
188
162
|
sync: !0,
|
|
189
163
|
devmode: !1
|
|
190
164
|
}
|
|
191
|
-
},
|
|
192
|
-
const e = z(structuredClone(
|
|
193
|
-
|
|
165
|
+
}, D = L("user", () => {
|
|
166
|
+
const e = z(structuredClone(E));
|
|
167
|
+
I(e, t, { deep: !0 });
|
|
194
168
|
function s() {
|
|
195
169
|
if (!W)
|
|
196
170
|
return;
|
|
197
|
-
const
|
|
198
|
-
if (
|
|
171
|
+
const c = localStorage.getItem("vuetify@user");
|
|
172
|
+
if (c)
|
|
199
173
|
try {
|
|
200
|
-
const n = JSON.parse(
|
|
201
|
-
if (n.version >=
|
|
202
|
-
const
|
|
203
|
-
version:
|
|
204
|
-
ecosystem:
|
|
205
|
-
one:
|
|
174
|
+
const n = JSON.parse(c);
|
|
175
|
+
if (n.version >= 7) {
|
|
176
|
+
const a = {
|
|
177
|
+
version: 7,
|
|
178
|
+
ecosystem: O(structuredClone(E.ecosystem), n.ecosystem || {}),
|
|
179
|
+
one: O(structuredClone(E.one), n.one || {})
|
|
180
|
+
};
|
|
181
|
+
Object.assign(e, a);
|
|
182
|
+
} else if (n.version === 6) {
|
|
183
|
+
const a = F(n), d = {
|
|
184
|
+
version: 7,
|
|
185
|
+
ecosystem: O(structuredClone(E.ecosystem), a.ecosystem || {}),
|
|
186
|
+
one: O(structuredClone(E.one), a.one || {})
|
|
206
187
|
};
|
|
207
|
-
Object.assign(e,
|
|
188
|
+
Object.assign(e, d);
|
|
208
189
|
} else {
|
|
209
|
-
const
|
|
210
|
-
Object.assign(e,
|
|
190
|
+
const a = Z(n);
|
|
191
|
+
Object.assign(e, a);
|
|
211
192
|
}
|
|
212
193
|
t();
|
|
213
194
|
} catch (n) {
|
|
@@ -218,45 +199,86 @@ const W = typeof window < "u", P = {
|
|
|
218
199
|
W && localStorage.setItem("vuetify@user", JSON.stringify(e, null, 2));
|
|
219
200
|
}
|
|
220
201
|
function o() {
|
|
221
|
-
W && (Object.assign(e, structuredClone(
|
|
202
|
+
W && (Object.assign(e, structuredClone(E)), t());
|
|
222
203
|
}
|
|
223
204
|
return s(), {
|
|
224
|
-
...
|
|
205
|
+
...M(e),
|
|
225
206
|
load: s,
|
|
226
207
|
save: t,
|
|
227
208
|
reset: o
|
|
228
209
|
};
|
|
210
|
+
}), H = L("http", {
|
|
211
|
+
state: () => ({
|
|
212
|
+
url: ""
|
|
213
|
+
}),
|
|
214
|
+
actions: {
|
|
215
|
+
async fetch(e, s = {}) {
|
|
216
|
+
const t = await fetch(`${this.url}${e}`, {
|
|
217
|
+
credentials: "include",
|
|
218
|
+
...s
|
|
219
|
+
});
|
|
220
|
+
if (!t.ok)
|
|
221
|
+
throw new Error(await t.text());
|
|
222
|
+
return t.status === 204 ? {} : t.json();
|
|
223
|
+
},
|
|
224
|
+
async post(e, s, t = {}) {
|
|
225
|
+
return this.fetch(e, {
|
|
226
|
+
method: "POST",
|
|
227
|
+
headers: {
|
|
228
|
+
"Content-Type": "application/json"
|
|
229
|
+
},
|
|
230
|
+
body: JSON.stringify(s),
|
|
231
|
+
...t
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
async form(e, s, t = {}) {
|
|
235
|
+
return this.fetch(e, {
|
|
236
|
+
method: "POST",
|
|
237
|
+
body: s,
|
|
238
|
+
...t
|
|
239
|
+
});
|
|
240
|
+
},
|
|
241
|
+
async get(e, s = {}) {
|
|
242
|
+
return this.fetch(e, s);
|
|
243
|
+
},
|
|
244
|
+
async delete(e, s = {}) {
|
|
245
|
+
return this.fetch(e, {
|
|
246
|
+
method: "DELETE",
|
|
247
|
+
...s
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
229
251
|
});
|
|
230
|
-
function
|
|
231
|
-
const e =
|
|
232
|
-
return
|
|
252
|
+
function Q() {
|
|
253
|
+
const e = Y();
|
|
254
|
+
return m(
|
|
233
255
|
() => e.query
|
|
234
256
|
);
|
|
235
257
|
}
|
|
236
|
-
const
|
|
237
|
-
const e =
|
|
238
|
-
if (!
|
|
258
|
+
const V = L("one", () => {
|
|
259
|
+
const e = Q(), s = J(), t = B(), o = H(), c = _(), n = U(!1), a = U(!1), d = T(null), v = T([]), g = m(() => e.value.session_id), A = m(() => d.value?.items[0].plan.interval), h = m(() => d.value?.items[0].plan.type), k = T([]), y = m(() => t.user?.sponsorships.find((r) => r.platform === "stripe" && r.tierName.startsWith("sub_"))), R = m(() => !!y.value?.tierName), u = m(() => t.user?.sponsorships.reduce((r, p) => {
|
|
260
|
+
if (!p.isActive || p.interval === "once")
|
|
239
261
|
return r;
|
|
240
|
-
const b =
|
|
262
|
+
const b = p.interval === "month" ? p.amount : p.amount / 12;
|
|
241
263
|
return r + b / 100;
|
|
242
|
-
}, 0) ?? 0), i =
|
|
243
|
-
|
|
244
|
-
r && await
|
|
245
|
-
}, { immediate: !0 }),
|
|
264
|
+
}, 0) ?? 0), i = m(() => t.user?.sponsorships.find((r) => r.tierName.startsWith("sub_") && r.isActive)), f = m(() => t.user?.sponsorships.find((r) => r.platform === "github" && r.isActive)), l = m(() => t.user?.sponsorships.find((r) => r.platform === "discord" && r.isActive)), $ = m(() => t.user?.identities.find((r) => r.provider === "shopify")), N = m(() => !o.url || t.user?.isAdmin || y.value?.isActive || k.value.some((r) => ["one", "one/team"].includes(r)));
|
|
265
|
+
I(a, w), I(g, async (r) => {
|
|
266
|
+
r && await j();
|
|
267
|
+
}, { immediate: !0 }), I(e, (r) => {
|
|
246
268
|
if (r.one !== "subscribe" || t.user)
|
|
247
269
|
return;
|
|
248
270
|
t.dialog = !0;
|
|
249
|
-
const
|
|
250
|
-
b && (t.dialog = !1,
|
|
271
|
+
const p = I(() => t.user, (b) => {
|
|
272
|
+
b && (t.dialog = !1, p());
|
|
251
273
|
});
|
|
252
274
|
}, { immediate: !0 });
|
|
253
|
-
async function
|
|
275
|
+
async function j() {
|
|
254
276
|
try {
|
|
255
|
-
n.value = !0, await o.post("/one/activate", { sessionId: g.value }), await t.verify(!0), await
|
|
256
|
-
const r = new URL(window.location.href),
|
|
257
|
-
|
|
277
|
+
n.value = !0, await o.post("/one/activate", { sessionId: g.value }), await t.verify(!0), await q();
|
|
278
|
+
const r = new URL(window.location.href), p = r.searchParams;
|
|
279
|
+
p.delete("session_id"), p.delete("team"), history.pushState(null, "", r.toString());
|
|
258
280
|
} catch (r) {
|
|
259
|
-
|
|
281
|
+
c.showError(r?.message ?? "Error activating subscription, Please contact support");
|
|
260
282
|
} finally {
|
|
261
283
|
n.value = !1;
|
|
262
284
|
}
|
|
@@ -264,44 +286,44 @@ const Q = $("one", () => {
|
|
|
264
286
|
async function S() {
|
|
265
287
|
window.open(`${o.url}/one/manage`, "_blank");
|
|
266
288
|
}
|
|
267
|
-
async function
|
|
289
|
+
async function C(r, p) {
|
|
268
290
|
n.value = !0;
|
|
269
291
|
const b = new URL("/one/subscribe", o.url);
|
|
270
|
-
b.searchParams.set("interval", r), b.searchParams.set("type",
|
|
292
|
+
b.searchParams.set("interval", r), b.searchParams.set("type", p), window.location.href = b.toString();
|
|
271
293
|
}
|
|
272
|
-
async function
|
|
273
|
-
if (
|
|
294
|
+
async function x() {
|
|
295
|
+
if (y.value)
|
|
274
296
|
try {
|
|
275
297
|
n.value = !0, await o.post(
|
|
276
|
-
`/one/cancel?subscriptionId=${
|
|
298
|
+
`/one/cancel?subscriptionId=${y.value?.tierName}`
|
|
277
299
|
), await t.verify(!0);
|
|
278
300
|
} catch (r) {
|
|
279
|
-
|
|
301
|
+
c.showError(r?.message ?? "Error cancelling subscription, Please contact support");
|
|
280
302
|
} finally {
|
|
281
303
|
n.value = !1;
|
|
282
304
|
}
|
|
283
305
|
}
|
|
284
|
-
async function
|
|
285
|
-
if (
|
|
306
|
+
async function P(r, p) {
|
|
307
|
+
if (y.value)
|
|
286
308
|
try {
|
|
287
309
|
n.value = !0, await o.post("/one/modify", {
|
|
288
|
-
subscriptionId:
|
|
310
|
+
subscriptionId: y.value.tierName,
|
|
289
311
|
interval: r,
|
|
290
|
-
type:
|
|
312
|
+
type: p
|
|
291
313
|
}), await t.verify(!0);
|
|
292
314
|
} catch (b) {
|
|
293
|
-
|
|
315
|
+
c.showError(b?.message ?? "Error modifying subscription");
|
|
294
316
|
} finally {
|
|
295
317
|
n.value = !1;
|
|
296
318
|
}
|
|
297
319
|
}
|
|
298
|
-
async function
|
|
320
|
+
async function q() {
|
|
299
321
|
try {
|
|
300
322
|
n.value = !0;
|
|
301
323
|
const r = await o.get("/one/info");
|
|
302
|
-
return d.value = r.subscription,
|
|
324
|
+
return d.value = r.subscription, v.value = r.invoices, r;
|
|
303
325
|
} catch (r) {
|
|
304
|
-
|
|
326
|
+
c.showError(r?.message ?? "Error fetching subscription info");
|
|
305
327
|
} finally {
|
|
306
328
|
n.value = !1;
|
|
307
329
|
}
|
|
@@ -316,207 +338,217 @@ const Q = $("one", () => {
|
|
|
316
338
|
}
|
|
317
339
|
return {
|
|
318
340
|
info: d,
|
|
319
|
-
interval:
|
|
320
|
-
subscriptionType:
|
|
321
|
-
access:
|
|
322
|
-
invoices:
|
|
341
|
+
interval: A,
|
|
342
|
+
subscriptionType: h,
|
|
343
|
+
access: k,
|
|
344
|
+
invoices: v,
|
|
323
345
|
sessionId: g,
|
|
324
|
-
subscription:
|
|
325
|
-
monthlyTotal:
|
|
326
|
-
hasBilling:
|
|
346
|
+
subscription: y,
|
|
347
|
+
monthlyTotal: u,
|
|
348
|
+
hasBilling: R,
|
|
327
349
|
isLoading: n,
|
|
328
|
-
isOpen:
|
|
350
|
+
isOpen: a,
|
|
329
351
|
isSubscriber: N,
|
|
330
|
-
github:
|
|
331
|
-
discord:
|
|
332
|
-
shopify:
|
|
352
|
+
github: f,
|
|
353
|
+
discord: l,
|
|
354
|
+
shopify: $,
|
|
333
355
|
one: i,
|
|
334
|
-
activate:
|
|
335
|
-
cancel:
|
|
356
|
+
activate: j,
|
|
357
|
+
cancel: x,
|
|
336
358
|
manage: S,
|
|
337
|
-
modify:
|
|
359
|
+
modify: P,
|
|
338
360
|
resetQuery: w,
|
|
339
|
-
subscribe:
|
|
340
|
-
subscriptionInfo:
|
|
361
|
+
subscribe: C,
|
|
362
|
+
subscriptionInfo: q
|
|
341
363
|
};
|
|
342
|
-
}),
|
|
343
|
-
const e =
|
|
344
|
-
() =>
|
|
364
|
+
}), ee = L("team", () => {
|
|
365
|
+
const e = Q(), s = B(), t = V(), o = H(), c = _(), n = U(!1), a = T(null), d = T(!1), v = m(() => e.value.invite), g = m(
|
|
366
|
+
() => a.value ? t.access?.some((u) => ["one/team", "snips/team"].includes(u)) : !1
|
|
345
367
|
);
|
|
346
|
-
|
|
347
|
-
if (
|
|
368
|
+
I(v, async () => {
|
|
369
|
+
if (v.value) {
|
|
348
370
|
s.user || (s.dialog = !0);
|
|
349
371
|
try {
|
|
350
372
|
n.value = !0;
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
} catch (
|
|
354
|
-
|
|
373
|
+
const u = await o.get(`/one/team/${v.value}`);
|
|
374
|
+
a.value = u.team, d.value = !0;
|
|
375
|
+
} catch (u) {
|
|
376
|
+
y(), c.showError(u.message);
|
|
355
377
|
} finally {
|
|
356
378
|
n.value = !1;
|
|
357
379
|
}
|
|
358
380
|
}
|
|
359
381
|
}, { immediate: !0 });
|
|
360
|
-
async function
|
|
382
|
+
async function A(u) {
|
|
361
383
|
try {
|
|
362
|
-
if (n.value = !0, !
|
|
384
|
+
if (n.value = !0, !a.value)
|
|
363
385
|
return;
|
|
364
|
-
await o.post("/one/team/remove", { userId:
|
|
386
|
+
await o.post("/one/team/remove", { userId: u }), a.value.members = a.value.members.filter((i) => i.id !== u);
|
|
365
387
|
} catch (i) {
|
|
366
|
-
|
|
388
|
+
c.showError(i?.message ?? "Error removing user from team");
|
|
367
389
|
} finally {
|
|
368
390
|
n.value = !1;
|
|
369
391
|
}
|
|
370
392
|
}
|
|
371
|
-
async function
|
|
393
|
+
async function h() {
|
|
372
394
|
try {
|
|
373
|
-
n.value = !0, await o.post("/one/team/leave", { teamId:
|
|
374
|
-
} catch (
|
|
375
|
-
|
|
395
|
+
n.value = !0, await o.post("/one/team/leave", { teamId: a.value?.id }), await s.verify(!0);
|
|
396
|
+
} catch (u) {
|
|
397
|
+
c.showError(u?.message ?? "Error leaving team");
|
|
376
398
|
} finally {
|
|
377
399
|
n.value = !1;
|
|
378
400
|
}
|
|
379
401
|
}
|
|
380
|
-
async function
|
|
402
|
+
async function k() {
|
|
381
403
|
try {
|
|
382
|
-
n.value = !0, await o.post("/one/team/join", { inviteCode:
|
|
383
|
-
} catch (
|
|
384
|
-
|
|
404
|
+
n.value = !0, await o.post("/one/team/join", { inviteCode: v.value }), await s.verify(!0), y();
|
|
405
|
+
} catch (u) {
|
|
406
|
+
c.showError(u?.message ?? "Error joining team");
|
|
385
407
|
} finally {
|
|
386
408
|
n.value = !1;
|
|
387
409
|
}
|
|
388
410
|
}
|
|
389
|
-
function
|
|
411
|
+
function y() {
|
|
390
412
|
d.value = !1;
|
|
391
|
-
const
|
|
392
|
-
|
|
413
|
+
const u = new URL(window.location.href);
|
|
414
|
+
u.searchParams.delete("invite"), window.history.replaceState({}, "", u.toString());
|
|
393
415
|
}
|
|
394
|
-
const
|
|
416
|
+
const R = m(() => s.user?.id === s.user?.team?.owner.id);
|
|
395
417
|
return {
|
|
396
|
-
team:
|
|
418
|
+
team: a,
|
|
397
419
|
teamInviteDialog: d,
|
|
398
|
-
teamInviteCode:
|
|
420
|
+
teamInviteCode: v,
|
|
399
421
|
hasTeamAccess: g,
|
|
400
|
-
isTeamOwner:
|
|
422
|
+
isTeamOwner: R,
|
|
401
423
|
isLoading: n,
|
|
402
|
-
removeFromTeam:
|
|
403
|
-
leaveTeam:
|
|
404
|
-
joinTeam:
|
|
405
|
-
clearTeamQuery:
|
|
424
|
+
removeFromTeam: A,
|
|
425
|
+
leaveTeam: h,
|
|
426
|
+
joinTeam: k,
|
|
427
|
+
clearTeamQuery: y
|
|
406
428
|
};
|
|
407
|
-
}), B =
|
|
408
|
-
const e =
|
|
409
|
-
let g = !!
|
|
410
|
-
|
|
429
|
+
}), B = L("auth", () => {
|
|
430
|
+
const e = T(!1), s = T(null), t = H(), o = D(), c = J(), n = U(!1), a = V(), d = ee(), v = _();
|
|
431
|
+
let g = !!u();
|
|
432
|
+
I(s, (i) => {
|
|
411
433
|
if (!i?.settings)
|
|
412
434
|
return;
|
|
413
|
-
const
|
|
414
|
-
JSON.stringify(i.settings, null, 2)
|
|
435
|
+
const f = localStorage.getItem("vuetify@user") || "{}";
|
|
436
|
+
if (JSON.stringify(i.settings, null, 2) === f)
|
|
437
|
+
return;
|
|
438
|
+
g = !0;
|
|
439
|
+
let l = i.settings;
|
|
440
|
+
l.version === 6 && (l = F(l));
|
|
441
|
+
const $ = {
|
|
442
|
+
version: 7,
|
|
443
|
+
ecosystem: O(structuredClone(E.ecosystem), l.ecosystem || {}),
|
|
444
|
+
one: O(structuredClone(E.one), l.one || {})
|
|
445
|
+
};
|
|
446
|
+
Object.assign(o, $);
|
|
415
447
|
}), o.$subscribe(() => {
|
|
416
|
-
g ||
|
|
448
|
+
g || A(), g = !1;
|
|
417
449
|
});
|
|
418
|
-
async function
|
|
419
|
-
if (await
|
|
450
|
+
async function A() {
|
|
451
|
+
if (await X(), !(!s.value || !o.one.sync))
|
|
420
452
|
try {
|
|
421
|
-
await t.post("/user/settings", { settings: o.$state }), await
|
|
453
|
+
await t.post("/user/settings", { settings: o.$state }), await h(!0);
|
|
422
454
|
} catch (i) {
|
|
423
|
-
|
|
455
|
+
v.showError(i?.message ?? "Error syncing settings");
|
|
424
456
|
}
|
|
425
457
|
}
|
|
426
|
-
async function
|
|
427
|
-
if (
|
|
428
|
-
return
|
|
458
|
+
async function h(i = !1) {
|
|
459
|
+
if (h.promise)
|
|
460
|
+
return h.promise;
|
|
429
461
|
if (!i && !document.cookie.includes("sx=1") && location.hostname.match(/([^.]+\.[^.]+)$/)?.[1] === new URL(t.url).hostname.match(/([^.]+\.[^.]+)$/)?.[1]) {
|
|
430
462
|
s.value = null;
|
|
431
463
|
return;
|
|
432
464
|
}
|
|
433
|
-
n.value = !0,
|
|
465
|
+
n.value = !0, h.promise = fetch(`${t.url}/auth/verify`, {
|
|
434
466
|
credentials: "include",
|
|
435
467
|
cache: i ? "reload" : void 0
|
|
436
468
|
}).then(
|
|
437
|
-
async (
|
|
438
|
-
if (
|
|
439
|
-
const
|
|
440
|
-
s.value =
|
|
469
|
+
async (f) => {
|
|
470
|
+
if (f.ok || f.status === 401) {
|
|
471
|
+
const l = await f.json();
|
|
472
|
+
s.value = l.user, a.access = l.access, d.team = l.user?.team;
|
|
441
473
|
} else
|
|
442
|
-
console.error(
|
|
474
|
+
console.error(f.statusText);
|
|
443
475
|
},
|
|
444
476
|
() => {
|
|
445
477
|
}
|
|
446
478
|
).finally(() => {
|
|
447
|
-
n.value = !1,
|
|
479
|
+
n.value = !1, h.promise = null;
|
|
448
480
|
});
|
|
449
481
|
}
|
|
450
|
-
|
|
451
|
-
async function
|
|
482
|
+
h.promise = null;
|
|
483
|
+
async function k(i = "github") {
|
|
452
484
|
n.value = !0;
|
|
453
|
-
const
|
|
485
|
+
const f = `${t.url}/auth/${i}/redirect`;
|
|
454
486
|
if (i === "shopify") {
|
|
455
|
-
window.location.assign(
|
|
487
|
+
window.location.assign(f + "?next=" + encodeURIComponent(window.location.href));
|
|
456
488
|
return;
|
|
457
489
|
}
|
|
458
|
-
const
|
|
490
|
+
const l = 400, $ = 600, N = window.screenX + (window.innerWidth - l) / 2, j = window.screenY + (window.innerHeight - $) / 2, S = window.open(
|
|
459
491
|
"",
|
|
460
492
|
"vuetify:authorize:popup",
|
|
461
|
-
`popup,left=${N},top=${
|
|
493
|
+
`popup,left=${N},top=${j},width=${l},height=${$},resizable`
|
|
462
494
|
);
|
|
463
495
|
if (!S) {
|
|
464
496
|
console.error("Failed to open popup");
|
|
465
497
|
return;
|
|
466
498
|
}
|
|
467
|
-
S.location.href =
|
|
468
|
-
let
|
|
469
|
-
function
|
|
470
|
-
w.origin === t.url && w.data?.type === "auth-response" && (w.data.status === "success" ? (s.value || localStorage.setItem("vuetify@lastLoginProvider", i), s.value = w.data.body.user,
|
|
499
|
+
S.location.href = f;
|
|
500
|
+
let C = -1, x = -1;
|
|
501
|
+
function P(w) {
|
|
502
|
+
w.origin === t.url && w.data?.type === "auth-response" && (w.data.status === "success" ? (s.value || localStorage.setItem("vuetify@lastLoginProvider", i), s.value = w.data.body.user, a.access = w.data.body.access, d.team = w.data.body.user?.team, A()) : console.error(w.data.message), q());
|
|
471
503
|
}
|
|
472
|
-
function
|
|
473
|
-
window.removeEventListener("message",
|
|
504
|
+
function q() {
|
|
505
|
+
window.removeEventListener("message", P), window.clearInterval(C), window.clearTimeout(x), S?.close(), n.value = !1;
|
|
474
506
|
}
|
|
475
|
-
window.addEventListener("message",
|
|
476
|
-
!S || S.closed ? (console.error("Auth popup closed"),
|
|
477
|
-
}, 1e3),
|
|
478
|
-
|
|
507
|
+
window.addEventListener("message", P), C = window.setInterval(() => {
|
|
508
|
+
!S || S.closed ? (console.error("Auth popup closed"), q()) : S.postMessage({ type: "auth-request" }, "*");
|
|
509
|
+
}, 1e3), x = window.setTimeout(() => {
|
|
510
|
+
q(), console.error("Auth timed out");
|
|
479
511
|
}, 120 * 1e3);
|
|
480
512
|
}
|
|
481
|
-
async function
|
|
513
|
+
async function y(i) {
|
|
482
514
|
n.value = !0;
|
|
483
|
-
const
|
|
515
|
+
const f = i ? `/auth/${i}/logout` : "/auth/logout";
|
|
484
516
|
try {
|
|
485
|
-
await t.post(
|
|
486
|
-
} catch (
|
|
487
|
-
|
|
517
|
+
await t.post(f), await h(!0), s.value = null;
|
|
518
|
+
} catch (l) {
|
|
519
|
+
v.showError(l?.message ?? "Error logging out");
|
|
488
520
|
} finally {
|
|
489
|
-
|
|
521
|
+
c.push({
|
|
490
522
|
path: "/",
|
|
491
|
-
query:
|
|
523
|
+
query: c.currentRoute.value.query
|
|
492
524
|
}), n.value = !1;
|
|
493
525
|
}
|
|
494
526
|
}
|
|
495
|
-
function
|
|
496
|
-
return s.value?.identities.find((
|
|
527
|
+
function R(i) {
|
|
528
|
+
return s.value?.identities.find((f) => f.provider === i);
|
|
497
529
|
}
|
|
498
|
-
function
|
|
530
|
+
function u() {
|
|
499
531
|
return localStorage.getItem("vuetify@lastLoginProvider");
|
|
500
532
|
}
|
|
501
|
-
return
|
|
533
|
+
return h(), {
|
|
502
534
|
user: s,
|
|
503
535
|
url: t.url,
|
|
504
536
|
dialog: e,
|
|
505
537
|
isLoading: n,
|
|
506
|
-
verify:
|
|
507
|
-
findIdentity:
|
|
508
|
-
login:
|
|
509
|
-
logout:
|
|
510
|
-
lastLoginProvider:
|
|
511
|
-
sync:
|
|
538
|
+
verify: h,
|
|
539
|
+
findIdentity: R,
|
|
540
|
+
login: k,
|
|
541
|
+
logout: y,
|
|
542
|
+
lastLoginProvider: u,
|
|
543
|
+
sync: A
|
|
512
544
|
};
|
|
513
545
|
});
|
|
514
546
|
export {
|
|
515
547
|
B as a,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
548
|
+
H as b,
|
|
549
|
+
D as c,
|
|
550
|
+
V as d,
|
|
551
|
+
Q as e,
|
|
552
|
+
ee as f,
|
|
521
553
|
_ as u
|
|
522
554
|
};
|