@yourgoods/ui-smart 0.53.45 → 0.53.46
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-1PdklFjX.js → ProfileEmailDialog-dPD0IuHC.js} +2 -2
- package/dist/{ProfilePasswordDialog-Cf5_HAyj.js → ProfilePasswordDialog-BbSbc-Sb.js} +1 -1
- package/dist/{ProfilePhoneDialog-B6_z4IOU.js → ProfilePhoneDialog-Dinhq4hZ.js} +2 -2
- package/dist/{index-JgKD-0yi.js → index-FVumIZZb.js} +336 -332
- package/dist/index.js +2 -2
- package/dist/{useRateLimitToast-CfKIVWV2.js → useRateLimitToast-tKC4taf4.js} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as oe, ref as T, reactive as Z, watch as Y, computed as b, toRefs as ce, createElementBlock as I, openBlock as y, createElementVNode as x, createCommentVNode as D, toDisplayString as _, createVNode as $, unref as u, isRef as ee, withCtx as G, createTextVNode as ie, Fragment as Ae, createBlock as H, resolveDynamicComponent as he, onMounted as Fe } from "vue";
|
|
2
|
-
import { _ as ve, c as ke, u as Re, a as ze, P as Me, b as We } from "./useRateLimitToast-
|
|
3
|
-
import { C as F, _ as He, B as qe, p as W, g as je } from "./index-
|
|
2
|
+
import { _ as ve, c as ke, u as Re, a as ze, P as Me, b as We } from "./useRateLimitToast-tKC4taf4.js";
|
|
3
|
+
import { C as F, _ as He, B as qe, p as W, g as je } from "./index-FVumIZZb.js";
|
|
4
4
|
import { PInput as J, IconMailMd as pe, PButton as ne, IconEyeMd as Ve, IconEyeClosedMd as be, PDialog as Ge, PTopBar as Ye, IconCrossMd as Je } from "@profeat/ui-kit";
|
|
5
5
|
const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { class: "dialogDefaultContainerTextHint" }, Xe = {
|
|
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-FVumIZZb.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 S, openBlock as v, createElementVNode as H, defineComponent as he, reactive as ve, watch as _, ref as O, toRefs as Ce, computed as I, createCommentVNode as B, createVNode as b, toDisplayString as G, createBlock as J, createTextVNode as Z, unref as r, isRef as le, withCtx as X, onMounted as We, Fragment as je } from "vue";
|
|
2
|
-
import { _ as we, c as Ne, a as He, u as Ge, P as Oe, b as Je } from "./useRateLimitToast-
|
|
2
|
+
import { _ as we, c as Ne, a as He, u as Ge, P as Oe, b as Je } from "./useRateLimitToast-tKC4taf4.js";
|
|
3
3
|
import { IconTelegramSm as Pe, PInput as se, IconPhoneMd as Re, IconMailMd as Ke, PButton as ze, PDialog as Qe, PTopBar as Xe, IconCrossMd as Ye, PTeleportContainer as Ze } from "@profeat/ui-kit";
|
|
4
|
-
import { C as j, t as De, p as te, g as Ae } from "./index-
|
|
4
|
+
import { C as j, t as De, p as te, g as Ae } from "./index-FVumIZZb.js";
|
|
5
5
|
const _e = {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: "12",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as w, shallowRef as Ye, defineComponent as te, defineAsyncComponent as oe, watch as Ie, createBlock as $, createCommentVNode as V, unref as p, openBlock as P, resolveDynamicComponent as Ke, mergeProps as Xe, computed as I, reactive as re, onMounted as Ze, createElementBlock as F, Fragment as Be, createVNode as E, createElementVNode as le, withCtx as R, toDisplayString as O, createTextVNode as se, Teleport as Ee, Transition as He, withDirectives as Qe, vShow as et } from "vue";
|
|
2
2
|
import tt from "axios";
|
|
3
|
-
import { PInputFileUploader as at, PInput as
|
|
4
|
-
function it(
|
|
5
|
-
if (
|
|
3
|
+
import { PInputFileUploader as at, PInput as G, IconFilledEditMd as Q, PButton as be, PImageCropper as nt, PToast as ot, PTeleportContainer as De, PToastContainer as rt, IconPhoneMd as lt, IconMailMd as st } from "@profeat/ui-kit";
|
|
4
|
+
function it(r, i = 2) {
|
|
5
|
+
if (r === 0)
|
|
6
6
|
return "0 B";
|
|
7
|
-
const a = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], f = Math.floor(Math.log(
|
|
8
|
-
return `${Number.parseFloat((
|
|
7
|
+
const a = 1024, n = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], f = Math.floor(Math.log(r) / Math.log(a));
|
|
8
|
+
return `${Number.parseFloat((r / a ** f).toFixed(i))} ${n[f]}`;
|
|
9
9
|
}
|
|
10
10
|
const ut = {
|
|
11
11
|
"image/jpeg": "JPEG",
|
|
@@ -15,10 +15,10 @@ const ut = {
|
|
|
15
15
|
"application/zip": "ZIP Archive"
|
|
16
16
|
// ...
|
|
17
17
|
};
|
|
18
|
-
function dt(
|
|
19
|
-
return
|
|
18
|
+
function dt(r) {
|
|
19
|
+
return r.map((i) => {
|
|
20
20
|
var a;
|
|
21
|
-
return ut[
|
|
21
|
+
return ut[i] || ((a = i.split("/")[1]) == null ? void 0 : a.toUpperCase());
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
const Lt = {
|
|
@@ -28,12 +28,12 @@ const Lt = {
|
|
|
28
28
|
}, _t = {
|
|
29
29
|
VERIFY_EMAIL: "verify-email"
|
|
30
30
|
};
|
|
31
|
-
let
|
|
32
|
-
function ct(
|
|
33
|
-
|
|
34
|
-
baseURL:
|
|
31
|
+
let de = null;
|
|
32
|
+
function ct(r, i, a) {
|
|
33
|
+
de = tt.create({
|
|
34
|
+
baseURL: i,
|
|
35
35
|
headers: {
|
|
36
|
-
Authorization: `Bearer ${
|
|
36
|
+
Authorization: `Bearer ${r}`,
|
|
37
37
|
"x-throttler-prefix": a ?? "throttler_profile_edit"
|
|
38
38
|
// здесь можно словить баг, который может быть сложно отследить, если будет передаваться пустой прелфикс
|
|
39
39
|
// 'Content-Type': 'application/json',
|
|
@@ -41,41 +41,41 @@ function ct(l, s, a) {
|
|
|
41
41
|
validateStatus: (n) => n >= 200 && n < 300
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
if (!
|
|
44
|
+
function pe() {
|
|
45
|
+
if (!de)
|
|
46
46
|
throw new Error("Axios instance not initialized. Call initAxios(token, baseUrl) first.");
|
|
47
|
-
return
|
|
47
|
+
return de;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
50
|
-
return
|
|
49
|
+
async function ce(r, i, a) {
|
|
50
|
+
return pe().post(r, i, a);
|
|
51
51
|
}
|
|
52
|
-
async function mt(
|
|
53
|
-
return
|
|
52
|
+
async function mt(r, i) {
|
|
53
|
+
return pe().get(r, i);
|
|
54
54
|
}
|
|
55
|
-
async function pt(
|
|
56
|
-
return
|
|
55
|
+
async function pt(r, i) {
|
|
56
|
+
return pe().delete(r, i);
|
|
57
57
|
}
|
|
58
|
-
async function ft(
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
58
|
+
async function ft(r) {
|
|
59
|
+
const i = await ce("/users/profile/me", r);
|
|
60
|
+
if (i.status !== 200 && i.status !== 201 || !i.data)
|
|
61
61
|
throw new Error("Ошибка при получении профиля пользователя");
|
|
62
|
-
return
|
|
62
|
+
return i.data;
|
|
63
63
|
}
|
|
64
|
-
const ee =
|
|
65
|
-
function
|
|
64
|
+
const ee = w(null), ie = Ye(null);
|
|
65
|
+
function fe() {
|
|
66
66
|
return {
|
|
67
67
|
currentDialog: ee,
|
|
68
|
-
dialogPayload:
|
|
68
|
+
dialogPayload: ie,
|
|
69
69
|
openDialog: (n, f) => {
|
|
70
|
-
ee.value = n,
|
|
70
|
+
ee.value = n, ie.value = f ?? null;
|
|
71
71
|
},
|
|
72
72
|
closeDialog: () => {
|
|
73
|
-
ee.value = null,
|
|
73
|
+
ee.value = null, ie.value = null;
|
|
74
74
|
},
|
|
75
75
|
isDialogOpen: (n) => ee.value === n
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const me = {
|
|
79
79
|
ru: {
|
|
80
80
|
Имя: "Имя",
|
|
81
81
|
Фамилия: "Фамилия",
|
|
@@ -224,33 +224,33 @@ const ce = {
|
|
|
224
224
|
disableAddPhone: { type: Boolean }
|
|
225
225
|
},
|
|
226
226
|
emits: ["clean-input-errors", "on-update-jwt", "update-phone-field", "update-email-field", "on-password-error", "on-toast"],
|
|
227
|
-
setup(
|
|
228
|
-
const a =
|
|
229
|
-
email:
|
|
230
|
-
phone:
|
|
231
|
-
password:
|
|
232
|
-
},
|
|
233
|
-
a("update-email-field",
|
|
234
|
-
},
|
|
235
|
-
a("update-phone-field",
|
|
227
|
+
setup(r, { emit: i }) {
|
|
228
|
+
const a = i, n = w(!0), { currentDialog: f, dialogPayload: v, closeDialog: x } = fe(), c = {
|
|
229
|
+
email: oe(() => import("./ProfileEmailDialog-dPD0IuHC.js")),
|
|
230
|
+
phone: oe(() => import("./ProfilePhoneDialog-Dinhq4hZ.js")),
|
|
231
|
+
password: oe(() => import("./ProfilePasswordDialog-BbSbc-Sb.js"))
|
|
232
|
+
}, m = ({ email: N }) => {
|
|
233
|
+
a("update-email-field", N);
|
|
234
|
+
}, g = ({ phone: N }) => {
|
|
235
|
+
a("update-phone-field", N);
|
|
236
236
|
};
|
|
237
|
-
return
|
|
238
|
-
n.value = !!
|
|
239
|
-
}), (
|
|
237
|
+
return Ie(f, (N) => {
|
|
238
|
+
n.value = !!N;
|
|
239
|
+
}), (N, u) => p(f) ? (P(), $(Ke(c[p(f)]), Xe({
|
|
240
240
|
key: 0,
|
|
241
241
|
modelValue: n.value,
|
|
242
|
-
"onUpdate:modelValue":
|
|
243
|
-
language:
|
|
244
|
-
provider:
|
|
245
|
-
"disable-add-phone":
|
|
242
|
+
"onUpdate:modelValue": u[0] || (u[0] = (y) => n.value = y),
|
|
243
|
+
language: N.language,
|
|
244
|
+
provider: N.provider,
|
|
245
|
+
"disable-add-phone": N.disableAddPhone
|
|
246
246
|
}, p(v), {
|
|
247
|
-
onClose: p(
|
|
248
|
-
onCleanInputErrors:
|
|
249
|
-
onOnUpdateJwt:
|
|
250
|
-
onSubmitEmail:
|
|
251
|
-
onSubmitPhone:
|
|
252
|
-
onOnPasswordError:
|
|
253
|
-
onOnToast:
|
|
247
|
+
onClose: p(x),
|
|
248
|
+
onCleanInputErrors: u[1] || (u[1] = (y) => a("clean-input-errors")),
|
|
249
|
+
onOnUpdateJwt: u[2] || (u[2] = (y, k, l) => a("on-update-jwt", y, k, l)),
|
|
250
|
+
onSubmitEmail: m,
|
|
251
|
+
onSubmitPhone: g,
|
|
252
|
+
onOnPasswordError: u[3] || (u[3] = (y, k) => a("on-password-error", y, k)),
|
|
253
|
+
onOnToast: u[4] || (u[4] = (y) => a("on-toast", y))
|
|
254
254
|
}), null, 16, ["modelValue", "language", "provider", "disable-add-phone", "onClose"])) : V("", !0);
|
|
255
255
|
}
|
|
256
256
|
}), gt = { class: "base-container" }, ht = {
|
|
@@ -285,8 +285,8 @@ const ce = {
|
|
|
285
285
|
disableAddPhone: { type: Boolean }
|
|
286
286
|
},
|
|
287
287
|
emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
|
|
288
|
-
setup(
|
|
289
|
-
const a =
|
|
288
|
+
setup(r, { emit: i }) {
|
|
289
|
+
const a = r, n = i, f = I(() => a.language ?? "ru"), v = (e) => me[f.value][e] || e, { openDialog: x } = fe(), c = re({ firstName: "", lastName: "" }), m = w({ firstName: "", lastName: "" }), g = re({ firstName: !1, lastName: !1, email: !1, phone: !1 }), N = w(""), u = w(""), y = w(""), k = w(!1), l = re({
|
|
290
290
|
value: null,
|
|
291
291
|
loading: !1,
|
|
292
292
|
accept: ["image/png", "image/jpeg"],
|
|
@@ -294,48 +294,48 @@ const ce = {
|
|
|
294
294
|
// 10 MB
|
|
295
295
|
imageBinary: null,
|
|
296
296
|
imageContent: ""
|
|
297
|
-
}),
|
|
297
|
+
}), b = w(""), M = w(!1), C = w(!0), L = w(!0), j = w(void 0), q = w(""), ae = I(() => S(c.firstName, g.firstName)), ne = I(() => S(c.lastName, g.lastName)), s = I(() => g.email && !u.value.trim() ? "Введите e-mail" : ""), h = I(() => g.phone && !y.value.trim() ? "Введите номер телефона" : ""), d = (e) => a.fields.some((t) => t.key === e), A = (e) => e && e.trim() ? "edit" : "bind", T = () => setTimeout(() => {
|
|
298
298
|
var e;
|
|
299
299
|
return (e = document.activeElement) == null ? void 0 : e.blur();
|
|
300
|
-
}, 0),
|
|
300
|
+
}, 0), _ = I(() => !!(u.value && u.value.trim() !== "")), z = I(() => l.imageContent ? v("Загрузить другое фото") : v("Загрузить фото")), S = (e, t) => {
|
|
301
301
|
if (!t) return "";
|
|
302
|
-
const
|
|
303
|
-
return
|
|
304
|
-
},
|
|
305
|
-
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
}, Ae = async (e, t,
|
|
309
|
-
e === "email" &&
|
|
302
|
+
const o = e.trim();
|
|
303
|
+
return o ? o.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
|
|
304
|
+
}, J = (e) => x("email", { mode: e ? "edit" : "bind", initialEmail: e }), W = () => {
|
|
305
|
+
T(), g.email = !1, L.value = !1, n("open-email-dialog", u.value, A(u.value)), J(u.value);
|
|
306
|
+
}, Y = () => {
|
|
307
|
+
T(), g.phone = !1, C.value = !1, n("open-phone-dialog", y.value, A(y.value));
|
|
308
|
+
}, Ae = async (e, t, o) => {
|
|
309
|
+
e === "email" && o && (u.value = o), e === "phone" && o && (y.value = o), n("on-update-jwt");
|
|
310
310
|
}, Fe = (e) => {
|
|
311
311
|
y.value = e;
|
|
312
312
|
}, Se = (e) => {
|
|
313
|
-
|
|
313
|
+
u.value = e;
|
|
314
314
|
}, xe = (e, t) => {
|
|
315
|
-
|
|
315
|
+
M.value = !0, n("on-password-error", e, t);
|
|
316
316
|
}, Me = () => {
|
|
317
|
-
|
|
317
|
+
C.value = !1, L.value = !1;
|
|
318
318
|
}, K = (e) => {
|
|
319
|
-
|
|
319
|
+
M.value = !0, j.value = e.color ?? "", q.value = e.text ?? "";
|
|
320
320
|
}, X = (e) => {
|
|
321
|
-
if (
|
|
322
|
-
const t =
|
|
323
|
-
t.length > 40 && (
|
|
321
|
+
if (g[e] = !0, e === "firstName" || e === "lastName") {
|
|
322
|
+
const t = c[e];
|
|
323
|
+
t.length > 40 && (c[e] = t.slice(0, 40));
|
|
324
324
|
}
|
|
325
325
|
}, $e = (e) => {
|
|
326
|
-
var
|
|
327
|
-
if (
|
|
328
|
-
|
|
326
|
+
var Z, H;
|
|
327
|
+
if (b.value = "", !e) {
|
|
328
|
+
ve();
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
const t = ((
|
|
331
|
+
const t = ((Z = e.fileBinary) == null ? void 0 : Z.type) ?? "", o = ((H = e.fileBinary) == null ? void 0 : H.size) ?? 0, U = !["image/png", "image/jpeg"].includes(t), D = o > l.uploadLimit;
|
|
332
332
|
if (U || D) {
|
|
333
|
-
|
|
333
|
+
b.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", ve();
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
|
|
337
|
-
},
|
|
338
|
-
|
|
336
|
+
l.value = e, l.imageBinary = e.fileBinary ?? null, l.imageContent = e.fileContent ?? "", k.value = !0;
|
|
337
|
+
}, ve = () => {
|
|
338
|
+
l.value = null, l.imageBinary = null, l.imageContent = "", k.value = !1;
|
|
339
339
|
}, ze = async () => {
|
|
340
340
|
try {
|
|
341
341
|
const t = (await pt("/users/profile/delete/avatar")).data;
|
|
@@ -344,80 +344,80 @@ const ce = {
|
|
|
344
344
|
return console.error("Ошибка при удалении аватара:", e), !1;
|
|
345
345
|
}
|
|
346
346
|
}, Le = () => {
|
|
347
|
-
|
|
348
|
-
},
|
|
347
|
+
b.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", l.value = null, l.imageBinary = null, l.imageContent = "", k.value = !1;
|
|
348
|
+
}, ge = async (e, t, o = "image/png") => {
|
|
349
349
|
if (!e) return null;
|
|
350
350
|
const U = await (await fetch(e)).blob();
|
|
351
|
-
return new File([U], t, { type:
|
|
351
|
+
return new File([U], t, { type: o });
|
|
352
352
|
}, _e = () => {
|
|
353
|
-
|
|
353
|
+
l.value = null, l.imageBinary = null, l.imageContent = "", k.value = !1;
|
|
354
354
|
}, Re = async (e) => {
|
|
355
|
-
|
|
356
|
-
const t =
|
|
357
|
-
if (
|
|
358
|
-
const
|
|
355
|
+
k.value = !1;
|
|
356
|
+
const t = l.imageContent;
|
|
357
|
+
if (l.imageContent = e, !l.imageBinary) return;
|
|
358
|
+
const o = await ge(
|
|
359
359
|
e,
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
l.imageBinary.name,
|
|
361
|
+
l.imageBinary.type || "image/png"
|
|
362
362
|
);
|
|
363
|
-
if (!
|
|
364
|
-
|
|
363
|
+
if (!o) {
|
|
364
|
+
l.imageContent = t;
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
367
|
try {
|
|
368
|
-
|
|
368
|
+
l.loading = !0;
|
|
369
369
|
const B = new FormData();
|
|
370
|
-
B.append("file",
|
|
370
|
+
B.append("file", o), await ce(`/users/profile/avatar/${N.value}`, B, { headers: { "Content-Type": void 0 } });
|
|
371
371
|
} catch (B) {
|
|
372
372
|
console.error(B), K({
|
|
373
373
|
color: "error",
|
|
374
374
|
text: v("Не удалось сохранить изменения. Попробуйте позже")
|
|
375
|
-
}),
|
|
375
|
+
}), l.imageContent = t;
|
|
376
376
|
} finally {
|
|
377
|
-
|
|
377
|
+
l.loading = !1;
|
|
378
378
|
}
|
|
379
379
|
}, Oe = async (e) => {
|
|
380
|
-
|
|
380
|
+
l.imageContent = e ?? "", l.imageBinary && (l.imageBinary = await ge(
|
|
381
381
|
e ?? "",
|
|
382
|
-
|
|
383
|
-
|
|
382
|
+
l.imageBinary.name,
|
|
383
|
+
l.imageBinary.type || "image/png"
|
|
384
384
|
));
|
|
385
|
-
},
|
|
386
|
-
var
|
|
387
|
-
const t = (
|
|
385
|
+
}, he = w(!1), ye = async (e) => {
|
|
386
|
+
var o, B;
|
|
387
|
+
const t = (o = c[e]) == null ? void 0 : o.trim();
|
|
388
388
|
if (t)
|
|
389
389
|
try {
|
|
390
|
-
|
|
391
|
-
const D = (B = (await
|
|
392
|
-
D != null && D.user && (
|
|
393
|
-
firstName:
|
|
394
|
-
lastName:
|
|
390
|
+
he.value = !0;
|
|
391
|
+
const D = (B = (await ce("/users/profile/update-name", { [e]: t })).data) == null ? void 0 : B.data;
|
|
392
|
+
D != null && D.user && (c.firstName = D.user.firstName ?? c.firstName, c.lastName = D.user.lastName ?? c.lastName, m.value = {
|
|
393
|
+
firstName: c.firstName,
|
|
394
|
+
lastName: c.lastName
|
|
395
395
|
});
|
|
396
396
|
} catch (U) {
|
|
397
397
|
throw U;
|
|
398
398
|
} finally {
|
|
399
|
-
|
|
399
|
+
he.value = !1;
|
|
400
400
|
}
|
|
401
401
|
}, Ge = async () => {
|
|
402
402
|
var e;
|
|
403
403
|
if (!a.accessToken)
|
|
404
404
|
throw console.error("Access token не передан в props"), new Error("Access token is required");
|
|
405
405
|
try {
|
|
406
|
-
const
|
|
406
|
+
const o = (e = (await ft({
|
|
407
407
|
accessToken: a.accessToken,
|
|
408
408
|
refreshToken: a.refreshToken ?? "",
|
|
409
409
|
excludeFields: []
|
|
410
410
|
})).data) == null ? void 0 : e.user;
|
|
411
|
-
if (!
|
|
411
|
+
if (!o)
|
|
412
412
|
throw console.error("Данные пользователя отсутствуют в ответе сервера"), new Error("User data is missing from the response");
|
|
413
413
|
const {
|
|
414
414
|
userId: B,
|
|
415
415
|
privateFirstName: U,
|
|
416
416
|
privateLastName: D,
|
|
417
|
-
email:
|
|
418
|
-
phoneNumber:
|
|
419
|
-
} =
|
|
420
|
-
|
|
417
|
+
email: Z,
|
|
418
|
+
phoneNumber: H
|
|
419
|
+
} = o;
|
|
420
|
+
N.value = B ?? "", c.firstName = U ?? "", c.lastName = D ?? "", u.value = Z ?? "", y.value = H ?? "", l.imageContent = await je(), m.value = {
|
|
421
421
|
firstName: U ?? "",
|
|
422
422
|
lastName: D ?? ""
|
|
423
423
|
};
|
|
@@ -427,8 +427,8 @@ const ce = {
|
|
|
427
427
|
}, je = async () => {
|
|
428
428
|
var e;
|
|
429
429
|
try {
|
|
430
|
-
const
|
|
431
|
-
return
|
|
430
|
+
const o = (e = (await mt("/users/profile/avatar")).data) == null ? void 0 : e.data;
|
|
431
|
+
return o ? qe(o) : "";
|
|
432
432
|
} catch (t) {
|
|
433
433
|
return console.error("Ошибка при загрузке метаданных аватара:", t), "";
|
|
434
434
|
}
|
|
@@ -442,15 +442,15 @@ const ce = {
|
|
|
442
442
|
return console.error("Ошибка при составлении URL аватара:", t), "";
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
if (!
|
|
445
|
+
const we = I(() => {
|
|
446
|
+
if (!m.value.firstName && !m.value.lastName)
|
|
447
447
|
return !1;
|
|
448
|
-
const e =
|
|
448
|
+
const e = c.firstName.trim(), t = c.lastName.trim(), o = m.value.firstName.trim(), B = m.value.lastName.trim(), U = e !== o || t !== B, D = e.length >= 2 && t.length >= 2;
|
|
449
449
|
return U && D;
|
|
450
450
|
}), Je = async () => {
|
|
451
|
-
if (
|
|
451
|
+
if (we.value)
|
|
452
452
|
try {
|
|
453
|
-
await Promise.all([
|
|
453
|
+
await Promise.all([ye("firstName"), ye("lastName")]), n("on-update-jwt"), K({ color: "success", text: "Изменения сохранены" });
|
|
454
454
|
} catch (e) {
|
|
455
455
|
console.error(e), K({
|
|
456
456
|
color: "error",
|
|
@@ -458,14 +458,14 @@ const ce = {
|
|
|
458
458
|
});
|
|
459
459
|
}
|
|
460
460
|
}, We = () => {
|
|
461
|
-
|
|
461
|
+
T(), n("open-password-dialog");
|
|
462
462
|
};
|
|
463
|
-
return
|
|
463
|
+
return Ze(async () => {
|
|
464
464
|
if (!a.accessToken) throw new Error("Access token не передан в props");
|
|
465
465
|
if (!a.requestUrl) throw new Error("auth-backend url не передан в props");
|
|
466
466
|
ct(a.accessToken, a.requestUrl, a.throttlerPrefix), await Ge();
|
|
467
|
-
}), (e, t) => (P(), F(
|
|
468
|
-
|
|
467
|
+
}), (e, t) => (P(), F(Be, null, [
|
|
468
|
+
E(vt, {
|
|
469
469
|
language: f.value,
|
|
470
470
|
provider: e.provider,
|
|
471
471
|
"disable-add-phone": e.disableAddPhone,
|
|
@@ -476,152 +476,152 @@ const ce = {
|
|
|
476
476
|
onOnPasswordError: xe,
|
|
477
477
|
onOnToast: K
|
|
478
478
|
}, null, 8, ["language", "provider", "disable-add-phone"]),
|
|
479
|
-
|
|
480
|
-
|
|
479
|
+
le("div", gt, [
|
|
480
|
+
d("avatar") ? (P(), $(p(at), {
|
|
481
481
|
key: 0,
|
|
482
|
-
modelValue:
|
|
482
|
+
modelValue: l.value,
|
|
483
483
|
"onUpdate:modelValue": [
|
|
484
|
-
t[0] || (t[0] = (
|
|
485
|
-
t[1] || (t[1] = (
|
|
484
|
+
t[0] || (t[0] = (o) => l.value = o),
|
|
485
|
+
t[1] || (t[1] = (o) => $e(o))
|
|
486
486
|
],
|
|
487
487
|
type: "img",
|
|
488
488
|
class: "avatar-input",
|
|
489
|
-
src:
|
|
490
|
-
loading:
|
|
489
|
+
src: l.imageContent,
|
|
490
|
+
loading: l.loading,
|
|
491
491
|
label: v("Загрузить фото"),
|
|
492
|
-
"upload-limit":
|
|
492
|
+
"upload-limit": l.uploadLimit,
|
|
493
493
|
accept: "image/jpeg, image/png",
|
|
494
494
|
onDelete: ze,
|
|
495
495
|
"onChange:error": Le
|
|
496
496
|
}, {
|
|
497
|
-
afterLoadLabel:
|
|
498
|
-
|
|
497
|
+
afterLoadLabel: R(() => [
|
|
498
|
+
se(O(z.value), 1)
|
|
499
499
|
]),
|
|
500
|
-
subtext:
|
|
501
|
-
|
|
500
|
+
subtext: R(() => [
|
|
501
|
+
b.value ? (P(), F("span", ht, O(b.value), 1)) : (P(), F("span", yt, O(`${v("Формат")} ${p(dt)(l.accept).join(", ")} ${v("до")} ${p(it)(l.uploadLimit)}`), 1))
|
|
502
502
|
]),
|
|
503
503
|
_: 1
|
|
504
504
|
}, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) : V("", !0),
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
modelValue:
|
|
508
|
-
"onUpdate:modelValue": t[2] || (t[2] = (
|
|
505
|
+
d("firstName") ? (P(), F("div", wt, [
|
|
506
|
+
E(p(G), {
|
|
507
|
+
modelValue: c.firstName,
|
|
508
|
+
"onUpdate:modelValue": t[2] || (t[2] = (o) => c.firstName = o),
|
|
509
509
|
size: "large",
|
|
510
510
|
label: v("Имя"),
|
|
511
511
|
error: ae.value,
|
|
512
|
-
onBlur: t[3] || (t[3] = (
|
|
513
|
-
onInput: t[4] || (t[4] = (
|
|
512
|
+
onBlur: t[3] || (t[3] = (o) => g.firstName = !0),
|
|
513
|
+
onInput: t[4] || (t[4] = (o) => X("firstName"))
|
|
514
514
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
515
|
-
|
|
515
|
+
E(p(Q), { class: "icon-locked" })
|
|
516
516
|
])) : V("", !0),
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
modelValue:
|
|
520
|
-
"onUpdate:modelValue": t[5] || (t[5] = (
|
|
517
|
+
d("lastName") ? (P(), F("div", Et, [
|
|
518
|
+
E(p(G), {
|
|
519
|
+
modelValue: c.lastName,
|
|
520
|
+
"onUpdate:modelValue": t[5] || (t[5] = (o) => c.lastName = o),
|
|
521
521
|
size: "large",
|
|
522
522
|
label: v("Фамилия"),
|
|
523
|
-
error:
|
|
524
|
-
onBlur: t[6] || (t[6] = (
|
|
525
|
-
onInput: t[7] || (t[7] = (
|
|
523
|
+
error: ne.value,
|
|
524
|
+
onBlur: t[6] || (t[6] = (o) => g.lastName = !0),
|
|
525
|
+
onInput: t[7] || (t[7] = (o) => X("lastName"))
|
|
526
526
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
527
|
-
|
|
527
|
+
E(p(Q), { class: "icon-locked" })
|
|
528
528
|
])) : V("", !0),
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
modelValue:
|
|
532
|
-
"onUpdate:modelValue": t[8] || (t[8] = (
|
|
529
|
+
d("email") ? (P(), F("div", bt, [
|
|
530
|
+
E(p(G), {
|
|
531
|
+
modelValue: u.value,
|
|
532
|
+
"onUpdate:modelValue": t[8] || (t[8] = (o) => u.value = o),
|
|
533
533
|
size: "large",
|
|
534
534
|
"text-size": "medium",
|
|
535
535
|
label: "E-mail",
|
|
536
536
|
type: "email",
|
|
537
537
|
readonly: "",
|
|
538
538
|
style: { cursor: "pointer" },
|
|
539
|
-
error:
|
|
540
|
-
onBlur: t[9] || (t[9] = (
|
|
541
|
-
onInput: t[10] || (t[10] = (
|
|
542
|
-
onClick:
|
|
539
|
+
error: s.value && L.value,
|
|
540
|
+
onBlur: t[9] || (t[9] = (o) => g.email = !0),
|
|
541
|
+
onInput: t[10] || (t[10] = (o) => X("email")),
|
|
542
|
+
onClick: W
|
|
543
543
|
}, null, 8, ["modelValue", "error"]),
|
|
544
|
-
|
|
544
|
+
E(p(Q), { class: "icon-locked" })
|
|
545
545
|
])) : V("", !0),
|
|
546
|
-
|
|
547
|
-
|
|
546
|
+
d("phone") ? (P(), F("div", Pt, [
|
|
547
|
+
E(p(G), {
|
|
548
548
|
modelValue: y.value,
|
|
549
|
-
"onUpdate:modelValue": t[11] || (t[11] = (
|
|
549
|
+
"onUpdate:modelValue": t[11] || (t[11] = (o) => y.value = o),
|
|
550
550
|
size: "large",
|
|
551
551
|
"text-size": "medium",
|
|
552
552
|
label: v("Номер телефона"),
|
|
553
553
|
type: "tel",
|
|
554
554
|
readonly: "",
|
|
555
555
|
style: { cursor: "pointer" },
|
|
556
|
-
error:
|
|
557
|
-
onBlur: t[12] || (t[12] = (
|
|
558
|
-
onInput: t[13] || (t[13] = (
|
|
559
|
-
onClick:
|
|
556
|
+
error: h.value && C.value,
|
|
557
|
+
onBlur: t[12] || (t[12] = (o) => g.phone = !0),
|
|
558
|
+
onInput: t[13] || (t[13] = (o) => X("phone")),
|
|
559
|
+
onClick: Y
|
|
560
560
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
561
|
-
|
|
561
|
+
E(p(Q), { class: "icon-locked" })
|
|
562
562
|
])) : V("", !0),
|
|
563
|
-
|
|
564
|
-
|
|
563
|
+
le("div", Nt, [
|
|
564
|
+
_.value ? (P(), $(p(be), {
|
|
565
565
|
key: 0,
|
|
566
566
|
color: "secondary",
|
|
567
567
|
onClick: We
|
|
568
568
|
}, {
|
|
569
|
-
default:
|
|
570
|
-
|
|
569
|
+
default: R(() => [
|
|
570
|
+
se(O(v("Сменить пароль")), 1)
|
|
571
571
|
]),
|
|
572
572
|
_: 1
|
|
573
573
|
})) : V("", !0),
|
|
574
|
-
|
|
575
|
-
disabled: !
|
|
574
|
+
E(p(be), {
|
|
575
|
+
disabled: !we.value,
|
|
576
576
|
onClick: Je
|
|
577
577
|
}, {
|
|
578
|
-
default:
|
|
579
|
-
|
|
578
|
+
default: R(() => [
|
|
579
|
+
se(O(v("Сохранить")), 1)
|
|
580
580
|
]),
|
|
581
581
|
_: 1
|
|
582
582
|
}, 8, ["disabled"])
|
|
583
583
|
])
|
|
584
584
|
]),
|
|
585
|
-
|
|
585
|
+
k.value ? (P(), $(Ee, {
|
|
586
586
|
key: 0,
|
|
587
587
|
to: "body"
|
|
588
588
|
}, [
|
|
589
|
-
|
|
590
|
-
|
|
589
|
+
k.value ? (P(), F("div", Ct, [
|
|
590
|
+
E(p(nt), {
|
|
591
591
|
"circle-mode": !0,
|
|
592
|
-
"model-value":
|
|
592
|
+
"model-value": l.imageContent,
|
|
593
593
|
onClose: _e,
|
|
594
|
-
onSave: t[14] || (t[14] = (
|
|
595
|
-
"onUpdate:modelValue": t[15] || (t[15] = (
|
|
594
|
+
onSave: t[14] || (t[14] = (o) => Re(o)),
|
|
595
|
+
"onUpdate:modelValue": t[15] || (t[15] = (o) => Oe(o))
|
|
596
596
|
}, null, 8, ["model-value"])
|
|
597
597
|
])) : V("", !0)
|
|
598
598
|
])) : V("", !0),
|
|
599
|
-
(P(), $(
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
default:
|
|
603
|
-
Qe(
|
|
599
|
+
(P(), $(Ee, { to: "#toast-root" }, [
|
|
600
|
+
le("div", kt, [
|
|
601
|
+
E(He, { name: "list" }, {
|
|
602
|
+
default: R(() => [
|
|
603
|
+
Qe(E(p(ot), {
|
|
604
604
|
class: "toast",
|
|
605
|
-
color:
|
|
606
|
-
text:
|
|
607
|
-
onClose: t[16] || (t[16] = (
|
|
605
|
+
color: j.value,
|
|
606
|
+
text: q.value,
|
|
607
|
+
onClose: t[16] || (t[16] = (o) => M.value = !1)
|
|
608
608
|
}, null, 8, ["color", "text"]), [
|
|
609
|
-
[et,
|
|
609
|
+
[et, M.value]
|
|
610
610
|
])
|
|
611
611
|
]),
|
|
612
612
|
_: 1
|
|
613
613
|
})
|
|
614
614
|
])
|
|
615
615
|
])),
|
|
616
|
-
|
|
616
|
+
E(p(De))
|
|
617
617
|
], 64));
|
|
618
618
|
}
|
|
619
|
-
}),
|
|
620
|
-
const a =
|
|
621
|
-
for (const [n, f] of
|
|
619
|
+
}), Ue = (r, i) => {
|
|
620
|
+
const a = r.__vccOpts || r;
|
|
621
|
+
for (const [n, f] of i)
|
|
622
622
|
a[n] = f;
|
|
623
623
|
return a;
|
|
624
|
-
}, It = /* @__PURE__ */
|
|
624
|
+
}, It = /* @__PURE__ */ Ue(Tt, [["__scopeId", "data-v-4e8a6f81"]]), Rt = /* @__PURE__ */ te({
|
|
625
625
|
__name: "index",
|
|
626
626
|
props: {
|
|
627
627
|
throttlerPrefix: {},
|
|
@@ -635,69 +635,69 @@ const ce = {
|
|
|
635
635
|
disableAddPhone: { type: Boolean }
|
|
636
636
|
},
|
|
637
637
|
emits: ["on-update-jwt", "update-tokens"],
|
|
638
|
-
setup(
|
|
639
|
-
const a =
|
|
640
|
-
n("email", { initialEmail:
|
|
641
|
-
}, v = (
|
|
642
|
-
n("phone", { initialPhone:
|
|
643
|
-
},
|
|
638
|
+
setup(r, { emit: i }) {
|
|
639
|
+
const a = i, { openDialog: n } = fe(), f = (m, g) => {
|
|
640
|
+
n("email", { initialEmail: m, mode: g });
|
|
641
|
+
}, v = (m, g) => {
|
|
642
|
+
n("phone", { initialPhone: m, mode: g });
|
|
643
|
+
}, x = () => {
|
|
644
644
|
n("password");
|
|
645
|
-
},
|
|
646
|
-
a("on-update-jwt",
|
|
645
|
+
}, c = (m, g, N) => {
|
|
646
|
+
a("on-update-jwt", m, g, N);
|
|
647
647
|
};
|
|
648
|
-
return (
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
"throttler-prefix":
|
|
652
|
-
provider:
|
|
653
|
-
"request-url":
|
|
654
|
-
language:
|
|
655
|
-
fields:
|
|
656
|
-
"access-token":
|
|
657
|
-
"refresh-token":
|
|
658
|
-
"aws-storage-url":
|
|
659
|
-
"disable-add-phone":
|
|
648
|
+
return (m, g) => (P(), F(Be, null, [
|
|
649
|
+
E(p(rt)),
|
|
650
|
+
E(It, {
|
|
651
|
+
"throttler-prefix": m.throttlerPrefix,
|
|
652
|
+
provider: m.provider,
|
|
653
|
+
"request-url": m.requestUrl,
|
|
654
|
+
language: m.language,
|
|
655
|
+
fields: m.fields,
|
|
656
|
+
"access-token": m.accessToken,
|
|
657
|
+
"refresh-token": m.refreshToken,
|
|
658
|
+
"aws-storage-url": m.awsStorageUrl,
|
|
659
|
+
"disable-add-phone": m.disableAddPhone,
|
|
660
660
|
onOpenEmailDialog: f,
|
|
661
661
|
onOpenPhoneDialog: v,
|
|
662
|
-
onOpenPasswordDialog:
|
|
663
|
-
onOnUpdateJwt:
|
|
662
|
+
onOpenPasswordDialog: x,
|
|
663
|
+
onOnUpdateJwt: c
|
|
664
664
|
}, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url", "disable-add-phone"]),
|
|
665
|
-
|
|
665
|
+
E(p(De))
|
|
666
666
|
], 64));
|
|
667
667
|
}
|
|
668
668
|
}), Bt = 10, Dt = 10, Ut = 15;
|
|
669
|
-
function
|
|
670
|
-
let n =
|
|
671
|
-
return a != null && a.startsWith("ru") && n.startsWith("8") ? n = `+7${n.slice(1)}` :
|
|
669
|
+
function Pe(r, i, a) {
|
|
670
|
+
let n = r.replace(/[^\d+]/g, "").replace(/(?!^)\+/g, "");
|
|
671
|
+
return a != null && a.startsWith("ru") && n.startsWith("8") ? n = `+7${n.slice(1)}` : i && n && !n.startsWith("+") && (n = `+${n}`), n;
|
|
672
672
|
}
|
|
673
|
-
function
|
|
674
|
-
return
|
|
673
|
+
function Ne(r) {
|
|
674
|
+
return r.startsWith("+") ? r.slice(1).replace(/\D/g, "") : r.replace(/\D/g, "");
|
|
675
675
|
}
|
|
676
|
-
function
|
|
677
|
-
if (!
|
|
676
|
+
function Ce(r, i = Bt, a = Ut) {
|
|
677
|
+
if (!r.startsWith("+"))
|
|
678
678
|
return !1;
|
|
679
|
-
const n =
|
|
680
|
-
return !(!/^\d+$/.test(n) || n.length <
|
|
679
|
+
const n = r.slice(1);
|
|
680
|
+
return !(!/^\d+$/.test(n) || n.length < i || n.length > a);
|
|
681
681
|
}
|
|
682
|
-
function
|
|
683
|
-
return !/^\+?\d*$/.test(
|
|
682
|
+
function ue(r) {
|
|
683
|
+
return !/^\+?\d*$/.test(r);
|
|
684
684
|
}
|
|
685
|
-
function Vt(
|
|
685
|
+
function Vt(r, i) {
|
|
686
686
|
let a = 0, n = !1;
|
|
687
|
-
return
|
|
687
|
+
return r.split("").filter((f, v) => f === "+" ? v !== 0 || n ? !1 : (n = !0, !0) : /\d/.test(f) ? (a++, a <= i) : !1).join("");
|
|
688
688
|
}
|
|
689
|
-
function
|
|
690
|
-
return
|
|
689
|
+
function ke(r) {
|
|
690
|
+
return r.startsWith("+") || /^\d/.test(r);
|
|
691
691
|
}
|
|
692
692
|
const At = /^[\w.%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i;
|
|
693
|
-
function
|
|
694
|
-
return At.test(
|
|
693
|
+
function Te(r) {
|
|
694
|
+
return At.test(r);
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
function Ft(
|
|
696
|
+
const Ve = /^[\d\s()+]+$/;
|
|
697
|
+
function Ft(r, i) {
|
|
698
698
|
var n, f;
|
|
699
|
-
const a =
|
|
700
|
-
return (n =
|
|
699
|
+
const a = r.trim();
|
|
700
|
+
return (n = i.phone) != null && n.enabled && Ve.test(a) && /\d/.test(a) && !a.includes("@") ? "phone" : (f = i.email) != null && f.enabled ? "email" : null;
|
|
701
701
|
}
|
|
702
702
|
const St = { class: "smart-input" }, xt = /* @__PURE__ */ te({
|
|
703
703
|
__name: "index",
|
|
@@ -712,32 +712,36 @@ const St = { class: "smart-input" }, xt = /* @__PURE__ */ te({
|
|
|
712
712
|
errorMessages: {}
|
|
713
713
|
},
|
|
714
714
|
emits: ["update:modelValue", "validity-change", "type-change"],
|
|
715
|
-
setup(
|
|
716
|
-
const a =
|
|
717
|
-
|
|
718
|
-
return
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
|
|
715
|
+
setup(r, { emit: i }) {
|
|
716
|
+
const a = r, n = i, f = I(() => a.locale ?? "ru"), v = (s) => me[f.value][s] || s;
|
|
717
|
+
function x(s) {
|
|
718
|
+
return /[a-zA-Z@._-]/.test(s);
|
|
719
|
+
}
|
|
720
|
+
const c = I(() => {
|
|
721
|
+
const s = b.value;
|
|
722
|
+
return s ? ke(s) ? "phone" : /[^\d+]/.test(s) ? "email" : null : null;
|
|
723
|
+
}), m = I(() => c.value), g = I(() => a.label ? v(a.label) : v("Email или телефон"));
|
|
724
|
+
function N(s, h) {
|
|
725
|
+
return h ? h in me[f.value] ? v(h) : h : v(s);
|
|
722
726
|
}
|
|
723
|
-
const
|
|
724
|
-
var
|
|
727
|
+
const u = I(() => {
|
|
728
|
+
var s, h, d, A, T, _, z, S, J, W, Y;
|
|
725
729
|
return {
|
|
726
|
-
mode: ((
|
|
730
|
+
mode: ((s = a.config) == null ? void 0 : s.mode) ?? "auto",
|
|
727
731
|
phone: {
|
|
728
|
-
enabled: ((
|
|
729
|
-
minDigits: ((
|
|
730
|
-
maxDigits: ((z = (
|
|
731
|
-
autoPlus: ((
|
|
732
|
+
enabled: ((d = (h = a.config) == null ? void 0 : h.phone) == null ? void 0 : d.enabled) ?? !0,
|
|
733
|
+
minDigits: ((T = (A = a.config) == null ? void 0 : A.phone) == null ? void 0 : T.minDigits) ?? 10,
|
|
734
|
+
maxDigits: ((z = (_ = a.config) == null ? void 0 : _.phone) == null ? void 0 : z.maxDigits) ?? 15,
|
|
735
|
+
autoPlus: ((J = (S = a.config) == null ? void 0 : S.phone) == null ? void 0 : J.autoPlus) ?? !0
|
|
732
736
|
},
|
|
733
737
|
email: {
|
|
734
738
|
enabled: ((Y = (W = a.config) == null ? void 0 : W.email) == null ? void 0 : Y.enabled) ?? !0
|
|
735
739
|
}
|
|
736
740
|
};
|
|
737
741
|
});
|
|
738
|
-
function
|
|
742
|
+
function y(s) {
|
|
739
743
|
if (a.errorMessages)
|
|
740
|
-
switch (
|
|
744
|
+
switch (s) {
|
|
741
745
|
case "Допустимы только цифры и знак + в начале":
|
|
742
746
|
return a.errorMessages.invalidPhoneChars;
|
|
743
747
|
case "Это не похоже на номер телефона":
|
|
@@ -746,128 +750,128 @@ const St = { class: "smart-input" }, xt = /* @__PURE__ */ te({
|
|
|
746
750
|
return a.errorMessages.invalidEmail;
|
|
747
751
|
}
|
|
748
752
|
}
|
|
749
|
-
const
|
|
750
|
-
|
|
751
|
-
|
|
753
|
+
const k = w(null), l = w(""), b = w(a.modelValue ?? ""), M = w(null), C = w(null), L = I(() => C.value ? N(
|
|
754
|
+
C.value,
|
|
755
|
+
y(C.value)
|
|
752
756
|
) : "");
|
|
753
|
-
|
|
754
|
-
|
|
757
|
+
Ie(() => a.modelValue, (s) => {
|
|
758
|
+
s !== void 0 && (b.value = s, l.value = s);
|
|
755
759
|
});
|
|
756
|
-
function
|
|
757
|
-
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
760
|
-
|
|
760
|
+
function j(s) {
|
|
761
|
+
C.value = null;
|
|
762
|
+
const d = s.target.value;
|
|
763
|
+
if (d.trim() === "") {
|
|
764
|
+
M.value = null, C.value = null, n("type-change", null), n("update:modelValue", ""), n("validity-change", !1);
|
|
761
765
|
return;
|
|
762
766
|
}
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
|
|
767
|
+
const A = u.value.mode === "auto" ? Ft(d, u.value) : u.value.mode;
|
|
768
|
+
if (M.value = A, n("type-change", A), ue(d) && ke(d) && !x(d)) {
|
|
769
|
+
b.value = d, n("update:modelValue", d), C.value = "Допустимы только цифры и знак + в начале", n("validity-change", !1);
|
|
766
770
|
return;
|
|
767
771
|
}
|
|
768
|
-
if (
|
|
769
|
-
const
|
|
770
|
-
|
|
772
|
+
if (A === "email") {
|
|
773
|
+
const T = Te(d);
|
|
774
|
+
b.value = d, l.value = d, n("update:modelValue", d), n("validity-change", T);
|
|
771
775
|
return;
|
|
772
776
|
}
|
|
773
|
-
if (
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
|
|
777
|
+
if (A === "phone") {
|
|
778
|
+
const T = Pe(
|
|
779
|
+
d,
|
|
780
|
+
u.value.phone.autoPlus,
|
|
777
781
|
a.locale
|
|
778
782
|
);
|
|
779
|
-
if (
|
|
780
|
-
const
|
|
781
|
-
|
|
783
|
+
if (Ne(T).length > u.value.phone.maxDigits) {
|
|
784
|
+
const S = Vt(d, u.value.phone.maxDigits);
|
|
785
|
+
b.value = S, n("update:modelValue", S), ne(S);
|
|
782
786
|
return;
|
|
783
787
|
}
|
|
784
|
-
if (
|
|
785
|
-
|
|
788
|
+
if (b.value = d, ue(d)) {
|
|
789
|
+
Ve.test(d) && (C.value = "Допустимы только цифры и знак + в начале", n("validity-change", !1));
|
|
786
790
|
return;
|
|
787
791
|
}
|
|
788
|
-
|
|
789
|
-
const z =
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
792
|
+
b.value = T, n("update:modelValue", T), l.value = T;
|
|
793
|
+
const z = Ce(
|
|
794
|
+
T,
|
|
795
|
+
u.value.phone.minDigits,
|
|
796
|
+
u.value.phone.maxDigits
|
|
793
797
|
);
|
|
794
798
|
n("validity-change", z);
|
|
795
799
|
}
|
|
796
800
|
}
|
|
797
801
|
function q() {
|
|
798
|
-
if (
|
|
799
|
-
if (
|
|
800
|
-
if (
|
|
801
|
-
|
|
802
|
+
if (c.value) {
|
|
803
|
+
if (c.value === "phone") {
|
|
804
|
+
if (ue(b.value)) {
|
|
805
|
+
C.value = "Допустимы только цифры и знак + в начале", n("validity-change", !1);
|
|
802
806
|
return;
|
|
803
807
|
}
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
|
|
808
|
+
const s = Pe(
|
|
809
|
+
b.value,
|
|
810
|
+
u.value.phone.autoPlus,
|
|
807
811
|
a.locale
|
|
808
812
|
);
|
|
809
|
-
if (
|
|
810
|
-
|
|
813
|
+
if (Ne(s).length < Dt) {
|
|
814
|
+
C.value = "Это не похоже на номер телефона", n("validity-change", !1);
|
|
811
815
|
return;
|
|
812
816
|
}
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
+
const d = Ce(
|
|
818
|
+
s,
|
|
819
|
+
u.value.phone.minDigits,
|
|
820
|
+
u.value.phone.maxDigits
|
|
817
821
|
);
|
|
818
|
-
|
|
822
|
+
C.value = d ? null : "Это не похоже на номер телефона", n("validity-change", d);
|
|
819
823
|
return;
|
|
820
824
|
}
|
|
821
|
-
if (
|
|
822
|
-
const
|
|
823
|
-
|
|
825
|
+
if (c.value === "email") {
|
|
826
|
+
const s = Te(b.value);
|
|
827
|
+
C.value = s ? null : "Это не похоже на email", n("validity-change", s);
|
|
824
828
|
}
|
|
825
829
|
}
|
|
826
830
|
}
|
|
827
|
-
function
|
|
828
|
-
var
|
|
829
|
-
const
|
|
830
|
-
return
|
|
831
|
+
function ae() {
|
|
832
|
+
var h;
|
|
833
|
+
const s = (h = k.value) == null ? void 0 : h.$el;
|
|
834
|
+
return s ? s.querySelector("input") : null;
|
|
831
835
|
}
|
|
832
|
-
function
|
|
833
|
-
const
|
|
834
|
-
if (!
|
|
835
|
-
const
|
|
836
|
-
|
|
837
|
-
|
|
836
|
+
function ne(s) {
|
|
837
|
+
const h = ae();
|
|
838
|
+
if (!h) return;
|
|
839
|
+
const d = h.selectionStart ?? s.length;
|
|
840
|
+
h.value = s, requestAnimationFrame(() => {
|
|
841
|
+
h.setSelectionRange(d, d);
|
|
838
842
|
});
|
|
839
843
|
}
|
|
840
|
-
return (
|
|
841
|
-
|
|
844
|
+
return (s, h) => (P(), F("div", St, [
|
|
845
|
+
E(p(G), {
|
|
842
846
|
ref_key: "inputRef",
|
|
843
|
-
ref:
|
|
844
|
-
"model-value":
|
|
845
|
-
readonly:
|
|
847
|
+
ref: k,
|
|
848
|
+
"model-value": b.value,
|
|
849
|
+
readonly: s.disabled,
|
|
846
850
|
error: L.value,
|
|
847
|
-
type:
|
|
848
|
-
size:
|
|
849
|
-
label:
|
|
850
|
-
onInput:
|
|
851
|
+
type: s.type ?? "text",
|
|
852
|
+
size: s.size ?? "large",
|
|
853
|
+
label: g.value,
|
|
854
|
+
onInput: j,
|
|
851
855
|
onBlur: q
|
|
852
856
|
}, null, 8, ["model-value", "readonly", "error", "type", "size", "label"]),
|
|
853
|
-
|
|
857
|
+
m.value === "phone" ? (P(), $(p(lt), {
|
|
854
858
|
key: 0,
|
|
855
859
|
class: "smart-input__icon"
|
|
856
860
|
})) : V("", !0),
|
|
857
|
-
|
|
861
|
+
m.value === "email" ? (P(), $(p(st), {
|
|
858
862
|
key: 1,
|
|
859
863
|
class: "smart-input__icon"
|
|
860
864
|
})) : V("", !0)
|
|
861
865
|
]));
|
|
862
866
|
}
|
|
863
|
-
}), Ot = /* @__PURE__ */
|
|
867
|
+
}), Ot = /* @__PURE__ */ Ue(xt, [["__scopeId", "data-v-2d1e7493"]]);
|
|
864
868
|
export {
|
|
865
869
|
_t as B,
|
|
866
870
|
Lt as C,
|
|
867
|
-
|
|
871
|
+
Ue as _,
|
|
868
872
|
Rt as a,
|
|
869
873
|
mt as g,
|
|
870
874
|
Ot as i,
|
|
871
|
-
|
|
872
|
-
|
|
875
|
+
ce as p,
|
|
876
|
+
me as t
|
|
873
877
|
};
|
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-4e8a6f81] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-4e8a6f81] .p-input-file:hover .overlay{visibility:visible}.smart-input[data-v-
|
|
2
|
-
import { a as o, i as r } from "./index-
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".avatar-input[data-v-4e8a6f81] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-4e8a6f81] .p-input-file:hover .overlay{visibility:visible}.smart-input[data-v-2d1e7493]{position:relative;width:100%}.smart-input__icon[data-v-2d1e7493]{position:absolute;top:16px;right:16px;pointer-events:none;opacity:.5}.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:100%;min-height:94px;background:#e4606026;border-radius:8px}.finalLimitText{text-align:center;max-width:100%;word-wrap:break-word;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, i as r } from "./index-FVumIZZb.js";
|
|
3
3
|
export {
|
|
4
4
|
o as PEditUserContact,
|
|
5
5
|
r as PEmailOrPhoneInput
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref as n, defineComponent as L, createElementBlock as p, openBlock as v, normalizeClass as c, createVNode as w, unref as _, computed as T, renderSlot as d, createCommentVNode as h, createElementVNode as i, toDisplayString as y, createTextVNode as f } from "vue";
|
|
2
2
|
import { PLoader as $ } from "@profeat/ui-kit";
|
|
3
|
-
import { _ as b, g as C, p as R } from "./index-
|
|
3
|
+
import { _ as b, g as C, p as R } from "./index-FVumIZZb.js";
|
|
4
4
|
function g(s) {
|
|
5
5
|
const e = Math.floor(s / 60), a = s % 60;
|
|
6
6
|
return `${String(e).padStart(2, "0")}:${String(a).padStart(2, "0")}`;
|