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