@vuetify/one 2.6.9 → 2.7.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/{auth-Bwo9TDIn.js → auth-QWWxnYQv.js} +56 -52
- package/dist/index.d.ts +24 -0
- package/dist/index.js +1595 -1478
- package/dist/stores/auth.js +1 -1
- package/package.json +2 -10
|
@@ -5,8 +5,8 @@ import { useRoute as Y, useRouter as J } from "vue-router";
|
|
|
5
5
|
const _ = L("queue", () => {
|
|
6
6
|
const e = T([]);
|
|
7
7
|
function s(o) {
|
|
8
|
-
const
|
|
9
|
-
e.value.push(
|
|
8
|
+
const a = typeof o == "string" ? { text: o } : o;
|
|
9
|
+
e.value.push(a);
|
|
10
10
|
}
|
|
11
11
|
function t(o) {
|
|
12
12
|
s({
|
|
@@ -100,14 +100,14 @@ function F(e) {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
function Z(e) {
|
|
103
|
-
const s = G.reduce((o,
|
|
103
|
+
const s = G.reduce((o, a) => a(o), e), t = K(s);
|
|
104
104
|
return F(t);
|
|
105
105
|
}
|
|
106
106
|
const W = typeof window < "u", E = {
|
|
107
107
|
version: 7,
|
|
108
108
|
ecosystem: {
|
|
109
109
|
bin: {
|
|
110
|
-
wordWrap: !
|
|
110
|
+
wordWrap: !0
|
|
111
111
|
},
|
|
112
112
|
play: {
|
|
113
113
|
showErrors: !0,
|
|
@@ -159,6 +159,10 @@ const W = typeof window < "u", E = {
|
|
|
159
159
|
last: ""
|
|
160
160
|
},
|
|
161
161
|
quicklinks: !1,
|
|
162
|
+
ecosystem: {
|
|
163
|
+
pinned: [],
|
|
164
|
+
seen: !1
|
|
165
|
+
},
|
|
162
166
|
sync: !0,
|
|
163
167
|
devmode: !1
|
|
164
168
|
}
|
|
@@ -168,27 +172,27 @@ const W = typeof window < "u", E = {
|
|
|
168
172
|
function s() {
|
|
169
173
|
if (!W)
|
|
170
174
|
return;
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
175
|
+
const a = localStorage.getItem("vuetify@user");
|
|
176
|
+
if (a)
|
|
173
177
|
try {
|
|
174
|
-
const n = JSON.parse(
|
|
178
|
+
const n = JSON.parse(a);
|
|
175
179
|
if (n.version >= 7) {
|
|
176
|
-
const
|
|
180
|
+
const u = {
|
|
177
181
|
version: 7,
|
|
178
182
|
ecosystem: O(structuredClone(E.ecosystem), n.ecosystem || {}),
|
|
179
183
|
one: O(structuredClone(E.one), n.one || {})
|
|
180
184
|
};
|
|
181
|
-
Object.assign(e,
|
|
185
|
+
Object.assign(e, u);
|
|
182
186
|
} else if (n.version === 6) {
|
|
183
|
-
const
|
|
187
|
+
const u = F(n), d = {
|
|
184
188
|
version: 7,
|
|
185
|
-
ecosystem: O(structuredClone(E.ecosystem),
|
|
186
|
-
one: O(structuredClone(E.one),
|
|
189
|
+
ecosystem: O(structuredClone(E.ecosystem), u.ecosystem || {}),
|
|
190
|
+
one: O(structuredClone(E.one), u.one || {})
|
|
187
191
|
};
|
|
188
192
|
Object.assign(e, d);
|
|
189
193
|
} else {
|
|
190
|
-
const
|
|
191
|
-
Object.assign(e,
|
|
194
|
+
const u = Z(n);
|
|
195
|
+
Object.assign(e, u);
|
|
192
196
|
}
|
|
193
197
|
t();
|
|
194
198
|
} catch (n) {
|
|
@@ -256,13 +260,13 @@ function Q() {
|
|
|
256
260
|
);
|
|
257
261
|
}
|
|
258
262
|
const V = L("one", () => {
|
|
259
|
-
const e = Q(), s = J(), t = B(), o = H(),
|
|
263
|
+
const e = Q(), s = J(), t = B(), o = H(), a = _(), n = U(!1), u = 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), c = m(() => t.user?.sponsorships.reduce((r, p) => {
|
|
260
264
|
if (!p.isActive || p.interval === "once")
|
|
261
265
|
return r;
|
|
262
266
|
const b = p.interval === "month" ? p.amount : p.amount / 12;
|
|
263
267
|
return r + b / 100;
|
|
264
268
|
}, 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(
|
|
269
|
+
I(u, w), I(g, async (r) => {
|
|
266
270
|
r && await j();
|
|
267
271
|
}, { immediate: !0 }), I(e, (r) => {
|
|
268
272
|
if (r.one !== "subscribe" || t.user)
|
|
@@ -278,7 +282,7 @@ const V = L("one", () => {
|
|
|
278
282
|
const r = new URL(window.location.href), p = r.searchParams;
|
|
279
283
|
p.delete("session_id"), p.delete("team"), history.pushState(null, "", r.toString());
|
|
280
284
|
} catch (r) {
|
|
281
|
-
|
|
285
|
+
a.showError(r?.message ?? "Error activating subscription, Please contact support");
|
|
282
286
|
} finally {
|
|
283
287
|
n.value = !1;
|
|
284
288
|
}
|
|
@@ -298,7 +302,7 @@ const V = L("one", () => {
|
|
|
298
302
|
`/one/cancel?subscriptionId=${y.value?.tierName}`
|
|
299
303
|
), await t.verify(!0);
|
|
300
304
|
} catch (r) {
|
|
301
|
-
|
|
305
|
+
a.showError(r?.message ?? "Error cancelling subscription, Please contact support");
|
|
302
306
|
} finally {
|
|
303
307
|
n.value = !1;
|
|
304
308
|
}
|
|
@@ -312,7 +316,7 @@ const V = L("one", () => {
|
|
|
312
316
|
type: p
|
|
313
317
|
}), await t.verify(!0);
|
|
314
318
|
} catch (b) {
|
|
315
|
-
|
|
319
|
+
a.showError(b?.message ?? "Error modifying subscription");
|
|
316
320
|
} finally {
|
|
317
321
|
n.value = !1;
|
|
318
322
|
}
|
|
@@ -323,7 +327,7 @@ const V = L("one", () => {
|
|
|
323
327
|
const r = await o.get("/one/info");
|
|
324
328
|
return d.value = r.subscription, v.value = r.invoices, r;
|
|
325
329
|
} catch (r) {
|
|
326
|
-
|
|
330
|
+
a.showError(r?.message ?? "Error fetching subscription info");
|
|
327
331
|
} finally {
|
|
328
332
|
n.value = !1;
|
|
329
333
|
}
|
|
@@ -344,10 +348,10 @@ const V = L("one", () => {
|
|
|
344
348
|
invoices: v,
|
|
345
349
|
sessionId: g,
|
|
346
350
|
subscription: y,
|
|
347
|
-
monthlyTotal:
|
|
351
|
+
monthlyTotal: c,
|
|
348
352
|
hasBilling: R,
|
|
349
353
|
isLoading: n,
|
|
350
|
-
isOpen:
|
|
354
|
+
isOpen: u,
|
|
351
355
|
isSubscriber: N,
|
|
352
356
|
github: f,
|
|
353
357
|
discord: l,
|
|
@@ -362,39 +366,39 @@ const V = L("one", () => {
|
|
|
362
366
|
subscriptionInfo: q
|
|
363
367
|
};
|
|
364
368
|
}), ee = L("team", () => {
|
|
365
|
-
const e = Q(), s = B(), t = V(), o = H(),
|
|
366
|
-
() =>
|
|
369
|
+
const e = Q(), s = B(), t = V(), o = H(), a = _(), n = U(!1), u = T(null), d = T(!1), v = m(() => e.value.invite), g = m(
|
|
370
|
+
() => u.value ? t.access?.some((c) => ["one/team", "snips/team"].includes(c)) : !1
|
|
367
371
|
);
|
|
368
372
|
I(v, async () => {
|
|
369
373
|
if (v.value) {
|
|
370
374
|
s.user || (s.dialog = !0);
|
|
371
375
|
try {
|
|
372
376
|
n.value = !0;
|
|
373
|
-
const
|
|
374
|
-
|
|
375
|
-
} catch (
|
|
376
|
-
y(),
|
|
377
|
+
const c = await o.get(`/one/team/${v.value}`);
|
|
378
|
+
u.value = c.team, d.value = !0;
|
|
379
|
+
} catch (c) {
|
|
380
|
+
y(), a.showError(c.message);
|
|
377
381
|
} finally {
|
|
378
382
|
n.value = !1;
|
|
379
383
|
}
|
|
380
384
|
}
|
|
381
385
|
}, { immediate: !0 });
|
|
382
|
-
async function A(
|
|
386
|
+
async function A(c) {
|
|
383
387
|
try {
|
|
384
|
-
if (n.value = !0, !
|
|
388
|
+
if (n.value = !0, !u.value)
|
|
385
389
|
return;
|
|
386
|
-
await o.post("/one/team/remove", { userId:
|
|
390
|
+
await o.post("/one/team/remove", { userId: c }), u.value.members = u.value.members.filter((i) => i.id !== c);
|
|
387
391
|
} catch (i) {
|
|
388
|
-
|
|
392
|
+
a.showError(i?.message ?? "Error removing user from team");
|
|
389
393
|
} finally {
|
|
390
394
|
n.value = !1;
|
|
391
395
|
}
|
|
392
396
|
}
|
|
393
397
|
async function h() {
|
|
394
398
|
try {
|
|
395
|
-
n.value = !0, await o.post("/one/team/leave", { teamId:
|
|
396
|
-
} catch (
|
|
397
|
-
|
|
399
|
+
n.value = !0, await o.post("/one/team/leave", { teamId: u.value?.id }), await s.verify(!0);
|
|
400
|
+
} catch (c) {
|
|
401
|
+
a.showError(c?.message ?? "Error leaving team");
|
|
398
402
|
} finally {
|
|
399
403
|
n.value = !1;
|
|
400
404
|
}
|
|
@@ -402,20 +406,20 @@ const V = L("one", () => {
|
|
|
402
406
|
async function k() {
|
|
403
407
|
try {
|
|
404
408
|
n.value = !0, await o.post("/one/team/join", { inviteCode: v.value }), await s.verify(!0), y();
|
|
405
|
-
} catch (
|
|
406
|
-
|
|
409
|
+
} catch (c) {
|
|
410
|
+
a.showError(c?.message ?? "Error joining team");
|
|
407
411
|
} finally {
|
|
408
412
|
n.value = !1;
|
|
409
413
|
}
|
|
410
414
|
}
|
|
411
415
|
function y() {
|
|
412
416
|
d.value = !1;
|
|
413
|
-
const
|
|
414
|
-
|
|
417
|
+
const c = new URL(window.location.href);
|
|
418
|
+
c.searchParams.delete("invite"), window.history.replaceState({}, "", c.toString());
|
|
415
419
|
}
|
|
416
420
|
const R = m(() => s.user?.id === s.user?.team?.owner.id);
|
|
417
421
|
return {
|
|
418
|
-
team:
|
|
422
|
+
team: u,
|
|
419
423
|
teamInviteDialog: d,
|
|
420
424
|
teamInviteCode: v,
|
|
421
425
|
hasTeamAccess: g,
|
|
@@ -427,8 +431,8 @@ const V = L("one", () => {
|
|
|
427
431
|
clearTeamQuery: y
|
|
428
432
|
};
|
|
429
433
|
}), B = L("auth", () => {
|
|
430
|
-
const e = T(!1), s = T(null), t = H(), o = D(),
|
|
431
|
-
let g = !!
|
|
434
|
+
const e = T(!1), s = T(null), t = H(), o = D(), a = J(), n = U(!1), u = V(), d = ee(), v = _();
|
|
435
|
+
let g = !!c();
|
|
432
436
|
I(s, (i) => {
|
|
433
437
|
if (!i?.settings)
|
|
434
438
|
return;
|
|
@@ -469,7 +473,7 @@ const V = L("one", () => {
|
|
|
469
473
|
async (f) => {
|
|
470
474
|
if (f.ok || f.status === 401) {
|
|
471
475
|
const l = await f.json();
|
|
472
|
-
s.value = l.user,
|
|
476
|
+
s.value = l.user, u.access = l.access, d.team = l.user?.team;
|
|
473
477
|
} else
|
|
474
478
|
console.error(f.statusText);
|
|
475
479
|
},
|
|
@@ -499,7 +503,7 @@ const V = L("one", () => {
|
|
|
499
503
|
S.location.href = f;
|
|
500
504
|
let C = -1, x = -1;
|
|
501
505
|
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,
|
|
506
|
+
w.origin === t.url && w.data?.type === "auth-response" && (w.data.status === "success" ? (s.value || (localStorage.setItem("vuetify@lastLoginProvider", i), e.value = !1, a.push("/user/dashboard")), s.value = w.data.body.user, u.access = w.data.body.access, d.team = w.data.body.user?.team, A()) : console.error(w.data.message), q());
|
|
503
507
|
}
|
|
504
508
|
function q() {
|
|
505
509
|
window.removeEventListener("message", P), window.clearInterval(C), window.clearTimeout(x), S?.close(), n.value = !1;
|
|
@@ -518,16 +522,16 @@ const V = L("one", () => {
|
|
|
518
522
|
} catch (l) {
|
|
519
523
|
v.showError(l?.message ?? "Error logging out");
|
|
520
524
|
} finally {
|
|
521
|
-
|
|
525
|
+
a.push({
|
|
522
526
|
path: "/",
|
|
523
|
-
query:
|
|
527
|
+
query: a.currentRoute.value.query
|
|
524
528
|
}), n.value = !1;
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
531
|
function R(i) {
|
|
528
532
|
return s.value?.identities.find((f) => f.provider === i);
|
|
529
533
|
}
|
|
530
|
-
function
|
|
534
|
+
function c() {
|
|
531
535
|
return localStorage.getItem("vuetify@lastLoginProvider");
|
|
532
536
|
}
|
|
533
537
|
return h(), {
|
|
@@ -539,16 +543,16 @@ const V = L("one", () => {
|
|
|
539
543
|
findIdentity: R,
|
|
540
544
|
login: k,
|
|
541
545
|
logout: y,
|
|
542
|
-
lastLoginProvider:
|
|
546
|
+
lastLoginProvider: c,
|
|
543
547
|
sync: A
|
|
544
548
|
};
|
|
545
549
|
});
|
|
546
550
|
export {
|
|
547
551
|
B as a,
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
+
D as b,
|
|
553
|
+
V as c,
|
|
554
|
+
Q as d,
|
|
555
|
+
H as e,
|
|
552
556
|
ee as f,
|
|
553
557
|
_ as u
|
|
554
558
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1201,6 +1201,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1201
1201
|
last: string;
|
|
1202
1202
|
};
|
|
1203
1203
|
quicklinks: boolean;
|
|
1204
|
+
ecosystem: {
|
|
1205
|
+
pinned: string[];
|
|
1206
|
+
seen: boolean;
|
|
1207
|
+
};
|
|
1204
1208
|
sync: boolean;
|
|
1205
1209
|
devmode: boolean;
|
|
1206
1210
|
}, {
|
|
@@ -1231,6 +1235,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1231
1235
|
last: string;
|
|
1232
1236
|
};
|
|
1233
1237
|
quicklinks: boolean;
|
|
1238
|
+
ecosystem: {
|
|
1239
|
+
pinned: string[];
|
|
1240
|
+
seen: boolean;
|
|
1241
|
+
};
|
|
1234
1242
|
sync: boolean;
|
|
1235
1243
|
devmode: boolean;
|
|
1236
1244
|
}>;
|
|
@@ -1398,6 +1406,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1398
1406
|
last: string;
|
|
1399
1407
|
};
|
|
1400
1408
|
quicklinks: boolean;
|
|
1409
|
+
ecosystem: {
|
|
1410
|
+
pinned: string[];
|
|
1411
|
+
seen: boolean;
|
|
1412
|
+
};
|
|
1401
1413
|
sync: boolean;
|
|
1402
1414
|
devmode: boolean;
|
|
1403
1415
|
}, {
|
|
@@ -1428,6 +1440,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1428
1440
|
last: string;
|
|
1429
1441
|
};
|
|
1430
1442
|
quicklinks: boolean;
|
|
1443
|
+
ecosystem: {
|
|
1444
|
+
pinned: string[];
|
|
1445
|
+
seen: boolean;
|
|
1446
|
+
};
|
|
1431
1447
|
sync: boolean;
|
|
1432
1448
|
devmode: boolean;
|
|
1433
1449
|
}>;
|
|
@@ -1595,6 +1611,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1595
1611
|
last: string;
|
|
1596
1612
|
};
|
|
1597
1613
|
quicklinks: boolean;
|
|
1614
|
+
ecosystem: {
|
|
1615
|
+
pinned: string[];
|
|
1616
|
+
seen: boolean;
|
|
1617
|
+
};
|
|
1598
1618
|
sync: boolean;
|
|
1599
1619
|
devmode: boolean;
|
|
1600
1620
|
}, {
|
|
@@ -1625,6 +1645,10 @@ declare const useUserStore: pinia.StoreDefinition<"user", Pick<{
|
|
|
1625
1645
|
last: string;
|
|
1626
1646
|
};
|
|
1627
1647
|
quicklinks: boolean;
|
|
1648
|
+
ecosystem: {
|
|
1649
|
+
pinned: string[];
|
|
1650
|
+
seen: boolean;
|
|
1651
|
+
};
|
|
1628
1652
|
sync: boolean;
|
|
1629
1653
|
devmode: boolean;
|
|
1630
1654
|
}>;
|