@yourgoods/ui-smart 0.41.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-Ci3c9oSV.js";
3
- import { C as A, _ as ze, B as We, p as W, g as He } from "./index-DLfEv7A5.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-DLfEv7A5.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-Ci3c9oSV.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-DLfEv7A5.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,45 +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-B5qG1a49.js")),
220
- phone: q(() => import("./ProfilePhoneDialog-Cw739x1Q.js")),
221
- password: q(() => import("./ProfilePasswordDialog-CrTrG_OZ.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 = {
245
+ }), na = { class: "base-container" }, la = {
246
246
  key: 0,
247
247
  style: { color: "#E46060" }
248
- }, la = { key: 1 }, ia = {
248
+ }, sa = { key: 1 }, ia = {
249
249
  key: 1,
250
250
  class: "input-wrapper"
251
251
  }, ua = {
@@ -260,7 +260,7 @@ const oa = {
260
260
  }, pa = { class: "buttons-container" }, ca = {
261
261
  key: 0,
262
262
  class: "centered-overlay"
263
- }, fa = { class: "toastWrapper" }, ga = /* @__PURE__ */ Z({
263
+ }, fa = { class: "toastWrapper" }, ga = /* @__PURE__ */ H({
264
264
  __name: "PEditUserContact",
265
265
  props: {
266
266
  language: {},
@@ -273,8 +273,8 @@ const oa = {
273
273
  awsStorageUrl: {}
274
274
  },
275
275
  emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
276
- setup(s, { emit: n }) {
277
- 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({
278
278
  value: null,
279
279
  loading: !1,
280
280
  accept: ["image/png", "image/jpeg"],
@@ -282,45 +282,50 @@ const oa = {
282
282
  // 10mb вроде
283
283
  imageBinary: null,
284
284
  imageContent: ""
285
- }), 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(() => {
286
286
  var e;
287
287
  return (e = document.activeElement) == null ? void 0 : e.blur();
288
- }, 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) => {
289
289
  if (!a) return "";
290
290
  const t = e.trim();
291
291
  return t ? t.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
292
292
  }, we = (e) => U("email", { mode: e ? "edit" : "bind", initialEmail: e }), ye = () => {
293
- 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);
294
294
  }, Ee = () => {
295
- 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));
296
296
  }, Ne = async (e, a, t) => {
297
- 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");
298
298
  }, Ce = (e) => {
299
- c.value = e;
299
+ f.value = e;
300
300
  }, Pe = (e) => {
301
301
  console.debug("emitUpdateEmailField, цепочка такая: profileEmailDialog -> DialogManager -> PEditUserContact", e), u.value = e;
302
302
  }, be = (e, a) => {
303
303
  V.value = !0, i("on-password-error", e, a);
304
304
  }, ke = () => {
305
- L.value = !1, M.value = !1;
306
- }, G = (e) => {
307
- V.value = !0, X.value = e.color ?? "", ee.value = e.text ?? "";
305
+ M.value = !1, R.value = !1;
308
306
  }, x = (e) => {
307
+ V.value = !0, ee.value = e.color ?? "", ae.value = e.text ?? "";
308
+ }, $ = (e) => {
309
309
  if (p[e] = !0, e === "firstName" || e === "lastName") {
310
- const a = l[e];
311
- 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 символов. Ввод обрезан.`));
312
312
  }
313
313
  }, Te = (e) => {
314
- var t;
314
+ var C, N;
315
315
  if (!e) {
316
316
  o.imageContent = "", o.imageBinary = null, o.value = null;
317
317
  return;
318
318
  }
319
- if ((((t = e.fileBinary) == null ? void 0 : t.size) ?? 0) > o.uploadLimit) {
320
- 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;
321
322
  return;
322
323
  }
323
- I.value = !1, o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", E.value = !0;
324
+ if ((((N = e.fileBinary) == null ? void 0 : N.size) ?? 0) > o.uploadLimit) {
325
+ j(), o.value = null;
326
+ return;
327
+ }
328
+ S.value = !1, o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", P.value = !0;
324
329
  }, Ue = async () => {
325
330
  try {
326
331
  const a = (await aa("/users/profile/delete/avatar")).data;
@@ -328,50 +333,62 @@ const oa = {
328
333
  } catch (e) {
329
334
  return console.error("Ошибка при удалении аватара:", e), !1;
330
335
  }
331
- }, oe = () => {
332
- 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;
333
338
  }, re = async (e, a, t = "image/png") => {
334
339
  if (!e) return null;
335
340
  const C = await (await fetch(e)).blob();
336
341
  return new File([C], a, { type: t });
337
342
  }, Be = () => {
338
- o.value = null, o.imageBinary = null, o.imageContent = "", E.value = !1;
343
+ o.value = null, o.imageBinary = null, o.imageContent = "", P.value = !1;
339
344
  }, De = async (e) => {
340
- if (E.value = !1, o.imageContent = e, !o.imageBinary) return;
341
- const a = await re(e, o.imageBinary.name, o.imageBinary.type || "image/png");
342
- if (a)
343
- try {
344
- o.loading = !0;
345
- const t = new FormData();
346
- t.append("file", a), await K(`/users/profile/avatar/${y.value}`, t, { headers: { "Content-Type": void 0 } });
347
- } catch (t) {
348
- console.error(t);
349
- } finally {
350
- I.value = !1, o.loading = !1;
351
- }
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
+ }
352
369
  }, Fe = async (e) => {
353
370
  o.imageContent = e ?? "", o.imageBinary && (o.imageBinary = await re(
354
371
  e ?? "",
355
372
  o.imageBinary.name,
356
373
  o.imageBinary.type || "image/png"
357
374
  ));
358
- }, ne = h(!1), se = async (e) => {
359
- var t, k;
360
- 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();
361
378
  if (a)
362
379
  try {
363
380
  ne.value = !0;
364
- const N = (k = (await K("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : k.data;
365
- N != null && N.user && (l.firstName = N.user.firstName ?? l.firstName, l.lastName = N.user.lastName ?? l.lastName, d.value = {
366
- firstName: l.firstName,
367
- 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
368
385
  });
369
386
  } catch (C) {
370
387
  throw C;
371
388
  } finally {
372
389
  ne.value = !1;
373
390
  }
374
- }, Se = async () => {
391
+ }, Ie = async () => {
375
392
  var e;
376
393
  if (!r.accessToken)
377
394
  throw console.error("Access token не передан в props"), new Error("Access token is required");
@@ -384,20 +401,20 @@ const oa = {
384
401
  if (!t)
385
402
  throw console.error("Данные пользователя отсутствуют в ответе сервера"), new Error("User data is missing from the response");
386
403
  const {
387
- userId: k,
404
+ userId: w,
388
405
  privateFirstName: C,
389
406
  privateLastName: N,
390
407
  email: $e,
391
408
  phoneNumber: Oe
392
409
  } = t;
393
- 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 = {
394
411
  firstName: C ?? "",
395
412
  lastName: N ?? ""
396
413
  };
397
414
  } catch (a) {
398
415
  console.error("Критическая ошибка при загрузке профиля:", a);
399
416
  }
400
- }, Ie = async () => {
417
+ }, Se = async () => {
401
418
  var e;
402
419
  try {
403
420
  const t = (e = (await ea("/users/profile/avatar")).data) == null ? void 0 : e.data;
@@ -416,9 +433,9 @@ const oa = {
416
433
  }
417
434
  }
418
435
  ue(
419
- () => [l.firstName, l.lastName],
436
+ () => [s.firstName, s.lastName],
420
437
  ([e, a]) => {
421
- 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;
422
439
  A.value = C && N;
423
440
  },
424
441
  { immediate: !0 }
@@ -426,22 +443,22 @@ const oa = {
426
443
  const Ve = async () => {
427
444
  if (A.value)
428
445
  try {
429
- 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: "Изменения сохранены" });
430
447
  } catch (e) {
431
- console.error(e), G({
448
+ console.error(e), x({
432
449
  color: "error",
433
- text: g("Не удалось сохранить изменения. Попробуйте позже")
450
+ text: c("Не удалось сохранить изменения. Попробуйте позже")
434
451
  });
435
452
  }
436
453
  }, xe = () => {
437
- R(), i("open-password-dialog");
454
+ G(), i("open-password-dialog");
438
455
  };
439
456
  return Re(async () => {
440
457
  if (!r.accessToken) throw new Error("Access token не передан в props");
441
458
  if (!r.requestUrl) throw new Error("auth-backend url не передан в props");
442
- Xe(r.accessToken, r.requestUrl), await Se();
443
- }), (e, a) => (w(), b(me, null, [
444
- f(ra, {
459
+ Xe(r.accessToken, r.requestUrl), await Ie();
460
+ }), (e, a) => (y(), k(me, null, [
461
+ g(ra, {
445
462
  language: v.value,
446
463
  provider: e.provider,
447
464
  onCleanInputErrors: ke,
@@ -449,10 +466,10 @@ const oa = {
449
466
  onUpdatePhoneField: Ce,
450
467
  onUpdateEmailField: Pe,
451
468
  onOnPasswordError: be,
452
- onOnToast: G
469
+ onOnToast: x
453
470
  }, null, 8, ["language", "provider"]),
454
- j("div", na, [
455
- B("avatar") ? (w(), S(m(_e), {
471
+ _("div", na, [
472
+ B("avatar") ? (y(), I(m(_e), {
456
473
  key: 0,
457
474
  modelValue: o.value,
458
475
  "onUpdate:modelValue": [
@@ -464,45 +481,45 @@ const oa = {
464
481
  src: o.imageContent,
465
482
  accept: o.accept,
466
483
  loading: o.loading,
467
- label: g("Загрузить фото"),
484
+ label: c("Загрузить фото"),
468
485
  "upload-limit": o.uploadLimit,
469
486
  onDelete: Ue,
470
- "onChange:error": oe
487
+ "onChange:error": j
471
488
  }, {
472
489
  afterLoadLabel: D(() => [
473
- _(F(he.value), 1)
490
+ Y(F(he.value), 1)
474
491
  ]),
475
492
  subtext: D(() => [
476
- 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))
477
494
  ]),
478
495
  _: 1
479
- }, 8, ["modelValue", "src", "accept", "loading", "label", "upload-limit"])) : P("", !0),
480
- B("firstName") ? (w(), b("div", ia, [
481
- f(m($), {
482
- modelValue: l.firstName,
483
- "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),
484
501
  size: "large",
485
- label: g("Имя"),
502
+ label: c("Имя"),
486
503
  error: pe.value,
487
504
  onBlur: a[3] || (a[3] = (t) => p.firstName = !0),
488
- onInput: a[4] || (a[4] = (t) => x("firstName"))
505
+ onInput: a[4] || (a[4] = (t) => $("firstName"))
489
506
  }, null, 8, ["modelValue", "label", "error"]),
490
- f(m(O), { class: "icon-locked" })
491
- ])) : P("", !0),
492
- B("lastName") ? (w(), b("div", ua, [
493
- f(m($), {
494
- modelValue: l.lastName,
495
- "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),
496
513
  size: "large",
497
- label: g("Фамилия"),
514
+ label: c("Фамилия"),
498
515
  error: ce.value,
499
516
  onBlur: a[6] || (a[6] = (t) => p.lastName = !0),
500
- onInput: a[7] || (a[7] = (t) => x("lastName"))
517
+ onInput: a[7] || (a[7] = (t) => $("lastName"))
501
518
  }, null, 8, ["modelValue", "label", "error"]),
502
- f(m(O), { class: "icon-locked" })
503
- ])) : P("", !0),
504
- B("email") ? (w(), b("div", ma, [
505
- f(m($), {
519
+ g(m(z), { class: "icon-locked" })
520
+ ])) : b("", !0),
521
+ B("email") ? (y(), k("div", ma, [
522
+ g(m(O), {
506
523
  modelValue: u.value,
507
524
  "onUpdate:modelValue": a[8] || (a[8] = (t) => u.value = t),
508
525
  size: "large",
@@ -511,92 +528,92 @@ const oa = {
511
528
  type: "email",
512
529
  readonly: "",
513
530
  style: { cursor: "pointer" },
514
- error: fe.value && M.value,
531
+ error: fe.value && R.value,
515
532
  onBlur: a[9] || (a[9] = (t) => p.email = !0),
516
- onInput: a[10] || (a[10] = (t) => x("email")),
533
+ onInput: a[10] || (a[10] = (t) => $("email")),
517
534
  onClick: ye
518
535
  }, null, 8, ["modelValue", "error"]),
519
- f(m(O), { class: "icon-locked" })
520
- ])) : P("", !0),
521
- B("phone") ? (w(), b("div", da, [
522
- f(m($), {
523
- modelValue: c.value,
524
- "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),
525
542
  size: "large",
526
543
  "text-size": "medium",
527
- label: g("Номер телефона"),
544
+ label: c("Номер телефона"),
528
545
  type: "tel",
529
546
  readonly: "",
530
547
  style: { cursor: "pointer" },
531
- error: ge.value && L.value,
548
+ error: ge.value && M.value,
532
549
  onBlur: a[12] || (a[12] = (t) => p.phone = !0),
533
- onInput: a[13] || (a[13] = (t) => x("phone")),
550
+ onInput: a[13] || (a[13] = (t) => $("phone")),
534
551
  onClick: Ee
535
552
  }, null, 8, ["modelValue", "label", "error"]),
536
- f(m(O), { class: "icon-locked" })
537
- ])) : P("", !0),
538
- j("div", pa, [
539
- 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), {
540
557
  key: 0,
541
558
  color: "secondary",
542
559
  onClick: xe
543
560
  }, {
544
561
  default: D(() => [
545
- _(F(g("Сменить пароль")), 1)
562
+ Y(F(c("Сменить пароль")), 1)
546
563
  ]),
547
564
  _: 1
548
- })) : P("", !0),
549
- f(m(ie), {
565
+ })) : b("", !0),
566
+ g(m(ie), {
550
567
  disabled: !A.value,
551
568
  onClick: Ve
552
569
  }, {
553
570
  default: D(() => [
554
- _(F(g("Сохранить")), 1)
571
+ Y(F(c("Сохранить")), 1)
555
572
  ]),
556
573
  _: 1
557
574
  }, 8, ["disabled"])
558
575
  ])
559
576
  ]),
560
- E.value ? (w(), S(le, {
577
+ P.value ? (y(), I(se, {
561
578
  key: 0,
562
579
  to: "body"
563
580
  }, [
564
- E.value ? (w(), b("div", ca, [
565
- f(m(Ye), {
581
+ P.value ? (y(), k("div", ca, [
582
+ g(m(Ye), {
566
583
  "circle-mode": !0,
567
584
  "model-value": o.imageContent,
568
585
  onClose: Be,
569
586
  onSave: a[14] || (a[14] = (t) => De(t)),
570
587
  "onUpdate:modelValue": a[15] || (a[15] = (t) => Fe(t))
571
588
  }, null, 8, ["model-value"])
572
- ])) : P("", !0)
573
- ])) : P("", !0),
574
- (w(), S(le, { to: "#toast-root" }, [
575
- j("div", fa, [
576
- 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" }, {
577
594
  default: D(() => [
578
- qe(f(m(We), {
595
+ je(g(m(We), {
579
596
  class: "toast",
580
- color: X.value,
581
- text: ee.value,
597
+ color: ee.value,
598
+ text: ae.value,
582
599
  onClose: a[16] || (a[16] = (t) => V.value = !1)
583
600
  }, null, 8, ["color", "text"]), [
584
- [Je, V.value]
601
+ [qe, V.value]
585
602
  ])
586
603
  ]),
587
604
  _: 1
588
605
  })
589
606
  ])
590
607
  ])),
591
- f(m(de))
608
+ g(m(de))
592
609
  ], 64));
593
610
  }
594
- }), va = (s, n) => {
595
- const r = s.__vccOpts || s;
611
+ }), va = (l, n) => {
612
+ const r = l.__vccOpts || l;
596
613
  for (const [i, v] of n)
597
614
  r[i] = v;
598
615
  return r;
599
- }, ha = /* @__PURE__ */ va(ga, [["__scopeId", "data-v-9c000a09"]]), Pa = /* @__PURE__ */ Z({
616
+ }, ha = /* @__PURE__ */ va(ga, [["__scopeId", "data-v-e236cb5b"]]), Pa = /* @__PURE__ */ H({
600
617
  __name: "index",
601
618
  props: {
602
619
  throttlerPrefix: {},
@@ -609,19 +626,19 @@ const oa = {
609
626
  awsStorageUrl: {}
610
627
  },
611
628
  emits: ["on-update-jwt", "update-tokens"],
612
- setup(s, { emit: n }) {
613
- const r = n, { openDialog: i } = Q(), v = (d, p) => {
629
+ setup(l, { emit: n }) {
630
+ const r = n, { openDialog: i } = X(), v = (d, p) => {
614
631
  i("email", { initialEmail: d, mode: p });
615
- }, g = (d, p) => {
632
+ }, c = (d, p) => {
616
633
  i("phone", { initialPhone: d, mode: p });
617
634
  }, U = () => {
618
635
  i("password");
619
- }, l = (d, p, y) => {
620
- r("on-update-jwt", d, p, y);
636
+ }, s = (d, p, E) => {
637
+ r("on-update-jwt", d, p, E);
621
638
  };
622
- return (d, p) => (w(), b(me, null, [
623
- f(m(Ke)),
624
- f(ha, {
639
+ return (d, p) => (y(), k(me, null, [
640
+ g(m(Ke)),
641
+ g(ha, {
625
642
  "throttler-prefix": d.throttlerPrefix,
626
643
  provider: d.provider,
627
644
  "request-url": d.requestUrl,
@@ -631,11 +648,11 @@ const oa = {
631
648
  "refresh-token": d.refreshToken,
632
649
  "aws-storage-url": d.awsStorageUrl,
633
650
  onOpenEmailDialog: v,
634
- onOpenPhoneDialog: g,
651
+ onOpenPhoneDialog: c,
635
652
  onOpenPasswordDialog: U,
636
- onOnUpdateJwt: l
653
+ onOnUpdateJwt: s
637
654
  }, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url"]),
638
- f(m(de))
655
+ g(m(de))
639
656
  ], 64));
640
657
  }
641
658
  });
@@ -645,6 +662,6 @@ export {
645
662
  va as _,
646
663
  Pa as a,
647
664
  ea as g,
648
- K as p,
665
+ Z as p,
649
666
  oa as t
650
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-9c000a09] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-9c000a09] .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-DLfEv7A5.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-DLfEv7A5.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.41.0",
3
+ "version": "0.42.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",