@yourgoods/ui-smart 0.1.1
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-_CmzDM2p.js +777 -0
- package/dist/ProfilePasswordDialog-DTLqgHqm.js +268 -0
- package/dist/ProfilePhoneDialog-D4EwUMe2.js +737 -0
- package/dist/components/PEditUserContact/PEditUserContact.vue.d.ts +44 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogManager.vue.d.ts +24 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/AddNewEmailContent.vue.d.ts +60 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/AddNewPasswordContent.vue.d.ts +25 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/AddNewPhoneContent.vue.d.ts +63 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/NewEmailContent.vue.d.ts +64 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/NewPhoneContent.vue.d.ts +64 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/OldEmailContent.vue.d.ts +55 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/OldPhoneContent.vue.d.ts +55 -0
- package/dist/components/PEditUserContact/ProfileDialogs/DialogSegments/ThrottlerTimer.vue.d.ts +45 -0
- package/dist/components/PEditUserContact/ProfileDialogs/ProfileEmailDialog.vue.d.ts +55 -0
- package/dist/components/PEditUserContact/ProfileDialogs/ProfilePasswordDialog.vue.d.ts +36 -0
- package/dist/components/PEditUserContact/ProfileDialogs/ProfilePhoneDialog.vue.d.ts +89 -0
- package/dist/components/PEditUserContact/ProfileOverlayLoading.vue.d.ts +2 -0
- package/dist/components/PEditUserContact/index.vue.d.ts +36 -0
- package/dist/components/PEditUserContact/types.d.ts +29 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/composables/profile/useDialogManager.d.ts +21 -0
- package/dist/composables/profile/useModeFlow.d.ts +7 -0
- package/dist/composables/profile/usePasswordRateLimitToast.d.ts +9 -0
- package/dist/composables/profile/useRateLimitToast.d.ts +9 -0
- package/dist/composables/profile/useThrottler.d.ts +13 -0
- package/dist/index-DtHlzO1x.js +570 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/locales/index.d.ts +130 -0
- package/dist/modules/api/profile/check-availability.d.ts +1 -0
- package/dist/modules/api/profile/me.d.ts +19 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/types/vue-shims.d.ts +5 -0
- package/dist/useRateLimitToast-DsEVCh0F.js +140 -0
- package/dist/vue-shims.d.ts +5 -0
- package/package.json +49 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { defineComponent as Pe, ref as r, reactive as N, computed as u, watch as X, onMounted as ye, createElementBlock as _, openBlock as C, Fragment as Ce, createVNode as n, unref as o, withCtx as P, createCommentVNode as Y, createElementVNode as l, toDisplayString as g, createBlock as S, resolveDynamicComponent as B, createTextVNode as R } from "vue";
|
|
2
|
+
import { C as V, p as E, g as ge } from "./index-DtHlzO1x.js";
|
|
3
|
+
import { PDialog as Ve, PInput as $, IconEyeMd as z, IconEyeClosedMd as M, PButton as O, PTopBar as be, IconCrossMd as Ie, PTeleportContainer as Te } from "@profeat/ui-kit";
|
|
4
|
+
function xe(b) {
|
|
5
|
+
return { showPasswordRateLimitToast: (y) => {
|
|
6
|
+
if (!y) return;
|
|
7
|
+
const { attemptsLeft: a, retryAfterSec: I } = y;
|
|
8
|
+
if (a === 2) {
|
|
9
|
+
b("on-toast", {
|
|
10
|
+
color: "error",
|
|
11
|
+
text: "Осталось 2 попытки. Ввод пароля будет заблокирован на 5 минут."
|
|
12
|
+
});
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (a === 1) {
|
|
16
|
+
b("on-toast", {
|
|
17
|
+
color: "error",
|
|
18
|
+
text: "Осталась 1 попытка. После исчерпания лимита ввод пароля будет заблокирован на 1 час."
|
|
19
|
+
});
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (a === 0) {
|
|
23
|
+
const p = I && I > 0 ? I : 3600;
|
|
24
|
+
b("on-toast", {
|
|
25
|
+
color: "error",
|
|
26
|
+
text: `Достигнут лимит попыток ввода пароля. Попробуйте снова через ${Math.ceil(p / 60)} минут.`
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
} };
|
|
31
|
+
}
|
|
32
|
+
const ke = { class: "text-center w-full" }, De = { class: "dialogTitle" }, Ee = {
|
|
33
|
+
key: 0,
|
|
34
|
+
class: "dialogDefaultContainer"
|
|
35
|
+
}, he = { class: "dialogDefaultContainerInsideContent" }, Le = { class: "dialogDefaultContainerTextHint" }, Ne = { class: "input-wrapper" }, _e = {
|
|
36
|
+
key: 1,
|
|
37
|
+
class: "dialogDefaultContainer"
|
|
38
|
+
}, Se = { class: "dialogDefaultContainerInsideContent" }, Be = { class: "input-wrapper" }, Re = { class: "input-wrapper" }, $e = { style: { width: "100%", display: "flex" } }, Z = 8, Ue = /* @__PURE__ */ Pe({
|
|
39
|
+
__name: "ProfilePasswordDialog",
|
|
40
|
+
props: {
|
|
41
|
+
modelValue: { type: Boolean },
|
|
42
|
+
title: { default: "Смена пароля" },
|
|
43
|
+
hintText: { default: "Введите ваш текущий пароль" },
|
|
44
|
+
oldPassword: { default: "" }
|
|
45
|
+
},
|
|
46
|
+
emits: ["update:modelValue", "submit", "edit", "close", "on-update-jwt", "on-password-error", "on-password-success", "on-toast"],
|
|
47
|
+
setup(b, { emit: U }) {
|
|
48
|
+
const y = b, a = U, I = r(!0), p = r(y.modelValue), v = N({ oldPassword: y.oldPassword ?? "" }), d = r(""), f = r(""), F = N({ oldPassword: !1 }), w = N({ newPassword: !1, newPasswordConfirm: !1 }), i = r(V.OLD), m = r(null), H = r(!1), { showPasswordRateLimitToast: ee } = xe(a), x = r(!1), se = u(() => x.value ? "text" : "password"), te = () => x.value = !x.value, k = r(!1), D = r(!1), oe = u(() => k.value ? "text" : "password"), ae = u(() => D.value ? "text" : "password"), re = () => {
|
|
49
|
+
k.value = !k.value;
|
|
50
|
+
}, le = () => {
|
|
51
|
+
D.value = !D.value;
|
|
52
|
+
}, T = r(!1), ne = u(() => T.value ? "Неверный текущий пароль" : F.oldPassword && !v.oldPassword.trim() ? "Введите пароль" : ""), de = u(() => !v.oldPassword.trim()), ie = u(() => H.value || !d.value.trim() || !f.value.trim() ? !0 : q.value);
|
|
53
|
+
X(
|
|
54
|
+
() => y.modelValue,
|
|
55
|
+
(t) => p.value = t
|
|
56
|
+
), X(p, (t) => a("update:modelValue", t));
|
|
57
|
+
const ue = async (t = "email") => {
|
|
58
|
+
var s;
|
|
59
|
+
const e = await ge("/users/profile/session/get-edit-session", { params: { field: t } });
|
|
60
|
+
return ((s = e.data) == null ? void 0 : s.data) ?? e.data;
|
|
61
|
+
}, h = async (t = "email") => {
|
|
62
|
+
var s;
|
|
63
|
+
const e = await E("/users/profile/session/create-if-not-exists", { field: t, oldValue: v.oldPassword });
|
|
64
|
+
return ((s = e.data) == null ? void 0 : s.data) ?? e.data;
|
|
65
|
+
}, we = async () => {
|
|
66
|
+
var c, J, K, Q;
|
|
67
|
+
if (!m.value) throw new Error("Нет sessionId");
|
|
68
|
+
const t = await E("/users/profile/password/match", { sessionId: m.value, password: v.oldPassword }), e = ((c = t.data) == null ? void 0 : c.data) ?? t.data, s = ((K = (J = t.data) == null ? void 0 : J.data) == null ? void 0 : K.passwordRateLimit) ?? ((Q = t.data) == null ? void 0 : Q.passwordRateLimit);
|
|
69
|
+
return ee(s), { success: (e == null ? void 0 : e.success) ?? !1, message: (e == null ? void 0 : e.message) ?? "" };
|
|
70
|
+
}, ce = async () => {
|
|
71
|
+
await E("/users/profile/password/init", { never_: "never" });
|
|
72
|
+
}, pe = async () => {
|
|
73
|
+
await E("/users/profile/password/update", {
|
|
74
|
+
sessionId: m.value,
|
|
75
|
+
newPassword: d.value.trim(),
|
|
76
|
+
confirmPassword: f.value.trim()
|
|
77
|
+
});
|
|
78
|
+
}, j = async (t = "password") => {
|
|
79
|
+
try {
|
|
80
|
+
const e = await ue(t);
|
|
81
|
+
if (m.value = e.sessionId, i.value = e.step, !e.sessionId) {
|
|
82
|
+
const s = await h(t);
|
|
83
|
+
m.value = s.sessionId, i.value = s.step;
|
|
84
|
+
}
|
|
85
|
+
} catch {
|
|
86
|
+
const s = await h(t);
|
|
87
|
+
m.value = s.sessionId, i.value = s.step;
|
|
88
|
+
}
|
|
89
|
+
}, L = () => {
|
|
90
|
+
a("close"), p.value = !1;
|
|
91
|
+
}, A = (t) => {
|
|
92
|
+
F[t] = !0, T.value = !1;
|
|
93
|
+
}, ve = async () => {
|
|
94
|
+
var t, e;
|
|
95
|
+
T.value = !1;
|
|
96
|
+
try {
|
|
97
|
+
if (await j("password"), i.value !== V.OLD) return;
|
|
98
|
+
const { success: s } = await we();
|
|
99
|
+
if (!s) {
|
|
100
|
+
T.value = !0;
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const c = await h("password");
|
|
104
|
+
m.value = c.sessionId, i.value = c.step;
|
|
105
|
+
} catch (s) {
|
|
106
|
+
const c = ((e = (t = s == null ? void 0 : s.response) == null ? void 0 : t.data) == null ? void 0 : e.message) ?? "";
|
|
107
|
+
if (typeof c == "string" && c.toLowerCase().includes("never")) {
|
|
108
|
+
T.value = !0;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, fe = async () => {
|
|
113
|
+
if (!q.value)
|
|
114
|
+
try {
|
|
115
|
+
await pe(), i.value = V.COMPLETED, a("on-update-jwt", "password", "edit", d.value), a("on-toast", { color: "success", text: "Пароль изменён" }), a("close");
|
|
116
|
+
} catch {
|
|
117
|
+
}
|
|
118
|
+
}, me = async () => {
|
|
119
|
+
d.value = "", f.value = "", w.newPassword = !1, w.newPasswordConfirm = !1, i.value = V.OLD, v.oldPassword = "", a("close");
|
|
120
|
+
}, G = u(() => w.newPassword ? d.value.trim() ? d.value.trim().length < Z ? `Пароль слишком короткий. Введите хотя бы ${Z} символов` : "" : "Введите пароль" : ""), W = u(() => w.newPasswordConfirm ? f.value.trim() ? f.value !== d.value ? "Пароли не совпадают" : "" : "Повторите пароль" : ""), q = u(() => !!G.value || !!W.value);
|
|
121
|
+
return ye(async () => {
|
|
122
|
+
try {
|
|
123
|
+
await ce(), await j("password");
|
|
124
|
+
} finally {
|
|
125
|
+
I.value = !1;
|
|
126
|
+
}
|
|
127
|
+
}), (t, e) => (C(), _(Ce, null, [
|
|
128
|
+
n(o(Ve), {
|
|
129
|
+
modelValue: p.value,
|
|
130
|
+
"onUpdate:modelValue": [
|
|
131
|
+
e[9] || (e[9] = (s) => p.value = s),
|
|
132
|
+
L
|
|
133
|
+
],
|
|
134
|
+
width: "small",
|
|
135
|
+
"auto-height": !0,
|
|
136
|
+
"close-on-click-outside": !0,
|
|
137
|
+
"onClick:outside": L
|
|
138
|
+
}, {
|
|
139
|
+
header: P(() => [
|
|
140
|
+
l("div", ke, [
|
|
141
|
+
n(o(be), {
|
|
142
|
+
"slot-left": !1,
|
|
143
|
+
size: "small",
|
|
144
|
+
borded: !0,
|
|
145
|
+
"no-padding": !1
|
|
146
|
+
}, {
|
|
147
|
+
title: P(() => [
|
|
148
|
+
l("span", De, g(t.title), 1)
|
|
149
|
+
]),
|
|
150
|
+
"right-button": P(() => [
|
|
151
|
+
n(o(Ie), {
|
|
152
|
+
class: "cross",
|
|
153
|
+
onClick: L
|
|
154
|
+
})
|
|
155
|
+
]),
|
|
156
|
+
_: 1
|
|
157
|
+
})
|
|
158
|
+
])
|
|
159
|
+
]),
|
|
160
|
+
default: P(() => [
|
|
161
|
+
i.value === o(V).OLD ? (C(), _("div", Ee, [
|
|
162
|
+
l("div", he, [
|
|
163
|
+
l("div", Le, g(t.hintText), 1),
|
|
164
|
+
l("div", Ne, [
|
|
165
|
+
n(o($), {
|
|
166
|
+
modelValue: v.oldPassword,
|
|
167
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => v.oldPassword = s),
|
|
168
|
+
size: "large",
|
|
169
|
+
"text-size": "medium",
|
|
170
|
+
label: "Текущий пароль",
|
|
171
|
+
type: se.value,
|
|
172
|
+
error: ne.value,
|
|
173
|
+
onBlur: e[1] || (e[1] = (s) => A("oldPassword")),
|
|
174
|
+
onInput: e[2] || (e[2] = (s) => A("oldPassword"))
|
|
175
|
+
}, null, 8, ["modelValue", "type", "error"]),
|
|
176
|
+
(C(), S(B(x.value ? o(z) : o(M)), {
|
|
177
|
+
class: "icon-locked",
|
|
178
|
+
onClick: te
|
|
179
|
+
}))
|
|
180
|
+
]),
|
|
181
|
+
n(o(O), {
|
|
182
|
+
style: { width: "100%" },
|
|
183
|
+
disabled: de.value,
|
|
184
|
+
onClick: ve
|
|
185
|
+
}, {
|
|
186
|
+
default: P(() => e[10] || (e[10] = [
|
|
187
|
+
R(g("Продолжить"))
|
|
188
|
+
])),
|
|
189
|
+
_: 1,
|
|
190
|
+
__: [10]
|
|
191
|
+
}, 8, ["disabled"])
|
|
192
|
+
])
|
|
193
|
+
])) : Y("", !0),
|
|
194
|
+
i.value === o(V).NEW ? (C(), _("div", _e, [
|
|
195
|
+
l("div", Se, [
|
|
196
|
+
e[14] || (e[14] = l("div", { class: "dialogDefaultContainerTextHint" }, g("Установите новый пароль для защиты аккаунта. Пароль должен содержать не менее 8 символов."), -1)),
|
|
197
|
+
l("div", Be, [
|
|
198
|
+
n(o($), {
|
|
199
|
+
modelValue: d.value,
|
|
200
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => d.value = s),
|
|
201
|
+
size: "large",
|
|
202
|
+
"text-size": "medium",
|
|
203
|
+
label: "Новый пароль",
|
|
204
|
+
type: oe.value,
|
|
205
|
+
error: G.value,
|
|
206
|
+
onBlur: e[4] || (e[4] = (s) => w.newPassword = !0),
|
|
207
|
+
onInput: e[5] || (e[5] = (s) => w.newPassword = !0)
|
|
208
|
+
}, null, 8, ["modelValue", "type", "error"]),
|
|
209
|
+
(C(), S(B(k.value ? o(z) : o(M)), {
|
|
210
|
+
class: "icon-locked",
|
|
211
|
+
onClick: re
|
|
212
|
+
}))
|
|
213
|
+
]),
|
|
214
|
+
l("div", Re, [
|
|
215
|
+
n(o($), {
|
|
216
|
+
modelValue: f.value,
|
|
217
|
+
"onUpdate:modelValue": e[6] || (e[6] = (s) => f.value = s),
|
|
218
|
+
size: "large",
|
|
219
|
+
"text-size": "medium",
|
|
220
|
+
label: "Повторите новый пароль",
|
|
221
|
+
type: ae.value,
|
|
222
|
+
error: W.value,
|
|
223
|
+
onBlur: e[7] || (e[7] = (s) => w.newPasswordConfirm = !0),
|
|
224
|
+
onInput: e[8] || (e[8] = (s) => w.newPasswordConfirm = !0)
|
|
225
|
+
}, null, 8, ["modelValue", "type", "error"]),
|
|
226
|
+
(C(), S(B(D.value ? o(z) : o(M)), {
|
|
227
|
+
class: "icon-locked",
|
|
228
|
+
onClick: le
|
|
229
|
+
}))
|
|
230
|
+
]),
|
|
231
|
+
l("div", $e, [
|
|
232
|
+
n(o(O), {
|
|
233
|
+
style: { width: "100%" },
|
|
234
|
+
color: "secondary",
|
|
235
|
+
disabled: H.value,
|
|
236
|
+
onClick: me
|
|
237
|
+
}, {
|
|
238
|
+
default: P(() => e[11] || (e[11] = [
|
|
239
|
+
R(g("Отмена"))
|
|
240
|
+
])),
|
|
241
|
+
_: 1,
|
|
242
|
+
__: [11]
|
|
243
|
+
}, 8, ["disabled"]),
|
|
244
|
+
e[13] || (e[13] = l("div", { style: { width: "5%" } }, null, -1)),
|
|
245
|
+
n(o(O), {
|
|
246
|
+
style: { width: "100%" },
|
|
247
|
+
disabled: ie.value,
|
|
248
|
+
onClick: fe
|
|
249
|
+
}, {
|
|
250
|
+
default: P(() => e[12] || (e[12] = [
|
|
251
|
+
R(g("Сохранить"))
|
|
252
|
+
])),
|
|
253
|
+
_: 1,
|
|
254
|
+
__: [12]
|
|
255
|
+
}, 8, ["disabled"])
|
|
256
|
+
])
|
|
257
|
+
])
|
|
258
|
+
])) : Y("", !0)
|
|
259
|
+
]),
|
|
260
|
+
_: 1
|
|
261
|
+
}, 8, ["modelValue"]),
|
|
262
|
+
n(o(Te))
|
|
263
|
+
], 64));
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
export {
|
|
267
|
+
Ue as default
|
|
268
|
+
};
|