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