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