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