@yourgoods/ui-smart 0.53.13 → 0.53.15
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-BEm_1AG5.js → ProfileEmailDialog-DLudgSso.js} +2 -2
- package/dist/{ProfilePasswordDialog-Cv4U-OoG.js → ProfilePasswordDialog-CBk7eiWU.js} +1 -1
- package/dist/{ProfilePhoneDialog-o5U8NiE2.js → ProfilePhoneDialog-DliOsBke.js} +2 -2
- package/dist/components/PEmailOrPhoneInput/utils/phone.d.ts +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/{index-BAbLTZ1M.js → index-BqAKjNzC.js} +359 -367
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/{useRateLimitToast-C3NYj8B6.js → useRateLimitToast-DhiphkbR.js} +1 -1
- package/package.json +1 -1
- package/dist/types/vue-shims.d.ts +0 -5
- package/dist/vue-shims.d.ts +0 -5
|
@@ -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-DhiphkbR.js";
|
|
3
|
+
import { C as F, _ as He, B as qe, p as W, g as je } from "./index-BqAKjNzC.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-BqAKjNzC.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-DhiphkbR.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-BqAKjNzC.js";
|
|
5
5
|
const _e = {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: "12",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const MIN_VISIBLE_DIGITS =
|
|
1
|
+
export declare const MIN_VISIBLE_DIGITS = 10;
|
|
2
2
|
export declare function normalizePhoneInput(raw: string, autoPlus: boolean, locale?: string): string;
|
|
3
3
|
export declare function extractDigits(value: string): string;
|
|
4
4
|
export declare function limitPhoneLength(value: string, maxDigits: number): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as h, shallowRef as _e, defineComponent as q, defineAsyncComponent as Y, watch as pe, createBlock as x, createCommentVNode as T, unref as f, openBlock as w, resolveDynamicComponent as Oe, mergeProps as Re, computed as V, reactive as X, onMounted as Ge, createElementBlock as I, Fragment as ce, createVNode as y, createElementVNode as K, withCtx as $, toDisplayString as z, createTextVNode as Z, Teleport as de, Transition as je, withDirectives as Je, vShow as qe } from "vue";
|
|
2
2
|
import We from "axios";
|
|
3
|
-
import { PInputFileUploader as Ye, PInput as
|
|
4
|
-
function
|
|
3
|
+
import { PInputFileUploader as Ye, PInput as L, IconFilledEditMd as j, PButton as me, PImageCropper as Xe, PToast as Ke, PTeleportContainer as fe, PToastContainer as Ze, IconPhoneMd as He, IconMailMd as Qe } from "@profeat/ui-kit";
|
|
4
|
+
function ea(l, i = 2) {
|
|
5
5
|
if (l === 0)
|
|
6
6
|
return "0 B";
|
|
7
|
-
const
|
|
8
|
-
return `${Number.parseFloat((l /
|
|
7
|
+
const t = 1024, o = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], m = Math.floor(Math.log(l) / Math.log(t));
|
|
8
|
+
return `${Number.parseFloat((l / t ** m).toFixed(i))} ${o[m]}`;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
10
|
+
const aa = {
|
|
11
11
|
"image/jpeg": "JPEG",
|
|
12
12
|
"image/png": "PNG",
|
|
13
13
|
"application/pdf": "PDF",
|
|
@@ -15,67 +15,67 @@ const tt = {
|
|
|
15
15
|
"application/zip": "ZIP Archive"
|
|
16
16
|
// ...
|
|
17
17
|
};
|
|
18
|
-
function
|
|
19
|
-
return l.map((
|
|
20
|
-
var
|
|
21
|
-
return
|
|
18
|
+
function ta(l) {
|
|
19
|
+
return l.map((i) => {
|
|
20
|
+
var t;
|
|
21
|
+
return aa[i] || ((t = i.split("/")[1]) == null ? void 0 : t.toUpperCase());
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const Ma = {
|
|
25
25
|
OLD: "old",
|
|
26
26
|
NEW: "new",
|
|
27
27
|
COMPLETED: "completed"
|
|
28
|
-
},
|
|
28
|
+
}, $a = {
|
|
29
29
|
VERIFY_EMAIL: "verify-email"
|
|
30
30
|
};
|
|
31
|
-
let
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
baseURL:
|
|
31
|
+
let Q = null;
|
|
32
|
+
function oa(l, i, t) {
|
|
33
|
+
Q = We.create({
|
|
34
|
+
baseURL: i,
|
|
35
35
|
headers: {
|
|
36
36
|
Authorization: `Bearer ${l}`,
|
|
37
|
-
"x-throttler-prefix":
|
|
37
|
+
"x-throttler-prefix": t ?? "throttler_profile_edit"
|
|
38
38
|
// здесь можно словить баг, который может быть сложно отследить, если будет передаваться пустой прелфикс
|
|
39
39
|
// 'Content-Type': 'application/json',
|
|
40
40
|
},
|
|
41
|
-
validateStatus: (
|
|
41
|
+
validateStatus: (o) => o >= 200 && o < 300
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
if (!
|
|
44
|
+
function ae() {
|
|
45
|
+
if (!Q)
|
|
46
46
|
throw new Error("Axios instance not initialized. Call initAxios(token, baseUrl) first.");
|
|
47
|
-
return
|
|
47
|
+
return Q;
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
50
|
-
return
|
|
49
|
+
async function ee(l, i, t) {
|
|
50
|
+
return ae().post(l, i, t);
|
|
51
51
|
}
|
|
52
|
-
async function
|
|
53
|
-
return
|
|
52
|
+
async function na(l, i) {
|
|
53
|
+
return ae().get(l, i);
|
|
54
54
|
}
|
|
55
|
-
async function
|
|
56
|
-
return
|
|
55
|
+
async function ra(l, i) {
|
|
56
|
+
return ae().delete(l, i);
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
58
|
+
async function la(l) {
|
|
59
|
+
const i = await ee("/users/profile/me", l);
|
|
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
|
|
65
|
-
function
|
|
64
|
+
const J = h(null), H = _e(null);
|
|
65
|
+
function te() {
|
|
66
66
|
return {
|
|
67
|
-
currentDialog:
|
|
68
|
-
dialogPayload:
|
|
69
|
-
openDialog: (
|
|
70
|
-
|
|
67
|
+
currentDialog: J,
|
|
68
|
+
dialogPayload: H,
|
|
69
|
+
openDialog: (o, m) => {
|
|
70
|
+
J.value = o, H.value = m ?? null;
|
|
71
71
|
},
|
|
72
72
|
closeDialog: () => {
|
|
73
|
-
|
|
73
|
+
J.value = null, H.value = null;
|
|
74
74
|
},
|
|
75
|
-
isDialogOpen: (
|
|
75
|
+
isDialogOpen: (o) => J.value === o
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
const
|
|
78
|
+
const sa = {
|
|
79
79
|
ru: {
|
|
80
80
|
Имя: "Имя",
|
|
81
81
|
Фамилия: "Фамилия",
|
|
@@ -208,7 +208,7 @@ const st = {
|
|
|
208
208
|
"Введите новый номер телефона": "Enter a new phone number",
|
|
209
209
|
"Телефон успешно изменен": "Phone number successfully changed"
|
|
210
210
|
}
|
|
211
|
-
},
|
|
211
|
+
}, ia = /* @__PURE__ */ q({
|
|
212
212
|
__name: "DialogManager",
|
|
213
213
|
props: {
|
|
214
214
|
language: {},
|
|
@@ -216,54 +216,54 @@ const st = {
|
|
|
216
216
|
disableAddPhone: { type: Boolean }
|
|
217
217
|
},
|
|
218
218
|
emits: ["clean-input-errors", "on-update-jwt", "update-phone-field", "update-email-field", "on-password-error", "on-toast"],
|
|
219
|
-
setup(l, { emit:
|
|
220
|
-
const
|
|
221
|
-
email:
|
|
222
|
-
phone:
|
|
223
|
-
password:
|
|
224
|
-
}, d = ({ email:
|
|
225
|
-
|
|
226
|
-
},
|
|
227
|
-
|
|
219
|
+
setup(l, { emit: i }) {
|
|
220
|
+
const t = i, o = h(!0), { currentDialog: m, dialogPayload: v, closeDialog: U } = te(), u = {
|
|
221
|
+
email: Y(() => import("./ProfileEmailDialog-DLudgSso.js")),
|
|
222
|
+
phone: Y(() => import("./ProfilePhoneDialog-DliOsBke.js")),
|
|
223
|
+
password: Y(() => import("./ProfilePasswordDialog-CBk7eiWU.js"))
|
|
224
|
+
}, d = ({ email: b }) => {
|
|
225
|
+
t("update-email-field", b);
|
|
226
|
+
}, p = ({ phone: b }) => {
|
|
227
|
+
t("update-phone-field", b);
|
|
228
228
|
};
|
|
229
|
-
return
|
|
230
|
-
|
|
231
|
-
}), (
|
|
229
|
+
return pe(m, (b) => {
|
|
230
|
+
o.value = !!b;
|
|
231
|
+
}), (b, s) => f(m) ? (w(), x(Oe(u[f(m)]), Re({
|
|
232
232
|
key: 0,
|
|
233
|
-
modelValue:
|
|
234
|
-
"onUpdate:modelValue":
|
|
235
|
-
language:
|
|
236
|
-
provider:
|
|
237
|
-
"disable-add-phone":
|
|
238
|
-
},
|
|
239
|
-
onClose:
|
|
240
|
-
onCleanInputErrors:
|
|
241
|
-
onOnUpdateJwt:
|
|
233
|
+
modelValue: o.value,
|
|
234
|
+
"onUpdate:modelValue": s[0] || (s[0] = (g) => o.value = g),
|
|
235
|
+
language: b.language,
|
|
236
|
+
provider: b.provider,
|
|
237
|
+
"disable-add-phone": b.disableAddPhone
|
|
238
|
+
}, f(v), {
|
|
239
|
+
onClose: f(U),
|
|
240
|
+
onCleanInputErrors: s[1] || (s[1] = (g) => t("clean-input-errors")),
|
|
241
|
+
onOnUpdateJwt: s[2] || (s[2] = (g, c, r) => t("on-update-jwt", g, c, r)),
|
|
242
242
|
onSubmitEmail: d,
|
|
243
|
-
onSubmitPhone:
|
|
244
|
-
onOnPasswordError:
|
|
245
|
-
onOnToast:
|
|
246
|
-
}), null, 16, ["modelValue", "language", "provider", "disable-add-phone", "onClose"])) :
|
|
243
|
+
onSubmitPhone: p,
|
|
244
|
+
onOnPasswordError: s[3] || (s[3] = (g, c) => t("on-password-error", g, c)),
|
|
245
|
+
onOnToast: s[4] || (s[4] = (g) => t("on-toast", g))
|
|
246
|
+
}), null, 16, ["modelValue", "language", "provider", "disable-add-phone", "onClose"])) : T("", !0);
|
|
247
247
|
}
|
|
248
|
-
}),
|
|
248
|
+
}), ua = { class: "base-container" }, da = {
|
|
249
249
|
key: 0,
|
|
250
250
|
style: { color: "#E46060" }
|
|
251
|
-
},
|
|
251
|
+
}, ma = { key: 1 }, pa = {
|
|
252
252
|
key: 1,
|
|
253
253
|
class: "input-wrapper"
|
|
254
|
-
},
|
|
254
|
+
}, ca = {
|
|
255
255
|
key: 2,
|
|
256
256
|
class: "input-wrapper"
|
|
257
|
-
},
|
|
257
|
+
}, fa = {
|
|
258
258
|
key: 3,
|
|
259
259
|
class: "input-wrapper"
|
|
260
|
-
},
|
|
260
|
+
}, ga = {
|
|
261
261
|
key: 4,
|
|
262
262
|
class: "input-wrapper"
|
|
263
|
-
},
|
|
263
|
+
}, va = { class: "buttons-container" }, ha = {
|
|
264
264
|
key: 0,
|
|
265
265
|
class: "centered-overlay"
|
|
266
|
-
},
|
|
266
|
+
}, ya = { class: "toastWrapper" }, wa = /* @__PURE__ */ q({
|
|
267
267
|
__name: "PEditUserContact",
|
|
268
268
|
props: {
|
|
269
269
|
language: {},
|
|
@@ -277,8 +277,8 @@ const st = {
|
|
|
277
277
|
disableAddPhone: { type: Boolean }
|
|
278
278
|
},
|
|
279
279
|
emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
|
|
280
|
-
setup(l, { emit:
|
|
281
|
-
const
|
|
280
|
+
setup(l, { emit: i }) {
|
|
281
|
+
const t = l, o = i, m = V(() => t.language ?? "ru"), v = (e) => sa[m.value][e] || e, { openDialog: U } = te(), u = X({ firstName: "", lastName: "" }), d = h({ firstName: "", lastName: "" }), p = X({ firstName: !1, lastName: !1, email: !1, phone: !1 }), b = h(""), s = h(""), g = h(""), c = h(!1), r = X({
|
|
282
282
|
value: null,
|
|
283
283
|
loading: !1,
|
|
284
284
|
accept: ["image/png", "image/jpeg"],
|
|
@@ -286,334 +286,334 @@ const st = {
|
|
|
286
286
|
// 10 MB
|
|
287
287
|
imageBinary: null,
|
|
288
288
|
imageContent: ""
|
|
289
|
-
}),
|
|
289
|
+
}), C = h(""), D = h(!1), B = h(!0), E = h(!0), A = h(void 0), F = h(""), S = V(() => ne(u.firstName, p.firstName)), ve = V(() => ne(u.lastName, p.lastName)), he = V(() => p.email && !s.value.trim() ? "Введите e-mail" : ""), ye = V(() => p.phone && !g.value.trim() ? "Введите номер телефона" : ""), M = (e) => t.fields.some((a) => a.key === e), oe = (e) => e && e.trim() ? "edit" : "bind", W = () => setTimeout(() => {
|
|
290
290
|
var e;
|
|
291
291
|
return (e = document.activeElement) == null ? void 0 : e.blur();
|
|
292
|
-
}, 0), we = V(() => !!(
|
|
293
|
-
if (!
|
|
292
|
+
}, 0), we = V(() => !!(s.value && s.value.trim() !== "")), be = V(() => r.imageContent ? v("Загрузить другое фото") : v("Загрузить фото")), ne = (e, a) => {
|
|
293
|
+
if (!a) return "";
|
|
294
294
|
const n = e.trim();
|
|
295
295
|
return n ? n.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
|
|
296
|
-
}, Ee = (e) =>
|
|
297
|
-
|
|
296
|
+
}, Ee = (e) => U("email", { mode: e ? "edit" : "bind", initialEmail: e }), Pe = () => {
|
|
297
|
+
W(), p.email = !1, E.value = !1, o("open-email-dialog", s.value, oe(s.value)), Ee(s.value);
|
|
298
298
|
}, Ne = () => {
|
|
299
|
-
|
|
300
|
-
}, Ce = async (e,
|
|
301
|
-
e === "email" && n && (
|
|
299
|
+
W(), p.phone = !1, B.value = !1, o("open-phone-dialog", g.value, oe(g.value));
|
|
300
|
+
}, Ce = async (e, a, n) => {
|
|
301
|
+
e === "email" && n && (s.value = n), e === "phone" && n && (g.value = n), o("on-update-jwt");
|
|
302
302
|
}, ke = (e) => {
|
|
303
|
-
|
|
303
|
+
g.value = e;
|
|
304
304
|
}, Te = (e) => {
|
|
305
|
-
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
},
|
|
309
|
-
|
|
305
|
+
s.value = e;
|
|
306
|
+
}, Ue = (e, a) => {
|
|
307
|
+
D.value = !0, o("on-password-error", e, a);
|
|
308
|
+
}, De = () => {
|
|
309
|
+
B.value = !1, E.value = !1;
|
|
310
|
+
}, _ = (e) => {
|
|
311
|
+
D.value = !0, A.value = e.color ?? "", F.value = e.text ?? "";
|
|
310
312
|
}, O = (e) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const t = u[e];
|
|
315
|
-
t.length > 40 && (u[e] = t.slice(0, 40));
|
|
313
|
+
if (p[e] = !0, e === "firstName" || e === "lastName") {
|
|
314
|
+
const a = u[e];
|
|
315
|
+
a.length > 40 && (u[e] = a.slice(0, 40));
|
|
316
316
|
}
|
|
317
|
-
},
|
|
318
|
-
var
|
|
319
|
-
if (
|
|
320
|
-
|
|
317
|
+
}, Ie = (e) => {
|
|
318
|
+
var R, G;
|
|
319
|
+
if (C.value = "", !e) {
|
|
320
|
+
re();
|
|
321
321
|
return;
|
|
322
322
|
}
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
|
|
323
|
+
const a = ((R = e.fileBinary) == null ? void 0 : R.type) ?? "", n = ((G = e.fileBinary) == null ? void 0 : G.size) ?? 0, k = !["image/png", "image/jpeg"].includes(a), N = n > r.uploadLimit;
|
|
324
|
+
if (k || N) {
|
|
325
|
+
C.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", re();
|
|
326
326
|
return;
|
|
327
327
|
}
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
},
|
|
328
|
+
r.value = e, r.imageBinary = e.fileBinary ?? null, r.imageContent = e.fileContent ?? "", c.value = !0;
|
|
329
|
+
}, re = () => {
|
|
330
|
+
r.value = null, r.imageBinary = null, r.imageContent = "", c.value = !1;
|
|
331
|
+
}, Be = async () => {
|
|
332
332
|
try {
|
|
333
|
-
const
|
|
334
|
-
return (
|
|
333
|
+
const a = (await ra("/users/profile/delete/avatar")).data;
|
|
334
|
+
return (a == null ? void 0 : a.success) === !0;
|
|
335
335
|
} catch (e) {
|
|
336
336
|
return console.error("Ошибка при удалении аватара:", e), !1;
|
|
337
337
|
}
|
|
338
|
-
}, Ae = () => {
|
|
339
|
-
h.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", o.value = null, o.imageBinary = null, o.imageContent = "", i.value = !1;
|
|
340
|
-
}, ie = async (e, t, n = "image/png") => {
|
|
341
|
-
if (!e) return null;
|
|
342
|
-
const I = await (await fetch(e)).blob();
|
|
343
|
-
return new File([I], t, { type: n });
|
|
344
338
|
}, Ve = () => {
|
|
345
|
-
|
|
339
|
+
C.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", r.value = null, r.imageBinary = null, r.imageContent = "", c.value = !1;
|
|
340
|
+
}, le = async (e, a, n = "image/png") => {
|
|
341
|
+
if (!e) return null;
|
|
342
|
+
const k = await (await fetch(e)).blob();
|
|
343
|
+
return new File([k], a, { type: n });
|
|
344
|
+
}, Ae = () => {
|
|
345
|
+
r.value = null, r.imageBinary = null, r.imageContent = "", c.value = !1;
|
|
346
346
|
}, Fe = async (e) => {
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const n = await
|
|
347
|
+
c.value = !1;
|
|
348
|
+
const a = r.imageContent;
|
|
349
|
+
if (r.imageContent = e, !r.imageBinary) return;
|
|
350
|
+
const n = await le(
|
|
351
351
|
e,
|
|
352
|
-
|
|
353
|
-
|
|
352
|
+
r.imageBinary.name,
|
|
353
|
+
r.imageBinary.type || "image/png"
|
|
354
354
|
);
|
|
355
355
|
if (!n) {
|
|
356
|
-
|
|
356
|
+
r.imageContent = a;
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
359
|
try {
|
|
360
|
-
|
|
361
|
-
const
|
|
362
|
-
|
|
363
|
-
} catch (
|
|
364
|
-
console.error(
|
|
360
|
+
r.loading = !0;
|
|
361
|
+
const P = new FormData();
|
|
362
|
+
P.append("file", n), await ee(`/users/profile/avatar/${b.value}`, P, { headers: { "Content-Type": void 0 } });
|
|
363
|
+
} catch (P) {
|
|
364
|
+
console.error(P), _({
|
|
365
365
|
color: "error",
|
|
366
|
-
text:
|
|
367
|
-
}),
|
|
366
|
+
text: v("Не удалось сохранить изменения. Попробуйте позже")
|
|
367
|
+
}), r.imageContent = a;
|
|
368
368
|
} finally {
|
|
369
|
-
|
|
369
|
+
r.loading = !1;
|
|
370
370
|
}
|
|
371
371
|
}, Se = async (e) => {
|
|
372
|
-
|
|
372
|
+
r.imageContent = e ?? "", r.imageBinary && (r.imageBinary = await le(
|
|
373
373
|
e ?? "",
|
|
374
|
-
|
|
375
|
-
|
|
374
|
+
r.imageBinary.name,
|
|
375
|
+
r.imageBinary.type || "image/png"
|
|
376
376
|
));
|
|
377
|
-
},
|
|
378
|
-
var n,
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
377
|
+
}, se = h(!1), ie = async (e) => {
|
|
378
|
+
var n, P;
|
|
379
|
+
const a = (n = u[e]) == null ? void 0 : n.trim();
|
|
380
|
+
if (a)
|
|
381
381
|
try {
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
382
|
+
se.value = !0;
|
|
383
|
+
const N = (P = (await ee("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : P.data;
|
|
384
|
+
N != null && N.user && (u.firstName = N.user.firstName ?? u.firstName, u.lastName = N.user.lastName ?? u.lastName, d.value = {
|
|
385
385
|
firstName: u.firstName,
|
|
386
386
|
lastName: u.lastName
|
|
387
387
|
});
|
|
388
|
-
} catch (
|
|
389
|
-
throw
|
|
388
|
+
} catch (k) {
|
|
389
|
+
throw k;
|
|
390
390
|
} finally {
|
|
391
|
-
|
|
391
|
+
se.value = !1;
|
|
392
392
|
}
|
|
393
|
-
},
|
|
393
|
+
}, xe = async () => {
|
|
394
394
|
var e;
|
|
395
|
-
if (!
|
|
395
|
+
if (!t.accessToken)
|
|
396
396
|
throw console.error("Access token не передан в props"), new Error("Access token is required");
|
|
397
397
|
try {
|
|
398
|
-
const n = (e = (await
|
|
399
|
-
accessToken:
|
|
400
|
-
refreshToken:
|
|
398
|
+
const n = (e = (await la({
|
|
399
|
+
accessToken: t.accessToken,
|
|
400
|
+
refreshToken: t.refreshToken ?? "",
|
|
401
401
|
excludeFields: []
|
|
402
402
|
})).data) == null ? void 0 : e.user;
|
|
403
403
|
if (!n)
|
|
404
404
|
throw console.error("Данные пользователя отсутствуют в ответе сервера"), new Error("User data is missing from the response");
|
|
405
405
|
const {
|
|
406
|
-
userId:
|
|
407
|
-
privateFirstName:
|
|
408
|
-
privateLastName:
|
|
409
|
-
email:
|
|
410
|
-
phoneNumber:
|
|
406
|
+
userId: P,
|
|
407
|
+
privateFirstName: k,
|
|
408
|
+
privateLastName: N,
|
|
409
|
+
email: R,
|
|
410
|
+
phoneNumber: G
|
|
411
411
|
} = n;
|
|
412
|
-
|
|
413
|
-
firstName:
|
|
414
|
-
lastName:
|
|
412
|
+
b.value = P ?? "", u.firstName = k ?? "", u.lastName = N ?? "", s.value = R ?? "", g.value = G ?? "", r.imageContent = await Me(), d.value = {
|
|
413
|
+
firstName: k ?? "",
|
|
414
|
+
lastName: N ?? ""
|
|
415
415
|
};
|
|
416
|
-
} catch (
|
|
417
|
-
console.error("Критическая ошибка при загрузке профиля:",
|
|
416
|
+
} catch (a) {
|
|
417
|
+
console.error("Критическая ошибка при загрузке профиля:", a);
|
|
418
418
|
}
|
|
419
419
|
}, Me = async () => {
|
|
420
420
|
var e;
|
|
421
421
|
try {
|
|
422
|
-
const n = (e = (await
|
|
423
|
-
return n ?
|
|
424
|
-
} catch (
|
|
425
|
-
return console.error("Ошибка при загрузке метаданных аватара:",
|
|
422
|
+
const n = (e = (await na("/users/profile/avatar")).data) == null ? void 0 : e.data;
|
|
423
|
+
return n ? $e(n) : "";
|
|
424
|
+
} catch (a) {
|
|
425
|
+
return console.error("Ошибка при загрузке метаданных аватара:", a), "";
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
|
-
function
|
|
428
|
+
function $e(e) {
|
|
429
429
|
if (!e)
|
|
430
430
|
return "";
|
|
431
431
|
try {
|
|
432
|
-
return new URL(e.key,
|
|
433
|
-
} catch (
|
|
434
|
-
return console.error("Ошибка при составлении URL аватара:",
|
|
432
|
+
return new URL(e.key, t.awsStorageUrl).toString();
|
|
433
|
+
} catch (a) {
|
|
434
|
+
return console.error("Ошибка при составлении URL аватара:", a), "";
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const ue = V(() => {
|
|
438
438
|
if (!d.value.firstName && !d.value.lastName)
|
|
439
439
|
return !1;
|
|
440
|
-
const e = u.firstName.trim(),
|
|
441
|
-
return
|
|
440
|
+
const e = u.firstName.trim(), a = u.lastName.trim(), n = d.value.firstName.trim(), P = d.value.lastName.trim(), k = e !== n || a !== P, N = e.length >= 2 && a.length >= 2;
|
|
441
|
+
return k && N;
|
|
442
442
|
}), ze = async () => {
|
|
443
|
-
if (
|
|
443
|
+
if (ue.value)
|
|
444
444
|
try {
|
|
445
|
-
await Promise.all([
|
|
445
|
+
await Promise.all([ie("firstName"), ie("lastName")]), o("on-update-jwt"), _({ color: "success", text: "Изменения сохранены" });
|
|
446
446
|
} catch (e) {
|
|
447
|
-
console.error(e),
|
|
447
|
+
console.error(e), _({
|
|
448
448
|
color: "error",
|
|
449
|
-
text:
|
|
449
|
+
text: v("Не удалось сохранить изменения. Попробуйте позже")
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
452
|
}, Le = () => {
|
|
453
|
-
|
|
453
|
+
W(), o("open-password-dialog");
|
|
454
454
|
};
|
|
455
455
|
return Ge(async () => {
|
|
456
|
-
if (!
|
|
457
|
-
if (!
|
|
458
|
-
|
|
459
|
-
}), (e,
|
|
460
|
-
|
|
456
|
+
if (!t.accessToken) throw new Error("Access token не передан в props");
|
|
457
|
+
if (!t.requestUrl) throw new Error("auth-backend url не передан в props");
|
|
458
|
+
oa(t.accessToken, t.requestUrl, t.throttlerPrefix), await xe();
|
|
459
|
+
}), (e, a) => (w(), I(ce, null, [
|
|
460
|
+
y(ia, {
|
|
461
461
|
language: m.value,
|
|
462
462
|
provider: e.provider,
|
|
463
463
|
"disable-add-phone": e.disableAddPhone,
|
|
464
|
-
onCleanInputErrors:
|
|
464
|
+
onCleanInputErrors: De,
|
|
465
465
|
onOnUpdateJwt: Ce,
|
|
466
466
|
onUpdatePhoneField: ke,
|
|
467
467
|
onUpdateEmailField: Te,
|
|
468
|
-
onOnPasswordError:
|
|
469
|
-
onOnToast:
|
|
468
|
+
onOnPasswordError: Ue,
|
|
469
|
+
onOnToast: _
|
|
470
470
|
}, null, 8, ["language", "provider", "disable-add-phone"]),
|
|
471
|
-
|
|
472
|
-
|
|
471
|
+
K("div", ua, [
|
|
472
|
+
M("avatar") ? (w(), x(f(Ye), {
|
|
473
473
|
key: 0,
|
|
474
|
-
modelValue:
|
|
474
|
+
modelValue: r.value,
|
|
475
475
|
"onUpdate:modelValue": [
|
|
476
|
-
|
|
477
|
-
|
|
476
|
+
a[0] || (a[0] = (n) => r.value = n),
|
|
477
|
+
a[1] || (a[1] = (n) => Ie(n))
|
|
478
478
|
],
|
|
479
479
|
type: "img",
|
|
480
480
|
class: "avatar-input",
|
|
481
|
-
src:
|
|
482
|
-
loading:
|
|
483
|
-
label:
|
|
484
|
-
"upload-limit":
|
|
481
|
+
src: r.imageContent,
|
|
482
|
+
loading: r.loading,
|
|
483
|
+
label: v("Загрузить фото"),
|
|
484
|
+
"upload-limit": r.uploadLimit,
|
|
485
485
|
accept: "image/jpeg, image/png",
|
|
486
|
-
onDelete:
|
|
487
|
-
"onChange:error":
|
|
486
|
+
onDelete: Be,
|
|
487
|
+
"onChange:error": Ve
|
|
488
488
|
}, {
|
|
489
|
-
afterLoadLabel:
|
|
490
|
-
|
|
489
|
+
afterLoadLabel: $(() => [
|
|
490
|
+
Z(z(be.value), 1)
|
|
491
491
|
]),
|
|
492
|
-
subtext:
|
|
493
|
-
|
|
492
|
+
subtext: $(() => [
|
|
493
|
+
C.value ? (w(), I("span", da, z(C.value), 1)) : (w(), I("span", ma, z(`${v("Формат")} ${f(ta)(r.accept).join(", ")} ${v("до")} ${f(ea)(r.uploadLimit)}`), 1))
|
|
494
494
|
]),
|
|
495
495
|
_: 1
|
|
496
|
-
}, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) :
|
|
497
|
-
|
|
498
|
-
|
|
496
|
+
}, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) : T("", !0),
|
|
497
|
+
M("firstName") ? (w(), I("div", pa, [
|
|
498
|
+
y(f(L), {
|
|
499
499
|
modelValue: u.firstName,
|
|
500
|
-
"onUpdate:modelValue":
|
|
500
|
+
"onUpdate:modelValue": a[2] || (a[2] = (n) => u.firstName = n),
|
|
501
501
|
size: "large",
|
|
502
|
-
label:
|
|
502
|
+
label: v("Имя"),
|
|
503
503
|
error: S.value,
|
|
504
|
-
onBlur:
|
|
505
|
-
onInput:
|
|
504
|
+
onBlur: a[3] || (a[3] = (n) => p.firstName = !0),
|
|
505
|
+
onInput: a[4] || (a[4] = (n) => O("firstName"))
|
|
506
506
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
507
|
-
|
|
508
|
-
])) :
|
|
509
|
-
|
|
510
|
-
|
|
507
|
+
y(f(j), { class: "icon-locked" })
|
|
508
|
+
])) : T("", !0),
|
|
509
|
+
M("lastName") ? (w(), I("div", ca, [
|
|
510
|
+
y(f(L), {
|
|
511
511
|
modelValue: u.lastName,
|
|
512
|
-
"onUpdate:modelValue":
|
|
512
|
+
"onUpdate:modelValue": a[5] || (a[5] = (n) => u.lastName = n),
|
|
513
513
|
size: "large",
|
|
514
|
-
label:
|
|
515
|
-
error:
|
|
516
|
-
onBlur:
|
|
517
|
-
onInput:
|
|
514
|
+
label: v("Фамилия"),
|
|
515
|
+
error: ve.value,
|
|
516
|
+
onBlur: a[6] || (a[6] = (n) => p.lastName = !0),
|
|
517
|
+
onInput: a[7] || (a[7] = (n) => O("lastName"))
|
|
518
518
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
519
|
-
|
|
520
|
-
])) :
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
modelValue:
|
|
524
|
-
"onUpdate:modelValue":
|
|
519
|
+
y(f(j), { class: "icon-locked" })
|
|
520
|
+
])) : T("", !0),
|
|
521
|
+
M("email") ? (w(), I("div", fa, [
|
|
522
|
+
y(f(L), {
|
|
523
|
+
modelValue: s.value,
|
|
524
|
+
"onUpdate:modelValue": a[8] || (a[8] = (n) => s.value = n),
|
|
525
525
|
size: "large",
|
|
526
526
|
"text-size": "medium",
|
|
527
527
|
label: "E-mail",
|
|
528
528
|
type: "email",
|
|
529
529
|
readonly: "",
|
|
530
530
|
style: { cursor: "pointer" },
|
|
531
|
-
error:
|
|
532
|
-
onBlur:
|
|
533
|
-
onInput:
|
|
531
|
+
error: he.value && E.value,
|
|
532
|
+
onBlur: a[9] || (a[9] = (n) => p.email = !0),
|
|
533
|
+
onInput: a[10] || (a[10] = (n) => O("email")),
|
|
534
534
|
onClick: Pe
|
|
535
535
|
}, null, 8, ["modelValue", "error"]),
|
|
536
|
-
|
|
537
|
-
])) :
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
modelValue:
|
|
541
|
-
"onUpdate:modelValue":
|
|
536
|
+
y(f(j), { class: "icon-locked" })
|
|
537
|
+
])) : T("", !0),
|
|
538
|
+
M("phone") ? (w(), I("div", ga, [
|
|
539
|
+
y(f(L), {
|
|
540
|
+
modelValue: g.value,
|
|
541
|
+
"onUpdate:modelValue": a[11] || (a[11] = (n) => g.value = n),
|
|
542
542
|
size: "large",
|
|
543
543
|
"text-size": "medium",
|
|
544
|
-
label:
|
|
544
|
+
label: v("Номер телефона"),
|
|
545
545
|
type: "tel",
|
|
546
546
|
readonly: "",
|
|
547
547
|
style: { cursor: "pointer" },
|
|
548
|
-
error: ye.value &&
|
|
549
|
-
onBlur:
|
|
550
|
-
onInput:
|
|
548
|
+
error: ye.value && B.value,
|
|
549
|
+
onBlur: a[12] || (a[12] = (n) => p.phone = !0),
|
|
550
|
+
onInput: a[13] || (a[13] = (n) => O("phone")),
|
|
551
551
|
onClick: Ne
|
|
552
552
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
553
|
-
|
|
554
|
-
])) :
|
|
555
|
-
|
|
556
|
-
we.value ? (
|
|
553
|
+
y(f(j), { class: "icon-locked" })
|
|
554
|
+
])) : T("", !0),
|
|
555
|
+
K("div", va, [
|
|
556
|
+
we.value ? (w(), x(f(me), {
|
|
557
557
|
key: 0,
|
|
558
558
|
color: "secondary",
|
|
559
559
|
onClick: Le
|
|
560
560
|
}, {
|
|
561
|
-
default:
|
|
562
|
-
|
|
561
|
+
default: $(() => [
|
|
562
|
+
Z(z(v("Сменить пароль")), 1)
|
|
563
563
|
]),
|
|
564
564
|
_: 1
|
|
565
|
-
})) :
|
|
566
|
-
|
|
567
|
-
disabled: !
|
|
565
|
+
})) : T("", !0),
|
|
566
|
+
y(f(me), {
|
|
567
|
+
disabled: !ue.value,
|
|
568
568
|
onClick: ze
|
|
569
569
|
}, {
|
|
570
|
-
default:
|
|
571
|
-
|
|
570
|
+
default: $(() => [
|
|
571
|
+
Z(z(v("Сохранить")), 1)
|
|
572
572
|
]),
|
|
573
573
|
_: 1
|
|
574
574
|
}, 8, ["disabled"])
|
|
575
575
|
])
|
|
576
576
|
]),
|
|
577
|
-
|
|
577
|
+
c.value ? (w(), x(de, {
|
|
578
578
|
key: 0,
|
|
579
579
|
to: "body"
|
|
580
580
|
}, [
|
|
581
|
-
|
|
582
|
-
|
|
581
|
+
c.value ? (w(), I("div", ha, [
|
|
582
|
+
y(f(Xe), {
|
|
583
583
|
"circle-mode": !0,
|
|
584
|
-
"model-value":
|
|
585
|
-
onClose:
|
|
586
|
-
onSave:
|
|
587
|
-
"onUpdate:modelValue":
|
|
584
|
+
"model-value": r.imageContent,
|
|
585
|
+
onClose: Ae,
|
|
586
|
+
onSave: a[14] || (a[14] = (n) => Fe(n)),
|
|
587
|
+
"onUpdate:modelValue": a[15] || (a[15] = (n) => Se(n))
|
|
588
588
|
}, null, 8, ["model-value"])
|
|
589
|
-
])) :
|
|
590
|
-
])) :
|
|
591
|
-
(
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
default:
|
|
595
|
-
|
|
589
|
+
])) : T("", !0)
|
|
590
|
+
])) : T("", !0),
|
|
591
|
+
(w(), x(de, { to: "#toast-root" }, [
|
|
592
|
+
K("div", ya, [
|
|
593
|
+
y(je, { name: "list" }, {
|
|
594
|
+
default: $(() => [
|
|
595
|
+
Je(y(f(Ke), {
|
|
596
596
|
class: "toast",
|
|
597
|
-
color:
|
|
598
|
-
text:
|
|
599
|
-
onClose:
|
|
597
|
+
color: A.value,
|
|
598
|
+
text: F.value,
|
|
599
|
+
onClose: a[16] || (a[16] = (n) => D.value = !1)
|
|
600
600
|
}, null, 8, ["color", "text"]), [
|
|
601
|
-
[
|
|
601
|
+
[qe, D.value]
|
|
602
602
|
])
|
|
603
603
|
]),
|
|
604
604
|
_: 1
|
|
605
605
|
})
|
|
606
606
|
])
|
|
607
607
|
])),
|
|
608
|
-
|
|
608
|
+
y(f(fe))
|
|
609
609
|
], 64));
|
|
610
610
|
}
|
|
611
|
-
}),
|
|
612
|
-
const
|
|
613
|
-
for (const [
|
|
614
|
-
|
|
615
|
-
return
|
|
616
|
-
},
|
|
611
|
+
}), ge = (l, i) => {
|
|
612
|
+
const t = l.__vccOpts || l;
|
|
613
|
+
for (const [o, m] of i)
|
|
614
|
+
t[o] = m;
|
|
615
|
+
return t;
|
|
616
|
+
}, ba = /* @__PURE__ */ ge(wa, [["__scopeId", "data-v-a56fcdbb"]]), za = /* @__PURE__ */ q({
|
|
617
617
|
__name: "index",
|
|
618
618
|
props: {
|
|
619
619
|
throttlerPrefix: {},
|
|
@@ -627,19 +627,19 @@ const st = {
|
|
|
627
627
|
disableAddPhone: { type: Boolean }
|
|
628
628
|
},
|
|
629
629
|
emits: ["on-update-jwt", "update-tokens"],
|
|
630
|
-
setup(l, { emit:
|
|
631
|
-
const
|
|
632
|
-
|
|
633
|
-
},
|
|
634
|
-
|
|
635
|
-
},
|
|
636
|
-
|
|
637
|
-
}, u = (d,
|
|
638
|
-
|
|
630
|
+
setup(l, { emit: i }) {
|
|
631
|
+
const t = i, { openDialog: o } = te(), m = (d, p) => {
|
|
632
|
+
o("email", { initialEmail: d, mode: p });
|
|
633
|
+
}, v = (d, p) => {
|
|
634
|
+
o("phone", { initialPhone: d, mode: p });
|
|
635
|
+
}, U = () => {
|
|
636
|
+
o("password");
|
|
637
|
+
}, u = (d, p, b) => {
|
|
638
|
+
t("on-update-jwt", d, p, b);
|
|
639
639
|
};
|
|
640
|
-
return (d,
|
|
641
|
-
|
|
642
|
-
|
|
640
|
+
return (d, p) => (w(), I(ce, null, [
|
|
641
|
+
y(f(Ze)),
|
|
642
|
+
y(ba, {
|
|
643
643
|
"throttler-prefix": d.throttlerPrefix,
|
|
644
644
|
provider: d.provider,
|
|
645
645
|
"request-url": d.requestUrl,
|
|
@@ -650,40 +650,40 @@ const st = {
|
|
|
650
650
|
"aws-storage-url": d.awsStorageUrl,
|
|
651
651
|
"disable-add-phone": d.disableAddPhone,
|
|
652
652
|
onOpenEmailDialog: m,
|
|
653
|
-
onOpenPhoneDialog:
|
|
654
|
-
onOpenPasswordDialog:
|
|
653
|
+
onOpenPhoneDialog: v,
|
|
654
|
+
onOpenPasswordDialog: U,
|
|
655
655
|
onOnUpdateJwt: u
|
|
656
656
|
}, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url", "disable-add-phone"]),
|
|
657
|
-
|
|
657
|
+
y(f(fe))
|
|
658
658
|
], 64));
|
|
659
659
|
}
|
|
660
|
-
}),
|
|
661
|
-
function
|
|
662
|
-
let
|
|
663
|
-
return
|
|
660
|
+
}), Ea = 10, Pa = 10, Na = 15;
|
|
661
|
+
function Ca(l, i, t) {
|
|
662
|
+
let o = l.replace(/[^\d+]/g, "");
|
|
663
|
+
return t != null && t.startsWith("ru") && o.startsWith("8") ? o = `+7${o.slice(1)}` : i && o && !o.startsWith("+") && (o = `+${o}`), o;
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function ka(l) {
|
|
666
666
|
return l.startsWith("+") ? l.slice(1).replace(/\D/g, "") : l.replace(/\D/g, "");
|
|
667
667
|
}
|
|
668
|
-
function
|
|
668
|
+
function Ta(l, i = Ea, t = Na) {
|
|
669
669
|
if (!l.startsWith("+"))
|
|
670
670
|
return !1;
|
|
671
|
-
const
|
|
672
|
-
return !(!/^\d+$/.test(
|
|
671
|
+
const o = l.slice(1);
|
|
672
|
+
return !(!/^\d+$/.test(o) || o.length < i || o.length > t);
|
|
673
673
|
}
|
|
674
|
-
function
|
|
674
|
+
function Ua(l) {
|
|
675
675
|
return /[^\d+]/.test(l);
|
|
676
676
|
}
|
|
677
|
-
const
|
|
678
|
-
function
|
|
679
|
-
return
|
|
677
|
+
const Da = /^[\w.%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/i;
|
|
678
|
+
function Ia(l) {
|
|
679
|
+
return Da.test(l);
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
var
|
|
683
|
-
const
|
|
684
|
-
return (
|
|
681
|
+
function Ba(l, i) {
|
|
682
|
+
var o, m;
|
|
683
|
+
const t = l.trim();
|
|
684
|
+
return (o = i.phone) != null && o.enabled && (t.startsWith("+") || /^\d+$/.test(t)) ? "phone" : (m = i.email) != null && m.enabled ? "email" : null;
|
|
685
685
|
}
|
|
686
|
-
const
|
|
686
|
+
const Va = { class: "smart-input" }, Aa = /* @__PURE__ */ q({
|
|
687
687
|
__name: "index",
|
|
688
688
|
props: {
|
|
689
689
|
modelValue: {},
|
|
@@ -696,102 +696,94 @@ const At = { class: "smart-input" }, Vt = /* @__PURE__ */ Y({
|
|
|
696
696
|
errorMessages: {}
|
|
697
697
|
},
|
|
698
698
|
emits: ["update:modelValue", "validity-change", "type-change"],
|
|
699
|
-
setup(l, { emit:
|
|
700
|
-
const
|
|
701
|
-
var
|
|
699
|
+
setup(l, { emit: i }) {
|
|
700
|
+
const t = l, o = i, m = V(() => {
|
|
701
|
+
var s, g, c, r, C, D, B, E, A, F, S;
|
|
702
702
|
return {
|
|
703
|
-
mode: ((
|
|
703
|
+
mode: ((s = t.config) == null ? void 0 : s.mode) ?? "auto",
|
|
704
704
|
phone: {
|
|
705
|
-
enabled: ((
|
|
706
|
-
minDigits: ((
|
|
707
|
-
maxDigits: ((
|
|
708
|
-
autoPlus: ((
|
|
705
|
+
enabled: ((c = (g = t.config) == null ? void 0 : g.phone) == null ? void 0 : c.enabled) ?? !0,
|
|
706
|
+
minDigits: ((C = (r = t.config) == null ? void 0 : r.phone) == null ? void 0 : C.minDigits) ?? 10,
|
|
707
|
+
maxDigits: ((B = (D = t.config) == null ? void 0 : D.phone) == null ? void 0 : B.maxDigits) ?? 15,
|
|
708
|
+
autoPlus: ((A = (E = t.config) == null ? void 0 : E.phone) == null ? void 0 : A.autoPlus) ?? !0
|
|
709
709
|
},
|
|
710
710
|
email: {
|
|
711
|
-
enabled: ((
|
|
711
|
+
enabled: ((S = (F = t.config) == null ? void 0 : F.email) == null ? void 0 : S.enabled) ?? !0
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
|
-
}),
|
|
715
|
-
|
|
716
|
-
|
|
714
|
+
}), v = h(null), U = h(""), u = h(t.modelValue ?? ""), d = h(null), p = h("");
|
|
715
|
+
pe(() => t.modelValue, (s) => {
|
|
716
|
+
s !== void 0 && (u.value = s, U.value = s);
|
|
717
717
|
});
|
|
718
|
-
function
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
718
|
+
function b(s) {
|
|
719
|
+
var C, D, B;
|
|
720
|
+
u.value.trim() === "" && (d.value = null, o("type-change", null));
|
|
721
|
+
const c = s.target.value, r = m.value.mode === "auto" ? Ba(c, m.value) : m.value.mode;
|
|
722
|
+
if (d.value = r, o("type-change", r), r === "email") {
|
|
723
|
+
const E = Ia(c);
|
|
724
|
+
p.value = c.length === 0 || E ? "" : ((C = t.errorMessages) == null ? void 0 : C.invalidEmail) ?? "Это не похоже на email", u.value = c, U.value = c, o("update:modelValue", c), o("validity-change", E);
|
|
724
725
|
return;
|
|
725
726
|
}
|
|
726
|
-
if (
|
|
727
|
-
|
|
728
|
-
c
|
|
727
|
+
if (r === "phone") {
|
|
728
|
+
const E = Ca(
|
|
729
|
+
c,
|
|
730
|
+
m.value.phone.autoPlus,
|
|
731
|
+
t.locale
|
|
732
|
+
), A = ka(E);
|
|
733
|
+
if (u.value = c, o("update:modelValue", c), Ua(c)) {
|
|
734
|
+
p.value = ((D = t.errorMessages) == null ? void 0 : D.invalidPhoneChars) ?? "Допустимы только цифры и знак +", o("validity-change", !1);
|
|
729
735
|
return;
|
|
730
736
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
v(T.value);
|
|
737
|
+
if (A.length > m.value.phone.maxDigits) {
|
|
738
|
+
const S = E.slice(
|
|
739
|
+
0,
|
|
740
|
+
E.indexOf("+") === 0 ? m.value.phone.maxDigits + 1 : m.value.phone.maxDigits
|
|
741
|
+
);
|
|
742
|
+
u.value = S, U.value = S, o("update:modelValue", S);
|
|
738
743
|
return;
|
|
739
744
|
}
|
|
740
|
-
if (
|
|
741
|
-
|
|
745
|
+
if (U.value = E, A.length < Pa) {
|
|
746
|
+
p.value = "", o("validity-change", !1);
|
|
742
747
|
return;
|
|
743
748
|
}
|
|
744
|
-
const
|
|
745
|
-
|
|
749
|
+
const F = Ta(
|
|
750
|
+
E,
|
|
746
751
|
m.value.phone.minDigits,
|
|
747
752
|
m.value.phone.maxDigits
|
|
748
753
|
);
|
|
749
|
-
|
|
754
|
+
p.value = F ? "" : ((B = t.errorMessages) == null ? void 0 : B.invalidPhoneLength) ?? "Это не похоже на номер телефона", o("validity-change", F);
|
|
750
755
|
}
|
|
751
756
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
const i = (o = g.value) == null ? void 0 : o.$el;
|
|
755
|
-
return i ? i.querySelector("input") : null;
|
|
756
|
-
}
|
|
757
|
-
function v(i) {
|
|
758
|
-
const o = f();
|
|
759
|
-
if (!o) return;
|
|
760
|
-
const h = o.selectionStart ?? i.length;
|
|
761
|
-
o.value = i, requestAnimationFrame(() => {
|
|
762
|
-
o.setSelectionRange(h, h);
|
|
763
|
-
});
|
|
764
|
-
}
|
|
765
|
-
return (i, o) => (b(), B("div", At, [
|
|
766
|
-
w(p(_), {
|
|
757
|
+
return (s, g) => (w(), I("div", Va, [
|
|
758
|
+
y(f(L), {
|
|
767
759
|
ref_key: "inputRef",
|
|
768
|
-
ref:
|
|
760
|
+
ref: v,
|
|
769
761
|
"model-value": u.value,
|
|
770
|
-
readonly:
|
|
771
|
-
error:
|
|
772
|
-
type:
|
|
773
|
-
size:
|
|
774
|
-
label:
|
|
775
|
-
onInput:
|
|
762
|
+
readonly: s.disabled,
|
|
763
|
+
error: p.value,
|
|
764
|
+
type: s.type ?? "text",
|
|
765
|
+
size: s.size ?? "large",
|
|
766
|
+
label: s.label ?? "Email или телефон",
|
|
767
|
+
onInput: b
|
|
776
768
|
}, null, 8, ["model-value", "readonly", "error", "type", "size", "label"]),
|
|
777
|
-
d.value === "phone" ? (
|
|
769
|
+
d.value === "phone" ? (w(), x(f(He), {
|
|
778
770
|
key: 0,
|
|
779
771
|
class: "smart-input__icon"
|
|
780
|
-
})) :
|
|
781
|
-
d.value === "email" ? (
|
|
772
|
+
})) : T("", !0),
|
|
773
|
+
d.value === "email" ? (w(), x(f(Qe), {
|
|
782
774
|
key: 1,
|
|
783
775
|
class: "smart-input__icon"
|
|
784
|
-
})) :
|
|
776
|
+
})) : T("", !0)
|
|
785
777
|
]));
|
|
786
778
|
}
|
|
787
|
-
}),
|
|
779
|
+
}), La = /* @__PURE__ */ ge(Aa, [["__scopeId", "data-v-0f49a2a4"]]);
|
|
788
780
|
export {
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
781
|
+
$a as B,
|
|
782
|
+
Ma as C,
|
|
783
|
+
ge as _,
|
|
784
|
+
za as a,
|
|
785
|
+
na as g,
|
|
786
|
+
La as i,
|
|
787
|
+
ee as p,
|
|
788
|
+
sa as t
|
|
797
789
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as PEditUserContact } from './components/PEditUserContact/index.vue';
|
|
2
|
+
export { default as PEmailOrPhoneInput } from './components/PEmailOrPhoneInput/index.vue';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode(".avatar-input[data-v-a56fcdbb] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-a56fcdbb] .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 t=document.createElement("style");t.appendChild(document.createTextNode(".avatar-input[data-v-a56fcdbb] .p-input-file .overlay{visibility:hidden}.avatar-input[data-v-a56fcdbb] .p-input-file:hover .overlay{visibility:visible}.smart-input[data-v-0f49a2a4]{position:relative;width:100%}.smart-input__icon[data-v-0f49a2a4]{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(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { a as o, i as r } from "./index-BqAKjNzC.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-BqAKjNzC.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")}`;
|
package/package.json
CHANGED