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