@yourgoods/ui-smart 0.50.0 → 0.51.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-rzPRsM0B.js → ProfileEmailDialog-CLM-pIRG.js} +325 -325
- package/dist/{ProfilePasswordDialog-FRHBCNZO.js → ProfilePasswordDialog-BY5VAdH3.js} +1 -1
- package/dist/{ProfilePhoneDialog-DyDCK0A6.js → ProfilePhoneDialog-BdAKmUji.js} +324 -317
- package/dist/components/PEditUserContact/PEditUserContact.vue.d.ts +2 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogManager.vue.d.ts +2 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/AddNewEmailContent.vue.d.ts +3 -1
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/AddNewPhoneContent.vue.d.ts +4 -1
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/NewEmailContent.vue.d.ts +4 -2
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/NewPhoneContent.vue.d.ts +3 -1
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/OldEmailContent.vue.d.ts +3 -1
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/OldPhoneContent.vue.d.ts +3 -1
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/ThrottlerTimer.vue.d.ts +31 -43
- package/dist/components/PEditUserContact/ProfileDialogs/ProfilePhoneDialog.vue.d.ts +1 -0
- package/dist/components/PEditUserContact/index.vue.d.ts +2 -0
- package/dist/{index-B03tgxbV.js → index-5nM1qYsp.js} +213 -207
- package/dist/index.js +2 -2
- package/dist/types.d.ts +10 -0
- package/dist/useRateLimitToast-BS-y9G79.js +151 -0
- package/dist/utils/url.d.ts +2 -0
- package/package.json +1 -1
- package/dist/useRateLimitToast-BDwiUmEF.js +0 -135
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import
|
|
3
|
-
import { PInputFileUploader as
|
|
4
|
-
function He(
|
|
5
|
-
if (
|
|
1
|
+
import { ref as w, shallowRef as Le, defineComponent as H, defineAsyncComponent as J, watch as ze, createBlock as I, createCommentVNode as C, unref as m, openBlock as y, resolveDynamicComponent as Me, mergeProps as Re, computed as T, reactive as q, onMounted as Ge, createElementBlock as k, Fragment as me, createVNode as g, createElementVNode as Y, withCtx as A, toDisplayString as F, createTextVNode as _, Teleport as ue, Transition as je, withDirectives as Je, vShow as qe } from "vue";
|
|
2
|
+
import Ye from "axios";
|
|
3
|
+
import { PInputFileUploader as _e, PInput as L, IconFilledEditMd as z, PButton as de, PImageCropper as We, PToast as Ke, PTeleportContainer as pe, PToastContainer as Ze } from "@profeat/ui-kit";
|
|
4
|
+
function He(l, r = 2) {
|
|
5
|
+
if (l === 0)
|
|
6
6
|
return "0 B";
|
|
7
|
-
const
|
|
8
|
-
return `${Number.parseFloat((
|
|
7
|
+
const n = 1024, u = ["B", "KB", "MB", "GB", "TB", "PB", "EB"], v = Math.floor(Math.log(l) / Math.log(n));
|
|
8
|
+
return `${Number.parseFloat((l / n ** v).toFixed(r))} ${u[v]}`;
|
|
9
9
|
}
|
|
10
10
|
const Qe = {
|
|
11
11
|
"image/jpeg": "JPEG",
|
|
@@ -15,13 +15,13 @@ const Qe = {
|
|
|
15
15
|
"application/zip": "ZIP Archive"
|
|
16
16
|
// ...
|
|
17
17
|
};
|
|
18
|
-
function Xe(
|
|
19
|
-
return
|
|
20
|
-
var
|
|
21
|
-
return Qe[
|
|
18
|
+
function Xe(l) {
|
|
19
|
+
return l.map((r) => {
|
|
20
|
+
var n;
|
|
21
|
+
return Qe[r] || ((n = r.split("/")[1]) == null ? void 0 : n.toUpperCase());
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const ba = {
|
|
25
25
|
OLD: "old",
|
|
26
26
|
NEW: "new",
|
|
27
27
|
COMPLETED: "completed"
|
|
@@ -29,15 +29,15 @@ const Ca = {
|
|
|
29
29
|
VERIFY_EMAIL: "verify-email"
|
|
30
30
|
};
|
|
31
31
|
let K = null;
|
|
32
|
-
function ea(
|
|
33
|
-
K =
|
|
34
|
-
baseURL:
|
|
32
|
+
function ea(l, r) {
|
|
33
|
+
K = Ye.create({
|
|
34
|
+
baseURL: r,
|
|
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
|
-
validateStatus: (
|
|
40
|
+
validateStatus: (n) => n >= 200 && n < 300
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
function Q() {
|
|
@@ -45,22 +45,22 @@ function Q() {
|
|
|
45
45
|
throw new Error("Axios instance not initialized. Call initAxios(token, baseUrl) first.");
|
|
46
46
|
return K;
|
|
47
47
|
}
|
|
48
|
-
async function Z(
|
|
49
|
-
return Q().post(
|
|
48
|
+
async function Z(l, r, n) {
|
|
49
|
+
return Q().post(l, r, n);
|
|
50
50
|
}
|
|
51
|
-
async function aa(
|
|
52
|
-
return Q().get(
|
|
51
|
+
async function aa(l, r) {
|
|
52
|
+
return Q().get(l, r);
|
|
53
53
|
}
|
|
54
|
-
async function ta(
|
|
55
|
-
return Q().delete(
|
|
54
|
+
async function ta(l, r) {
|
|
55
|
+
return Q().delete(l, r);
|
|
56
56
|
}
|
|
57
|
-
async function oa(
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
57
|
+
async function oa(l) {
|
|
58
|
+
const r = await Z("/users/profile/me", l);
|
|
59
|
+
if (r.status !== 200 && r.status !== 201 || !r.data)
|
|
60
60
|
throw new Error("Ошибка при получении профиля пользователя");
|
|
61
|
-
return
|
|
61
|
+
return r.data;
|
|
62
62
|
}
|
|
63
|
-
const M =
|
|
63
|
+
const M = w(null), W = Le(null);
|
|
64
64
|
function X() {
|
|
65
65
|
return {
|
|
66
66
|
currentDialog: M,
|
|
@@ -74,7 +74,7 @@ function X() {
|
|
|
74
74
|
isDialogOpen: (u) => M.value === u
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const na = {
|
|
78
78
|
ru: {
|
|
79
79
|
Имя: "Имя",
|
|
80
80
|
Фамилия: "Фамилия",
|
|
@@ -207,40 +207,42 @@ const ra = {
|
|
|
207
207
|
"Введите новый номер телефона": "Enter a new phone number",
|
|
208
208
|
"Телефон успешно изменен": "Phone number successfully changed"
|
|
209
209
|
}
|
|
210
|
-
},
|
|
210
|
+
}, ra = /* @__PURE__ */ H({
|
|
211
211
|
__name: "DialogManager",
|
|
212
212
|
props: {
|
|
213
213
|
language: {},
|
|
214
|
-
provider: {}
|
|
214
|
+
provider: {},
|
|
215
|
+
onDisableAddPhone: { type: Boolean }
|
|
215
216
|
},
|
|
216
217
|
emits: ["clean-input-errors", "on-update-jwt", "update-phone-field", "update-email-field", "on-password-error", "on-toast"],
|
|
217
|
-
setup(
|
|
218
|
-
const
|
|
219
|
-
email: J(() => import("./ProfileEmailDialog-
|
|
220
|
-
phone: J(() => import("./ProfilePhoneDialog-
|
|
221
|
-
password: J(() => import("./ProfilePasswordDialog-
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
}, p = ({ phone:
|
|
225
|
-
|
|
218
|
+
setup(l, { emit: r }) {
|
|
219
|
+
const n = r, u = w(!0), { currentDialog: v, dialogPayload: c, closeDialog: U } = X(), i = {
|
|
220
|
+
email: J(() => import("./ProfileEmailDialog-CLM-pIRG.js")),
|
|
221
|
+
phone: J(() => import("./ProfilePhoneDialog-BdAKmUji.js")),
|
|
222
|
+
password: J(() => import("./ProfilePasswordDialog-BY5VAdH3.js"))
|
|
223
|
+
}, s = ({ email: h }) => {
|
|
224
|
+
n("update-email-field", h);
|
|
225
|
+
}, p = ({ phone: h }) => {
|
|
226
|
+
n("update-phone-field", h);
|
|
226
227
|
};
|
|
227
|
-
return ze(v, (
|
|
228
|
-
u.value = !!
|
|
229
|
-
}), (
|
|
228
|
+
return ze(v, (h) => {
|
|
229
|
+
u.value = !!h;
|
|
230
|
+
}), (h, d) => m(v) ? (y(), I(Me(i[m(v)]), Re({
|
|
230
231
|
key: 0,
|
|
231
232
|
modelValue: u.value,
|
|
232
|
-
"onUpdate:modelValue":
|
|
233
|
-
language:
|
|
234
|
-
provider:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
"onUpdate:modelValue": d[0] || (d[0] = (f) => u.value = f),
|
|
234
|
+
language: h.language,
|
|
235
|
+
provider: h.provider,
|
|
236
|
+
"on-disable-add-phone": h.onDisableAddPhone
|
|
237
|
+
}, m(c), {
|
|
238
|
+
onClose: m(U),
|
|
239
|
+
onCleanInputErrors: d[1] || (d[1] = (f) => n("clean-input-errors")),
|
|
240
|
+
onOnUpdateJwt: d[2] || (d[2] = (f, b, o) => n("on-update-jwt", f, b, o)),
|
|
241
|
+
onSubmitEmail: s,
|
|
240
242
|
onSubmitPhone: p,
|
|
241
|
-
onOnPasswordError:
|
|
242
|
-
onOnToast:
|
|
243
|
-
}), null, 16, ["modelValue", "language", "provider", "onClose"])) :
|
|
243
|
+
onOnPasswordError: d[3] || (d[3] = (f, b) => n("on-password-error", f, b)),
|
|
244
|
+
onOnToast: d[4] || (d[4] = (f) => n("on-toast", f))
|
|
245
|
+
}), null, 16, ["modelValue", "language", "provider", "on-disable-add-phone", "onClose"])) : C("", !0);
|
|
244
246
|
}
|
|
245
247
|
}), sa = { class: "base-container" }, la = {
|
|
246
248
|
key: 0,
|
|
@@ -248,19 +250,19 @@ const ra = {
|
|
|
248
250
|
}, ia = { key: 1 }, ua = {
|
|
249
251
|
key: 1,
|
|
250
252
|
class: "input-wrapper"
|
|
251
|
-
},
|
|
253
|
+
}, da = {
|
|
252
254
|
key: 2,
|
|
253
255
|
class: "input-wrapper"
|
|
254
|
-
},
|
|
256
|
+
}, ma = {
|
|
255
257
|
key: 3,
|
|
256
258
|
class: "input-wrapper"
|
|
257
259
|
}, pa = {
|
|
258
260
|
key: 4,
|
|
259
261
|
class: "input-wrapper"
|
|
260
|
-
}, ca = { class: "buttons-container" },
|
|
262
|
+
}, ca = { class: "buttons-container" }, fa = {
|
|
261
263
|
key: 0,
|
|
262
264
|
class: "centered-overlay"
|
|
263
|
-
},
|
|
265
|
+
}, ga = { class: "toastWrapper" }, va = /* @__PURE__ */ H({
|
|
264
266
|
__name: "PEditUserContact",
|
|
265
267
|
props: {
|
|
266
268
|
language: {},
|
|
@@ -270,11 +272,12 @@ const ra = {
|
|
|
270
272
|
accessToken: {},
|
|
271
273
|
refreshToken: {},
|
|
272
274
|
fields: {},
|
|
273
|
-
awsStorageUrl: {}
|
|
275
|
+
awsStorageUrl: {},
|
|
276
|
+
onDisableAddPhone: { type: Boolean }
|
|
274
277
|
},
|
|
275
278
|
emits: ["open-email-dialog", "open-phone-dialog", "open-password-dialog", "on-update-jwt", "on-password-error", "update-tokens"],
|
|
276
|
-
setup(
|
|
277
|
-
const
|
|
279
|
+
setup(l, { emit: r }) {
|
|
280
|
+
const n = l, u = r, v = T(() => n.language ?? "ru"), c = (e) => na[v.value][e] || e, { openDialog: U } = X(), i = q({ firstName: "", lastName: "" }), s = w({ firstName: "", lastName: "" }), p = q({ firstName: !1, lastName: !1, email: !1, phone: !1 }), h = w(""), d = w(""), f = w(""), b = w(!1), o = q({
|
|
278
281
|
value: null,
|
|
279
282
|
loading: !1,
|
|
280
283
|
accept: ["image/png", "image/jpeg"],
|
|
@@ -282,68 +285,68 @@ const ra = {
|
|
|
282
285
|
// 10 MB
|
|
283
286
|
imageBinary: null,
|
|
284
287
|
imageContent: ""
|
|
285
|
-
}), B =
|
|
288
|
+
}), B = w(""), S = w(!1), R = w(!0), G = w(!0), ee = w(void 0), ae = w(""), ce = T(() => oe(i.firstName, p.firstName)), fe = T(() => oe(i.lastName, p.lastName)), ge = T(() => p.email && !d.value.trim() ? "Введите e-mail" : ""), ve = T(() => p.phone && !f.value.trim() ? "Введите номер телефона" : ""), D = (e) => n.fields.some((a) => a.key === e), te = (e) => e && e.trim() ? "edit" : "bind", j = () => setTimeout(() => {
|
|
286
289
|
var e;
|
|
287
290
|
return (e = document.activeElement) == null ? void 0 : e.blur();
|
|
288
|
-
}, 0), he = T(() => !!(
|
|
291
|
+
}, 0), he = T(() => !!(d.value && d.value.trim() !== "")), we = T(() => o.imageContent ? c("Загрузить другое фото") : c("Загрузить фото")), oe = (e, a) => {
|
|
289
292
|
if (!a) return "";
|
|
290
293
|
const t = e.trim();
|
|
291
294
|
return t ? t.length < 2 ? "Поле должно содержать минимум 2 символа" : "" : "Введите значение";
|
|
292
295
|
}, ye = (e) => U("email", { mode: e ? "edit" : "bind", initialEmail: e }), Ee = () => {
|
|
293
|
-
j(), p.email = !1, G.value = !1, u("open-email-dialog",
|
|
296
|
+
j(), p.email = !1, G.value = !1, u("open-email-dialog", d.value, te(d.value)), ye(d.value);
|
|
294
297
|
}, Ne = () => {
|
|
295
|
-
j(), p.phone = !1, R.value = !1, u("open-phone-dialog",
|
|
296
|
-
},
|
|
297
|
-
e === "email" && t && (
|
|
298
|
+
j(), p.phone = !1, R.value = !1, u("open-phone-dialog", f.value, te(f.value));
|
|
299
|
+
}, be = async (e, a, t) => {
|
|
300
|
+
e === "email" && t && (d.value = t), e === "phone" && t && (f.value = t), u("on-update-jwt");
|
|
298
301
|
}, Pe = (e) => {
|
|
299
|
-
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
+
f.value = e;
|
|
303
|
+
}, Ce = (e) => {
|
|
304
|
+
d.value = e;
|
|
302
305
|
}, ke = (e, a) => {
|
|
303
|
-
|
|
306
|
+
S.value = !0, u("on-password-error", e, a);
|
|
304
307
|
}, Te = () => {
|
|
305
308
|
R.value = !1, G.value = !1;
|
|
306
309
|
}, V = (e) => {
|
|
307
|
-
|
|
310
|
+
S.value = !0, ee.value = e.color ?? "", ae.value = e.text ?? "";
|
|
308
311
|
}, x = (e) => {
|
|
309
312
|
if (p[e] = !0, e === "firstName" || e === "lastName") {
|
|
310
|
-
const a =
|
|
311
|
-
a.length > 40 && (
|
|
313
|
+
const a = i[e];
|
|
314
|
+
a.length > 40 && (i[e] = a.slice(0, 40));
|
|
312
315
|
}
|
|
313
316
|
}, Ue = (e) => {
|
|
314
|
-
var $,
|
|
317
|
+
var $, O;
|
|
315
318
|
if (B.value = "", !e) {
|
|
316
|
-
|
|
319
|
+
ne();
|
|
317
320
|
return;
|
|
318
321
|
}
|
|
319
|
-
const a = (($ = e.fileBinary) == null ? void 0 : $.type) ?? "", t = ((
|
|
322
|
+
const a = (($ = e.fileBinary) == null ? void 0 : $.type) ?? "", t = ((O = e.fileBinary) == null ? void 0 : O.size) ?? 0, P = !["image/png", "image/jpeg"].includes(a), N = t > o.uploadLimit;
|
|
320
323
|
if (P || N) {
|
|
321
|
-
B.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ",
|
|
324
|
+
B.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", ne();
|
|
322
325
|
return;
|
|
323
326
|
}
|
|
324
|
-
o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "",
|
|
325
|
-
},
|
|
326
|
-
o.value = null, o.imageBinary = null, o.imageContent = "",
|
|
327
|
+
o.value = e, o.imageBinary = e.fileBinary ?? null, o.imageContent = e.fileContent ?? "", b.value = !0;
|
|
328
|
+
}, ne = () => {
|
|
329
|
+
o.value = null, o.imageBinary = null, o.imageContent = "", b.value = !1;
|
|
327
330
|
}, Be = async () => {
|
|
328
331
|
try {
|
|
329
332
|
const a = (await ta("/users/profile/delete/avatar")).data;
|
|
330
|
-
return (a == null ? void 0 : a.success)
|
|
333
|
+
return (a == null ? void 0 : a.success) === !0;
|
|
331
334
|
} catch (e) {
|
|
332
335
|
return console.error("Ошибка при удалении аватара:", e), !1;
|
|
333
336
|
}
|
|
334
|
-
},
|
|
335
|
-
B.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", o.value = null, o.imageBinary = null, o.imageContent = "",
|
|
336
|
-
},
|
|
337
|
+
}, De = () => {
|
|
338
|
+
B.value = "Файл не подходит. Пожалуйста, загрузите PNG или JPEG размером до 10 МБ", o.value = null, o.imageBinary = null, o.imageContent = "", b.value = !1;
|
|
339
|
+
}, re = async (e, a, t = "image/png") => {
|
|
337
340
|
if (!e) return null;
|
|
338
341
|
const P = await (await fetch(e)).blob();
|
|
339
342
|
return new File([P], a, { type: t });
|
|
340
|
-
},
|
|
341
|
-
o.value = null, o.imageBinary = null, o.imageContent = "",
|
|
342
|
-
},
|
|
343
|
-
|
|
343
|
+
}, Ae = () => {
|
|
344
|
+
o.value = null, o.imageBinary = null, o.imageContent = "", b.value = !1;
|
|
345
|
+
}, Fe = async (e) => {
|
|
346
|
+
b.value = !1;
|
|
344
347
|
const a = o.imageContent;
|
|
345
348
|
if (o.imageContent = e, !o.imageBinary) return;
|
|
346
|
-
const t = await
|
|
349
|
+
const t = await re(
|
|
347
350
|
e,
|
|
348
351
|
o.imageBinary.name,
|
|
349
352
|
o.imageBinary.type || "image/png"
|
|
@@ -355,7 +358,7 @@ const ra = {
|
|
|
355
358
|
try {
|
|
356
359
|
o.loading = !0;
|
|
357
360
|
const E = new FormData();
|
|
358
|
-
E.append("file", t), await Z(`/users/profile/avatar/${
|
|
361
|
+
E.append("file", t), await Z(`/users/profile/avatar/${h.value}`, E, { headers: { "Content-Type": void 0 } });
|
|
359
362
|
} catch (E) {
|
|
360
363
|
console.error(E), V({
|
|
361
364
|
color: "error",
|
|
@@ -364,36 +367,36 @@ const ra = {
|
|
|
364
367
|
} finally {
|
|
365
368
|
o.loading = !1;
|
|
366
369
|
}
|
|
367
|
-
},
|
|
368
|
-
o.imageContent = e ?? "", o.imageBinary && (o.imageBinary = await
|
|
370
|
+
}, Ie = async (e) => {
|
|
371
|
+
o.imageContent = e ?? "", o.imageBinary && (o.imageBinary = await re(
|
|
369
372
|
e ?? "",
|
|
370
373
|
o.imageBinary.name,
|
|
371
374
|
o.imageBinary.type || "image/png"
|
|
372
375
|
));
|
|
373
|
-
}, se =
|
|
376
|
+
}, se = w(!1), le = async (e) => {
|
|
374
377
|
var t, E;
|
|
375
|
-
const a = (t =
|
|
378
|
+
const a = (t = i[e]) == null ? void 0 : t.trim();
|
|
376
379
|
if (a)
|
|
377
380
|
try {
|
|
378
381
|
se.value = !0;
|
|
379
382
|
const N = (E = (await Z("/users/profile/update-name", { [e]: a })).data) == null ? void 0 : E.data;
|
|
380
|
-
N != null && N.user && (
|
|
381
|
-
firstName:
|
|
382
|
-
lastName:
|
|
383
|
+
N != null && N.user && (i.firstName = N.user.firstName ?? i.firstName, i.lastName = N.user.lastName ?? i.lastName, s.value = {
|
|
384
|
+
firstName: i.firstName,
|
|
385
|
+
lastName: i.lastName
|
|
383
386
|
});
|
|
384
387
|
} catch (P) {
|
|
385
388
|
throw P;
|
|
386
389
|
} finally {
|
|
387
390
|
se.value = !1;
|
|
388
391
|
}
|
|
389
|
-
},
|
|
392
|
+
}, Se = async () => {
|
|
390
393
|
var e;
|
|
391
|
-
if (!
|
|
394
|
+
if (!n.accessToken)
|
|
392
395
|
throw console.error("Access token не передан в props"), new Error("Access token is required");
|
|
393
396
|
try {
|
|
394
397
|
const t = (e = (await oa({
|
|
395
|
-
accessToken:
|
|
396
|
-
refreshToken:
|
|
398
|
+
accessToken: n.accessToken,
|
|
399
|
+
refreshToken: n.refreshToken ?? "",
|
|
397
400
|
excludeFields: []
|
|
398
401
|
})).data) == null ? void 0 : e.user;
|
|
399
402
|
if (!t)
|
|
@@ -403,9 +406,9 @@ const ra = {
|
|
|
403
406
|
privateFirstName: P,
|
|
404
407
|
privateLastName: N,
|
|
405
408
|
email: $,
|
|
406
|
-
phoneNumber:
|
|
409
|
+
phoneNumber: O
|
|
407
410
|
} = t;
|
|
408
|
-
|
|
411
|
+
h.value = E ?? "", i.firstName = P ?? "", i.lastName = N ?? "", d.value = $ ?? "", f.value = O ?? "", o.imageContent = await Ve(), s.value = {
|
|
409
412
|
firstName: P ?? "",
|
|
410
413
|
lastName: N ?? ""
|
|
411
414
|
};
|
|
@@ -416,7 +419,7 @@ const ra = {
|
|
|
416
419
|
var e;
|
|
417
420
|
try {
|
|
418
421
|
const t = (e = (await aa("/users/profile/avatar")).data) == null ? void 0 : e.data;
|
|
419
|
-
return t ? xe(t) :
|
|
422
|
+
return t ? xe(t) : "";
|
|
420
423
|
} catch (a) {
|
|
421
424
|
return console.error("Ошибка при загрузке метаданных аватара:", a), "";
|
|
422
425
|
}
|
|
@@ -425,15 +428,15 @@ const ra = {
|
|
|
425
428
|
if (!e)
|
|
426
429
|
return "";
|
|
427
430
|
try {
|
|
428
|
-
return new URL(e.key,
|
|
431
|
+
return new URL(e.key, n.awsStorageUrl).toString();
|
|
429
432
|
} catch (a) {
|
|
430
433
|
return console.error("Ошибка при составлении URL аватара:", a), "";
|
|
431
434
|
}
|
|
432
435
|
}
|
|
433
436
|
const ie = T(() => {
|
|
434
|
-
if (!
|
|
437
|
+
if (!s.value.firstName && !s.value.lastName)
|
|
435
438
|
return !1;
|
|
436
|
-
const e =
|
|
439
|
+
const e = i.firstName.trim(), a = i.lastName.trim(), t = s.value.firstName.trim(), E = s.value.lastName.trim(), P = e !== t || a !== E, N = e.length >= 2 && a.length >= 2;
|
|
437
440
|
return P && N;
|
|
438
441
|
}), $e = async () => {
|
|
439
442
|
if (ie.value)
|
|
@@ -445,26 +448,27 @@ const ra = {
|
|
|
445
448
|
text: c("Не удалось сохранить изменения. Попробуйте позже")
|
|
446
449
|
});
|
|
447
450
|
}
|
|
448
|
-
},
|
|
451
|
+
}, Oe = () => {
|
|
449
452
|
j(), u("open-password-dialog");
|
|
450
453
|
};
|
|
451
454
|
return Ge(async () => {
|
|
452
|
-
if (!
|
|
453
|
-
if (!
|
|
454
|
-
ea(
|
|
455
|
-
}), (e, a) => (
|
|
456
|
-
|
|
455
|
+
if (!n.accessToken) throw new Error("Access token не передан в props");
|
|
456
|
+
if (!n.requestUrl) throw new Error("auth-backend url не передан в props");
|
|
457
|
+
ea(n.accessToken, n.requestUrl), await Se();
|
|
458
|
+
}), (e, a) => (y(), k(me, null, [
|
|
459
|
+
g(ra, {
|
|
457
460
|
language: v.value,
|
|
458
461
|
provider: e.provider,
|
|
462
|
+
"on-disable-add-phone": e.onDisableAddPhone,
|
|
459
463
|
onCleanInputErrors: Te,
|
|
460
|
-
onOnUpdateJwt:
|
|
464
|
+
onOnUpdateJwt: be,
|
|
461
465
|
onUpdatePhoneField: Pe,
|
|
462
|
-
onUpdateEmailField:
|
|
466
|
+
onUpdateEmailField: Ce,
|
|
463
467
|
onOnPasswordError: ke,
|
|
464
468
|
onOnToast: V
|
|
465
|
-
}, null, 8, ["language", "provider"]),
|
|
466
|
-
|
|
467
|
-
|
|
469
|
+
}, null, 8, ["language", "provider", "on-disable-add-phone"]),
|
|
470
|
+
Y("div", sa, [
|
|
471
|
+
D("avatar") ? (y(), I(m(_e), {
|
|
468
472
|
key: 0,
|
|
469
473
|
modelValue: o.value,
|
|
470
474
|
"onUpdate:modelValue": [
|
|
@@ -479,61 +483,61 @@ const ra = {
|
|
|
479
483
|
"upload-limit": o.uploadLimit,
|
|
480
484
|
accept: "image/jpeg, image/png",
|
|
481
485
|
onDelete: Be,
|
|
482
|
-
"onChange:error":
|
|
486
|
+
"onChange:error": De
|
|
483
487
|
}, {
|
|
484
|
-
afterLoadLabel:
|
|
485
|
-
|
|
488
|
+
afterLoadLabel: A(() => [
|
|
489
|
+
_(F(we.value), 1)
|
|
486
490
|
]),
|
|
487
|
-
subtext:
|
|
488
|
-
B.value ? (
|
|
491
|
+
subtext: A(() => [
|
|
492
|
+
B.value ? (y(), k("span", la, F(B.value), 1)) : (y(), k("span", ia, F(`${c("Формат")} ${m(Xe)(o.accept).join(", ")} ${c("до")} ${m(He)(o.uploadLimit)}`), 1))
|
|
489
493
|
]),
|
|
490
494
|
_: 1
|
|
491
|
-
}, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) :
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
modelValue:
|
|
495
|
-
"onUpdate:modelValue": a[2] || (a[2] = (t) =>
|
|
495
|
+
}, 8, ["modelValue", "src", "loading", "label", "upload-limit"])) : C("", !0),
|
|
496
|
+
D("firstName") ? (y(), k("div", ua, [
|
|
497
|
+
g(m(L), {
|
|
498
|
+
modelValue: i.firstName,
|
|
499
|
+
"onUpdate:modelValue": a[2] || (a[2] = (t) => i.firstName = t),
|
|
496
500
|
size: "large",
|
|
497
501
|
label: c("Имя"),
|
|
498
502
|
error: ce.value,
|
|
499
503
|
onBlur: a[3] || (a[3] = (t) => p.firstName = !0),
|
|
500
504
|
onInput: a[4] || (a[4] = (t) => x("firstName"))
|
|
501
505
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
502
|
-
|
|
503
|
-
])) :
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
modelValue:
|
|
507
|
-
"onUpdate:modelValue": a[5] || (a[5] = (t) =>
|
|
506
|
+
g(m(z), { class: "icon-locked" })
|
|
507
|
+
])) : C("", !0),
|
|
508
|
+
D("lastName") ? (y(), k("div", da, [
|
|
509
|
+
g(m(L), {
|
|
510
|
+
modelValue: i.lastName,
|
|
511
|
+
"onUpdate:modelValue": a[5] || (a[5] = (t) => i.lastName = t),
|
|
508
512
|
size: "large",
|
|
509
513
|
label: c("Фамилия"),
|
|
510
|
-
error:
|
|
514
|
+
error: fe.value,
|
|
511
515
|
onBlur: a[6] || (a[6] = (t) => p.lastName = !0),
|
|
512
516
|
onInput: a[7] || (a[7] = (t) => x("lastName"))
|
|
513
517
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
514
|
-
|
|
515
|
-
])) :
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
modelValue:
|
|
519
|
-
"onUpdate:modelValue": a[8] || (a[8] = (t) =>
|
|
518
|
+
g(m(z), { class: "icon-locked" })
|
|
519
|
+
])) : C("", !0),
|
|
520
|
+
D("email") ? (y(), k("div", ma, [
|
|
521
|
+
g(m(L), {
|
|
522
|
+
modelValue: d.value,
|
|
523
|
+
"onUpdate:modelValue": a[8] || (a[8] = (t) => d.value = t),
|
|
520
524
|
size: "large",
|
|
521
525
|
"text-size": "medium",
|
|
522
526
|
label: "E-mail",
|
|
523
527
|
type: "email",
|
|
524
528
|
readonly: "",
|
|
525
529
|
style: { cursor: "pointer" },
|
|
526
|
-
error:
|
|
530
|
+
error: ge.value && G.value,
|
|
527
531
|
onBlur: a[9] || (a[9] = (t) => p.email = !0),
|
|
528
532
|
onInput: a[10] || (a[10] = (t) => x("email")),
|
|
529
533
|
onClick: Ee
|
|
530
534
|
}, null, 8, ["modelValue", "error"]),
|
|
531
|
-
|
|
532
|
-
])) :
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
modelValue:
|
|
536
|
-
"onUpdate:modelValue": a[11] || (a[11] = (t) =>
|
|
535
|
+
g(m(z), { class: "icon-locked" })
|
|
536
|
+
])) : C("", !0),
|
|
537
|
+
D("phone") ? (y(), k("div", pa, [
|
|
538
|
+
g(m(L), {
|
|
539
|
+
modelValue: f.value,
|
|
540
|
+
"onUpdate:modelValue": a[11] || (a[11] = (t) => f.value = t),
|
|
537
541
|
size: "large",
|
|
538
542
|
"text-size": "medium",
|
|
539
543
|
label: c("Номер телефона"),
|
|
@@ -545,70 +549,70 @@ const ra = {
|
|
|
545
549
|
onInput: a[13] || (a[13] = (t) => x("phone")),
|
|
546
550
|
onClick: Ne
|
|
547
551
|
}, null, 8, ["modelValue", "label", "error"]),
|
|
548
|
-
|
|
549
|
-
])) :
|
|
550
|
-
|
|
551
|
-
he.value ? (
|
|
552
|
+
g(m(z), { class: "icon-locked" })
|
|
553
|
+
])) : C("", !0),
|
|
554
|
+
Y("div", ca, [
|
|
555
|
+
he.value ? (y(), I(m(de), {
|
|
552
556
|
key: 0,
|
|
553
557
|
color: "secondary",
|
|
554
|
-
onClick:
|
|
558
|
+
onClick: Oe
|
|
555
559
|
}, {
|
|
556
|
-
default:
|
|
557
|
-
|
|
560
|
+
default: A(() => [
|
|
561
|
+
_(F(c("Сменить пароль")), 1)
|
|
558
562
|
]),
|
|
559
563
|
_: 1
|
|
560
|
-
})) :
|
|
561
|
-
|
|
564
|
+
})) : C("", !0),
|
|
565
|
+
g(m(de), {
|
|
562
566
|
disabled: !ie.value,
|
|
563
567
|
onClick: $e
|
|
564
568
|
}, {
|
|
565
|
-
default:
|
|
566
|
-
|
|
569
|
+
default: A(() => [
|
|
570
|
+
_(F(c("Сохранить")), 1)
|
|
567
571
|
]),
|
|
568
572
|
_: 1
|
|
569
573
|
}, 8, ["disabled"])
|
|
570
574
|
])
|
|
571
575
|
]),
|
|
572
|
-
|
|
576
|
+
b.value ? (y(), I(ue, {
|
|
573
577
|
key: 0,
|
|
574
578
|
to: "body"
|
|
575
579
|
}, [
|
|
576
|
-
|
|
577
|
-
|
|
580
|
+
b.value ? (y(), k("div", fa, [
|
|
581
|
+
g(m(We), {
|
|
578
582
|
"circle-mode": !0,
|
|
579
583
|
"model-value": o.imageContent,
|
|
580
|
-
onClose:
|
|
581
|
-
onSave: a[14] || (a[14] = (t) =>
|
|
582
|
-
"onUpdate:modelValue": a[15] || (a[15] = (t) =>
|
|
584
|
+
onClose: Ae,
|
|
585
|
+
onSave: a[14] || (a[14] = (t) => Fe(t)),
|
|
586
|
+
"onUpdate:modelValue": a[15] || (a[15] = (t) => Ie(t))
|
|
583
587
|
}, null, 8, ["model-value"])
|
|
584
|
-
])) :
|
|
585
|
-
])) :
|
|
586
|
-
(
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
default:
|
|
590
|
-
Je(
|
|
588
|
+
])) : C("", !0)
|
|
589
|
+
])) : C("", !0),
|
|
590
|
+
(y(), I(ue, { to: "#toast-root" }, [
|
|
591
|
+
Y("div", ga, [
|
|
592
|
+
g(je, { name: "list" }, {
|
|
593
|
+
default: A(() => [
|
|
594
|
+
Je(g(m(Ke), {
|
|
591
595
|
class: "toast",
|
|
592
596
|
color: ee.value,
|
|
593
597
|
text: ae.value,
|
|
594
|
-
onClose: a[16] || (a[16] = (t) =>
|
|
598
|
+
onClose: a[16] || (a[16] = (t) => S.value = !1)
|
|
595
599
|
}, null, 8, ["color", "text"]), [
|
|
596
|
-
[qe,
|
|
600
|
+
[qe, S.value]
|
|
597
601
|
])
|
|
598
602
|
]),
|
|
599
603
|
_: 1
|
|
600
604
|
})
|
|
601
605
|
])
|
|
602
606
|
])),
|
|
603
|
-
|
|
607
|
+
g(m(pe))
|
|
604
608
|
], 64));
|
|
605
609
|
}
|
|
606
|
-
}), ha = (
|
|
607
|
-
const
|
|
608
|
-
for (const [u, v] of
|
|
609
|
-
|
|
610
|
-
return
|
|
611
|
-
}, wa = /* @__PURE__ */ ha(va, [["__scopeId", "data-v-
|
|
610
|
+
}), ha = (l, r) => {
|
|
611
|
+
const n = l.__vccOpts || l;
|
|
612
|
+
for (const [u, v] of r)
|
|
613
|
+
n[u] = v;
|
|
614
|
+
return n;
|
|
615
|
+
}, wa = /* @__PURE__ */ ha(va, [["__scopeId", "data-v-05cc0841"]]), Ca = /* @__PURE__ */ H({
|
|
612
616
|
__name: "index",
|
|
613
617
|
props: {
|
|
614
618
|
throttlerPrefix: {},
|
|
@@ -618,45 +622,47 @@ const ra = {
|
|
|
618
622
|
refreshToken: {},
|
|
619
623
|
language: {},
|
|
620
624
|
fields: {},
|
|
621
|
-
awsStorageUrl: {}
|
|
625
|
+
awsStorageUrl: {},
|
|
626
|
+
onDisableAddPhone: { type: Boolean }
|
|
622
627
|
},
|
|
623
628
|
emits: ["on-update-jwt", "update-tokens"],
|
|
624
|
-
setup(
|
|
625
|
-
const
|
|
626
|
-
u("email", { initialEmail:
|
|
627
|
-
}, c = (
|
|
628
|
-
u("phone", { initialPhone:
|
|
629
|
+
setup(l, { emit: r }) {
|
|
630
|
+
const n = r, { openDialog: u } = X(), v = (s, p) => {
|
|
631
|
+
u("email", { initialEmail: s, mode: p });
|
|
632
|
+
}, c = (s, p) => {
|
|
633
|
+
u("phone", { initialPhone: s, mode: p });
|
|
629
634
|
}, U = () => {
|
|
630
635
|
u("password");
|
|
631
|
-
},
|
|
632
|
-
|
|
636
|
+
}, i = (s, p, h) => {
|
|
637
|
+
n("on-update-jwt", s, p, h);
|
|
633
638
|
};
|
|
634
|
-
return (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
"throttler-prefix":
|
|
638
|
-
provider:
|
|
639
|
-
"request-url":
|
|
640
|
-
language:
|
|
641
|
-
fields:
|
|
642
|
-
"access-token":
|
|
643
|
-
"refresh-token":
|
|
644
|
-
"aws-storage-url":
|
|
639
|
+
return (s, p) => (y(), k(me, null, [
|
|
640
|
+
g(m(Ze)),
|
|
641
|
+
g(wa, {
|
|
642
|
+
"throttler-prefix": s.throttlerPrefix,
|
|
643
|
+
provider: s.provider,
|
|
644
|
+
"request-url": s.requestUrl,
|
|
645
|
+
language: s.language,
|
|
646
|
+
fields: s.fields,
|
|
647
|
+
"access-token": s.accessToken,
|
|
648
|
+
"refresh-token": s.refreshToken,
|
|
649
|
+
"aws-storage-url": s.awsStorageUrl,
|
|
650
|
+
"on-disable-add-phone": s.onDisableAddPhone,
|
|
645
651
|
onOpenEmailDialog: v,
|
|
646
652
|
onOpenPhoneDialog: c,
|
|
647
653
|
onOpenPasswordDialog: U,
|
|
648
|
-
onOnUpdateJwt:
|
|
649
|
-
}, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url"]),
|
|
650
|
-
|
|
654
|
+
onOnUpdateJwt: i
|
|
655
|
+
}, null, 8, ["throttler-prefix", "provider", "request-url", "language", "fields", "access-token", "refresh-token", "aws-storage-url", "on-disable-add-phone"]),
|
|
656
|
+
g(m(pe))
|
|
651
657
|
], 64));
|
|
652
658
|
}
|
|
653
659
|
});
|
|
654
660
|
export {
|
|
655
661
|
Pa as B,
|
|
656
|
-
|
|
662
|
+
ba as C,
|
|
657
663
|
ha as _,
|
|
658
|
-
|
|
664
|
+
Ca as a,
|
|
659
665
|
aa as g,
|
|
660
666
|
Z as p,
|
|
661
|
-
|
|
667
|
+
na as t
|
|
662
668
|
};
|