@yourgoods/ui-smart 0.40.0 → 0.42.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,6 +1,6 @@
1
1
  import { defineComponent as te, ref as b, reactive as Q, watch as Y, computed as M, toRefs as re, createElementBlock as k, openBlock as E, createElementVNode as S, createCommentVNode as D, toDisplayString as X, createVNode as $, unref as u, isRef as Z, withCtx as G, createTextVNode as le, Fragment as Oe, createBlock as H, resolveDynamicComponent as Ce, onMounted as Ue } from "vue";
2
- import { T as ue, c as Ve, u as Ae, a as Fe, P as ye, b as Re } from "./useRateLimitToast-niLDnYjh.js";
3
- import { C as A, _ as ze, B as We, p as W, g as He } from "./index-Qrxutvvf.js";
2
+ import { T as ue, c as Ve, u as Ae, a as Fe, P as ye, b as Re } from "./useRateLimitToast-DAUQG_SZ.js";
3
+ import { C as A, _ as ze, B as We, p as W, g as He } from "./index-Djp-dW6j.js";
4
4
  import { PInput as J, IconMailMd as me, PButton as oe, IconEyeMd as ge, IconEyeClosedMd as he, PDialog as _e, PTopBar as qe, IconCrossMd as je } from "@profeat/ui-kit";
5
5
  const Ge = { class: "dialogDefaultContainerInsideContent" }, Ye = { class: "dialogDefaultContainerTextHint" }, Je = {
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-Qrxutvvf.js";
2
+ import { C as I, p as D, g as Ve } from "./index-Djp-dW6j.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 T, openBlock as h, createElementVNode as U, defineComponent as ue, reactive as ce, watch as Z, ref as O, toRefs as fe, computed as E, createCommentVNode as V, createVNode as S, toDisplayString as H, createBlock as G, createTextVNode as Y, unref as i, isRef as te, withCtx as K, onMounted as Ue, Fragment as qe } from "vue";
2
- import { T as ge, c as Le, a as We, u as je, P as Ee, b as He } from "./useRateLimitToast-niLDnYjh.js";
2
+ import { T as ge, c as Le, a as We, u as je, P as Ee, b as He } from "./useRateLimitToast-DAUQG_SZ.js";
3
3
  import { IconTelegramSm as ye, PInput as oe, IconPhoneMd as Ge, IconMailMd as De, PButton as Ae, PDialog as Je, PTopBar as Ke, IconCrossMd as Qe, PTeleportContainer as Xe } from "@profeat/ui-kit";
4
- import { C as j, t as Ie, p as ee, g as Oe } from "./index-Qrxutvvf.js";
4
+ import { C as j, t as Ie, p as ee, g as Oe } from "./index-Djp-dW6j.js";
5
5
  const Ye = {
6
6
  xmlns: "http://www.w3.org/2000/svg",
7
7
  width: "12",
@@ -1,11 +1,11 @@
1
- import { ref as h, shallowRef as ze, defineComponent as Z, defineAsyncComponent as q, watch as ue, createBlock as S, createCommentVNode as P, unref as m, openBlock as w, resolveDynamicComponent as Le, mergeProps as Me, computed as T, reactive as J, onMounted as Re, createElementBlock as b, Fragment as me, createVNode as f, createElementVNode as j, withCtx as D, toDisplayString as F, createTextVNode as _, Teleport as le, Transition as Ge, withDirectives as qe, vShow as Je } from "vue";
2
- import je from "axios";
3
- import { PInputFileUploader as _e, PInput as $, IconFilledEditMd as O, PButton as ie, PImageCropper as Ye, PToast as We, PTeleportContainer as de, PToastContainer as Ke } from "@profeat/ui-kit";
4
- function Ze(s, n = 2) {
5
- if (s === 0)
1
+ import { ref as h, shallowRef as ze, defineComponent as H, defineAsyncComponent as q, watch as ue, createBlock as I, createCommentVNode as b, unref as m, openBlock as y, resolveDynamicComponent as Le, mergeProps as Me, computed as T, reactive as J, onMounted as Re, createElementBlock as k, Fragment as me, createVNode as g, createElementVNode as _, withCtx as D, toDisplayString as F, createTextVNode as Y, Teleport as se, Transition as Ge, withDirectives as je, vShow as qe } from "vue";
2
+ import Je from "axios";
3
+ import { PInputFileUploader as _e, PInput as O, IconFilledEditMd as z, PButton as ie, PImageCropper as Ye, PToast as We, PTeleportContainer as de, PToastContainer as Ke } from "@profeat/ui-kit";
4
+ function Ze(l, n = 2) {
5
+ if (l === 0)
6
6
  return "0 B";
7
- const r = 1024, i = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], v = Math.floor(Math.log(s) / Math.log(r));
8
- return `${Number.parseFloat((s / r ** v).toFixed(n))} ${i[v]}`;
7
+ const r = 1024, i = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], v = Math.floor(Math.log(l) / Math.log(r));
8
+ return `${Number.parseFloat((l / r ** v).toFixed(n))} ${i[v]}`;
9
9
  }
10
10
  const He = {
11
11
  "image/jpeg": "JPEG",
@@ -15,8 +15,8 @@ const He = {
15
15
  "application/zip": "ZIP Archive"
16
16
  // ...
17
17
  };
18
- function Qe(s) {
19
- return s.map((n) => {
18
+ function Qe(l) {
19
+ return l.map((n) => {
20
20
  var r;
21
21
  return He[n] || ((r = n.split("/")[1]) == null ? void 0 : r.toUpperCase());
22
22
  });
@@ -28,50 +28,50 @@ const Na = {
28
28
  }, Ca = {
29
29
  VERIFY_EMAIL: "verify-email"
30
30
  };
31
- let W = null;
32
- function Xe(s, n) {
33
- W = je.create({
31
+ let K = null;
32
+ function Xe(l, n) {
33
+ K = Je.create({
34
34
  baseURL: n,
35
35
  headers: {
36
- Authorization: `Bearer ${s}`,
36
+ Authorization: `Bearer ${l}`,
37
37
  // 'Content-Type': 'application/json',
38
38
  "x-throttler-prefix": "throttler_profile_edit"
39
39
  },
40
40
  validateStatus: () => !0
41
41
  });
42
42
  }
43
- function H() {
44
- if (!W)
43
+ function Q() {
44
+ if (!K)
45
45
  throw new Error("Axios instance not initialized. Call initAxios(token, baseUrl) first.");
46
- return W;
46
+ return K;
47
47
  }
48
- async function K(s, n, r) {
49
- return H().post(s, n, r);
48
+ async function Z(l, n, r) {
49
+ return Q().post(l, n, r);
50
50
  }
51
- async function ea(s, n) {
52
- return H().get(s, n);
51
+ async function ea(l, n) {
52
+ return Q().get(l, n);
53
53
  }
54
- async function aa(s, n) {
55
- return H().delete(s, n);
54
+ async function aa(l, n) {
55
+ return Q().delete(l, n);
56
56
  }
57
- async function ta(s) {
58
- const n = await K("/users/profile/me", s);
57
+ async function ta(l) {
58
+ const n = await Z("/users/profile/me", l);
59
59
  if (console.log("---res: ", n), n.status !== 200 && n.status !== 201 || !n.data)
60
60
  throw new Error("Ошибка при получении профиля пользователя");
61
61
  return n.data;
62
62
  }
63
- const z = h(null), Y = ze(null);
64
- function Q() {
63
+ const L = h(null), W = ze(null);
64
+ function X() {
65
65
  return {
66
- currentDialog: z,
67
- dialogPayload: Y,
66
+ currentDialog: L,
67
+ dialogPayload: W,
68
68
  openDialog: (i, v) => {
69
- z.value = i, Y.value = v ?? null;
69
+ L.value = i, W.value = v ?? null;
70
70
  },
71
71
  closeDialog: () => {
72
- z.value = null, Y.value = null;
72
+ L.value = null, W.value = null;
73
73
  },
74
- isDialogOpen: (i) => z.value === i
74
+ isDialogOpen: (i) => L.value === i
75
75
  };
76
76
  }
77
77
  const oa = {
@@ -207,42 +207,45 @@ const oa = {
207
207
  "Введите новый номер телефона": "Enter a new phone number",
208
208
  "Телефон успешно изменен": "Phone number successfully changed"
209
209
  }
210
- }, ra = /* @__PURE__ */ Z({
210
+ }, ra = /* @__PURE__ */ H({
211
211
  __name: "DialogManager",
212
212
  props: {
213
213
  language: {},
214
214
  provider: {}
215
215
  },
216
216
  emits: ["clean-input-errors", "on-update-jwt", "update-phone-field", "update-email-field", "on-password-error", "on-toast"],
217
- setup(s, { emit: n }) {
218
- const r = n, i = h(!0), { currentDialog: v, dialogPayload: g, closeDialog: U } = Q(), l = {
219
- email: q(() => import("./ProfileEmailDialog-ClATHsGK.js")),
220
- phone: q(() => import("./ProfilePhoneDialog-suFZIfPw.js")),
221
- password: q(() => import("./ProfilePasswordDialog-5ecQWNeU.js"))
222
- }, d = ({ email: y }) => {
223
- r("update-email-field", y);
224
- }, p = ({ phone: y }) => {
225
- r("update-phone-field", y);
217
+ setup(l, { emit: n }) {
218
+ const r = n, i = h(!0), { currentDialog: v, dialogPayload: c, closeDialog: U } = X(), s = {
219
+ email: q(() => import("./ProfileEmailDialog-CGzr5Ocq.js")),
220
+ phone: q(() => import("./ProfilePhoneDialog-FU-f-BrQ.js")),
221
+ password: q(() => import("./ProfilePasswordDialog-B1tiN8io.js"))
222
+ }, d = ({ email: E }) => {
223
+ r("update-email-field", E);
224
+ }, p = ({ phone: E }) => {
225
+ r("update-phone-field", E);
226
226
  };
227
- return ue(v, (y) => {
228
- i.value = !!y;
229
- }), (y, u) => m(v) ? (w(), S(Le(l[m(v)]), Me({
227
+ return ue(v, (E) => {
228
+ i.value = !!E;
229
+ }), (E, u) => m(v) ? (y(), I(Le(s[m(v)]), Me({
230
230
  key: 0,
231
231
  modelValue: i.value,
232
- "onUpdate:modelValue": u[0] || (u[0] = (c) => i.value = c),
233
- language: y.language,
234
- provider: y.provider
235
- }, m(g), {
232
+ "onUpdate:modelValue": u[0] || (u[0] = (f) => i.value = f),
233
+ language: E.language,
234
+ provider: E.provider
235
+ }, m(c), {
236
236
  onClose: m(U),
237
- onCleanInputErrors: u[1] || (u[1] = (c) => r("clean-input-errors")),
238
- onOnUpdateJwt: u[2] || (u[2] = (c, E, o) => r("on-update-jwt", c, E, o)),
237
+ onCleanInputErrors: u[1] || (u[1] = (f) => r("clean-input-errors")),
238
+ onOnUpdateJwt: u[2] || (u[2] = (f, P, o) => r("on-update-jwt", f, P, o)),
239
239
  onSubmitEmail: d,
240
240
  onSubmitPhone: p,
241
- onOnPasswordError: u[3] || (u[3] = (c, E) => r("on-password-error", c, E)),
242
- onOnToast: u[4] || (u[4] = (c) => r("on-toast", c))
243
- }), null, 16, ["modelValue", "language", "provider", "onClose"])) : P("", !0);
241
+ onOnPasswordError: u[3] || (u[3] = (f, P) => r("on-password-error", f, P)),
242
+ onOnToast: u[4] || (u[4] = (f) => r("on-toast", f))
243
+ }), null, 16, ["modelValue", "language", "provider", "onClose"])) : b("", !0);
244
244
  }
245
- }), na = { class: "base-container" }, sa = { key: 0 }, la = { key: 1 }, ia = {
245
+ }), na = { class: "base-container" }, la = {
246
+ key: 0,
247
+ style: { color: "#E46060" }
248
+ }, sa = { key: 1 }, ia = {
246
249
  key: 1,
247
250
  class: "input-wrapper"
248
251
  }, ua = {
@@ -257,7 +260,7 @@ const oa = {
257
260
  }, pa = { class: "buttons-container" }, ca = {
258
261
  key: 0,
259
262
  class: "centered-overlay"
260
- }, fa = { class: "toastWrapper" }, ga = /* @__PURE__ */ Z({
263
+ }, fa = { class: "toastWrapper" }, ga = /* @__PURE__ */ H({
261
264
  __name: "PEditUserContact",
262
265
  props: {
263
266
  language: {},
@@ -270,8 +273,8 @@ const oa = {
270
273
  awsStorageUrl: {}
271
274
  },
272
275
  emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
273
- setup(s, { emit: n }) {
274
- const r = s, i = n, v = T(() => r.language ?? "ru"), g = (e) => oa[v.value][e] || e, { openDialog: U } = Q(), l = J({ firstName: "", lastName: "" }), d = h({ firstName: "", lastName: "" }), p = J({ firstName: !1, lastName: !1, email: !1, phone: !1 }), y = h(""), u = h(""), c = h(""), E = h(!1), o = J({
276
+ setup(l, { emit: n }) {
277
+ const r = l, i = n, v = T(() => r.language ?? "ru"), c = (e) => oa[v.value][e] || e, { openDialog: U } = X(), s = J({ firstName: "", lastName: "" }), d = h({ firstName: "", lastName: "" }), p = J({ firstName: !1, lastName: !1, email: !1, phone: !1 }), E = h(""), u = h(""), f = h(""), P = h(!1), o = J({
275
278
  value: null,
276
279
  loading: !1,
277
280
  accept: ["image/png", "image/jpeg"],
@@ -279,45 +282,50 @@ const oa = {
279
282
  // 10mb вроде
280
283
  imageBinary: null,
281
284
  imageContent: ""
282
- }), I = h(!1), A = h(!1), V = h(!1), L = h(!0), M = h(!0), X = h(void 0), ee = h(""), pe = T(() => te(l.firstName, p.firstName)), ce = T(() => te(l.lastName, p.lastName)), fe = T(() => p.email && !u.value.trim() ? "Введите e-mail" : ""), ge = T(() => p.phone && !c.value.trim() ? "Введите номер телефона" : ""), B = (e) => r.fields.some((a) => a.key === e), ae = (e) => e && e.trim() ? "edit" : "bind", R = () => setTimeout(() => {
285
+ }), S = h(!1), A = h(!1), V = h(!1), M = h(!0), R = h(!0), ee = h(void 0), ae = h(""), pe = T(() => oe(s.firstName, p.firstName)), ce = T(() => oe(s.lastName, p.lastName)), fe = T(() => p.email && !u.value.trim() ? "Введите e-mail" : ""), ge = T(() => p.phone && !f.value.trim() ? "Введите номер телефона" : ""), B = (e) => r.fields.some((a) => a.key === e), te = (e) => e && e.trim() ? "edit" : "bind", G = () => setTimeout(() => {
283
286
  var e;
284
287
  return (e = document.activeElement) == null ? void 0 : e.blur();
285
- }, 0), ve = T(() => !!(u.value && u.value.trim() !== "")), he = T(() => o.imageContent ? g("Загрузить другое фото") : g("Загрузить фото")), te = (e, a) => {
288
+ }, 0), ve = T(() => !!(u.value && u.value.trim() !== "")), he = T(() => o.imageContent ? c("Загрузить другое фото") : c("Загрузить фото")), oe = (e, a) => {
286
289
  if (!a) return "";
287
290
  const t = e.trim();
288
291
  return t ? t.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
289
292
  }, we = (e) => U("email", { mode: e ? "edit" : "bind", initialEmail: e }), ye = () => {
290
- R(), p.email = !1, M.value = !1, i("open-email-dialog", u.value, ae(u.value)), we(u.value);
293
+ G(), p.email = !1, R.value = !1, i("open-email-dialog", u.value, te(u.value)), we(u.value);
291
294
  }, Ee = () => {
292
- R(), p.phone = !1, L.value = !1, i("open-phone-dialog", c.value, ae(c.value));
295
+ G(), p.phone = !1, M.value = !1, i("open-phone-dialog", f.value, te(f.value));
293
296
  }, Ne = async (e, a, t) => {
294
- e === "email" && t && (u.value = t), e === "phone" && t && (c.value = t), i("on-update-jwt");
297
+ e === "email" && t && (u.value = t), e === "phone" && t && (f.value = t), i("on-update-jwt");
295
298
  }, Ce = (e) => {
296
- c.value = e;
299
+ f.value = e;
297
300
  }, Pe = (e) => {
298
301
  console.debug("emitUpdateEmailField, цепочка такая: profileEmailDialog -> DialogManager -> PEditUserContact", e), u.value = e;
299
302
  }, be = (e, a) => {
300
303
  V.value = !0, i("on-password-error", e, a);
301
304
  }, ke = () => {
302
- L.value = !1, M.value = !1;
303
- }, G = (e) => {
304
- V.value = !0, X.value = e.color ?? "", ee.value = e.text ?? "";
305
+ M.value = !1, R.value = !1;
305
306
  }, x = (e) => {
307
+ V.value = !0, ee.value = e.color ?? "", ae.value = e.text ?? "";
308
+ }, $ = (e) => {
306
309
  if (p[e] = !0, e === "firstName" || e === "lastName") {
307
- const a = l[e];
308
- a.length > 40 && (l[e] = a.slice(0, 40), console.debug(`[Input Limit] Поле '${e}' достигло 40 символов. Ввод обрезан.`));
310
+ const a = s[e];
311
+ a.length > 40 && (s[e] = a.slice(0, 40), console.debug(`[Input Limit] Поле '${e}' достигло 40 символов. Ввод обрезан.`));
309
312
  }
310
313
  }, Te = (e) => {
311
- var t;
314
+ var C, N;
312
315
  if (!e) {
313
316
  o.imageContent = "", o.imageBinary = null, o.value = null;
314
317
  return;
315
318
  }
316
- if ((((t = e.fileBinary) == null ? void 0 : t.size) ?? 0) > o.uploadLimit) {
317
- oe(), o.value = null;
319
+ const a = ["image/png", "image/jpeg"], t = ((C = e.fileBinary) == null ? void 0 : C.type) ?? "";
320
+ if (!a.includes(t)) {
321
+ j(), o.value = null;
322
+ return;
323
+ }
324
+ if ((((N = e.fileBinary) == null ? void 0 : N.size) ?? 0) > o.uploadLimit) {
325
+ j(), o.value = null;
318
326
  return;
319
327
  }
320
- I.value = !1, o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", E.value = !0;
328
+ S.value = !1, o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", P.value = !0;
321
329
  }, Ue = async () => {
322
330
  try {
323
331
  const a = (await aa("/users/profile/delete/avatar")).data;
@@ -325,50 +333,62 @@ const oa = {
325
333
  } catch (e) {
326
334
  return console.error("Ошибка при удалении аватара:", e), !1;
327
335
  }
328
- }, oe = () => {
329
- I.value = !0, o.value = null, o.imageBinary = null, o.imageContent = "", E.value = !1;
336
+ }, j = () => {
337
+ S.value = !0, o.value = null, o.imageBinary = null, o.imageContent = "", P.value = !1;
330
338
  }, re = async (e, a, t = "image/png") => {
331
339
  if (!e) return null;
332
340
  const C = await (await fetch(e)).blob();
333
341
  return new File([C], a, { type: t });
334
342
  }, Be = () => {
335
- o.value = null, o.imageBinary = null, o.imageContent = "", E.value = !1;
343
+ o.value = null, o.imageBinary = null, o.imageContent = "", P.value = !1;
336
344
  }, De = async (e) => {
337
- if (E.value = !1, o.imageContent = e, !o.imageBinary) return;
338
- const a = await re(e, o.imageBinary.name, o.imageBinary.type || "image/png");
339
- if (a)
340
- try {
341
- o.loading = !0;
342
- const t = new FormData();
343
- t.append("file", a), await K(`/users/profile/avatar/${y.value}`, t, { headers: { "Content-Type": void 0 } });
344
- } catch (t) {
345
- console.error(t);
346
- } finally {
347
- I.value = !1, o.loading = !1;
348
- }
345
+ P.value = !1;
346
+ const a = o.imageContent;
347
+ if (o.imageContent = e, !o.imageBinary) return;
348
+ const t = await re(
349
+ e,
350
+ o.imageBinary.name,
351
+ o.imageBinary.type || "image/png"
352
+ );
353
+ if (!t) {
354
+ o.imageContent = a;
355
+ return;
356
+ }
357
+ try {
358
+ o.loading = !0;
359
+ const w = new FormData();
360
+ w.append("file", t), await Z(`/users/profile/avatar/${E.value}`, w, { headers: { "Content-Type": void 0 } });
361
+ } catch (w) {
362
+ console.error(w), x({
363
+ color: "error",
364
+ text: c("Не удалось сохранить изменения. Попробуйте позже")
365
+ }), o.imageContent = a;
366
+ } finally {
367
+ S.value = !1, o.loading = !1;
368
+ }
349
369
  }, Fe = async (e) => {
350
370
  o.imageContent = e ?? "", o.imageBinary && (o.imageBinary = await re(
351
371
  e ?? "",
352
372
  o.imageBinary.name,
353
373
  o.imageBinary.type || "image/png"
354
374
  ));
355
- }, ne = h(!1), se = async (e) => {
356
- var t, k;
357
- const a = (t = l[e]) == null ? void 0 : t.trim();
375
+ }, ne = h(!1), le = async (e) => {
376
+ var t, w;
377
+ const a = (t = s[e]) == null ? void 0 : t.trim();
358
378
  if (a)
359
379
  try {
360
380
  ne.value = !0;
361
- const N = (k = (await K("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : k.data;
362
- N != null && N.user && (l.firstName = N.user.firstName ?? l.firstName, l.lastName = N.user.lastName ?? l.lastName, d.value = {
363
- firstName: l.firstName,
364
- lastName: l.lastName
381
+ const N = (w = (await Z("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : w.data;
382
+ N != null && N.user && (s.firstName = N.user.firstName ?? s.firstName, s.lastName = N.user.lastName ?? s.lastName, d.value = {
383
+ firstName: s.firstName,
384
+ lastName: s.lastName
365
385
  });
366
386
  } catch (C) {
367
387
  throw C;
368
388
  } finally {
369
389
  ne.value = !1;
370
390
  }
371
- }, Se = async () => {
391
+ }, Ie = async () => {
372
392
  var e;
373
393
  if (!r.accessToken)
374
394
  throw console.error("Access token не передан в props"), new Error("Access token is required");
@@ -381,20 +401,20 @@ const oa = {
381
401
  if (!t)
382
402
  throw console.error("Данные пользователя отсутствуют в ответе сервера"), new Error("User data is missing from the response");
383
403
  const {
384
- userId: k,
404
+ userId: w,
385
405
  privateFirstName: C,
386
406
  privateLastName: N,
387
407
  email: $e,
388
408
  phoneNumber: Oe
389
409
  } = t;
390
- y.value = k ?? "", l.firstName = C ?? "", l.lastName = N ?? "", u.value = $e ?? "", c.value = Oe ?? "", o.imageContent = await Ie(), d.value = {
410
+ E.value = w ?? "", s.firstName = C ?? "", s.lastName = N ?? "", u.value = $e ?? "", f.value = Oe ?? "", o.imageContent = await Se(), d.value = {
391
411
  firstName: C ?? "",
392
412
  lastName: N ?? ""
393
413
  };
394
414
  } catch (a) {
395
415
  console.error("Критическая ошибка при загрузке профиля:", a);
396
416
  }
397
- }, Ie = async () => {
417
+ }, Se = async () => {
398
418
  var e;
399
419
  try {
400
420
  const t = (e = (await ea("/users/profile/avatar")).data) == null ? void 0 : e.data;
@@ -413,9 +433,9 @@ const oa = {
413
433
  }
414
434
  }
415
435
  ue(
416
- () => [l.firstName, l.lastName],
436
+ () => [s.firstName, s.lastName],
417
437
  ([e, a]) => {
418
- const t = e.trim(), k = a.trim(), C = t !== d.value.firstName.trim() || k !== d.value.lastName.trim(), N = t.length >= 2 && k.length >= 2;
438
+ const t = e.trim(), w = a.trim(), C = t !== d.value.firstName.trim() || w !== d.value.lastName.trim(), N = t.length >= 2 && w.length >= 2;
419
439
  A.value = C && N;
420
440
  },
421
441
  { immediate: !0 }
@@ -423,22 +443,22 @@ const oa = {
423
443
  const Ve = async () => {
424
444
  if (A.value)
425
445
  try {
426
- await Promise.all([se("firstName"), se("lastName")]), A.value = !1, i("on-update-jwt"), G({ color: "success", text: "Изменения сохранены" });
446
+ await Promise.all([le("firstName"), le("lastName")]), A.value = !1, i("on-update-jwt"), x({ color: "success", text: "Изменения сохранены" });
427
447
  } catch (e) {
428
- console.error(e), G({
448
+ console.error(e), x({
429
449
  color: "error",
430
- text: g("Не удалось сохранить изменения. Попробуйте позже")
450
+ text: c("Не удалось сохранить изменения. Попробуйте позже")
431
451
  });
432
452
  }
433
453
  }, xe = () => {
434
- R(), i("open-password-dialog");
454
+ G(), i("open-password-dialog");
435
455
  };
436
456
  return Re(async () => {
437
457
  if (!r.accessToken) throw new Error("Access token не передан в props");
438
458
  if (!r.requestUrl) throw new Error("auth-backend url не передан в props");
439
- Xe(r.accessToken, r.requestUrl), await Se();
440
- }), (e, a) => (w(), b(me, null, [
441
- f(ra, {
459
+ Xe(r.accessToken, r.requestUrl), await Ie();
460
+ }), (e, a) => (y(), k(me, null, [
461
+ g(ra, {
442
462
  language: v.value,
443
463
  provider: e.provider,
444
464
  onCleanInputErrors: ke,
@@ -446,10 +466,10 @@ const oa = {
446
466
  onUpdatePhoneField: Ce,
447
467
  onUpdateEmailField: Pe,
448
468
  onOnPasswordError: be,
449
- onOnToast: G
469
+ onOnToast: x
450
470
  }, null, 8, ["language", "provider"]),
451
- j("div", na, [
452
- B("avatar") ? (w(), S(m(_e), {
471
+ _("div", na, [
472
+ B("avatar") ? (y(), I(m(_e), {
453
473
  key: 0,
454
474
  modelValue: o.value,
455
475
  "onUpdate:modelValue": [
@@ -461,45 +481,45 @@ const oa = {
461
481
  src: o.imageContent,
462
482
  accept: o.accept,
463
483
  loading: o.loading,
464
- label: g("Загрузить фото"),
484
+ label: c("Загрузить фото"),
465
485
  "upload-limit": o.uploadLimit,
466
486
  onDelete: Ue,
467
- "onChange:error": oe
487
+ "onChange:error": j
468
488
  }, {
469
489
  afterLoadLabel: D(() => [
470
- _(F(he.value), 1)
490
+ Y(F(he.value), 1)
471
491
  ]),
472
492
  subtext: D(() => [
473
- I.value ? (w(), b("span", sa, F("Размер фото слишком большой. Загрузите JPEG, PNG до 10 MB"))) : (w(), b("span", la, F(`${g("Формат")} ${m(Qe)(o.accept).join(", ")} ${g("до")} ${m(Ze)(o.uploadLimit)}`), 1))
493
+ S.value ? (y(), k("span", la, F("Размер фото слишком большой. Загрузите JPEG, PNG до 10 MB"))) : (y(), k("span", sa, F(`${c("Формат")} ${m(Qe)(o.accept).join(", ")} ${c("до")} ${m(Ze)(o.uploadLimit)}`), 1))
474
494
  ]),
475
495
  _: 1
476
- }, 8, ["modelValue", "src", "accept", "loading", "label", "upload-limit"])) : P("", !0),
477
- B("firstName") ? (w(), b("div", ia, [
478
- f(m($), {
479
- modelValue: l.firstName,
480
- "onUpdate:modelValue": a[2] || (a[2] = (t) => l.firstName = t),
496
+ }, 8, ["modelValue", "src", "accept", "loading", "label", "upload-limit"])) : b("", !0),
497
+ B("firstName") ? (y(), k("div", ia, [
498
+ g(m(O), {
499
+ modelValue: s.firstName,
500
+ "onUpdate:modelValue": a[2] || (a[2] = (t) => s.firstName = t),
481
501
  size: "large",
482
- label: g("Имя"),
502
+ label: c("Имя"),
483
503
  error: pe.value,
484
504
  onBlur: a[3] || (a[3] = (t) => p.firstName = !0),
485
- onInput: a[4] || (a[4] = (t) => x("firstName"))
505
+ onInput: a[4] || (a[4] = (t) => $("firstName"))
486
506
  }, null, 8, ["modelValue", "label", "error"]),
487
- f(m(O), { class: "icon-locked" })
488
- ])) : P("", !0),
489
- B("lastName") ? (w(), b("div", ua, [
490
- f(m($), {
491
- modelValue: l.lastName,
492
- "onUpdate:modelValue": a[5] || (a[5] = (t) => l.lastName = t),
507
+ g(m(z), { class: "icon-locked" })
508
+ ])) : b("", !0),
509
+ B("lastName") ? (y(), k("div", ua, [
510
+ g(m(O), {
511
+ modelValue: s.lastName,
512
+ "onUpdate:modelValue": a[5] || (a[5] = (t) => s.lastName = t),
493
513
  size: "large",
494
- label: g("Фамилия"),
514
+ label: c("Фамилия"),
495
515
  error: ce.value,
496
516
  onBlur: a[6] || (a[6] = (t) => p.lastName = !0),
497
- onInput: a[7] || (a[7] = (t) => x("lastName"))
517
+ onInput: a[7] || (a[7] = (t) => $("lastName"))
498
518
  }, null, 8, ["modelValue", "label", "error"]),
499
- f(m(O), { class: "icon-locked" })
500
- ])) : P("", !0),
501
- B("email") ? (w(), b("div", ma, [
502
- f(m($), {
519
+ g(m(z), { class: "icon-locked" })
520
+ ])) : b("", !0),
521
+ B("email") ? (y(), k("div", ma, [
522
+ g(m(O), {
503
523
  modelValue: u.value,
504
524
  "onUpdate:modelValue": a[8] || (a[8] = (t) => u.value = t),
505
525
  size: "large",
@@ -508,92 +528,92 @@ const oa = {
508
528
  type: "email",
509
529
  readonly: "",
510
530
  style: { cursor: "pointer" },
511
- error: fe.value && M.value,
531
+ error: fe.value && R.value,
512
532
  onBlur: a[9] || (a[9] = (t) => p.email = !0),
513
- onInput: a[10] || (a[10] = (t) => x("email")),
533
+ onInput: a[10] || (a[10] = (t) => $("email")),
514
534
  onClick: ye
515
535
  }, null, 8, ["modelValue", "error"]),
516
- f(m(O), { class: "icon-locked" })
517
- ])) : P("", !0),
518
- B("phone") ? (w(), b("div", da, [
519
- f(m($), {
520
- modelValue: c.value,
521
- "onUpdate:modelValue": a[11] || (a[11] = (t) => c.value = t),
536
+ g(m(z), { class: "icon-locked" })
537
+ ])) : b("", !0),
538
+ B("phone") ? (y(), k("div", da, [
539
+ g(m(O), {
540
+ modelValue: f.value,
541
+ "onUpdate:modelValue": a[11] || (a[11] = (t) => f.value = t),
522
542
  size: "large",
523
543
  "text-size": "medium",
524
- label: g("Номер телефона"),
544
+ label: c("Номер телефона"),
525
545
  type: "tel",
526
546
  readonly: "",
527
547
  style: { cursor: "pointer" },
528
- error: ge.value && L.value,
548
+ error: ge.value && M.value,
529
549
  onBlur: a[12] || (a[12] = (t) => p.phone = !0),
530
- onInput: a[13] || (a[13] = (t) => x("phone")),
550
+ onInput: a[13] || (a[13] = (t) => $("phone")),
531
551
  onClick: Ee
532
552
  }, null, 8, ["modelValue", "label", "error"]),
533
- f(m(O), { class: "icon-locked" })
534
- ])) : P("", !0),
535
- j("div", pa, [
536
- ve.value ? (w(), S(m(ie), {
553
+ g(m(z), { class: "icon-locked" })
554
+ ])) : b("", !0),
555
+ _("div", pa, [
556
+ ve.value ? (y(), I(m(ie), {
537
557
  key: 0,
538
558
  color: "secondary",
539
559
  onClick: xe
540
560
  }, {
541
561
  default: D(() => [
542
- _(F(g("Сменить пароль")), 1)
562
+ Y(F(c("Сменить пароль")), 1)
543
563
  ]),
544
564
  _: 1
545
- })) : P("", !0),
546
- f(m(ie), {
565
+ })) : b("", !0),
566
+ g(m(ie), {
547
567
  disabled: !A.value,
548
568
  onClick: Ve
549
569
  }, {
550
570
  default: D(() => [
551
- _(F(g("Сохранить")), 1)
571
+ Y(F(c("Сохранить")), 1)
552
572
  ]),
553
573
  _: 1
554
574
  }, 8, ["disabled"])
555
575
  ])
556
576
  ]),
557
- E.value ? (w(), S(le, {
577
+ P.value ? (y(), I(se, {
558
578
  key: 0,
559
579
  to: "body"
560
580
  }, [
561
- E.value ? (w(), b("div", ca, [
562
- f(m(Ye), {
581
+ P.value ? (y(), k("div", ca, [
582
+ g(m(Ye), {
563
583
  "circle-mode": !0,
564
584
  "model-value": o.imageContent,
565
585
  onClose: Be,
566
586
  onSave: a[14] || (a[14] = (t) => De(t)),
567
587
  "onUpdate:modelValue": a[15] || (a[15] = (t) => Fe(t))
568
588
  }, null, 8, ["model-value"])
569
- ])) : P("", !0)
570
- ])) : P("", !0),
571
- (w(), S(le, { to: "#toast-root" }, [
572
- j("div", fa, [
573
- f(Ge, { name: "list" }, {
589
+ ])) : b("", !0)
590
+ ])) : b("", !0),
591
+ (y(), I(se, { to: "#toast-root" }, [
592
+ _("div", fa, [
593
+ g(Ge, { name: "list" }, {
574
594
  default: D(() => [
575
- qe(f(m(We), {
595
+ je(g(m(We), {
576
596
  class: "toast",
577
- color: X.value,
578
- text: ee.value,
597
+ color: ee.value,
598
+ text: ae.value,
579
599
  onClose: a[16] || (a[16] = (t) => V.value = !1)
580
600
  }, null, 8, ["color", "text"]), [
581
- [Je, V.value]
601
+ [qe, V.value]
582
602
  ])
583
603
  ]),
584
604
  _: 1
585
605
  })
586
606
  ])
587
607
  ])),
588
- f(m(de))
608
+ g(m(de))
589
609
  ], 64));
590
610
  }
591
- }), va = (s, n) => {
592
- const r = s.__vccOpts || s;
611
+ }), va = (l, n) => {
612
+ const r = l.__vccOpts || l;
593
613
  for (const [i, v] of n)
594
614
  r[i] = v;
595
615
  return r;
596
- }, ha = /* @__PURE__ */ va(ga, [["__scopeId", "data-v-915f1261"]]), Pa = /* @__PURE__ */ Z({
616
+ }, ha = /* @__PURE__ */ va(ga, [["__scopeId", "data-v-e236cb5b"]]), Pa = /* @__PURE__ */ H({
597
617
  __name: "index",
598
618
  props: {
599
619
  throttlerPrefix: {},
@@ -606,19 +626,19 @@ const oa = {
606
626
  awsStorageUrl: {}
607
627
  },
608
628
  emits: ["on-update-jwt", "update-tokens"],
609
- setup(s, { emit: n }) {
610
- const r = n, { openDialog: i } = Q(), v = (d, p) => {
629
+ setup(l, { emit: n }) {
630
+ const r = n, { openDialog: i } = X(), v = (d, p) => {
611
631
  i("email", { initialEmail: d, mode: p });
612
- }, g = (d, p) => {
632
+ }, c = (d, p) => {
613
633
  i("phone", { initialPhone: d, mode: p });
614
634
  }, U = () => {
615
635
  i("password");
616
- }, l = (d, p, y) => {
617
- r("on-update-jwt", d, p, y);
636
+ }, s = (d, p, E) => {
637
+ r("on-update-jwt", d, p, E);
618
638
  };
619
- return (d, p) => (w(), b(me, null, [
620
- f(m(Ke)),
621
- f(ha, {
639
+ return (d, p) => (y(), k(me, null, [
640
+ g(m(Ke)),
641
+ g(ha, {
622
642
  "throttler-prefix": d.throttlerPrefix,
623
643
  provider: d.provider,
624
644
  "request-url": d.requestUrl,
@@ -628,11 +648,11 @@ const oa = {
628
648
  "refresh-token": d.refreshToken,
629
649
  "aws-storage-url": d.awsStorageUrl,
630
650
  onOpenEmailDialog: v,
631
- onOpenPhoneDialog: g,
651
+ onOpenPhoneDialog: c,
632
652
  onOpenPasswordDialog: U,
633
- onOnUpdateJwt: l
653
+ onOnUpdateJwt: s
634
654
  }, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url"]),
635
- f(m(de))
655
+ g(m(de))
636
656
  ], 64));
637
657
  }
638
658
  });
@@ -642,6 +662,6 @@ export {
642
662
  va as _,
643
663
  Pa as a,
644
664
  ea as g,
645
- K as p,
665
+ Z as p,
646
666
  oa as t
647
667
  };
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-915f1261] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-915f1261] .p-input-file:hover .overlay{visibility:visible}.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:440px;min-height:94px;background:#e4606026;border-radius:8px}.finalLimitText{text-align:center;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 } from "./index-Qrxutvvf.js";
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".avatar-input[data-v-e236cb5b] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-e236cb5b] .p-input-file:hover .overlay{visibility:visible}.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:440px;min-height:94px;background:#e4606026;border-radius:8px}.finalLimitText{text-align:center;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 } from "./index-Djp-dW6j.js";
3
3
  export {
4
4
  o as PEditUserContact
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import { ref as l, defineComponent as L, createElementBlock as f, openBlock as v, normalizeClass as r, createVNode as E, unref as F, computed as T, renderSlot as d, createCommentVNode as $, createElementVNode as o, toDisplayString as y, createTextVNode as p } from "vue";
2
2
  import { PLoader as w } from "@profeat/ui-kit";
3
- import { _ as g, g as R, p as h } from "./index-Qrxutvvf.js";
3
+ import { _ as g, g as R, p as h } from "./index-Djp-dW6j.js";
4
4
  function C(e) {
5
5
  const t = Math.floor(e / 60), a = e % 60;
6
6
  return `${String(t).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.40.0",
3
+ "version": "0.42.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",