@vuetify/one 2.9.0 → 2.9.2
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-CXrXnM17.js → auth-DCDisIda.js} +56 -56
- package/dist/index.d.ts +1 -1
- package/dist/index.js +292 -268
- package/dist/stores/auth.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { merge as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import { ref as b, reactive as
|
|
4
|
-
import { useRoute as
|
|
5
|
-
const
|
|
1
|
+
import { merge as O } from "lodash-es";
|
|
2
|
+
import { defineStore as R } from "pinia";
|
|
3
|
+
import { ref as b, reactive as Y, watch as I, toRefs as G, computed as p, shallowRef as N, toRef as C, nextTick as K } from "vue";
|
|
4
|
+
import { useRoute as Z, useRouter as V } from "vue-router";
|
|
5
|
+
const B = R("queue", () => {
|
|
6
6
|
const e = b([]);
|
|
7
7
|
function t(o) {
|
|
8
8
|
const r = typeof o == "string" ? { text: o } : o;
|
|
@@ -29,14 +29,14 @@ const J = O("queue", () => {
|
|
|
29
29
|
showError: s,
|
|
30
30
|
showSuccess: i
|
|
31
31
|
};
|
|
32
|
-
}),
|
|
32
|
+
}), D = [
|
|
33
33
|
(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),
|
|
34
34
|
(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),
|
|
35
35
|
(e) => (e.v === 2 && (e.syncSettings = !0, e.disableAds = !1, e.v = 3), e),
|
|
36
36
|
(e) => (e.v === 3 && (e.quickbar = !1, e.v = 4), e),
|
|
37
37
|
(e) => (e.v === 4 && (e.suits = { show: !1, elements: ["app-bar"], suit: "" }, e.notifications = e.notifications || {}, e.notifications.banners = !0, e.v = 5), e)
|
|
38
38
|
];
|
|
39
|
-
function
|
|
39
|
+
function ee(e) {
|
|
40
40
|
return {
|
|
41
41
|
version: 6,
|
|
42
42
|
ecosystem: {
|
|
@@ -107,8 +107,8 @@ function F(e) {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const t =
|
|
110
|
+
function te(e) {
|
|
111
|
+
const t = D.reduce((i, o) => o(i), e), s = ee(t);
|
|
112
112
|
return F(s);
|
|
113
113
|
}
|
|
114
114
|
const H = typeof window < "u", g = {
|
|
@@ -174,8 +174,8 @@ const H = typeof window < "u", g = {
|
|
|
174
174
|
sync: !0,
|
|
175
175
|
devmode: !1
|
|
176
176
|
}
|
|
177
|
-
},
|
|
178
|
-
const e =
|
|
177
|
+
}, se = R("user", () => {
|
|
178
|
+
const e = Y(structuredClone(g));
|
|
179
179
|
I(e, s, { deep: !0 });
|
|
180
180
|
function t() {
|
|
181
181
|
if (!H)
|
|
@@ -187,19 +187,19 @@ const H = typeof window < "u", g = {
|
|
|
187
187
|
if (r.version >= 7) {
|
|
188
188
|
const u = {
|
|
189
189
|
version: 7,
|
|
190
|
-
ecosystem:
|
|
191
|
-
one:
|
|
190
|
+
ecosystem: O(structuredClone(g.ecosystem), r.ecosystem || {}),
|
|
191
|
+
one: O(structuredClone(g.one), r.one || {})
|
|
192
192
|
};
|
|
193
193
|
Object.assign(e, u);
|
|
194
194
|
} else if (r.version === 6) {
|
|
195
195
|
const u = F(r), h = {
|
|
196
196
|
version: 7,
|
|
197
|
-
ecosystem:
|
|
198
|
-
one:
|
|
197
|
+
ecosystem: O(structuredClone(g.ecosystem), u.ecosystem || {}),
|
|
198
|
+
one: O(structuredClone(g.one), u.one || {})
|
|
199
199
|
};
|
|
200
200
|
Object.assign(e, h);
|
|
201
201
|
} else {
|
|
202
|
-
const u =
|
|
202
|
+
const u = te(r);
|
|
203
203
|
Object.assign(e, u);
|
|
204
204
|
}
|
|
205
205
|
s();
|
|
@@ -214,12 +214,12 @@ const H = typeof window < "u", g = {
|
|
|
214
214
|
H && (Object.assign(e, structuredClone(g)), s());
|
|
215
215
|
}
|
|
216
216
|
return t(), {
|
|
217
|
-
...
|
|
217
|
+
...G(e),
|
|
218
218
|
load: t,
|
|
219
219
|
save: s,
|
|
220
220
|
reset: i
|
|
221
221
|
};
|
|
222
|
-
}), Q =
|
|
222
|
+
}), Q = R("http", {
|
|
223
223
|
state: () => ({
|
|
224
224
|
url: ""
|
|
225
225
|
}),
|
|
@@ -269,19 +269,19 @@ const H = typeof window < "u", g = {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
|
-
function
|
|
273
|
-
const e =
|
|
272
|
+
function z() {
|
|
273
|
+
const e = Z();
|
|
274
274
|
return p(
|
|
275
275
|
() => e.query
|
|
276
276
|
);
|
|
277
277
|
}
|
|
278
|
-
const
|
|
279
|
-
const e =
|
|
278
|
+
const M = R("one", () => {
|
|
279
|
+
const e = z(), t = V(), s = X(), i = Q(), o = B(), r = N(!1), u = N(!1), h = b(null), v = b([]), S = p(() => e.value.session_id), q = p(() => h.value?.items[0].plan.interval), j = p(() => h.value?.items[0].plan.type), $ = b([]), d = p(() => s.user?.sponsorships.find((n) => n.platform === "stripe" && n.tierName.startsWith("sub_"))), E = p(() => !!d.value?.tierName), a = p(() => s.user?.sponsorships.reduce((n, l) => {
|
|
280
280
|
if (!l.isActive || l.interval === "once")
|
|
281
281
|
return n;
|
|
282
282
|
const y = l.interval === "month" ? l.amount : l.amount / 12;
|
|
283
283
|
return n + y / 100;
|
|
284
|
-
}, 0) ?? 0), T = p(() => s.user?.sponsorships.find((n) => n.tierName.startsWith("sub_") && n.isActive)),
|
|
284
|
+
}, 0) ?? 0), T = p(() => s.user?.sponsorships.find((n) => n.tierName.startsWith("sub_") && n.isActive)), P = p(() => s.user?.sponsorships.find((n) => n.platform === "github" && n.isActive)), U = p(() => s.user?.sponsorships.find((n) => n.platform === "discord" && n.isActive)), x = p(() => s.user?.identities.find((n) => n.provider === "shopify")), c = p(() => !i.url || s.isAdmin || d.value?.isActive || $.value.some((n) => ["one", "one/team"].includes(n)));
|
|
285
285
|
I(u, L), I(S, async (n) => {
|
|
286
286
|
n && await f();
|
|
287
287
|
}, { immediate: !0 }), I(e, (n) => {
|
|
@@ -306,7 +306,7 @@ const z = O("one", () => {
|
|
|
306
306
|
async function m() {
|
|
307
307
|
window.open(`${i.url}/one/manage`, "_blank");
|
|
308
308
|
}
|
|
309
|
-
async function
|
|
309
|
+
async function k(n, l) {
|
|
310
310
|
r.value = !0;
|
|
311
311
|
const y = new URL("/one/subscribe", i.url);
|
|
312
312
|
y.searchParams.set("interval", n), y.searchParams.set("type", l), window.location.href = y.toString();
|
|
@@ -358,9 +358,9 @@ const z = O("one", () => {
|
|
|
358
358
|
}
|
|
359
359
|
return {
|
|
360
360
|
info: h,
|
|
361
|
-
interval:
|
|
361
|
+
interval: q,
|
|
362
362
|
subscriptionType: j,
|
|
363
|
-
access:
|
|
363
|
+
access: $,
|
|
364
364
|
invoices: v,
|
|
365
365
|
sessionId: S,
|
|
366
366
|
subscription: d,
|
|
@@ -369,7 +369,7 @@ const z = O("one", () => {
|
|
|
369
369
|
isLoading: r,
|
|
370
370
|
isOpen: u,
|
|
371
371
|
isSubscriber: c,
|
|
372
|
-
github:
|
|
372
|
+
github: P,
|
|
373
373
|
discord: U,
|
|
374
374
|
shopify: x,
|
|
375
375
|
one: T,
|
|
@@ -378,11 +378,11 @@ const z = O("one", () => {
|
|
|
378
378
|
manage: m,
|
|
379
379
|
modify: _,
|
|
380
380
|
resetQuery: L,
|
|
381
|
-
subscribe:
|
|
381
|
+
subscribe: k,
|
|
382
382
|
subscriptionInfo: w
|
|
383
383
|
};
|
|
384
|
-
}),
|
|
385
|
-
const e =
|
|
384
|
+
}), re = R("team", () => {
|
|
385
|
+
const e = z(), t = X(), s = M(), i = Q(), o = B(), r = N(!1), u = b(null), h = b(!1), v = p(() => e.value.invite), S = p(
|
|
386
386
|
() => u.value ? s.access?.some((a) => ["one/team", "snips/team"].includes(a)) : !1
|
|
387
387
|
);
|
|
388
388
|
I(v, async () => {
|
|
@@ -399,7 +399,7 @@ const z = O("one", () => {
|
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}, { immediate: !0 });
|
|
402
|
-
async function
|
|
402
|
+
async function q(a) {
|
|
403
403
|
try {
|
|
404
404
|
if (r.value = !0, !u.value)
|
|
405
405
|
return;
|
|
@@ -419,7 +419,7 @@ const z = O("one", () => {
|
|
|
419
419
|
r.value = !1;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
async function
|
|
422
|
+
async function $() {
|
|
423
423
|
try {
|
|
424
424
|
r.value = !0, await i.post("/one/team/join", { inviteCode: v.value }), await t.verify(!0), d();
|
|
425
425
|
} catch (a) {
|
|
@@ -441,16 +441,16 @@ const z = O("one", () => {
|
|
|
441
441
|
hasTeamAccess: S,
|
|
442
442
|
isTeamOwner: E,
|
|
443
443
|
isLoading: r,
|
|
444
|
-
removeFromTeam:
|
|
444
|
+
removeFromTeam: q,
|
|
445
445
|
leaveTeam: j,
|
|
446
|
-
joinTeam:
|
|
446
|
+
joinTeam: $,
|
|
447
447
|
clearTeamQuery: d
|
|
448
448
|
};
|
|
449
|
-
}),
|
|
450
|
-
const e = b(!1), t = b(null), s = Q(), i =
|
|
449
|
+
}), J = typeof window < "u", X = R("auth", () => {
|
|
450
|
+
const e = b(!1), t = b(null), s = Q(), i = se(), o = V(), r = N(!1), u = M(), h = re(), v = B(), S = C(() => !!t.value), q = C(() => t.value?.role === "super"), j = C(() => ["super", "admin"].includes(t.value?.role ?? "")), $ = C(() => ["super", "admin", "editor"].includes(t.value?.role ?? ""));
|
|
451
451
|
let d = !!x();
|
|
452
452
|
I(t, (c) => {
|
|
453
|
-
if (!c?.settings)
|
|
453
|
+
if (!J || !c?.settings)
|
|
454
454
|
return;
|
|
455
455
|
const f = localStorage.getItem("vuetify@user") || "{}";
|
|
456
456
|
if (JSON.stringify(c.settings, null, 2) === f)
|
|
@@ -458,17 +458,17 @@ const z = O("one", () => {
|
|
|
458
458
|
d = !0;
|
|
459
459
|
let m = c.settings;
|
|
460
460
|
m.version === 6 && (m = F(m));
|
|
461
|
-
const
|
|
461
|
+
const k = {
|
|
462
462
|
version: 7,
|
|
463
|
-
ecosystem:
|
|
464
|
-
one:
|
|
463
|
+
ecosystem: O(structuredClone(g.ecosystem), m.ecosystem || {}),
|
|
464
|
+
one: O(structuredClone(g.one), m.one || {})
|
|
465
465
|
};
|
|
466
|
-
Object.assign(i,
|
|
466
|
+
Object.assign(i, k);
|
|
467
467
|
}), i.$subscribe(() => {
|
|
468
468
|
d || E(), d = !1;
|
|
469
469
|
});
|
|
470
470
|
async function E() {
|
|
471
|
-
if (await
|
|
471
|
+
if (await K(), !(!t.value || !i.one.sync))
|
|
472
472
|
try {
|
|
473
473
|
await s.post("/user/settings", { settings: i.$state }), await a(!0);
|
|
474
474
|
} catch (c) {
|
|
@@ -507,10 +507,10 @@ const z = O("one", () => {
|
|
|
507
507
|
window.location.assign(f + "?next=" + encodeURIComponent(window.location.href));
|
|
508
508
|
return;
|
|
509
509
|
}
|
|
510
|
-
const m = 400,
|
|
510
|
+
const m = 400, k = 600, W = window.screenX + (window.innerWidth - m) / 2, _ = window.screenY + (window.innerHeight - k) / 2, w = window.open(
|
|
511
511
|
"",
|
|
512
512
|
"vuetify:authorize:popup",
|
|
513
|
-
`popup,left=${W},top=${_},width=${m},height=${
|
|
513
|
+
`popup,left=${W},top=${_},width=${m},height=${k},resizable`
|
|
514
514
|
);
|
|
515
515
|
if (!w) {
|
|
516
516
|
console.error("Failed to open popup");
|
|
@@ -530,7 +530,7 @@ const z = O("one", () => {
|
|
|
530
530
|
y(), console.error("Auth timed out");
|
|
531
531
|
}, 120 * 1e3);
|
|
532
532
|
}
|
|
533
|
-
async function
|
|
533
|
+
async function P(c) {
|
|
534
534
|
r.value = !0;
|
|
535
535
|
const f = c ? `/auth/${c}/logout` : "/auth/logout";
|
|
536
536
|
try {
|
|
@@ -548,31 +548,31 @@ const z = O("one", () => {
|
|
|
548
548
|
return t.value?.identities.find((f) => f.provider === c);
|
|
549
549
|
}
|
|
550
550
|
function x() {
|
|
551
|
-
return localStorage.getItem("vuetify@lastLoginProvider");
|
|
551
|
+
return J ? localStorage.getItem("vuetify@lastLoginProvider") : null;
|
|
552
552
|
}
|
|
553
|
-
return a(), {
|
|
553
|
+
return J && a(), {
|
|
554
554
|
user: t,
|
|
555
555
|
url: s.url,
|
|
556
556
|
dialog: e,
|
|
557
557
|
isLoading: r,
|
|
558
558
|
isAuthenticated: S,
|
|
559
|
-
isSuper:
|
|
559
|
+
isSuper: q,
|
|
560
560
|
isAdmin: j,
|
|
561
|
-
isEditor:
|
|
561
|
+
isEditor: $,
|
|
562
562
|
verify: a,
|
|
563
563
|
findIdentity: U,
|
|
564
564
|
login: T,
|
|
565
|
-
logout:
|
|
565
|
+
logout: P,
|
|
566
566
|
lastLoginProvider: x,
|
|
567
567
|
sync: E
|
|
568
568
|
};
|
|
569
569
|
});
|
|
570
570
|
export {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
571
|
+
X as a,
|
|
572
|
+
se as b,
|
|
573
|
+
M as c,
|
|
574
|
+
z as d,
|
|
575
575
|
Q as e,
|
|
576
|
-
|
|
577
|
-
|
|
576
|
+
re as f,
|
|
577
|
+
B as u
|
|
578
578
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -433,7 +433,7 @@ interface LinksState {
|
|
|
433
433
|
index: () => Promise<VOneLink[]>;
|
|
434
434
|
create: (options: CreateLinkOptions) => Promise<VOneLink | undefined>;
|
|
435
435
|
}
|
|
436
|
-
declare const useLinksStore: pinia.StoreDefinition<"links", Pick<LinksState, "isLoading" | "all" | "isSaving">, Pick<LinksState, "favorites" | "pinned" | "canCreate">, Pick<LinksState, "
|
|
436
|
+
declare const useLinksStore: pinia.StoreDefinition<"links", Pick<LinksState, "isLoading" | "all" | "isSaving">, Pick<LinksState, "favorites" | "pinned" | "canCreate">, Pick<LinksState, "create" | "index">>;
|
|
437
437
|
|
|
438
438
|
interface VOneNotification {
|
|
439
439
|
id: string;
|