@vuetify/one 2.11.3 → 2.12.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.
@@ -1,15 +1,15 @@
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";
1
+ import { merge as k } from "lodash-es";
2
+ import { defineStore as O } from "pinia";
3
+ import { ref as b, reactive as Y, watch as A, toRefs as G, computed as p, shallowRef as N, toRef as C, nextTick as K } from "vue";
4
4
  import { useRoute as Z, useRouter as V } from "vue-router";
5
- const B = R("queue", () => {
5
+ const B = O("queue", () => {
6
6
  const e = b([]);
7
- function t(o) {
8
- const r = typeof o == "string" ? { text: o } : o;
9
- e.value.push(r);
10
- }
11
7
  function s(o) {
12
- t({
8
+ const n = typeof o == "string" ? { text: o } : o;
9
+ e.value.push(n);
10
+ }
11
+ function r(o) {
12
+ s({
13
13
  color: "error",
14
14
  text: o,
15
15
  location: "top end",
@@ -17,7 +17,7 @@ const B = R("queue", () => {
17
17
  });
18
18
  }
19
19
  function i(o) {
20
- t({
20
+ s({
21
21
  color: "success",
22
22
  text: o,
23
23
  location: "top end"
@@ -25,8 +25,8 @@ const B = R("queue", () => {
25
25
  }
26
26
  return {
27
27
  queue: e,
28
- show: t,
29
- showError: s,
28
+ show: s,
29
+ showError: r,
30
30
  showSuccess: i
31
31
  };
32
32
  }), D = [
@@ -54,7 +54,7 @@ function ee(e) {
54
54
  composition: e.composition || "composition",
55
55
  pins: {
56
56
  enabled: e.pins || !1,
57
- pinned: Array.isArray(e.pinned) ? e.pinned.map((t) => t.name || t).filter(Boolean) : []
57
+ pinned: Array.isArray(e.pinned) ? e.pinned.map((s) => s.name || s).filter(Boolean) : []
58
58
  },
59
59
  mixedTheme: e.mixedTheme ?? !0,
60
60
  favorites: [],
@@ -108,8 +108,8 @@ function F(e) {
108
108
  };
109
109
  }
110
110
  function te(e) {
111
- const t = D.reduce((i, o) => o(i), e), s = ee(t);
112
- return F(s);
111
+ const s = D.reduce((i, o) => o(i), e), r = ee(s);
112
+ return F(r);
113
113
  }
114
114
  const H = typeof window < "u", g = {
115
115
  version: 7,
@@ -174,97 +174,97 @@ const H = typeof window < "u", g = {
174
174
  sync: !0,
175
175
  devmode: !1
176
176
  }
177
- }, se = R("user", () => {
177
+ }, se = O("user", () => {
178
178
  const e = Y(structuredClone(g));
179
- I(e, s, { deep: !0 });
180
- function t() {
179
+ A(e, r, { deep: !0 });
180
+ function s() {
181
181
  if (!H)
182
182
  return;
183
183
  const o = localStorage.getItem("vuetify@user");
184
184
  if (o)
185
185
  try {
186
- const r = JSON.parse(o);
187
- if (r.version >= 7) {
186
+ const n = JSON.parse(o);
187
+ if (n.version >= 7) {
188
188
  const u = {
189
189
  version: 7,
190
- ecosystem: O(structuredClone(g.ecosystem), r.ecosystem || {}),
191
- one: O(structuredClone(g.one), r.one || {})
190
+ ecosystem: k(structuredClone(g.ecosystem), n.ecosystem || {}),
191
+ one: k(structuredClone(g.one), n.one || {})
192
192
  };
193
193
  Object.assign(e, u);
194
- } else if (r.version === 6) {
195
- const u = F(r), h = {
194
+ } else if (n.version === 6) {
195
+ const u = F(n), y = {
196
196
  version: 7,
197
- ecosystem: O(structuredClone(g.ecosystem), u.ecosystem || {}),
198
- one: O(structuredClone(g.one), u.one || {})
197
+ ecosystem: k(structuredClone(g.ecosystem), u.ecosystem || {}),
198
+ one: k(structuredClone(g.one), u.one || {})
199
199
  };
200
- Object.assign(e, h);
200
+ Object.assign(e, y);
201
201
  } else {
202
- const u = te(r);
202
+ const u = te(n);
203
203
  Object.assign(e, u);
204
204
  }
205
- s();
206
- } catch (r) {
207
- console.error("Failed to load user settings:", r);
205
+ r();
206
+ } catch (n) {
207
+ console.error("Failed to load user settings:", n);
208
208
  }
209
209
  }
210
- function s() {
210
+ function r() {
211
211
  H && localStorage.setItem("vuetify@user", JSON.stringify(e, null, 2));
212
212
  }
213
213
  function i() {
214
- H && (Object.assign(e, structuredClone(g)), s());
214
+ H && (Object.assign(e, structuredClone(g)), r());
215
215
  }
216
- return t(), {
216
+ return s(), {
217
217
  ...G(e),
218
- load: t,
219
- save: s,
218
+ load: s,
219
+ save: r,
220
220
  reset: i
221
221
  };
222
- }), Q = R("http", {
222
+ }), Q = O("http", {
223
223
  state: () => ({
224
224
  url: ""
225
225
  }),
226
226
  actions: {
227
- async fetch(e, t = {}) {
228
- const s = await fetch(`${this.url}${e}`, {
227
+ async fetch(e, s = {}) {
228
+ const r = await fetch(`${this.url}${e}`, {
229
229
  credentials: "include",
230
- ...t
230
+ ...s
231
231
  });
232
- if (!s.ok) {
233
- const i = await s.text();
234
- let o = i || `HTTP ${s.status}`;
232
+ if (!r.ok) {
233
+ const i = await r.text();
234
+ let o = i || `HTTP ${r.status}`;
235
235
  try {
236
- const r = JSON.parse(i);
237
- o = r.message || r.error || i;
236
+ const n = JSON.parse(i);
237
+ o = n.message || n.error || i;
238
238
  } catch {
239
239
  }
240
240
  throw new Error(o);
241
241
  }
242
- return s.status === 204 ? {} : s.json();
242
+ return r.status === 204 ? {} : r.json();
243
243
  },
244
- async post(e, t, s = {}) {
244
+ async post(e, s, r = {}) {
245
245
  return this.fetch(e, {
246
246
  method: "POST",
247
247
  headers: {
248
248
  "Content-Type": "application/json"
249
249
  },
250
- body: JSON.stringify(t),
251
- ...s
250
+ body: JSON.stringify(s),
251
+ ...r
252
252
  });
253
253
  },
254
- async form(e, t, s = {}) {
254
+ async form(e, s, r = {}) {
255
255
  return this.fetch(e, {
256
256
  method: "POST",
257
- body: t,
258
- ...s
257
+ body: s,
258
+ ...r
259
259
  });
260
260
  },
261
- async get(e, t = {}) {
262
- return this.fetch(e, t);
261
+ async get(e, s = {}) {
262
+ return this.fetch(e, s);
263
263
  },
264
- async delete(e, t = {}) {
264
+ async delete(e, s = {}) {
265
265
  return this.fetch(e, {
266
266
  method: "DELETE",
267
- ...t
267
+ ...s
268
268
  });
269
269
  }
270
270
  }
@@ -275,81 +275,81 @@ function z() {
275
275
  () => e.query
276
276
  );
277
277
  }
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) => {
278
+ const M = O("one", () => {
279
+ const e = z(), s = V(), r = X(), i = Q(), o = B(), n = N(!1), u = N(!1), y = b(null), v = b([]), S = p(() => e.value.session_id), R = p(() => y.value?.items[0].plan.interval), q = p(() => y.value?.items[0].plan.type), I = b([]), d = p(() => r.user?.sponsorships.find((t) => t.platform === "stripe" && t.tierName.startsWith("sub_"))), E = p(() => !!d.value?.tierName), a = p(() => r.user?.sponsorships.reduce((t, l) => {
280
280
  if (!l.isActive || l.interval === "once")
281
- return n;
282
- const y = l.interval === "month" ? l.amount : l.amount / 12;
283
- return n + y / 100;
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
- I(u, L), I(S, async (n) => {
286
- n && await f();
287
- }, { immediate: !0 }), I(e, (n) => {
288
- if (n.one !== "subscribe" || s.user)
281
+ return t;
282
+ const m = l.interval === "month" ? l.amount : l.amount / 12;
283
+ return t + m / 100;
284
+ }, 0) ?? 0), T = p(() => r.user?.sponsorships.find((t) => t.tierName.startsWith("sub_") && t.isActive)), P = p(() => r.user?.sponsorships.find((t) => t.platform === "github" && t.isActive)), U = p(() => r.user?.sponsorships.find((t) => t.platform === "discord" && t.isActive)), x = p(() => r.user?.sponsorships.find((t) => t.platform === "opencollective" && t.isActive)), c = p(() => r.user?.identities.find((t) => t.provider === "shopify")), h = p(() => !i.url || r.isAdmin || d.value?.isActive || I.value.some((t) => ["one", "one/team"].includes(t)));
285
+ A(u, L), A(S, async (t) => {
286
+ t && await f();
287
+ }, { immediate: !0 }), A(e, (t) => {
288
+ if (t.one !== "subscribe" || r.user)
289
289
  return;
290
- s.dialog = !0;
291
- const l = I(() => s.user, (y) => {
292
- y && (s.dialog = !1, l());
290
+ r.dialog = !0;
291
+ const l = A(() => r.user, (m) => {
292
+ m && (r.dialog = !1, l());
293
293
  });
294
294
  }, { immediate: !0 });
295
295
  async function f() {
296
296
  try {
297
- r.value = !0, await i.post("/one/activate", { sessionId: S.value }), await s.verify(!0), await w();
298
- const n = new URL(window.location.href), l = n.searchParams;
299
- l.delete("session_id"), l.delete("team"), history.pushState(null, "", n.toString());
300
- } catch (n) {
301
- o.showError(n?.message ?? "Error activating subscription, Please contact support");
297
+ n.value = !0, await i.post("/one/activate", { sessionId: S.value }), await r.verify(!0), await j();
298
+ const t = new URL(window.location.href), l = t.searchParams;
299
+ l.delete("session_id"), l.delete("team"), history.pushState(null, "", t.toString());
300
+ } catch (t) {
301
+ o.showError(t?.message ?? "Error activating subscription, Please contact support");
302
302
  } finally {
303
- r.value = !1;
303
+ n.value = !1;
304
304
  }
305
305
  }
306
- async function m() {
306
+ async function $() {
307
307
  window.open(`${i.url}/one/manage`, "_blank");
308
308
  }
309
- async function k(n, l) {
310
- r.value = !0;
311
- const y = new URL("/one/subscribe", i.url);
312
- y.searchParams.set("interval", n), y.searchParams.set("type", l), window.location.href = y.toString();
309
+ async function W(t, l) {
310
+ n.value = !0;
311
+ const m = new URL("/one/subscribe", i.url);
312
+ m.searchParams.set("interval", t), m.searchParams.set("type", l), window.location.href = m.toString();
313
313
  }
314
- async function W() {
314
+ async function _() {
315
315
  if (d.value)
316
316
  try {
317
- r.value = !0, await i.post(
317
+ n.value = !0, await i.post(
318
318
  `/one/cancel?subscriptionId=${d.value?.tierName}`
319
- ), await s.verify(!0);
320
- } catch (n) {
321
- o.showError(n?.message ?? "Error cancelling subscription, Please contact support");
319
+ ), await r.verify(!0);
320
+ } catch (t) {
321
+ o.showError(t?.message ?? "Error cancelling subscription, Please contact support");
322
322
  } finally {
323
- r.value = !1;
323
+ n.value = !1;
324
324
  }
325
325
  }
326
- async function _(n, l) {
326
+ async function w(t, l) {
327
327
  if (d.value)
328
328
  try {
329
- r.value = !0, await i.post("/one/modify", {
329
+ n.value = !0, await i.post("/one/modify", {
330
330
  subscriptionId: d.value.tierName,
331
- interval: n,
331
+ interval: t,
332
332
  type: l
333
- }), await s.verify(!0);
334
- } catch (y) {
335
- o.showError(y?.message ?? "Error modifying subscription");
333
+ }), await r.verify(!0);
334
+ } catch (m) {
335
+ o.showError(m?.message ?? "Error modifying subscription");
336
336
  } finally {
337
- r.value = !1;
337
+ n.value = !1;
338
338
  }
339
339
  }
340
- async function w() {
340
+ async function j() {
341
341
  try {
342
- r.value = !0;
343
- const n = await i.get("/one/info");
344
- return h.value = n.subscription, v.value = n.invoices, n;
345
- } catch (n) {
346
- o.showError(n?.message ?? "Error fetching subscription info");
342
+ n.value = !0;
343
+ const t = await i.get("/one/info");
344
+ return y.value = t.subscription, v.value = t.invoices, t;
345
+ } catch (t) {
346
+ o.showError(t?.message ?? "Error fetching subscription info");
347
347
  } finally {
348
- r.value = !1;
348
+ n.value = !1;
349
349
  }
350
350
  }
351
351
  function L() {
352
- t.push({
352
+ s.push({
353
353
  query: {
354
354
  ...e.value,
355
355
  one: void 0
@@ -357,120 +357,121 @@ const M = R("one", () => {
357
357
  });
358
358
  }
359
359
  return {
360
- info: h,
361
- interval: q,
362
- subscriptionType: j,
363
- access: $,
360
+ info: y,
361
+ interval: R,
362
+ subscriptionType: q,
363
+ access: I,
364
364
  invoices: v,
365
365
  sessionId: S,
366
366
  subscription: d,
367
367
  monthlyTotal: a,
368
368
  hasBilling: E,
369
- isLoading: r,
369
+ isLoading: n,
370
370
  isOpen: u,
371
- isSubscriber: c,
371
+ isSubscriber: h,
372
+ opencollective: x,
372
373
  github: P,
373
374
  discord: U,
374
- shopify: x,
375
+ shopify: c,
375
376
  one: T,
376
377
  activate: f,
377
- cancel: W,
378
- manage: m,
379
- modify: _,
378
+ cancel: _,
379
+ manage: $,
380
+ modify: w,
380
381
  resetQuery: L,
381
- subscribe: k,
382
- subscriptionInfo: w
382
+ subscribe: W,
383
+ subscriptionInfo: j
383
384
  };
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
- () => u.value ? s.access?.some((a) => ["one/team", "snips/team"].includes(a)) : !1
385
+ }), re = O("team", () => {
386
+ const e = z(), s = X(), r = M(), i = Q(), o = B(), n = N(!1), u = b(null), y = b(!1), v = p(() => e.value.invite), S = p(
387
+ () => u.value ? r.access?.some((a) => ["one/team", "snips/team"].includes(a)) : !1
387
388
  );
388
- I(v, async () => {
389
+ A(v, async () => {
389
390
  if (v.value) {
390
- t.user || (t.dialog = !0);
391
+ s.user || (s.dialog = !0);
391
392
  try {
392
- r.value = !0;
393
+ n.value = !0;
393
394
  const a = await i.get(`/one/team/${v.value}`);
394
- u.value = a.team, h.value = !0;
395
+ u.value = a.team, y.value = !0;
395
396
  } catch (a) {
396
397
  d(), o.showError(a.message);
397
398
  } finally {
398
- r.value = !1;
399
+ n.value = !1;
399
400
  }
400
401
  }
401
402
  }, { immediate: !0 });
402
- async function q(a) {
403
+ async function R(a) {
403
404
  try {
404
- if (r.value = !0, !u.value)
405
+ if (n.value = !0, !u.value)
405
406
  return;
406
407
  await i.post("/one/team/remove", { userId: a }), u.value.members = u.value.members.filter((T) => T.id !== a);
407
408
  } catch (T) {
408
409
  o.showError(T?.message ?? "Error removing user from team");
409
410
  } finally {
410
- r.value = !1;
411
+ n.value = !1;
411
412
  }
412
413
  }
413
- async function j() {
414
+ async function q() {
414
415
  try {
415
- r.value = !0, await i.post("/one/team/leave", { teamId: u.value?.id }), await t.verify(!0);
416
+ n.value = !0, await i.post("/one/team/leave", { teamId: u.value?.id }), await s.verify(!0);
416
417
  } catch (a) {
417
418
  o.showError(a?.message ?? "Error leaving team");
418
419
  } finally {
419
- r.value = !1;
420
+ n.value = !1;
420
421
  }
421
422
  }
422
- async function $() {
423
+ async function I() {
423
424
  try {
424
- r.value = !0, await i.post("/one/team/join", { inviteCode: v.value }), await t.verify(!0), d();
425
+ n.value = !0, await i.post("/one/team/join", { inviteCode: v.value }), await s.verify(!0), d();
425
426
  } catch (a) {
426
427
  o.showError(a?.message ?? "Error joining team");
427
428
  } finally {
428
- r.value = !1;
429
+ n.value = !1;
429
430
  }
430
431
  }
431
432
  function d() {
432
- h.value = !1;
433
+ y.value = !1;
433
434
  const a = new URL(window.location.href);
434
435
  a.searchParams.delete("invite"), window.history.replaceState({}, "", a.toString());
435
436
  }
436
- const E = p(() => t.user?.id === t.user?.team?.owner.id);
437
+ const E = p(() => s.user?.id === s.user?.team?.owner.id);
437
438
  return {
438
439
  team: u,
439
- teamInviteDialog: h,
440
+ teamInviteDialog: y,
440
441
  teamInviteCode: v,
441
442
  hasTeamAccess: S,
442
443
  isTeamOwner: E,
443
- isLoading: r,
444
- removeFromTeam: q,
445
- leaveTeam: j,
446
- joinTeam: $,
444
+ isLoading: n,
445
+ removeFromTeam: R,
446
+ leaveTeam: q,
447
+ joinTeam: I,
447
448
  clearTeamQuery: d
448
449
  };
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 ?? ""));
450
+ }), J = typeof window < "u", X = O("auth", () => {
451
+ const e = b(!1), s = b(null), r = Q(), i = se(), o = V(), n = N(!1), u = M(), y = re(), v = B(), S = C(() => !!s.value), R = C(() => s.value?.role === "super"), q = C(() => ["super", "admin"].includes(s.value?.role ?? "")), I = C(() => ["super", "admin", "editor"].includes(s.value?.role ?? ""));
451
452
  let d = !!x();
452
- I(t, (c) => {
453
+ A(s, (c) => {
453
454
  if (!J || !c?.settings)
454
455
  return;
455
- const f = localStorage.getItem("vuetify@user") || "{}";
456
- if (JSON.stringify(c.settings, null, 2) === f)
456
+ const h = localStorage.getItem("vuetify@user") || "{}";
457
+ if (JSON.stringify(c.settings, null, 2) === h)
457
458
  return;
458
459
  d = !0;
459
- let m = c.settings;
460
- m.version === 6 && (m = F(m));
461
- const k = {
460
+ let f = c.settings;
461
+ f.version === 6 && (f = F(f));
462
+ const $ = {
462
463
  version: 7,
463
- ecosystem: O(structuredClone(g.ecosystem), m.ecosystem || {}),
464
- one: O(structuredClone(g.one), m.one || {})
464
+ ecosystem: k(structuredClone(g.ecosystem), f.ecosystem || {}),
465
+ one: k(structuredClone(g.one), f.one || {})
465
466
  };
466
- Object.assign(i, k);
467
+ Object.assign(i, $);
467
468
  }), i.$subscribe(() => {
468
469
  d || E(), d = !1;
469
470
  });
470
471
  async function E() {
471
- if (await K(), !(!t.value || !i.one.sync))
472
+ if (await K(), !(!s.value || !i.one.sync))
472
473
  try {
473
- await s.post("/user/settings", { settings: i.$state }), await a(!0);
474
+ await r.post("/user/settings", { settings: i.$state }), await a(!0);
474
475
  } catch (c) {
475
476
  v.showError(c?.message ?? "Error syncing settings");
476
477
  }
@@ -478,87 +479,87 @@ const M = R("one", () => {
478
479
  async function a(c = !1) {
479
480
  if (a.promise)
480
481
  return a.promise;
481
- if (!c && !document.cookie.includes("sx=1") && location.hostname.match(/([^.]+\.[^.]+)$/)?.[1] === new URL(s.url).hostname.match(/([^.]+\.[^.]+)$/)?.[1]) {
482
- t.value = null;
482
+ if (!c && !document.cookie.includes("sx=1") && location.hostname.match(/([^.]+\.[^.]+)$/)?.[1] === new URL(r.url).hostname.match(/([^.]+\.[^.]+)$/)?.[1]) {
483
+ s.value = null;
483
484
  return;
484
485
  }
485
- r.value = !0, a.promise = fetch(`${s.url}/auth/verify`, {
486
+ n.value = !0, a.promise = fetch(`${r.url}/auth/verify`, {
486
487
  credentials: "include",
487
488
  cache: c ? "reload" : void 0
488
489
  }).then(
489
- async (f) => {
490
- if (f.ok || f.status === 401) {
491
- const m = await f.json();
492
- t.value = m.user, u.access = m.access, h.team = m.user?.team;
490
+ async (h) => {
491
+ if (h.ok || h.status === 401) {
492
+ const f = await h.json();
493
+ s.value = f.user, u.access = f.access, y.team = f.user?.team;
493
494
  } else
494
- console.error(f.statusText);
495
+ console.error(h.statusText);
495
496
  },
496
497
  () => {
497
498
  }
498
499
  ).finally(() => {
499
- r.value = !1, a.promise = null;
500
+ n.value = !1, a.promise = null;
500
501
  });
501
502
  }
502
503
  a.promise = null;
503
504
  async function T(c = "github") {
504
- r.value = !0;
505
- const f = `${s.url}/auth/${c}/redirect`;
505
+ n.value = !0;
506
+ const h = `${r.url}/auth/${c}/redirect`;
506
507
  if (c === "shopify") {
507
- window.location.assign(f + "?next=" + encodeURIComponent(window.location.href));
508
+ window.location.assign(h + "?next=" + encodeURIComponent(window.location.href));
508
509
  return;
509
510
  }
510
- const m = 400, k = 600, W = window.screenX + (window.innerWidth - m) / 2, _ = window.screenY + (window.innerHeight - k) / 2, w = window.open(
511
+ const f = 400, $ = 600, W = window.screenX + (window.innerWidth - f) / 2, _ = window.screenY + (window.innerHeight - $) / 2, w = window.open(
511
512
  "",
512
513
  "vuetify:authorize:popup",
513
- `popup,left=${W},top=${_},width=${m},height=${k},resizable`
514
+ `popup,left=${W},top=${_},width=${f},height=${$},resizable`
514
515
  );
515
516
  if (!w) {
516
517
  console.error("Failed to open popup");
517
518
  return;
518
519
  }
519
- w.location.href = f;
520
- let L = -1, n = -1;
521
- function l(A) {
522
- A.origin === s.url && A.data?.type === "auth-response" && (A.data.status === "success" ? (t.value || (localStorage.setItem("vuetify@lastLoginProvider", c), e.value = !1, o.push("/user/dashboard")), t.value = A.data.body.user, u.access = A.data.body.access, h.team = A.data.body.user?.team, E()) : console.error(A.data.message), y());
520
+ w.location.href = h;
521
+ let j = -1, L = -1;
522
+ function t(m) {
523
+ m.origin === r.url && m.data?.type === "auth-response" && (m.data.status === "success" ? (s.value || (localStorage.setItem("vuetify@lastLoginProvider", c), e.value = !1, o.push("/user/dashboard")), s.value = m.data.body.user, u.access = m.data.body.access, y.team = m.data.body.user?.team, E()) : console.error(m.data.message), l());
523
524
  }
524
- function y() {
525
- window.removeEventListener("message", l), window.clearInterval(L), window.clearTimeout(n), w?.close(), r.value = !1;
525
+ function l() {
526
+ window.removeEventListener("message", t), window.clearInterval(j), window.clearTimeout(L), w?.close(), n.value = !1;
526
527
  }
527
- window.addEventListener("message", l), L = window.setInterval(() => {
528
- !w || w.closed ? (console.error("Auth popup closed"), y()) : w.postMessage({ type: "auth-request" }, "*");
529
- }, 1e3), n = window.setTimeout(() => {
530
- y(), console.error("Auth timed out");
528
+ window.addEventListener("message", t), j = window.setInterval(() => {
529
+ !w || w.closed ? (console.error("Auth popup closed"), l()) : w.postMessage({ type: "auth-request" }, "*");
530
+ }, 1e3), L = window.setTimeout(() => {
531
+ l(), console.error("Auth timed out");
531
532
  }, 120 * 1e3);
532
533
  }
533
534
  async function P(c) {
534
- r.value = !0;
535
- const f = c ? `/auth/${c}/logout` : "/auth/logout";
535
+ n.value = !0;
536
+ const h = c ? `/auth/${c}/logout` : "/auth/logout";
536
537
  try {
537
- await s.post(f), await a(!0), t.value = null;
538
- } catch (m) {
539
- v.showError(m?.message ?? "Error logging out");
538
+ await r.post(h), await a(!0), s.value = null;
539
+ } catch (f) {
540
+ v.showError(f?.message ?? "Error logging out");
540
541
  } finally {
541
542
  o.push({
542
543
  path: "/",
543
544
  query: o.currentRoute.value.query
544
- }), r.value = !1;
545
+ }), n.value = !1;
545
546
  }
546
547
  }
547
548
  function U(c) {
548
- return t.value?.identities.find((f) => f.provider === c);
549
+ return s.value?.identities.find((h) => h.provider === c);
549
550
  }
550
551
  function x() {
551
552
  return J ? localStorage.getItem("vuetify@lastLoginProvider") : null;
552
553
  }
553
554
  return J && a(), {
554
- user: t,
555
- url: s.url,
555
+ user: s,
556
+ url: r.url,
556
557
  dialog: e,
557
- isLoading: r,
558
+ isLoading: n,
558
559
  isAuthenticated: S,
559
- isSuper: q,
560
- isAdmin: j,
561
- isEditor: $,
560
+ isSuper: R,
561
+ isAdmin: q,
562
+ isEditor: I,
562
563
  verify: a,
563
564
  findIdentity: U,
564
565
  login: T,
package/dist/index.d.ts CHANGED
@@ -181,7 +181,7 @@ interface AuthState {
181
181
  isEditor: Ref<boolean>;
182
182
  verify: (force?: boolean) => Promise<void>;
183
183
  findIdentity: (provider: string) => VOneIdentity | undefined;
184
- login: (provider?: 'github' | 'discord' | 'shopify' | 'google') => Promise<void>;
184
+ login: (provider?: 'github' | 'discord' | 'shopify' | 'google' | 'opencollective') => Promise<void>;
185
185
  logout: (identity?: string) => Promise<void>;
186
186
  lastLoginProvider: () => string | null;
187
187
  sync: () => Promise<void>;
@@ -518,6 +518,7 @@ interface OneState {
518
518
  github: ComputedRef<VOneSponsorship | undefined>;
519
519
  discord: ComputedRef<VOneSponsorship | undefined>;
520
520
  shopify: ComputedRef<VOneIdentity | undefined>;
521
+ opencollective: ComputedRef<VOneSponsorship | undefined>;
521
522
  one: ComputedRef<VOneSponsorship | undefined>;
522
523
  activate: () => Promise<void>;
523
524
  cancel: () => Promise<void>;
@@ -527,7 +528,7 @@ interface OneState {
527
528
  subscribe: (interval: SubscriptionItemPlan['interval'], type: SubscriptionItemPlan['type']) => Promise<void>;
528
529
  subscriptionInfo: () => Promise<any>;
529
530
  }
530
- declare const useOneStore: pinia.StoreDefinition<"one", Pick<OneState, "info" | "access" | "invoices" | "isLoading" | "isOpen">, Pick<OneState, "one" | "interval" | "subscriptionType" | "sessionId" | "subscription" | "monthlyTotal" | "hasBilling" | "isSubscriber" | "github" | "discord" | "shopify">, Pick<OneState, "activate" | "cancel" | "manage" | "modify" | "resetQuery" | "subscribe" | "subscriptionInfo">>;
531
+ declare const useOneStore: pinia.StoreDefinition<"one", Pick<OneState, "info" | "access" | "invoices" | "isLoading" | "isOpen">, Pick<OneState, "one" | "interval" | "subscriptionType" | "sessionId" | "subscription" | "monthlyTotal" | "hasBilling" | "isSubscriber" | "github" | "discord" | "shopify" | "opencollective">, Pick<OneState, "activate" | "cancel" | "manage" | "modify" | "resetQuery" | "subscribe" | "subscriptionInfo">>;
531
532
 
532
533
  type VOnePlay = {
533
534
  id: string;