@vue-skuilder/standalone-ui 0.2.20 → 0.2.21

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.
@@ -40477,6 +40477,7 @@ var import_vuedraggable_umd, B$1, N$2, R$1, q$2, M$2, F$2, z$1, H$1, J$2, y, W$2
40477
40477
  piniaPlugin: () => oe$3,
40478
40478
  requestPasswordReset: () => requestPasswordReset,
40479
40479
  resetPassword: () => resetPassword,
40480
+ resolveLoginIdentifier: () => resolveLoginIdentifier,
40480
40481
  sendVerificationEmail: () => sendVerificationEmail,
40481
40482
  splitByDelimiters: () => splitByDelimiters,
40482
40483
  splitParagraphToken: () => splitParagraphToken,
@@ -40825,10 +40826,46 @@ async function verifyEmail(t) {
40825
40826
  credentials: "include",
40826
40827
  body: JSON.stringify({ token: t })
40827
40828
  });
40828
- return c.ok ? await c.json() : {
40829
+ if (!c.ok) {
40830
+ let t;
40831
+ try {
40832
+ t = (await c.json())?.error;
40833
+ } catch {}
40834
+ return {
40835
+ ok: !1,
40836
+ error: t || `HTTP ${c.status}: ${c.statusText}`
40837
+ };
40838
+ }
40839
+ return await c.json();
40840
+ } catch (t) {
40841
+ return {
40829
40842
  ok: !1,
40830
- error: `HTTP ${c.status}: ${c.statusText}`
40843
+ error: t instanceof Error ? t.message : "Network error"
40831
40844
  };
40845
+ }
40846
+ }
40847
+ async function resolveLoginIdentifier(t, c) {
40848
+ try {
40849
+ let u = await fetch(`${getApiBase()}/auth/resolve-login`, {
40850
+ method: "POST",
40851
+ headers: { "Content-Type": "application/json" },
40852
+ credentials: "include",
40853
+ body: JSON.stringify({
40854
+ identifier: t,
40855
+ password: c
40856
+ })
40857
+ });
40858
+ if (!u.ok) {
40859
+ let t;
40860
+ try {
40861
+ t = (await u.json())?.error;
40862
+ } catch {}
40863
+ return {
40864
+ ok: !1,
40865
+ error: t || `HTTP ${u.status}: ${u.statusText}`
40866
+ };
40867
+ }
40868
+ return await u.json();
40832
40869
  } catch (t) {
40833
40870
  return {
40834
40871
  ok: !1,
@@ -44357,9 +44394,19 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
44357
44394
  D.value = !1;
44358
44395
  }, O.value);
44359
44396
  }, login = async () => {
44360
- E.value = !0, log$2("Starting login attempt"), log$2(`Login attempt for username: ${C.value}`);
44397
+ E.value = !0, log$2("Starting login attempt"), log$2(`Login attempt for identifier: ${C.value}`);
44361
44398
  try {
44362
- log$2("Attempting to get User instance"), yr.value = await getCurrentUser(), log$2("Got User instance, attempting login"), await yr.value.login(C.value, w.value), log$2("Login successful"), log$2("Initializing user config"), S.init(), log$2("User config initialized"), log$2("Setting authentication state"), b.loginAndRegistration.loggedIn = !0, log$2(`Authentication state set, redirecting to: ${u.redirectTo}`), d("loginSuccess", u.redirectTo), m.push(u.redirectTo), log$2("Login and redirect complete");
44399
+ log$2("Attempting to get User instance"), yr.value = await getCurrentUser(), log$2("Got User instance, attempting login");
44400
+ let t = C.value;
44401
+ if (C.value.includes("@")) {
44402
+ let c = await resolveLoginIdentifier(C.value, w.value);
44403
+ if (!c.ok || !c.username) {
44404
+ log$2("Email identifier did not resolve (bad credentials)"), initBadLogin(), E.value = !1;
44405
+ return;
44406
+ }
44407
+ t = c.username;
44408
+ }
44409
+ await yr.value.login(t, w.value), log$2("Login successful"), log$2("Initializing user config"), S.init(), log$2("User config initialized"), log$2("Setting authentication state"), b.loginAndRegistration.loggedIn = !0, log$2(`Authentication state set, redirecting to: ${u.redirectTo}`), d("loginSuccess", u.redirectTo), m.push(u.redirectTo), log$2("Login and redirect complete");
44363
44410
  } catch (t) {
44364
44411
  log$2("Login attempt failed"), log$2(`Login error details: ${JSON.stringify(t)}`), console.log(`login error: ${JSON.stringify(t)}`), log$2("Initiating bad login feedback"), initBadLogin();
44365
44412
  }
@@ -44390,7 +44437,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
44390
44437
  "onUpdate:modelValue": c[0] || (c[0] = (t) => C.value = t),
44391
44438
  autofocus: "",
44392
44439
  name: "username",
44393
- label: "Username",
44440
+ label: "Username or email",
44394
44441
  "prepend-icon": "mdi-account-circle"
44395
44442
  }, null, 8, ["modelValue"]),
44396
44443
  createVNode(d, {
@@ -44467,7 +44514,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
44467
44514
  });
44468
44515
  };
44469
44516
  }
44470
- }), [["__scopeId", "data-v-563b0048"]]), hn = /* @__PURE__ */ defineComponent({
44517
+ }), [["__scopeId", "data-v-f374a5e9"]]), hn = /* @__PURE__ */ defineComponent({
44471
44518
  name: "UserRegistration",
44472
44519
  props: { onSignupSuccess: {
44473
44520
  type: Function,
@@ -44556,7 +44603,6 @@ Author: ${this.author}
44556
44603
  this.user.createAccount(this.username, this.password).then(async (t) => {
44557
44604
  if (t.status === Status.ok) {
44558
44605
  if (this.authStore.loginAndRegistration.loggedIn = !0, this.authStore.loginAndRegistration.init = !1, this.authStore.loginAndRegistration.init = !0, this.email) try {
44559
- await (await getCurrentUser()).setConfig({ email: this.email });
44560
44606
  let t = typeof window < "u" ? window.location.origin : void 0, c = await sendVerificationEmail(this.username, this.email, t);
44561
44607
  c.ok ? Z$2({
44562
44608
  text: "Account created! Please check your email to verify your account.",