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