@yourgoods/ui-smart 0.53.37 → 0.53.38

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,6 +1,6 @@
1
1
  import { defineComponent as oe, ref as T, reactive as Z, watch as Y, computed as b, toRefs as ce, createElementBlock as I, openBlock as y, createElementVNode as x, createCommentVNode as D, toDisplayString as _, createVNode as $, unref as u, isRef as ee, withCtx as G, createTextVNode as ie, Fragment as Ae, createBlock as H, resolveDynamicComponent as he, onMounted as Fe } from "vue";
2
- import { _ as ve, c as ke, u as Re, a as ze, P as Me, b as We } from "./useRateLimitToast-BjQhqrta.js";
3
- import { C as F, _ as He, B as qe, p as W, g as je } from "./index-Dz48Vppw.js";
2
+ import { _ as ve, c as ke, u as Re, a as ze, P as Me, b as We } from "./useRateLimitToast-CWql-4d7.js";
3
+ import { C as F, _ as He, B as qe, p as W, g as je } from "./index-B5CrRKgu.js";
4
4
  import { PInput as J, IconMailMd as pe, PButton as ne, IconEyeMd as Ve, IconEyeClosedMd as be, PDialog as Ge, PTopBar as Ye, IconCrossMd as Je } from "@profeat/ui-kit";
5
5
  const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { class: "dialogDefaultContainerTextHint" }, Xe = {
6
6
  key: 0,
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as ye, ref as a, reactive as _, computed as u, watch as Z, onMounted as Ce, createElementBlock as S, openBlock as g, Fragment as ge, createVNode as n, unref as o, withCtx as m, createCommentVNode as ee, createElementVNode as r, toDisplayString as V, createBlock as B, resolveDynamicComponent as $, createTextVNode as z } from "vue";
2
- import { C as I, p as D, g as Ve } from "./index-Dz48Vppw.js";
2
+ import { C as I, p as D, g as Ve } from "./index-B5CrRKgu.js";
3
3
  import { PDialog as be, PInput as M, IconEyeMd as O, IconEyeClosedMd as U, PButton as F, PTopBar as Te, IconCrossMd as Ie, PTeleportContainer as xe } from "@profeat/ui-kit";
4
4
  function ke(b) {
5
5
  return { showPasswordRateLimitToast: (P) => {
@@ -1,7 +1,7 @@
1
1
  import { createElementBlock as S, openBlock as v, createElementVNode as H, defineComponent as he, reactive as ve, watch as _, ref as O, toRefs as Ce, computed as I, createCommentVNode as B, createVNode as b, toDisplayString as G, createBlock as J, createTextVNode as Z, unref as r, isRef as le, withCtx as X, onMounted as We, Fragment as je } from "vue";
2
- import { _ as we, c as Ne, a as He, u as Ge, P as Oe, b as Je } from "./useRateLimitToast-BjQhqrta.js";
2
+ import { _ as we, c as Ne, a as He, u as Ge, P as Oe, b as Je } from "./useRateLimitToast-CWql-4d7.js";
3
3
  import { IconTelegramSm as Pe, PInput as se, IconPhoneMd as Re, IconMailMd as Ke, PButton as ze, PDialog as Qe, PTopBar as Xe, IconCrossMd as Ye, PTeleportContainer as Ze } from "@profeat/ui-kit";
4
- import { C as j, t as De, p as te, g as Ae } from "./index-Dz48Vppw.js";
4
+ import { C as j, t as De, p as te, g as Ae } from "./index-B5CrRKgu.js";
5
5
  const _e = {
6
6
  xmlns: "http://www.w3.org/2000/svg",
7
7
  width: "12",
@@ -1,11 +1,11 @@
1
- import { ref as b, shallowRef as Je, defineComponent as H, defineAsyncComponent as Q, watch as Pe, createBlock as z, createCommentVNode as U, unref as p, openBlock as N, resolveDynamicComponent as We, mergeProps as Ye, computed as V, reactive as ee, onMounted as Xe, createElementBlock as F, Fragment as Ne, createVNode as P, createElementVNode as ae, withCtx as O, toDisplayString as G, createTextVNode as te, Teleport as ge, Transition as Ke, withDirectives as Ze, vShow as He } from "vue";
1
+ import { ref as b, shallowRef as Je, defineComponent as ee, defineAsyncComponent as ae, watch as Ne, createBlock as $, createCommentVNode as I, unref as p, openBlock as N, resolveDynamicComponent as We, mergeProps as Ye, computed as B, reactive as te, onMounted as Ke, createElementBlock as V, Fragment as Ce, createVNode as E, createElementVNode as ne, withCtx as O, toDisplayString as G, createTextVNode as oe, Teleport as ve, Transition as Xe, withDirectives as Ze, vShow as He } from "vue";
2
2
  import Qe from "axios";
3
- import { PInputFileUploader as ea, PInput as j, IconFilledEditMd as K, PButton as ve, PImageCropper as aa, PToast as ta, PTeleportContainer as Ce, PToastContainer as na, IconPhoneMd as oa, IconMailMd as ra } from "@profeat/ui-kit";
4
- function la(r, s = 2) {
5
- if (r === 0)
3
+ import { PInputFileUploader as ea, PInput as j, IconFilledEditMd as H, PButton as he, PImageCropper as aa, PToast as ta, PTeleportContainer as ke, PToastContainer as na, IconPhoneMd as oa, IconMailMd as ra } from "@profeat/ui-kit";
4
+ function la(l, s = 2) {
5
+ if (l === 0)
6
6
  return "0 B";
7
- const t = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], f = Math.floor(Math.log(r) / Math.log(t));
8
- return `${Number.parseFloat((r / t ** f).toFixed(s))} ${n[f]}`;
7
+ const t = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], f = Math.floor(Math.log(l) / Math.log(t));
8
+ return `${Number.parseFloat((l / t ** f).toFixed(s))} ${n[f]}`;
9
9
  }
10
10
  const sa = {
11
11
  "image/jpeg": "JPEG",
@@ -15,8 +15,8 @@ const sa = {
15
15
  "application/zip": "ZIP Archive"
16
16
  // ...
17
17
  };
18
- function ia(r) {
19
- return r.map((s) => {
18
+ function ia(l) {
19
+ return l.map((s) => {
20
20
  var t;
21
21
  return sa[s] || ((t = s.split("/")[1]) == null ? void 0 : t.toUpperCase());
22
22
  });
@@ -28,12 +28,12 @@ const $a = {
28
28
  }, za = {
29
29
  VERIFY_EMAIL: "verify-email"
30
30
  };
31
- let oe = null;
32
- function ua(r, s, t) {
33
- oe = Qe.create({
31
+ let le = null;
32
+ function ua(l, s, t) {
33
+ le = Qe.create({
34
34
  baseURL: s,
35
35
  headers: {
36
- Authorization: `Bearer ${r}`,
36
+ Authorization: `Bearer ${l}`,
37
37
  "x-throttler-prefix": t ?? "throttler_profile_edit"
38
38
  // здесь можно словить баг, который может быть сложно отследить, если будет передаваться пустой прелфикс
39
39
  // 'Content-Type': 'application/json',
@@ -41,41 +41,41 @@ function ua(r, s, t) {
41
41
  validateStatus: (n) => n >= 200 && n < 300
42
42
  });
43
43
  }
44
- function se() {
45
- if (!oe)
44
+ function ue() {
45
+ if (!le)
46
46
  throw new Error("Axios instance not initialized. Call initAxios(token, baseUrl) first.");
47
- return oe;
47
+ return le;
48
48
  }
49
- async function re(r, s, t) {
50
- return se().post(r, s, t);
49
+ async function se(l, s, t) {
50
+ return ue().post(l, s, t);
51
51
  }
52
- async function da(r, s) {
53
- return se().get(r, s);
52
+ async function da(l, s) {
53
+ return ue().get(l, s);
54
54
  }
55
- async function ma(r, s) {
56
- return se().delete(r, s);
55
+ async function ma(l, s) {
56
+ return ue().delete(l, s);
57
57
  }
58
- async function ca(r) {
59
- const s = await re("/users/profile/me", r);
58
+ async function ca(l) {
59
+ const s = await se("/users/profile/me", l);
60
60
  if (s.status !== 200 && s.status !== 201 || !s.data)
61
61
  throw new Error("Ошибка при получении профиля пользователя");
62
62
  return s.data;
63
63
  }
64
- const Z = b(null), ne = Je(null);
65
- function ie() {
64
+ const Q = b(null), re = Je(null);
65
+ function de() {
66
66
  return {
67
- currentDialog: Z,
68
- dialogPayload: ne,
67
+ currentDialog: Q,
68
+ dialogPayload: re,
69
69
  openDialog: (n, f) => {
70
- Z.value = n, ne.value = f ?? null;
70
+ Q.value = n, re.value = f ?? null;
71
71
  },
72
72
  closeDialog: () => {
73
- Z.value = null, ne.value = null;
73
+ Q.value = null, re.value = null;
74
74
  },
75
- isDialogOpen: (n) => Z.value === n
75
+ isDialogOpen: (n) => Q.value === n
76
76
  };
77
77
  }
78
- const le = {
78
+ const ie = {
79
79
  ru: {
80
80
  Имя: "Имя",
81
81
  Фамилия: "Фамилия",
@@ -216,7 +216,7 @@ const le = {
216
216
  "Это не похоже на email": "It’s not like email",
217
217
  "Email или телефон": "Email or phone"
218
218
  }
219
- }, pa = /* @__PURE__ */ H({
219
+ }, pa = /* @__PURE__ */ ee({
220
220
  __name: "DialogManager",
221
221
  props: {
222
222
  language: {},
@@ -224,34 +224,34 @@ const le = {
224
224
  disableAddPhone: { type: Boolean }
225
225
  },
226
226
  emits: ["clean-input-errors", "on-update-jwt", "update-phone-field", "update-email-field", "on-password-error", "on-toast"],
227
- setup(r, { emit: s }) {
228
- const t = s, n = b(!0), { currentDialog: f, dialogPayload: g, closeDialog: x } = ie(), m = {
229
- email: Q(() => import("./ProfileEmailDialog-aS-CW0cn.js")),
230
- phone: Q(() => import("./ProfilePhoneDialog-BysaY3fk.js")),
231
- password: Q(() => import("./ProfilePasswordDialog-Hew1T5DH.js"))
232
- }, i = ({ email: E }) => {
233
- t("update-email-field", E);
234
- }, v = ({ phone: E }) => {
235
- t("update-phone-field", E);
227
+ setup(l, { emit: s }) {
228
+ const t = s, n = b(!0), { currentDialog: f, dialogPayload: g, closeDialog: S } = de(), c = {
229
+ email: ae(() => import("./ProfileEmailDialog-Dc2fR8ip.js")),
230
+ phone: ae(() => import("./ProfilePhoneDialog-DBSI5V-4.js")),
231
+ password: ae(() => import("./ProfilePasswordDialog-34IUb78U.js"))
232
+ }, i = ({ email: P }) => {
233
+ t("update-email-field", P);
234
+ }, v = ({ phone: P }) => {
235
+ t("update-phone-field", P);
236
236
  };
237
- return Pe(f, (E) => {
238
- n.value = !!E;
239
- }), (E, u) => p(f) ? (N(), z(We(m[p(f)]), Ye({
237
+ return Ne(f, (P) => {
238
+ n.value = !!P;
239
+ }), (P, m) => p(f) ? (N(), $(We(c[p(f)]), Ye({
240
240
  key: 0,
241
241
  modelValue: n.value,
242
- "onUpdate:modelValue": u[0] || (u[0] = (c) => n.value = c),
243
- language: E.language,
244
- provider: E.provider,
245
- "disable-add-phone": E.disableAddPhone
242
+ "onUpdate:modelValue": m[0] || (m[0] = (d) => n.value = d),
243
+ language: P.language,
244
+ provider: P.provider,
245
+ "disable-add-phone": P.disableAddPhone
246
246
  }, p(g), {
247
- onClose: p(x),
248
- onCleanInputErrors: u[1] || (u[1] = (c) => t("clean-input-errors")),
249
- onOnUpdateJwt: u[2] || (u[2] = (c, w, l) => t("on-update-jwt", c, w, l)),
247
+ onClose: p(S),
248
+ onCleanInputErrors: m[1] || (m[1] = (d) => t("clean-input-errors")),
249
+ onOnUpdateJwt: m[2] || (m[2] = (d, w, o) => t("on-update-jwt", d, w, o)),
250
250
  onSubmitEmail: i,
251
251
  onSubmitPhone: v,
252
- onOnPasswordError: u[3] || (u[3] = (c, w) => t("on-password-error", c, w)),
253
- onOnToast: u[4] || (u[4] = (c) => t("on-toast", c))
254
- }), null, 16, ["modelValue", "language", "provider", "disable-add-phone", "onClose"])) : U("", !0);
252
+ onOnPasswordError: m[3] || (m[3] = (d, w) => t("on-password-error", d, w)),
253
+ onOnToast: m[4] || (m[4] = (d) => t("on-toast", d))
254
+ }), null, 16, ["modelValue", "language", "provider", "disable-add-phone", "onClose"])) : I("", !0);
255
255
  }
256
256
  }), fa = { class: "base-container" }, ga = {
257
257
  key: 0,
@@ -271,7 +271,7 @@ const le = {
271
271
  }, Ea = { class: "buttons-container" }, Pa = {
272
272
  key: 0,
273
273
  class: "centered-overlay"
274
- }, Na = { class: "toastWrapper" }, Ca = /* @__PURE__ */ H({
274
+ }, Na = { class: "toastWrapper" }, Ca = /* @__PURE__ */ ee({
275
275
  __name: "PEditUserContact",
276
276
  props: {
277
277
  language: {},
@@ -285,8 +285,8 @@ const le = {
285
285
  disableAddPhone: { type: Boolean }
286
286
  },
287
287
  emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
288
- setup(r, { emit: s }) {
289
- const t = r, n = s, f = V(() => t.language ?? "ru"), g = (e) => le[f.value][e] || e, { openDialog: x } = ie(), m = ee({ firstName: "", lastName: "" }), i = b({ firstName: "", lastName: "" }), v = ee({ firstName: !1, lastName: !1, email: !1, phone: !1 }), E = b(""), u = b(""), c = b(""), w = b(!1), l = ee({
288
+ setup(l, { emit: s }) {
289
+ const t = l, n = s, f = B(() => t.language ?? "ru"), g = (e) => ie[f.value][e] || e, { openDialog: S } = de(), c = te({ firstName: "", lastName: "" }), i = b({ firstName: "", lastName: "" }), v = te({ firstName: !1, lastName: !1, email: !1, phone: !1 }), P = b(""), m = b(""), d = b(""), w = b(!1), o = te({
290
290
  value: null,
291
291
  loading: !1,
292
292
  accept: ["image/png", "image/jpeg"],
@@ -294,49 +294,49 @@ const le = {
294
294
  // 10 MB
295
295
  imageBinary: null,
296
296
  imageContent: ""
297
- }), $ = b(""), L = b(!1), R = b(!0), d = b(!0), h = b(void 0), y = b(""), B = V(() => ue(m.firstName, v.firstName)), C = V(() => ue(m.lastName, v.lastName)), k = V(() => v.email && !u.value.trim() ? "Введите e-mail" : ""), M = V(() => v.phone && !c.value.trim() ? "Введите номер телефона" : ""), A = (e) => t.fields.some((a) => a.key === e), S = (e) => e && e.trim() ? "edit" : "bind", _ = () => setTimeout(() => {
297
+ }), x = b(""), z = b(!1), L = b(!0), _ = b(!0), q = b(void 0), u = b(""), h = B(() => R(c.firstName, v.firstName)), y = B(() => R(c.lastName, v.lastName)), A = B(() => v.email && !m.value.trim() ? "Введите e-mail" : ""), k = B(() => v.phone && !d.value.trim() ? "Введите номер телефона" : ""), F = (e) => t.fields.some((a) => a.key === e), M = (e) => e && e.trim() ? "edit" : "bind", U = () => setTimeout(() => {
298
298
  var e;
299
299
  return (e = document.activeElement) == null ? void 0 : e.blur();
300
- }, 0), q = V(() => !!(u.value && u.value.trim() !== "")), Te = V(() => l.imageContent ? g("Загрузить другое фото") : g("Загрузить фото")), ue = (e, a) => {
300
+ }, 0), J = B(() => !!(m.value && m.value.trim() !== "")), W = B(() => o.imageContent ? g("Загрузить другое фото") : g("Загрузить фото")), R = (e, a) => {
301
301
  if (!a) return "";
302
- const o = e.trim();
303
- return o ? o.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
304
- }, Be = (e) => x("email", { mode: e ? "edit" : "bind", initialEmail: e }), De = () => {
305
- _(), v.email = !1, d.value = !1, n("open-email-dialog", u.value, S(u.value)), Be(u.value);
302
+ const r = e.trim();
303
+ return r ? r.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
304
+ }, Be = (e) => S("email", { mode: e ? "edit" : "bind", initialEmail: e }), De = () => {
305
+ U(), v.email = !1, _.value = !1, n("open-email-dialog", m.value, M(m.value)), Be(m.value);
306
306
  }, Ie = () => {
307
- _(), v.phone = !1, R.value = !1, n("open-phone-dialog", c.value, S(c.value));
308
- }, Ue = async (e, a, o) => {
309
- e === "email" && o && (u.value = o), e === "phone" && o && (c.value = o), n("on-update-jwt");
307
+ U(), v.phone = !1, L.value = !1, n("open-phone-dialog", d.value, M(d.value));
308
+ }, Ue = async (e, a, r) => {
309
+ e === "email" && r && (m.value = r), e === "phone" && r && (d.value = r), n("on-update-jwt");
310
310
  }, Ve = (e) => {
311
- c.value = e;
311
+ d.value = e;
312
312
  }, Ae = (e) => {
313
- u.value = e;
313
+ m.value = e;
314
314
  }, Fe = (e, a) => {
315
- L.value = !0, n("on-password-error", e, a);
315
+ z.value = !0, n("on-password-error", e, a);
316
316
  }, Se = () => {
317
- R.value = !1, d.value = !1;
318
- }, J = (e) => {
319
- L.value = !0, h.value = e.color ?? "", y.value = e.text ?? "";
320
- }, W = (e) => {
317
+ L.value = !1, _.value = !1;
318
+ }, Y = (e) => {
319
+ z.value = !0, q.value = e.color ?? "", u.value = e.text ?? "";
320
+ }, K = (e) => {
321
321
  if (v[e] = !0, e === "firstName" || e === "lastName") {
322
- const a = m[e];
323
- a.length > 40 && (m[e] = a.slice(0, 40));
322
+ const a = c[e];
323
+ a.length > 40 && (c[e] = a.slice(0, 40));
324
324
  }
325
- }, Me = (e) => {
326
- var Y, X;
327
- if ($.value = "", !e) {
328
- de();
325
+ }, xe = (e) => {
326
+ var X, Z;
327
+ if (x.value = "", !e) {
328
+ me();
329
329
  return;
330
330
  }
331
- const a = ((Y = e.fileBinary) == null ? void 0 : Y.type) ?? "", o = ((X = e.fileBinary) == null ? void 0 : X.size) ?? 0, I = !["image/png", "image/jpeg"].includes(a), D = o > l.uploadLimit;
332
- if (I || D) {
333
- $.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", de();
331
+ const a = ((X = e.fileBinary) == null ? void 0 : X.type) ?? "", r = ((Z = e.fileBinary) == null ? void 0 : Z.size) ?? 0, D = !["image/png", "image/jpeg"].includes(a), T = r > o.uploadLimit;
332
+ if (D || T) {
333
+ x.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", me();
334
334
  return;
335
335
  }
336
- l.value = e, l.imageBinary = e.fileBinary ?? null, l.imageContent = e.fileContent ?? "", w.value = !0;
337
- }, de = () => {
338
- l.value = null, l.imageBinary = null, l.imageContent = "", w.value = !1;
339
- }, xe = async () => {
336
+ o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", w.value = !0;
337
+ }, me = () => {
338
+ o.value = null, o.imageBinary = null, o.imageContent = "", w.value = !1;
339
+ }, Me = async () => {
340
340
  try {
341
341
  const a = (await ma("/users/profile/delete/avatar")).data;
342
342
  return (a == null ? void 0 : a.success) === !0;
@@ -344,82 +344,82 @@ const le = {
344
344
  return console.error("Ошибка при удалении аватара:", e), !1;
345
345
  }
346
346
  }, $e = () => {
347
- $.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", l.value = null, l.imageBinary = null, l.imageContent = "", w.value = !1;
348
- }, me = async (e, a, o = "image/png") => {
347
+ x.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", o.value = null, o.imageBinary = null, o.imageContent = "", w.value = !1;
348
+ }, ce = async (e, a, r = "image/png") => {
349
349
  if (!e) return null;
350
- const I = await (await fetch(e)).blob();
351
- return new File([I], a, { type: o });
350
+ const D = await (await fetch(e)).blob();
351
+ return new File([D], a, { type: r });
352
352
  }, ze = () => {
353
- l.value = null, l.imageBinary = null, l.imageContent = "", w.value = !1;
353
+ o.value = null, o.imageBinary = null, o.imageContent = "", w.value = !1;
354
354
  }, Le = async (e) => {
355
355
  w.value = !1;
356
- const a = l.imageContent;
357
- if (l.imageContent = e, !l.imageBinary) return;
358
- const o = await me(
356
+ const a = o.imageContent;
357
+ if (o.imageContent = e, !o.imageBinary) return;
358
+ const r = await ce(
359
359
  e,
360
- l.imageBinary.name,
361
- l.imageBinary.type || "image/png"
360
+ o.imageBinary.name,
361
+ o.imageBinary.type || "image/png"
362
362
  );
363
- if (!o) {
364
- l.imageContent = a;
363
+ if (!r) {
364
+ o.imageContent = a;
365
365
  return;
366
366
  }
367
367
  try {
368
- l.loading = !0;
369
- const T = new FormData();
370
- T.append("file", o), await re(`/users/profile/avatar/${E.value}`, T, { headers: { "Content-Type": void 0 } });
371
- } catch (T) {
372
- console.error(T), J({
368
+ o.loading = !0;
369
+ const C = new FormData();
370
+ C.append("file", r), await se(`/users/profile/avatar/${P.value}`, C, { headers: { "Content-Type": void 0 } });
371
+ } catch (C) {
372
+ console.error(C), Y({
373
373
  color: "error",
374
374
  text: g("Не удалось сохранить изменения. Попробуйте позже")
375
- }), l.imageContent = a;
375
+ }), o.imageContent = a;
376
376
  } finally {
377
- l.loading = !1;
377
+ o.loading = !1;
378
378
  }
379
379
  }, _e = async (e) => {
380
- l.imageContent = e ?? "", l.imageBinary && (l.imageBinary = await me(
380
+ o.imageContent = e ?? "", o.imageBinary && (o.imageBinary = await ce(
381
381
  e ?? "",
382
- l.imageBinary.name,
383
- l.imageBinary.type || "image/png"
382
+ o.imageBinary.name,
383
+ o.imageBinary.type || "image/png"
384
384
  ));
385
- }, ce = b(!1), pe = async (e) => {
386
- var o, T;
387
- const a = (o = m[e]) == null ? void 0 : o.trim();
385
+ }, pe = b(!1), fe = async (e) => {
386
+ var r, C;
387
+ const a = (r = c[e]) == null ? void 0 : r.trim();
388
388
  if (a)
389
389
  try {
390
- ce.value = !0;
391
- const D = (T = (await re("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : T.data;
392
- D != null && D.user && (m.firstName = D.user.firstName ?? m.firstName, m.lastName = D.user.lastName ?? m.lastName, i.value = {
393
- firstName: m.firstName,
394
- lastName: m.lastName
390
+ pe.value = !0;
391
+ const T = (C = (await se("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : C.data;
392
+ T != null && T.user && (c.firstName = T.user.firstName ?? c.firstName, c.lastName = T.user.lastName ?? c.lastName, i.value = {
393
+ firstName: c.firstName,
394
+ lastName: c.lastName
395
395
  });
396
- } catch (I) {
397
- throw I;
396
+ } catch (D) {
397
+ throw D;
398
398
  } finally {
399
- ce.value = !1;
399
+ pe.value = !1;
400
400
  }
401
401
  }, Re = async () => {
402
402
  var e;
403
403
  if (!t.accessToken)
404
404
  throw console.error("Access token не передан в props"), new Error("Access token is required");
405
405
  try {
406
- const o = (e = (await ca({
406
+ const r = (e = (await ca({
407
407
  accessToken: t.accessToken,
408
408
  refreshToken: t.refreshToken ?? "",
409
409
  excludeFields: []
410
410
  })).data) == null ? void 0 : e.user;
411
- if (!o)
411
+ if (!r)
412
412
  throw console.error("Данные пользователя отсутствуют в ответе сервера"), new Error("User data is missing from the response");
413
413
  const {
414
- userId: T,
415
- privateFirstName: I,
416
- privateLastName: D,
417
- email: Y,
418
- phoneNumber: X
419
- } = o;
420
- E.value = T ?? "", m.firstName = I ?? "", m.lastName = D ?? "", u.value = Y ?? "", c.value = X ?? "", l.imageContent = await Oe(), i.value = {
421
- firstName: I ?? "",
422
- lastName: D ?? ""
414
+ userId: C,
415
+ privateFirstName: D,
416
+ privateLastName: T,
417
+ email: X,
418
+ phoneNumber: Z
419
+ } = r;
420
+ P.value = C ?? "", c.firstName = D ?? "", c.lastName = T ?? "", m.value = X ?? "", d.value = Z ?? "", o.imageContent = await Oe(), i.value = {
421
+ firstName: D ?? "",
422
+ lastName: T ?? ""
423
423
  };
424
424
  } catch (a) {
425
425
  console.error("Критическая ошибка при загрузке профиля:", a);
@@ -427,8 +427,8 @@ const le = {
427
427
  }, Oe = async () => {
428
428
  var e;
429
429
  try {
430
- const o = (e = (await da("/users/profile/avatar")).data) == null ? void 0 : e.data;
431
- return o ? Ge(o) : "";
430
+ const r = (e = (await da("/users/profile/avatar")).data) == null ? void 0 : e.data;
431
+ return r ? Ge(r) : "";
432
432
  } catch (a) {
433
433
  return console.error("Ошибка при загрузке метаданных аватара:", a), "";
434
434
  }
@@ -442,30 +442,30 @@ const le = {
442
442
  return console.error("Ошибка при составлении URL аватара:", a), "";
443
443
  }
444
444
  }
445
- const fe = V(() => {
445
+ const ge = B(() => {
446
446
  if (!i.value.firstName && !i.value.lastName)
447
447
  return !1;
448
- const e = m.firstName.trim(), a = m.lastName.trim(), o = i.value.firstName.trim(), T = i.value.lastName.trim(), I = e !== o || a !== T, D = e.length >= 2 && a.length >= 2;
449
- return I && D;
448
+ const e = c.firstName.trim(), a = c.lastName.trim(), r = i.value.firstName.trim(), C = i.value.lastName.trim(), D = e !== r || a !== C, T = e.length >= 2 && a.length >= 2;
449
+ return D && T;
450
450
  }), je = async () => {
451
- if (fe.value)
451
+ if (ge.value)
452
452
  try {
453
- await Promise.all([pe("firstName"), pe("lastName")]), n("on-update-jwt"), J({ color: "success", text: "Изменения сохранены" });
453
+ await Promise.all([fe("firstName"), fe("lastName")]), n("on-update-jwt"), Y({ color: "success", text: "Изменения сохранены" });
454
454
  } catch (e) {
455
- console.error(e), J({
455
+ console.error(e), Y({
456
456
  color: "error",
457
457
  text: g("Не удалось сохранить изменения. Попробуйте позже")
458
458
  });
459
459
  }
460
460
  }, qe = () => {
461
- _(), n("open-password-dialog");
461
+ U(), n("open-password-dialog");
462
462
  };
463
- return Xe(async () => {
463
+ return Ke(async () => {
464
464
  if (!t.accessToken) throw new Error("Access token не передан в props");
465
465
  if (!t.requestUrl) throw new Error("auth-backend url не передан в props");
466
466
  ua(t.accessToken, t.requestUrl, t.throttlerPrefix), await Re();
467
- }), (e, a) => (N(), F(Ne, null, [
468
- P(pa, {
467
+ }), (e, a) => (N(), V(Ce, null, [
468
+ E(pa, {
469
469
  language: f.value,
470
470
  provider: e.provider,
471
471
  "disable-add-phone": e.disableAddPhone,
@@ -474,154 +474,154 @@ const le = {
474
474
  onUpdatePhoneField: Ve,
475
475
  onUpdateEmailField: Ae,
476
476
  onOnPasswordError: Fe,
477
- onOnToast: J
477
+ onOnToast: Y
478
478
  }, null, 8, ["language", "provider", "disable-add-phone"]),
479
- ae("div", fa, [
480
- A("avatar") ? (N(), z(p(ea), {
479
+ ne("div", fa, [
480
+ F("avatar") ? (N(), $(p(ea), {
481
481
  key: 0,
482
- modelValue: l.value,
482
+ modelValue: o.value,
483
483
  "onUpdate:modelValue": [
484
- a[0] || (a[0] = (o) => l.value = o),
485
- a[1] || (a[1] = (o) => Me(o))
484
+ a[0] || (a[0] = (r) => o.value = r),
485
+ a[1] || (a[1] = (r) => xe(r))
486
486
  ],
487
487
  type: "img",
488
488
  class: "avatar-input",
489
- src: l.imageContent,
490
- loading: l.loading,
489
+ src: o.imageContent,
490
+ loading: o.loading,
491
491
  label: g("Загрузить фото"),
492
- "upload-limit": l.uploadLimit,
492
+ "upload-limit": o.uploadLimit,
493
493
  accept: "image/jpeg, image/png",
494
- onDelete: xe,
494
+ onDelete: Me,
495
495
  "onChange:error": $e
496
496
  }, {
497
497
  afterLoadLabel: O(() => [
498
- te(G(Te.value), 1)
498
+ oe(G(W.value), 1)
499
499
  ]),
500
500
  subtext: O(() => [
501
- $.value ? (N(), F("span", ga, G($.value), 1)) : (N(), F("span", va, G(`${g("Формат")} ${p(ia)(l.accept).join(", ")} ${g("до")} ${p(la)(l.uploadLimit)}`), 1))
501
+ x.value ? (N(), V("span", ga, G(x.value), 1)) : (N(), V("span", va, G(`${g("Формат")} ${p(ia)(o.accept).join(", ")} ${g("до")} ${p(la)(o.uploadLimit)}`), 1))
502
502
  ]),
503
503
  _: 1
504
- }, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) : U("", !0),
505
- A("firstName") ? (N(), F("div", ha, [
506
- P(p(j), {
507
- modelValue: m.firstName,
508
- "onUpdate:modelValue": a[2] || (a[2] = (o) => m.firstName = o),
504
+ }, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) : I("", !0),
505
+ F("firstName") ? (N(), V("div", ha, [
506
+ E(p(j), {
507
+ modelValue: c.firstName,
508
+ "onUpdate:modelValue": a[2] || (a[2] = (r) => c.firstName = r),
509
509
  size: "large",
510
510
  label: g("Имя"),
511
- error: B.value,
512
- onBlur: a[3] || (a[3] = (o) => v.firstName = !0),
513
- onInput: a[4] || (a[4] = (o) => W("firstName"))
511
+ error: h.value,
512
+ onBlur: a[3] || (a[3] = (r) => v.firstName = !0),
513
+ onInput: a[4] || (a[4] = (r) => K("firstName"))
514
514
  }, null, 8, ["modelValue", "label", "error"]),
515
- P(p(K), { class: "icon-locked" })
516
- ])) : U("", !0),
517
- A("lastName") ? (N(), F("div", ya, [
518
- P(p(j), {
519
- modelValue: m.lastName,
520
- "onUpdate:modelValue": a[5] || (a[5] = (o) => m.lastName = o),
515
+ E(p(H), { class: "icon-locked" })
516
+ ])) : I("", !0),
517
+ F("lastName") ? (N(), V("div", ya, [
518
+ E(p(j), {
519
+ modelValue: c.lastName,
520
+ "onUpdate:modelValue": a[5] || (a[5] = (r) => c.lastName = r),
521
521
  size: "large",
522
522
  label: g("Фамилия"),
523
- error: C.value,
524
- onBlur: a[6] || (a[6] = (o) => v.lastName = !0),
525
- onInput: a[7] || (a[7] = (o) => W("lastName"))
523
+ error: y.value,
524
+ onBlur: a[6] || (a[6] = (r) => v.lastName = !0),
525
+ onInput: a[7] || (a[7] = (r) => K("lastName"))
526
526
  }, null, 8, ["modelValue", "label", "error"]),
527
- P(p(K), { class: "icon-locked" })
528
- ])) : U("", !0),
529
- A("email") ? (N(), F("div", wa, [
530
- P(p(j), {
531
- modelValue: u.value,
532
- "onUpdate:modelValue": a[8] || (a[8] = (o) => u.value = o),
527
+ E(p(H), { class: "icon-locked" })
528
+ ])) : I("", !0),
529
+ F("email") ? (N(), V("div", wa, [
530
+ E(p(j), {
531
+ modelValue: m.value,
532
+ "onUpdate:modelValue": a[8] || (a[8] = (r) => m.value = r),
533
533
  size: "large",
534
534
  "text-size": "medium",
535
535
  label: "E-mail",
536
536
  type: "email",
537
537
  readonly: "",
538
538
  style: { cursor: "pointer" },
539
- error: k.value && d.value,
540
- onBlur: a[9] || (a[9] = (o) => v.email = !0),
541
- onInput: a[10] || (a[10] = (o) => W("email")),
539
+ error: A.value && _.value,
540
+ onBlur: a[9] || (a[9] = (r) => v.email = !0),
541
+ onInput: a[10] || (a[10] = (r) => K("email")),
542
542
  onClick: De
543
543
  }, null, 8, ["modelValue", "error"]),
544
- P(p(K), { class: "icon-locked" })
545
- ])) : U("", !0),
546
- A("phone") ? (N(), F("div", ba, [
547
- P(p(j), {
548
- modelValue: c.value,
549
- "onUpdate:modelValue": a[11] || (a[11] = (o) => c.value = o),
544
+ E(p(H), { class: "icon-locked" })
545
+ ])) : I("", !0),
546
+ F("phone") ? (N(), V("div", ba, [
547
+ E(p(j), {
548
+ modelValue: d.value,
549
+ "onUpdate:modelValue": a[11] || (a[11] = (r) => d.value = r),
550
550
  size: "large",
551
551
  "text-size": "medium",
552
552
  label: g("Номер телефона"),
553
553
  type: "tel",
554
554
  readonly: "",
555
555
  style: { cursor: "pointer" },
556
- error: M.value && R.value,
557
- onBlur: a[12] || (a[12] = (o) => v.phone = !0),
558
- onInput: a[13] || (a[13] = (o) => W("phone")),
556
+ error: k.value && L.value,
557
+ onBlur: a[12] || (a[12] = (r) => v.phone = !0),
558
+ onInput: a[13] || (a[13] = (r) => K("phone")),
559
559
  onClick: Ie
560
560
  }, null, 8, ["modelValue", "label", "error"]),
561
- P(p(K), { class: "icon-locked" })
562
- ])) : U("", !0),
563
- ae("div", Ea, [
564
- q.value ? (N(), z(p(ve), {
561
+ E(p(H), { class: "icon-locked" })
562
+ ])) : I("", !0),
563
+ ne("div", Ea, [
564
+ J.value ? (N(), $(p(he), {
565
565
  key: 0,
566
566
  color: "secondary",
567
567
  onClick: qe
568
568
  }, {
569
569
  default: O(() => [
570
- te(G(g("Сменить пароль")), 1)
570
+ oe(G(g("Сменить пароль")), 1)
571
571
  ]),
572
572
  _: 1
573
- })) : U("", !0),
574
- P(p(ve), {
575
- disabled: !fe.value,
573
+ })) : I("", !0),
574
+ E(p(he), {
575
+ disabled: !ge.value,
576
576
  onClick: je
577
577
  }, {
578
578
  default: O(() => [
579
- te(G(g("Сохранить")), 1)
579
+ oe(G(g("Сохранить")), 1)
580
580
  ]),
581
581
  _: 1
582
582
  }, 8, ["disabled"])
583
583
  ])
584
584
  ]),
585
- w.value ? (N(), z(ge, {
585
+ w.value ? (N(), $(ve, {
586
586
  key: 0,
587
587
  to: "body"
588
588
  }, [
589
- w.value ? (N(), F("div", Pa, [
590
- P(p(aa), {
589
+ w.value ? (N(), V("div", Pa, [
590
+ E(p(aa), {
591
591
  "circle-mode": !0,
592
- "model-value": l.imageContent,
592
+ "model-value": o.imageContent,
593
593
  onClose: ze,
594
- onSave: a[14] || (a[14] = (o) => Le(o)),
595
- "onUpdate:modelValue": a[15] || (a[15] = (o) => _e(o))
594
+ onSave: a[14] || (a[14] = (r) => Le(r)),
595
+ "onUpdate:modelValue": a[15] || (a[15] = (r) => _e(r))
596
596
  }, null, 8, ["model-value"])
597
- ])) : U("", !0)
598
- ])) : U("", !0),
599
- (N(), z(ge, { to: "#toast-root" }, [
600
- ae("div", Na, [
601
- P(Ke, { name: "list" }, {
597
+ ])) : I("", !0)
598
+ ])) : I("", !0),
599
+ (N(), $(ve, { to: "#toast-root" }, [
600
+ ne("div", Na, [
601
+ E(Xe, { name: "list" }, {
602
602
  default: O(() => [
603
- Ze(P(p(ta), {
603
+ Ze(E(p(ta), {
604
604
  class: "toast",
605
- color: h.value,
606
- text: y.value,
607
- onClose: a[16] || (a[16] = (o) => L.value = !1)
605
+ color: q.value,
606
+ text: u.value,
607
+ onClose: a[16] || (a[16] = (r) => z.value = !1)
608
608
  }, null, 8, ["color", "text"]), [
609
- [He, L.value]
609
+ [He, z.value]
610
610
  ])
611
611
  ]),
612
612
  _: 1
613
613
  })
614
614
  ])
615
615
  ])),
616
- P(p(Ce))
616
+ E(p(ke))
617
617
  ], 64));
618
618
  }
619
- }), ke = (r, s) => {
620
- const t = r.__vccOpts || r;
619
+ }), Te = (l, s) => {
620
+ const t = l.__vccOpts || l;
621
621
  for (const [n, f] of s)
622
622
  t[n] = f;
623
623
  return t;
624
- }, ka = /* @__PURE__ */ ke(Ca, [["__scopeId", "data-v-4e8a6f81"]]), La = /* @__PURE__ */ H({
624
+ }, ka = /* @__PURE__ */ Te(Ca, [["__scopeId", "data-v-4e8a6f81"]]), La = /* @__PURE__ */ ee({
625
625
  __name: "index",
626
626
  props: {
627
627
  throttlerPrefix: {},
@@ -635,19 +635,19 @@ const le = {
635
635
  disableAddPhone: { type: Boolean }
636
636
  },
637
637
  emits: ["on-update-jwt", "update-tokens"],
638
- setup(r, { emit: s }) {
639
- const t = s, { openDialog: n } = ie(), f = (i, v) => {
638
+ setup(l, { emit: s }) {
639
+ const t = s, { openDialog: n } = de(), f = (i, v) => {
640
640
  n("email", { initialEmail: i, mode: v });
641
641
  }, g = (i, v) => {
642
642
  n("phone", { initialPhone: i, mode: v });
643
- }, x = () => {
643
+ }, S = () => {
644
644
  n("password");
645
- }, m = (i, v, E) => {
646
- t("on-update-jwt", i, v, E);
645
+ }, c = (i, v, P) => {
646
+ t("on-update-jwt", i, v, P);
647
647
  };
648
- return (i, v) => (N(), F(Ne, null, [
649
- P(p(na)),
650
- P(ka, {
648
+ return (i, v) => (N(), V(Ce, null, [
649
+ E(p(na)),
650
+ E(ka, {
651
651
  "throttler-prefix": i.throttlerPrefix,
652
652
  provider: i.provider,
653
653
  "request-url": i.requestUrl,
@@ -659,43 +659,43 @@ const le = {
659
659
  "disable-add-phone": i.disableAddPhone,
660
660
  onOpenEmailDialog: f,
661
661
  onOpenPhoneDialog: g,
662
- onOpenPasswordDialog: x,
663
- onOnUpdateJwt: m
662
+ onOpenPasswordDialog: S,
663
+ onOnUpdateJwt: c
664
664
  }, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url", "disable-add-phone"]),
665
- P(p(Ce))
665
+ E(p(ke))
666
666
  ], 64));
667
667
  }
668
668
  }), Ta = 10, Ba = 10, Da = 15;
669
- function he(r, s, t) {
670
- let n = r.replace(/[^\d+]/g, "").replace(/(?!^)\+/g, "");
669
+ function ye(l, s, t) {
670
+ let n = l.replace(/[^\d+]/g, "").replace(/(?!^)\+/g, "");
671
671
  return t != null && t.startsWith("ru") && n.startsWith("8") ? n = `+7${n.slice(1)}` : s && n && !n.startsWith("+") && (n = `+${n}`), n;
672
672
  }
673
- function ye(r) {
674
- return r.startsWith("+") ? r.slice(1).replace(/\D/g, "") : r.replace(/\D/g, "");
673
+ function we(l) {
674
+ return l.startsWith("+") ? l.slice(1).replace(/\D/g, "") : l.replace(/\D/g, "");
675
675
  }
676
- function we(r, s = Ta, t = Da) {
677
- if (!r.startsWith("+"))
676
+ function be(l, s = Ta, t = Da) {
677
+ if (!l.startsWith("+"))
678
678
  return !1;
679
- const n = r.slice(1);
679
+ const n = l.slice(1);
680
680
  return !(!/^\d+$/.test(n) || n.length < s || n.length > t);
681
681
  }
682
- function be(r) {
683
- return !/^\+?\d*$/.test(r);
682
+ function Ee(l) {
683
+ return !/^\+?\d*$/.test(l);
684
684
  }
685
- function Ia(r, s) {
685
+ function Ia(l, s) {
686
686
  let t = 0, n = !1;
687
- return r.split("").filter((f, g) => f === "+" ? g !== 0 || n ? !1 : (n = !0, !0) : /\d/.test(f) ? (t++, t <= s) : !1).join("");
687
+ return l.split("").filter((f, g) => f === "+" ? g !== 0 || n ? !1 : (n = !0, !0) : /\d/.test(f) ? (t++, t <= s) : !1).join("");
688
688
  }
689
689
  const Ua = /^[\w.%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i;
690
- function Ee(r) {
691
- return Ua.test(r);
690
+ function Pe(l) {
691
+ return Ua.test(l);
692
692
  }
693
- function Va(r, s) {
693
+ function Va(l, s) {
694
694
  var n, f;
695
- const t = r.trim();
695
+ const t = l.trim();
696
696
  return (n = s.phone) != null && n.enabled && /\d/.test(t) && !t.includes("@") ? "phone" : (f = s.email) != null && f.enabled ? "email" : null;
697
697
  }
698
- const Aa = { class: "smart-input" }, Fa = /* @__PURE__ */ H({
698
+ const Aa = { class: "smart-input" }, Fa = /* @__PURE__ */ ee({
699
699
  __name: "index",
700
700
  props: {
701
701
  modelValue: {},
@@ -708,156 +708,154 @@ const Aa = { class: "smart-input" }, Fa = /* @__PURE__ */ H({
708
708
  errorMessages: {}
709
709
  },
710
710
  emits: ["update:modelValue", "validity-change", "type-change"],
711
- setup(r, { emit: s }) {
712
- const t = r, n = s, f = V(() => t.locale ?? "ru"), g = (d) => le[f.value][d] || d, x = V(() => t.label ? g(t.label) : g("Email или телефон"));
713
- function m(d, h) {
714
- return h ? h in le[f.value] ? g(h) : h : g(d);
711
+ setup(l, { emit: s }) {
712
+ const t = l, n = s, f = B(() => t.locale ?? "ru"), g = (u) => ie[f.value][u] || u, S = B(() => t.label ? g(t.label) : g("Email или телефон"));
713
+ function c(u, h) {
714
+ return h ? h in ie[f.value] ? g(h) : h : g(u);
715
715
  }
716
- const i = V(() => {
717
- var d, h, y, B, C, k, M, A, S, _, q;
716
+ const i = B(() => {
717
+ var u, h, y, A, k, F, M, U, J, W, R;
718
718
  return {
719
- mode: ((d = t.config) == null ? void 0 : d.mode) ?? "auto",
719
+ mode: ((u = t.config) == null ? void 0 : u.mode) ?? "auto",
720
720
  phone: {
721
721
  enabled: ((y = (h = t.config) == null ? void 0 : h.phone) == null ? void 0 : y.enabled) ?? !0,
722
- minDigits: ((C = (B = t.config) == null ? void 0 : B.phone) == null ? void 0 : C.minDigits) ?? 10,
723
- maxDigits: ((M = (k = t.config) == null ? void 0 : k.phone) == null ? void 0 : M.maxDigits) ?? 15,
724
- autoPlus: ((S = (A = t.config) == null ? void 0 : A.phone) == null ? void 0 : S.autoPlus) ?? !0
722
+ minDigits: ((k = (A = t.config) == null ? void 0 : A.phone) == null ? void 0 : k.minDigits) ?? 10,
723
+ maxDigits: ((M = (F = t.config) == null ? void 0 : F.phone) == null ? void 0 : M.maxDigits) ?? 15,
724
+ autoPlus: ((J = (U = t.config) == null ? void 0 : U.phone) == null ? void 0 : J.autoPlus) ?? !0
725
725
  },
726
726
  email: {
727
- enabled: ((q = (_ = t.config) == null ? void 0 : _.email) == null ? void 0 : q.enabled) ?? !0
727
+ enabled: ((R = (W = t.config) == null ? void 0 : W.email) == null ? void 0 : R.enabled) ?? !0
728
728
  }
729
729
  };
730
- }), v = b(null), E = b(""), u = b(t.modelValue ?? ""), c = b(null), w = b("");
731
- Pe(() => t.modelValue, (d) => {
732
- d !== void 0 && (u.value = d, E.value = d);
733
730
  });
734
- function l(d) {
735
- var C;
736
- w.value = "";
737
- const y = d.target.value;
731
+ function v(u) {
732
+ if (t.errorMessages)
733
+ switch (u) {
734
+ case "Допустимы только цифры и знак + в начале":
735
+ return t.errorMessages.invalidPhoneChars;
736
+ case "Это не похоже на номер телефона":
737
+ return t.errorMessages.invalidPhoneLength;
738
+ case "Это не похоже на email":
739
+ return t.errorMessages.invalidEmail;
740
+ }
741
+ }
742
+ const P = b(null), m = b(""), d = b(t.modelValue ?? ""), w = b(null), o = b(null), x = B(() => o.value ? c(
743
+ o.value,
744
+ v(o.value)
745
+ ) : "");
746
+ Ne(() => t.modelValue, (u) => {
747
+ u !== void 0 && (d.value = u, m.value = u);
748
+ });
749
+ function z(u) {
750
+ o.value = null;
751
+ const y = u.target.value;
738
752
  if (y.trim() === "") {
739
- c.value = null, w.value = "", n("type-change", null), n("update:modelValue", ""), n("validity-change", !1);
753
+ w.value = null, o.value = null, n("type-change", null), n("update:modelValue", ""), n("validity-change", !1);
740
754
  return;
741
755
  }
742
- const B = i.value.mode === "auto" ? Va(y, i.value) : i.value.mode;
743
- if (c.value = B, n("type-change", B), B === "email") {
744
- const k = Ee(y);
745
- u.value = y, E.value = y, n("update:modelValue", y), n("validity-change", k);
756
+ const A = i.value.mode === "auto" ? Va(y, i.value) : i.value.mode;
757
+ if (w.value = A, n("type-change", A), A === "email") {
758
+ const k = Pe(y);
759
+ d.value = y, m.value = y, n("update:modelValue", y), n("validity-change", k);
746
760
  return;
747
761
  }
748
- if (B === "phone") {
749
- const k = he(
762
+ if (A === "phone") {
763
+ const k = ye(
750
764
  y,
751
765
  i.value.phone.autoPlus,
752
766
  t.locale
753
767
  );
754
- if (ye(k).length > i.value.phone.maxDigits) {
755
- const S = Ia(y, i.value.phone.maxDigits);
756
- u.value = S, n("update:modelValue", S), R(S);
768
+ if (we(k).length > i.value.phone.maxDigits) {
769
+ const U = Ia(y, i.value.phone.maxDigits);
770
+ d.value = U, n("update:modelValue", U), q(U);
757
771
  return;
758
772
  }
759
- if (u.value = y, be(y)) {
760
- w.value = m(
761
- "Допустимы только цифры и знак + в начале",
762
- (C = t.errorMessages) == null ? void 0 : C.invalidPhoneChars
763
- ), n("validity-change", !1);
773
+ if (d.value = y, Ee(y)) {
774
+ o.value = "Допустимы только цифры и знак + в начале", n("validity-change", !1);
764
775
  return;
765
776
  }
766
- u.value = k, n("update:modelValue", k), E.value = k;
767
- const A = we(
777
+ d.value = k, n("update:modelValue", k), m.value = k;
778
+ const M = be(
768
779
  k,
769
780
  i.value.phone.minDigits,
770
781
  i.value.phone.maxDigits
771
782
  );
772
- n("validity-change", A);
783
+ n("validity-change", M);
773
784
  }
774
785
  }
775
- function $() {
776
- var d, h, y, B;
777
- if (console.debug("✅[event] onBlur is working"), !!c.value) {
778
- if (c.value === "phone") {
779
- const C = he(
780
- u.value,
786
+ function L() {
787
+ if (console.debug("✅[event] onBlur is working"), !!w.value) {
788
+ if (w.value === "phone") {
789
+ const u = ye(
790
+ d.value,
781
791
  i.value.phone.autoPlus,
782
792
  t.locale
783
- ), k = ye(C);
784
- if (be(C)) {
785
- w.value = m(
786
- "Допустимы только цифры и знак + в начале",
787
- (d = t.errorMessages) == null ? void 0 : d.invalidPhoneChars
788
- ), n("validity-change", !1);
793
+ ), h = we(u);
794
+ if (Ee(d.value)) {
795
+ o.value = "Допустимы только цифры и знак + в начале", n("validity-change", !1);
789
796
  return;
790
797
  }
791
- if (k.length < Ba) {
792
- w.value = m(
793
- "Это не похоже на номер телефона",
794
- (h = t.errorMessages) == null ? void 0 : h.invalidPhoneLength
795
- ), n("validity-change", !1);
798
+ if (h.length < Ba) {
799
+ o.value = "Это не похоже на номер телефона", n("validity-change", !1);
796
800
  return;
797
801
  }
798
- const M = we(
799
- C,
802
+ const y = be(
803
+ u,
800
804
  i.value.phone.minDigits,
801
805
  i.value.phone.maxDigits
802
806
  );
803
- w.value = M ? "" : m(
804
- "Это не похоже на номер телефона",
805
- (y = t.errorMessages) == null ? void 0 : y.invalidPhoneLength
806
- ), n("validity-change", M);
807
+ o.value = y ? null : "Это не похоже на номер телефона", n("validity-change", y);
807
808
  }
808
- if (c.value === "email") {
809
- const C = Ee(u.value);
810
- w.value = C ? "" : m(
811
- "Это не похоже на email",
812
- (B = t.errorMessages) == null ? void 0 : B.invalidEmail
813
- ), n("validity-change", C);
809
+ if (w.value === "email") {
810
+ const u = Pe(d.value);
811
+ o.value = u ? null : "Это не похоже на email", n("validity-change", u);
814
812
  }
815
813
  }
816
814
  }
817
- function L() {
815
+ function _() {
818
816
  var h;
819
- const d = (h = v.value) == null ? void 0 : h.$el;
820
- return d ? d.querySelector("input") : null;
817
+ const u = (h = P.value) == null ? void 0 : h.$el;
818
+ return u ? u.querySelector("input") : null;
821
819
  }
822
- function R(d) {
823
- const h = L();
820
+ function q(u) {
821
+ const h = _();
824
822
  if (!h) return;
825
- const y = h.selectionStart ?? d.length;
826
- h.value = d, requestAnimationFrame(() => {
823
+ const y = h.selectionStart ?? u.length;
824
+ h.value = u, requestAnimationFrame(() => {
827
825
  h.setSelectionRange(y, y);
828
826
  });
829
827
  }
830
- return (d, h) => (N(), F("div", Aa, [
831
- P(p(j), {
828
+ return (u, h) => (N(), V("div", Aa, [
829
+ E(p(j), {
832
830
  ref_key: "inputRef",
833
- ref: v,
834
- "model-value": u.value,
835
- readonly: d.disabled,
836
- error: w.value,
837
- type: d.type ?? "text",
838
- size: d.size ?? "large",
839
- label: x.value,
840
- onInput: l,
841
- onBlur: $
831
+ ref: P,
832
+ "model-value": d.value,
833
+ readonly: u.disabled,
834
+ error: x.value,
835
+ type: u.type ?? "text",
836
+ size: u.size ?? "large",
837
+ label: S.value,
838
+ onInput: z,
839
+ onBlur: L
842
840
  }, null, 8, ["model-value", "readonly", "error", "type", "size", "label"]),
843
- c.value === "phone" ? (N(), z(p(oa), {
841
+ w.value === "phone" ? (N(), $(p(oa), {
844
842
  key: 0,
845
843
  class: "smart-input__icon"
846
- })) : U("", !0),
847
- c.value === "email" ? (N(), z(p(ra), {
844
+ })) : I("", !0),
845
+ w.value === "email" ? (N(), $(p(ra), {
848
846
  key: 1,
849
847
  class: "smart-input__icon"
850
- })) : U("", !0)
848
+ })) : I("", !0)
851
849
  ]));
852
850
  }
853
- }), _a = /* @__PURE__ */ ke(Fa, [["__scopeId", "data-v-3f64f8a0"]]);
851
+ }), _a = /* @__PURE__ */ Te(Fa, [["__scopeId", "data-v-8928dcc3"]]);
854
852
  export {
855
853
  za as B,
856
854
  $a as C,
857
- ke as _,
855
+ Te as _,
858
856
  La as a,
859
857
  da as g,
860
858
  _a as i,
861
- re as p,
862
- le as t
859
+ se as p,
860
+ ie as t
863
861
  };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".avatar-input[data-v-4e8a6f81] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-4e8a6f81] .p-input-file:hover .overlay{visibility:visible}.smart-input[data-v-3f64f8a0]{position:relative;width:100%}.smart-input__icon[data-v-3f64f8a0]{position:absolute;top:16px;right:16px;pointer-events:none;opacity:.5}.icon-locked{pointer-events:auto;position:absolute;right:1rem;top:1rem;color:#b6c7d6}.input-wrapper{position:relative;width:100%}.dialogTitle{z-index:10;width:100%;font-size:16px;font-weight:600;line-height:24px;text-align:center;color:#2b3238}.dialogDefaultContainer{display:flex;align-items:flex-start;flex-direction:column;width:100%;gap:32px;margin-top:16px;padding:10px 16px}.dialogDefaultContainerTextHint{font-weight:400;font-size:14px;line-height:20px;text-align:center;color:#1b1b1b}.dialogDefaultContainerRateLimitText{font-weight:600;font-size:14px;line-height:20px;color:#d0dbe4}.dialogDefaultContainerInsideContent{width:100%;display:flex;flex-direction:column;gap:24px}.dialogDefaultContainerRateLimitTextActive{color:#1c7ef1;cursor:pointer}.dialogDefaultContainerSendCodeBySmsText{color:#1c7ef1;cursor:pointer;font-size:14px;font-weight:600;display:flex;align-items:center;text-align:center}.chip{display:flex;align-items:center;justify-content:center;flex-direction:row;gap:4px;height:24px;font-size:12px;font-weight:600;color:#1b1b1b;padding:4px;line-height:16px;background-color:#b6d7ff4d;border-radius:4px;text-align:center;margin-left:5px}.cross{cursor:pointer;text-align:end}.finalLimitWrapper{display:flex;flex-direction:column;align-items:center;padding:12px 0;gap:12px;width:100%;min-height:94px;background:#e4606026;border-radius:8px}.finalLimitText{text-align:center;max-width:100%;word-wrap:break-word;font-family:Inter,sans-serif;font-size:14px;line-height:20px;color:#5d7285}.finalLimitLink{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:20px;color:#1c7ef1;text-align:center;cursor:pointer;text-decoration:none}.finalLimitLink:hover{text-decoration:underline}.toastWrapper{position:fixed;bottom:1rem;right:1rem;z-index:9999}.toast{width:100%}.base-container{margin-top:1.5rem;display:flex;flex-direction:column;gap:1.25rem;width:490px;height:428px}.icon-disabled{pointer-events:none;position:absolute;right:1rem;top:1rem;color:#b6c7d6}.centered-overlay{position:absolute;left:50%;top:50%;z-index:1000;height:100%;width:100%;transform:translate(-50%,-50%)}.buttons-container{display:flex;flex-wrap:wrap;gap:12px;justify-content:flex-start}.buttons-container PButton{flex:1 1 100%}._loaderOverlay_cpu73_1[data-v-9e697525]{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;background:#ffffffb3;border-radius:16px;z-index:99}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { a as o, i as r } from "./index-Dz48Vppw.js";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".avatar-input[data-v-4e8a6f81] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-4e8a6f81] .p-input-file:hover .overlay{visibility:visible}.smart-input[data-v-8928dcc3]{position:relative;width:100%}.smart-input__icon[data-v-8928dcc3]{position:absolute;top:16px;right:16px;pointer-events:none;opacity:.5}.icon-locked{pointer-events:auto;position:absolute;right:1rem;top:1rem;color:#b6c7d6}.input-wrapper{position:relative;width:100%}.dialogTitle{z-index:10;width:100%;font-size:16px;font-weight:600;line-height:24px;text-align:center;color:#2b3238}.dialogDefaultContainer{display:flex;align-items:flex-start;flex-direction:column;width:100%;gap:32px;margin-top:16px;padding:10px 16px}.dialogDefaultContainerTextHint{font-weight:400;font-size:14px;line-height:20px;text-align:center;color:#1b1b1b}.dialogDefaultContainerRateLimitText{font-weight:600;font-size:14px;line-height:20px;color:#d0dbe4}.dialogDefaultContainerInsideContent{width:100%;display:flex;flex-direction:column;gap:24px}.dialogDefaultContainerRateLimitTextActive{color:#1c7ef1;cursor:pointer}.dialogDefaultContainerSendCodeBySmsText{color:#1c7ef1;cursor:pointer;font-size:14px;font-weight:600;display:flex;align-items:center;text-align:center}.chip{display:flex;align-items:center;justify-content:center;flex-direction:row;gap:4px;height:24px;font-size:12px;font-weight:600;color:#1b1b1b;padding:4px;line-height:16px;background-color:#b6d7ff4d;border-radius:4px;text-align:center;margin-left:5px}.cross{cursor:pointer;text-align:end}.finalLimitWrapper{display:flex;flex-direction:column;align-items:center;padding:12px 0;gap:12px;width:100%;min-height:94px;background:#e4606026;border-radius:8px}.finalLimitText{text-align:center;max-width:100%;word-wrap:break-word;font-family:Inter,sans-serif;font-size:14px;line-height:20px;color:#5d7285}.finalLimitLink{font-family:Inter,sans-serif;font-weight:600;font-size:14px;line-height:20px;color:#1c7ef1;text-align:center;cursor:pointer;text-decoration:none}.finalLimitLink:hover{text-decoration:underline}.toastWrapper{position:fixed;bottom:1rem;right:1rem;z-index:9999}.toast{width:100%}.base-container{margin-top:1.5rem;display:flex;flex-direction:column;gap:1.25rem;width:490px;height:428px}.icon-disabled{pointer-events:none;position:absolute;right:1rem;top:1rem;color:#b6c7d6}.centered-overlay{position:absolute;left:50%;top:50%;z-index:1000;height:100%;width:100%;transform:translate(-50%,-50%)}.buttons-container{display:flex;flex-wrap:wrap;gap:12px;justify-content:flex-start}.buttons-container PButton{flex:1 1 100%}._loaderOverlay_cpu73_1[data-v-9e697525]{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;background:#ffffffb3;border-radius:16px;z-index:99}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
+ import { a as o, i as r } from "./index-B5CrRKgu.js";
3
3
  export {
4
4
  o as PEditUserContact,
5
5
  r as PEmailOrPhoneInput
@@ -1,6 +1,6 @@
1
1
  import { ref as n, defineComponent as L, createElementBlock as p, openBlock as v, normalizeClass as c, createVNode as w, unref as _, computed as T, renderSlot as d, createCommentVNode as h, createElementVNode as i, toDisplayString as y, createTextVNode as f } from "vue";
2
2
  import { PLoader as $ } from "@profeat/ui-kit";
3
- import { _ as b, g as C, p as R } from "./index-Dz48Vppw.js";
3
+ import { _ as b, g as C, p as R } from "./index-B5CrRKgu.js";
4
4
  function g(s) {
5
5
  const e = Math.floor(s / 60), a = s % 60;
6
6
  return `${String(e).padStart(2, "0")}:${String(a).padStart(2, "0")}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yourgoods/ui-smart",
3
- "version": "0.53.37",
3
+ "version": "0.53.38",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",