@yourgoods/ui-smart 0.30.0 → 0.32.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-Bcjd6d7z.js → ProfileEmailDialog-BCBd_O2U.js} +271 -281
- package/dist/{ProfilePasswordDialog-CoyO2ZMq.js → ProfilePasswordDialog-BceSLpxy.js} +1 -1
- package/dist/{ProfilePhoneDialog-DwUrEI73.js → ProfilePhoneDialog-6A8CraBl.js} +289 -299
- package/dist/{index-BVFeD92e.js → index-D8GpZOPw.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/{useRateLimitToast-7uS9YHDn.js → useRateLimitToast-DGG5L4f3.js} +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createElementBlock as T, openBlock as h, createElementVNode as
|
|
2
|
-
import { T as fe, c as Oe, a as We, u as je, P as
|
|
3
|
-
import { IconTelegramSm as ge, PInput as
|
|
4
|
-
import { C as
|
|
1
|
+
import { createElementBlock as T, openBlock as h, createElementVNode as F, defineComponent as ue, reactive as ce, watch as Y, ref as O, toRefs as me, computed as B, createCommentVNode as k, createVNode as S, toDisplayString as j, createBlock as G, createTextVNode as X, unref as u, isRef as ee, withCtx as Q, onMounted as Ue, Fragment as qe } from "vue";
|
|
2
|
+
import { T as fe, c as Oe, a as We, u as je, P as Be, b as He } from "./useRateLimitToast-DGG5L4f3.js";
|
|
3
|
+
import { IconTelegramSm as ge, PInput as te, IconPhoneMd as Ge, IconMailMd as Le, PButton as De, PDialog as Je, PTopBar as Ke, IconCrossMd as Qe, PTeleportContainer as Xe } from "@profeat/ui-kit";
|
|
4
|
+
import { C as W, t as Ee, p as _, g as Ie } from "./index-D8GpZOPw.js";
|
|
5
5
|
const Ye = {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: "12",
|
|
@@ -10,7 +10,7 @@ const Ye = {
|
|
|
10
10
|
};
|
|
11
11
|
function Ze(N, x) {
|
|
12
12
|
return h(), T("svg", Ye, x[0] || (x[0] = [
|
|
13
|
-
|
|
13
|
+
F("path", {
|
|
14
14
|
fill: "#1C7EF1",
|
|
15
15
|
"fill-rule": "evenodd",
|
|
16
16
|
d: "M1 0a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1zm1.5 2a.5.5 0 0 0-.5.5v9a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5zM6 13a1 1 0 1 0 0 2 1 1 0 0 0 0-2",
|
|
@@ -18,13 +18,13 @@ function Ze(N, x) {
|
|
|
18
18
|
}, null, -1)
|
|
19
19
|
]));
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const oe = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }, et = { style: { display: "flex", width: "100%", gap: "4px", "align-items": "center", "justify-content": "center", "text-align": "center" } }, tt = { class: "dialogDefaultContainerTextHint" }, ot = { class: "chip" }, nt = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "input-wrapper"
|
|
24
24
|
}, at = {
|
|
25
25
|
key: 1,
|
|
26
26
|
class: "input-wrapper"
|
|
27
|
-
}, lt = /* @__PURE__ */
|
|
27
|
+
}, lt = /* @__PURE__ */ ue({
|
|
28
28
|
__name: "OldPhoneContent",
|
|
29
29
|
props: {
|
|
30
30
|
phone: {},
|
|
@@ -43,87 +43,87 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
43
43
|
},
|
|
44
44
|
emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code-again", "on-send-only-sms", "on-clear-code-error"],
|
|
45
45
|
setup(N, { emit: x }) {
|
|
46
|
-
const
|
|
46
|
+
const V = N, c = x, p = ce({
|
|
47
47
|
touched: { phone: !1, code: !1 },
|
|
48
|
-
phoneModel:
|
|
49
|
-
codeModel:
|
|
48
|
+
phoneModel: V.phone,
|
|
49
|
+
codeModel: V.code
|
|
50
50
|
});
|
|
51
|
-
|
|
51
|
+
Y(
|
|
52
52
|
() => p.phoneModel,
|
|
53
53
|
(i) => c("update:phone", i)
|
|
54
|
-
),
|
|
54
|
+
), Y(
|
|
55
55
|
() => p.codeModel,
|
|
56
56
|
(i) => c("update:code", i)
|
|
57
57
|
);
|
|
58
|
-
const
|
|
58
|
+
const f = (i) => {
|
|
59
59
|
p.touched[i] = !0;
|
|
60
60
|
};
|
|
61
61
|
let g = O("");
|
|
62
|
-
const
|
|
62
|
+
const E = (i) => {
|
|
63
63
|
c("on-clear-code-error");
|
|
64
64
|
const d = i.target;
|
|
65
65
|
let v = ((d == null ? void 0 : d.value) ?? "").replace(/\D/g, "");
|
|
66
66
|
v.length > 4 && (v = v.slice(0, 4)), M.value = v, d && d.value !== v && (d.value = v), v.length === 4 && v !== g.value && (g.value = v, c("on-match-code", { phone: e.value, code: v }));
|
|
67
|
-
},
|
|
67
|
+
}, H = () => c("on-send-code-again", { phone: p.phoneModel }), J = () => {
|
|
68
68
|
console.debug("onSendCodeViaSms"), c("on-send-only-sms", { phone: p.phoneModel });
|
|
69
|
-
}, { phoneModel: e, codeModel: M, touched: C } = me(p), y =
|
|
69
|
+
}, { phoneModel: e, codeModel: M, touched: C } = me(p), y = B(() => C.value.phone && !e.value.trim() ? "Введите телефон" : V.phoneError), z = B(() => V.isNotMatchCode ? "Неверный код" : C.value.code ? M.value.trim() ? V.codeError ?? null : "Введите код" : "");
|
|
70
70
|
return (i, d) => (h(), T("div", _e, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
i.isTg ? (h(),
|
|
71
|
+
F("div", et, [
|
|
72
|
+
F("div", tt, j(i.hintText), 1),
|
|
73
|
+
F("div", ot, [
|
|
74
|
+
i.isTg ? (h(), G(u(ge), { key: 0 })) : (h(), G(u(oe), {
|
|
75
75
|
key: 1,
|
|
76
76
|
style: { "margin-left": "5px" }
|
|
77
77
|
})),
|
|
78
|
-
|
|
78
|
+
X(" " + j(i.isTg ? "Telegram" : "СМС"), 1)
|
|
79
79
|
])
|
|
80
80
|
]),
|
|
81
81
|
i.showPhone ? (h(), T("div", nt, [
|
|
82
|
-
S(u(
|
|
82
|
+
S(u(te), {
|
|
83
83
|
modelValue: u(e),
|
|
84
|
-
"onUpdate:modelValue": d[0] || (d[0] = (v) =>
|
|
84
|
+
"onUpdate:modelValue": d[0] || (d[0] = (v) => ee(e) ? e.value = v : null),
|
|
85
85
|
size: "large",
|
|
86
86
|
"text-size": "medium",
|
|
87
87
|
label: "Телефон",
|
|
88
88
|
type: "tel",
|
|
89
89
|
error: y.value,
|
|
90
90
|
disabled: !0,
|
|
91
|
-
onBlur: d[1] || (d[1] = (v) =>
|
|
92
|
-
onInput: d[2] || (d[2] = (v) =>
|
|
91
|
+
onBlur: d[1] || (d[1] = (v) => f("phone")),
|
|
92
|
+
onInput: d[2] || (d[2] = (v) => f("phone"))
|
|
93
93
|
}, null, 8, ["modelValue", "error"]),
|
|
94
94
|
S(u(Ge), {
|
|
95
95
|
class: "icon-locked",
|
|
96
96
|
onClick: d[3] || (d[3] = (v) => i.$emit("edit", "phone"))
|
|
97
97
|
})
|
|
98
|
-
])) :
|
|
98
|
+
])) : k("", !0),
|
|
99
99
|
i.showCode ? (h(), T("div", at, [
|
|
100
|
-
S(u(
|
|
100
|
+
S(u(te), {
|
|
101
101
|
modelValue: u(M),
|
|
102
|
-
"onUpdate:modelValue": d[4] || (d[4] = (v) =>
|
|
102
|
+
"onUpdate:modelValue": d[4] || (d[4] = (v) => ee(M) ? M.value = v : null),
|
|
103
103
|
size: "large",
|
|
104
104
|
"text-size": "medium",
|
|
105
105
|
label: "Код",
|
|
106
106
|
type: "text",
|
|
107
|
-
error:
|
|
108
|
-
onInput:
|
|
109
|
-
onBlur: d[5] || (d[5] = (v) =>
|
|
107
|
+
error: z.value,
|
|
108
|
+
onInput: E,
|
|
109
|
+
onBlur: d[5] || (d[5] = (v) => f("code"))
|
|
110
110
|
}, null, 8, ["modelValue", "error"])
|
|
111
|
-
])) :
|
|
111
|
+
])) : k("", !0),
|
|
112
112
|
S(fe, {
|
|
113
113
|
loading: i.loading,
|
|
114
114
|
"rate-limit-text": i.rateLimitText,
|
|
115
115
|
"is-final-limit": i.isFinalLimit,
|
|
116
|
-
"on-send-again":
|
|
116
|
+
"on-send-again": H
|
|
117
117
|
}, {
|
|
118
|
-
extra:
|
|
118
|
+
extra: Q(() => [
|
|
119
119
|
i.isTg ? (h(), T("span", {
|
|
120
120
|
key: 0,
|
|
121
121
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
122
|
-
onClick:
|
|
122
|
+
onClick: J
|
|
123
123
|
}, [
|
|
124
|
-
|
|
125
|
-
S(u(
|
|
126
|
-
])) :
|
|
124
|
+
X(j(i.sendCodeBySmsText) + " ", 1),
|
|
125
|
+
S(u(oe), { style: { "margin-left": "5px" } })
|
|
126
|
+
])) : k("", !0)
|
|
127
127
|
]),
|
|
128
128
|
_: 1
|
|
129
129
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
@@ -150,7 +150,7 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
150
150
|
}, pt = {
|
|
151
151
|
key: 2,
|
|
152
152
|
class: "input-wrapper"
|
|
153
|
-
}, ht = { key: 3 }, vt = /* @__PURE__ */
|
|
153
|
+
}, ht = { key: 3 }, vt = /* @__PURE__ */ ue({
|
|
154
154
|
__name: "NewPhoneContent",
|
|
155
155
|
props: {
|
|
156
156
|
phone: {},
|
|
@@ -168,133 +168,128 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
168
168
|
},
|
|
169
169
|
emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code", "on-send-code-again", "on-send-only-sms", "on-clear-code-error"],
|
|
170
170
|
setup(N, { emit: x }) {
|
|
171
|
-
const
|
|
171
|
+
const V = N, c = x, p = O(!1), f = O(""), g = ce({
|
|
172
172
|
touched: { phone: !1, code: !1 },
|
|
173
173
|
phoneModel: "",
|
|
174
174
|
codeModel: ""
|
|
175
175
|
});
|
|
176
|
-
|
|
176
|
+
Y(
|
|
177
177
|
() => g.phoneModel,
|
|
178
|
-
(
|
|
179
|
-
c("update:phone",
|
|
178
|
+
(o) => {
|
|
179
|
+
c("update:phone", o), f.value = "";
|
|
180
180
|
}
|
|
181
|
-
),
|
|
181
|
+
), Y(
|
|
182
182
|
() => g.codeModel,
|
|
183
|
-
(
|
|
183
|
+
(o) => c("update:code", o)
|
|
184
184
|
);
|
|
185
|
-
const
|
|
186
|
-
const
|
|
187
|
-
return /^\+?\d{10,15}$/.test(
|
|
188
|
-
}),
|
|
189
|
-
var n;
|
|
185
|
+
const E = (o) => g.touched[o] = !0, H = B(() => {
|
|
186
|
+
const n = g.phoneModel.trim().replace(/[()\-\s]/g, "");
|
|
187
|
+
return /^\+?\d{10,15}$/.test(n);
|
|
188
|
+
}), J = B(() => !H.value || !!f.value), e = async () => {
|
|
189
|
+
var o, n;
|
|
190
190
|
try {
|
|
191
|
-
if (
|
|
192
|
-
|
|
191
|
+
if (E("phone"), !H.value) {
|
|
192
|
+
f.value = "Это не похоже на номер телефона";
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
if (checkPhoneFormatError(t)) {
|
|
197
|
-
m.value = "это не похоже на номер телефона";
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
const { data: l } = t.data;
|
|
195
|
+
const l = await Oe(void 0, A(g.phoneModel)), { data: R } = l.data;
|
|
201
196
|
if (console.debug("result for checkAvailability: ", {
|
|
202
|
-
res:
|
|
203
|
-
data:
|
|
204
|
-
}), !(((n =
|
|
205
|
-
|
|
197
|
+
res: l,
|
|
198
|
+
data: R
|
|
199
|
+
}), !(((n = (o = R == null ? void 0 : R.data) == null ? void 0 : o[0]) == null ? void 0 : n.available) ?? !1)) {
|
|
200
|
+
f.value = "Такой номер уже используется";
|
|
206
201
|
return;
|
|
207
202
|
}
|
|
208
|
-
|
|
209
|
-
} catch (
|
|
210
|
-
console.error("Неизвестная ошибка при проверке доступности телефона:",
|
|
203
|
+
f.value = "", c("on-send-code", { phone: g.phoneModel, prevPhone: V.oldPhone, offLoading: !0 }), p.value = !0;
|
|
204
|
+
} catch (l) {
|
|
205
|
+
console.error("Неизвестная ошибка при проверке доступности телефона:", l), f.value = "Это не похоже на номер телефона";
|
|
211
206
|
}
|
|
212
207
|
};
|
|
213
208
|
let M = O("");
|
|
214
|
-
const C = (
|
|
209
|
+
const C = (o) => {
|
|
215
210
|
c("on-clear-code-error");
|
|
216
|
-
const
|
|
217
|
-
let l = ((
|
|
218
|
-
l.length > 4 && (l = l.slice(0, 4)), d.value = l,
|
|
211
|
+
const n = o.target;
|
|
212
|
+
let l = ((n == null ? void 0 : n.value) ?? "").replace(/\D/g, "");
|
|
213
|
+
l.length > 4 && (l = l.slice(0, 4)), d.value = l, n && n.value !== l && (n.value = l), l.length === 4 && l !== M.value && (M.value = l, c("on-match-code", { phone: i.value, code: l }));
|
|
219
214
|
}, y = () => {
|
|
220
215
|
c("on-send-code-again", { phone: g.phoneModel });
|
|
221
|
-
},
|
|
216
|
+
}, z = () => {
|
|
222
217
|
console.debug("onSendCodeViaSms"), c("on-send-only-sms", { phone: g.phoneModel });
|
|
223
|
-
}, { phoneModel: i, codeModel: d, touched: v } = me(g),
|
|
224
|
-
return (
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
}, { phoneModel: i, codeModel: d, touched: v } = me(g), K = B(() => f.value ? f.value : v.value.phone && !i.value.trim() ? "Это не похоже на номер телефона" : V.phoneError || ""), ne = B(() => V.isNotMatchCode ? "Неверный код" : v.value.code ? d.value.trim() ? V.codeError ?? null : "Введите код" : "");
|
|
219
|
+
return (o, n) => (h(), T("div", st, [
|
|
220
|
+
F("div", it, [
|
|
221
|
+
F("div", dt, j(p.value ? "Чтобы продолжить, введите код подтверждения из" : o.hintText), 1),
|
|
227
222
|
p.value ? (h(), T("div", rt, [
|
|
228
|
-
|
|
223
|
+
o.isTg ? (h(), G(u(ge), { key: 0 })) : (h(), G(u(oe), {
|
|
229
224
|
key: 1,
|
|
230
225
|
style: { "margin-left": "5px" }
|
|
231
226
|
})),
|
|
232
|
-
|
|
233
|
-
])) :
|
|
227
|
+
X(" " + j(o.isTg ? "Telegram" : "СМС"), 1)
|
|
228
|
+
])) : k("", !0)
|
|
234
229
|
]),
|
|
235
|
-
|
|
236
|
-
S(u(
|
|
230
|
+
o.showPhone ? (h(), T("div", ut, [
|
|
231
|
+
S(u(te), {
|
|
237
232
|
modelValue: u(i),
|
|
238
|
-
"onUpdate:modelValue":
|
|
233
|
+
"onUpdate:modelValue": n[0] || (n[0] = (l) => ee(i) ? i.value = l : null),
|
|
239
234
|
size: "large",
|
|
240
235
|
"text-size": "medium",
|
|
241
236
|
label: "Телефон",
|
|
242
237
|
type: "tel",
|
|
243
|
-
error:
|
|
244
|
-
onBlur:
|
|
245
|
-
onInput:
|
|
238
|
+
error: K.value,
|
|
239
|
+
onBlur: n[1] || (n[1] = (l) => E("phone")),
|
|
240
|
+
onInput: n[2] || (n[2] = (l) => E("phone"))
|
|
246
241
|
}, null, 8, ["modelValue", "error"]),
|
|
247
242
|
S(u(Le), {
|
|
248
243
|
class: "icon-locked",
|
|
249
|
-
onClick:
|
|
244
|
+
onClick: n[3] || (n[3] = (l) => o.$emit("edit", "phone"))
|
|
250
245
|
})
|
|
251
|
-
])) :
|
|
252
|
-
p.value ?
|
|
246
|
+
])) : k("", !0),
|
|
247
|
+
p.value ? k("", !0) : (h(), T("div", ct, [
|
|
253
248
|
S(u(De), {
|
|
254
249
|
style: { width: "100%" },
|
|
255
|
-
disabled:
|
|
250
|
+
disabled: J.value,
|
|
256
251
|
onClick: e
|
|
257
252
|
}, {
|
|
258
|
-
default:
|
|
259
|
-
|
|
253
|
+
default: Q(() => n[6] || (n[6] = [
|
|
254
|
+
X(" Отправить код ")
|
|
260
255
|
])),
|
|
261
256
|
_: 1,
|
|
262
257
|
__: [6]
|
|
263
258
|
}, 8, ["disabled"])
|
|
264
259
|
])),
|
|
265
260
|
p.value ? (h(), T("div", pt, [
|
|
266
|
-
S(u(
|
|
261
|
+
S(u(te), {
|
|
267
262
|
modelValue: u(d),
|
|
268
|
-
"onUpdate:modelValue":
|
|
263
|
+
"onUpdate:modelValue": n[4] || (n[4] = (l) => ee(d) ? d.value = l : null),
|
|
269
264
|
size: "large",
|
|
270
265
|
"text-size": "medium",
|
|
271
266
|
label: "Код",
|
|
272
267
|
type: "text",
|
|
273
|
-
error:
|
|
268
|
+
error: ne.value,
|
|
274
269
|
onInput: C,
|
|
275
|
-
onBlur:
|
|
270
|
+
onBlur: n[5] || (n[5] = (l) => E("code"))
|
|
276
271
|
}, null, 8, ["modelValue", "error"])
|
|
277
|
-
])) :
|
|
278
|
-
!
|
|
272
|
+
])) : k("", !0),
|
|
273
|
+
!o.loading && p.value ? (h(), T("div", ht, [
|
|
279
274
|
S(fe, {
|
|
280
|
-
loading:
|
|
281
|
-
"rate-limit-text":
|
|
282
|
-
"is-final-limit":
|
|
275
|
+
loading: o.loading,
|
|
276
|
+
"rate-limit-text": o.rateLimitText,
|
|
277
|
+
"is-final-limit": o.isFinalLimit,
|
|
283
278
|
"on-send-again": y
|
|
284
279
|
}, {
|
|
285
|
-
extra:
|
|
286
|
-
|
|
280
|
+
extra: Q(() => [
|
|
281
|
+
o.isTg ? (h(), T("span", {
|
|
287
282
|
key: 0,
|
|
288
283
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
289
|
-
onClick:
|
|
284
|
+
onClick: z
|
|
290
285
|
}, [
|
|
291
|
-
|
|
292
|
-
S(u(
|
|
293
|
-
])) :
|
|
286
|
+
X(j(o.sendCodeBySmsText) + " ", 1),
|
|
287
|
+
S(u(oe), { style: { "margin-left": "5px" } })
|
|
288
|
+
])) : k("", !0)
|
|
294
289
|
]),
|
|
295
290
|
_: 1
|
|
296
291
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
297
|
-
])) :
|
|
292
|
+
])) : k("", !0)
|
|
298
293
|
]));
|
|
299
294
|
}
|
|
300
295
|
}), mt = { class: "dialogDefaultContainerInsideContent" }, ft = { style: { display: "flex", width: "100%", gap: "4px", "align-items": "center", "justify-content": "center", "text-align": "center" } }, gt = { class: "dialogDefaultContainerTextHint" }, yt = { class: "chip" }, Ct = {
|
|
@@ -306,7 +301,7 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
306
301
|
}, Pt = {
|
|
307
302
|
key: 2,
|
|
308
303
|
class: "input-wrapper"
|
|
309
|
-
}, Tt = { key: 3 }, St = /* @__PURE__ */
|
|
304
|
+
}, Tt = { key: 3 }, St = /* @__PURE__ */ ue({
|
|
310
305
|
__name: "AddNewPhoneContent",
|
|
311
306
|
props: {
|
|
312
307
|
phone: {},
|
|
@@ -324,139 +319,134 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
324
319
|
},
|
|
325
320
|
emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code", "on-send-code-again", "on-send-only-sms", "on-clear-code-error"],
|
|
326
321
|
setup(N, { emit: x }) {
|
|
327
|
-
const
|
|
322
|
+
const V = N, c = x, p = O(!1), f = O(""), g = ce({
|
|
328
323
|
touched: { phone: !1, code: !1 },
|
|
329
324
|
phoneModel: "",
|
|
330
325
|
codeModel: ""
|
|
331
326
|
});
|
|
332
|
-
|
|
327
|
+
Y(
|
|
333
328
|
() => g.phoneModel,
|
|
334
|
-
(
|
|
335
|
-
c("update:phone",
|
|
329
|
+
(o) => {
|
|
330
|
+
c("update:phone", o), f.value = "";
|
|
336
331
|
}
|
|
337
|
-
),
|
|
332
|
+
), Y(
|
|
338
333
|
() => g.codeModel,
|
|
339
|
-
(
|
|
334
|
+
(o) => c("update:code", o)
|
|
340
335
|
);
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
return /^\+?\d{10,15}$/.test(
|
|
344
|
-
}),
|
|
345
|
-
var n;
|
|
336
|
+
const E = (o) => g.touched[o] = !0, H = B(() => {
|
|
337
|
+
const n = g.phoneModel.trim().replace(/[()\-\s]/g, "");
|
|
338
|
+
return /^\+?\d{10,15}$/.test(n);
|
|
339
|
+
}), J = B(() => !H.value || !!f.value), e = async () => {
|
|
340
|
+
var o, n;
|
|
346
341
|
try {
|
|
347
|
-
if (
|
|
348
|
-
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
const t = await Oe(void 0, A(g.phoneModel));
|
|
352
|
-
if (checkPhoneFormatError(t)) {
|
|
353
|
-
m.value = "это не похоже на номер телефона";
|
|
342
|
+
if (E("phone"), !H.value) {
|
|
343
|
+
f.value = "Это не похоже на номер телефона";
|
|
354
344
|
return;
|
|
355
345
|
}
|
|
356
|
-
const { data:
|
|
357
|
-
if (!(((n =
|
|
358
|
-
|
|
346
|
+
const l = await Oe(void 0, A(g.phoneModel)), { data: R } = l.data;
|
|
347
|
+
if (!(((n = (o = R == null ? void 0 : R.data) == null ? void 0 : o[0]) == null ? void 0 : n.available) ?? !1)) {
|
|
348
|
+
f.value = "Такой номер уже используется";
|
|
359
349
|
return;
|
|
360
350
|
}
|
|
361
|
-
|
|
362
|
-
} catch (
|
|
363
|
-
console.error("Неизвестная ошибка при проверке доступности телефона:",
|
|
351
|
+
f.value = "", c("on-send-code", { phone: g.phoneModel, prevPhone: V.oldPhone, offLoading: !0 }), p.value = !0;
|
|
352
|
+
} catch (l) {
|
|
353
|
+
console.error("Неизвестная ошибка при проверке доступности телефона:", l), f.value = "Это не похоже на номер телефона";
|
|
364
354
|
}
|
|
365
355
|
};
|
|
366
356
|
let M = "";
|
|
367
|
-
const C = (
|
|
357
|
+
const C = (o) => {
|
|
368
358
|
c("on-clear-code-error");
|
|
369
|
-
const
|
|
370
|
-
let l =
|
|
371
|
-
l.length > 4 && (l = l.slice(0, 4),
|
|
359
|
+
const n = o.target;
|
|
360
|
+
let l = n.value.replace(/\D/g, "");
|
|
361
|
+
l.length > 4 && (l = l.slice(0, 4), n.value = l), g.codeModel = l, l.length === 4 && l !== M && (M = l, c("on-match-code", { phone: g.phoneModel, code: l }));
|
|
372
362
|
}, y = () => {
|
|
373
363
|
c("on-send-code-again", { phone: g.phoneModel });
|
|
374
|
-
},
|
|
364
|
+
}, z = () => {
|
|
375
365
|
console.debug("onSendCodeViaSms"), c("on-send-only-sms", { phone: g.phoneModel });
|
|
376
|
-
}, { phoneModel: i, codeModel: d, touched: v } = me(g),
|
|
377
|
-
return (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
366
|
+
}, { phoneModel: i, codeModel: d, touched: v } = me(g), K = B(() => f.value ? f.value : v.value.phone && !i.value.trim() ? "Это не похоже на номер телефона" : V.phoneError || ""), ne = B(() => V.isNotMatchCode ? "Неверный код" : g.touched.code ? d.value.trim() ? V.codeError ?? null : "Введите код" : "");
|
|
367
|
+
return (o, n) => (h(), T("div", mt, [
|
|
368
|
+
F("div", ft, [
|
|
369
|
+
F("div", gt, j(p.value ? "Чтобы продолжить, введите код подтверждения из" : o.hintText), 1),
|
|
370
|
+
F("div", yt, [
|
|
371
|
+
o.isTg ? (h(), G(u(ge), { key: 0 })) : (h(), G(u(oe), {
|
|
382
372
|
key: 1,
|
|
383
373
|
style: { "margin-left": "5px" }
|
|
384
374
|
})),
|
|
385
|
-
|
|
375
|
+
X(" " + j(o.isTg ? "Telegram" : "СМС"), 1)
|
|
386
376
|
])
|
|
387
377
|
]),
|
|
388
|
-
|
|
389
|
-
S(u(
|
|
378
|
+
o.showPhone ? (h(), T("div", Ct, [
|
|
379
|
+
S(u(te), {
|
|
390
380
|
modelValue: u(i),
|
|
391
|
-
"onUpdate:modelValue":
|
|
381
|
+
"onUpdate:modelValue": n[0] || (n[0] = (l) => ee(i) ? i.value = l : null),
|
|
392
382
|
size: "large",
|
|
393
383
|
"text-size": "medium",
|
|
394
384
|
label: "Телефон",
|
|
395
385
|
type: "tel",
|
|
396
|
-
error:
|
|
397
|
-
onBlur:
|
|
398
|
-
onInput:
|
|
386
|
+
error: K.value,
|
|
387
|
+
onBlur: n[1] || (n[1] = (l) => E("phone")),
|
|
388
|
+
onInput: n[2] || (n[2] = (l) => E("phone"))
|
|
399
389
|
}, null, 8, ["modelValue", "error"]),
|
|
400
390
|
S(u(Le), {
|
|
401
391
|
class: "icon-locked",
|
|
402
|
-
onClick:
|
|
392
|
+
onClick: n[3] || (n[3] = (l) => o.$emit("edit", "phone"))
|
|
403
393
|
})
|
|
404
|
-
])) :
|
|
405
|
-
p.value ?
|
|
394
|
+
])) : k("", !0),
|
|
395
|
+
p.value ? k("", !0) : (h(), T("div", wt, [
|
|
406
396
|
S(u(De), {
|
|
407
397
|
style: { width: "100%" },
|
|
408
|
-
disabled:
|
|
398
|
+
disabled: J.value,
|
|
409
399
|
onClick: e
|
|
410
400
|
}, {
|
|
411
|
-
default:
|
|
412
|
-
|
|
401
|
+
default: Q(() => n[6] || (n[6] = [
|
|
402
|
+
X(" Отправить код ")
|
|
413
403
|
])),
|
|
414
404
|
_: 1,
|
|
415
405
|
__: [6]
|
|
416
406
|
}, 8, ["disabled"])
|
|
417
407
|
])),
|
|
418
408
|
p.value ? (h(), T("div", Pt, [
|
|
419
|
-
S(u(
|
|
409
|
+
S(u(te), {
|
|
420
410
|
modelValue: u(d),
|
|
421
|
-
"onUpdate:modelValue":
|
|
411
|
+
"onUpdate:modelValue": n[4] || (n[4] = (l) => ee(d) ? d.value = l : null),
|
|
422
412
|
size: "large",
|
|
423
413
|
"text-size": "medium",
|
|
424
414
|
label: "Код",
|
|
425
415
|
type: "text",
|
|
426
|
-
error:
|
|
416
|
+
error: ne.value,
|
|
427
417
|
onInput: C,
|
|
428
|
-
onBlur:
|
|
418
|
+
onBlur: n[5] || (n[5] = (l) => E("code"))
|
|
429
419
|
}, null, 8, ["modelValue", "error"])
|
|
430
|
-
])) :
|
|
420
|
+
])) : k("", !0),
|
|
431
421
|
p.value ? (h(), T("div", Tt, [
|
|
432
422
|
S(fe, {
|
|
433
|
-
loading:
|
|
434
|
-
"rate-limit-text":
|
|
435
|
-
"is-final-limit":
|
|
423
|
+
loading: o.loading,
|
|
424
|
+
"rate-limit-text": o.rateLimitText,
|
|
425
|
+
"is-final-limit": o.isFinalLimit,
|
|
436
426
|
"on-send-again": y
|
|
437
427
|
}, {
|
|
438
|
-
extra:
|
|
439
|
-
|
|
428
|
+
extra: Q(() => [
|
|
429
|
+
o.isTg ? (h(), T("span", {
|
|
440
430
|
key: 0,
|
|
441
431
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
442
|
-
onClick:
|
|
432
|
+
onClick: z
|
|
443
433
|
}, [
|
|
444
|
-
|
|
445
|
-
S(u(
|
|
446
|
-
])) :
|
|
434
|
+
X(j(o.sendCodeBySmsText) + " ", 1),
|
|
435
|
+
S(u(oe), { style: { "margin-left": "5px" } })
|
|
436
|
+
])) : k("", !0)
|
|
447
437
|
]),
|
|
448
438
|
_: 1
|
|
449
439
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
450
|
-
])) :
|
|
440
|
+
])) : k("", !0)
|
|
451
441
|
]));
|
|
452
442
|
}
|
|
453
443
|
}), Mt = { class: "text-center w-full" }, xt = { class: "dialogTitle" }, bt = {
|
|
454
444
|
key: 0,
|
|
455
445
|
class: "dialogDefaultContainer"
|
|
456
|
-
},
|
|
446
|
+
}, Vt = { key: 3 }, kt = {
|
|
457
447
|
key: 1,
|
|
458
448
|
class: "dialogDefaultContainer"
|
|
459
|
-
},
|
|
449
|
+
}, se = 3, Ot = /* @__PURE__ */ ue({
|
|
460
450
|
__name: "ProfilePhoneDialog",
|
|
461
451
|
props: {
|
|
462
452
|
modelValue: { type: Boolean },
|
|
@@ -468,32 +458,32 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
468
458
|
mode: { default: void 0 }
|
|
469
459
|
},
|
|
470
460
|
emits: ["update:modelValue", "submit-phone", "edit", "close", "clean-input-errors", "on-update-jwt", "update-phone-field", "on-toast"],
|
|
471
|
-
setup(N, { expose: x, emit:
|
|
472
|
-
const c = N, p =
|
|
473
|
-
|
|
461
|
+
setup(N, { expose: x, emit: V }) {
|
|
462
|
+
const c = N, p = V, f = O(c.modelValue);
|
|
463
|
+
Y(
|
|
474
464
|
() => c.modelValue,
|
|
475
|
-
(s) =>
|
|
476
|
-
),
|
|
477
|
-
const g =
|
|
465
|
+
(s) => f.value = s
|
|
466
|
+
), Y(f, (s) => p("update:modelValue", s));
|
|
467
|
+
const g = B(() => c.language ?? "ru"), E = (s) => Ee[g.value] && Ee[g.value][s] || (c.title ?? s), H = B(() => c.title ?? E("Смена номера телефона")), J = B(() => c.hintText ?? E("Чтобы продолжить, введите новый номер")), e = ce({
|
|
478
468
|
oldPhone: c.initialPhone ?? "",
|
|
479
469
|
newPhone: "",
|
|
480
470
|
code: "",
|
|
481
471
|
addPhone: "",
|
|
482
472
|
addCode: ""
|
|
483
|
-
}), M = O(
|
|
473
|
+
}), M = O(W.OLD), C = O(null), y = O(!1), z = O(!1), i = O("tg"), d = B(() => i.value === "tg"), v = O(!1), { startTimer: K, remainingSeconds: ne, isAvailableForSendAgain: o, totalRateAttempts: n, currentRateAttempt: l } = We(), { showRateLimitToast: R } = He(p), { isEditFlow: ae, getFlow: Ae } = je(O(c.mode)), ie = B(() => o.value ? "Повторить" : `${ne.value}`), le = O(se), de = B(() => le.value === 0), Ne = (s) => new Promise((a) => setTimeout(a, s));
|
|
484
474
|
async function pe(s = "email") {
|
|
485
|
-
var
|
|
486
|
-
return (
|
|
475
|
+
var t;
|
|
476
|
+
return (t = (await Ie("/users/profile/session/get-edit-session", { params: { field: s } })).data) == null ? void 0 : t.data;
|
|
487
477
|
}
|
|
488
478
|
async function ye(s = "phone") {
|
|
489
479
|
var b;
|
|
490
|
-
const
|
|
480
|
+
const t = (b = (await _("/users/profile/session/create-if-not-exists", {
|
|
491
481
|
field: s,
|
|
492
482
|
oldValue: A(c.initialPhone)
|
|
493
483
|
})).data) == null ? void 0 : b.data;
|
|
494
|
-
C.value = (
|
|
484
|
+
C.value = (t == null ? void 0 : t.sessionId) ?? null, M.value = (t == null ? void 0 : t.step) ?? W.OLD, e.oldPhone = (t == null ? void 0 : t.oldValue) ?? "", e.newPhone = (t == null ? void 0 : t.newValue) ?? "";
|
|
495
485
|
}
|
|
496
|
-
async function
|
|
486
|
+
async function ze() {
|
|
497
487
|
try {
|
|
498
488
|
const s = await pe("phone");
|
|
499
489
|
C.value = s.sessionId, M.value = s.step, e.oldPhone = s.oldValue ?? "", s.sessionId || await ye("phone");
|
|
@@ -502,9 +492,9 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
502
492
|
}
|
|
503
493
|
}
|
|
504
494
|
async function Ce(s, a = !1) {
|
|
505
|
-
var
|
|
495
|
+
var t;
|
|
506
496
|
try {
|
|
507
|
-
const b = await
|
|
497
|
+
const b = await _(
|
|
508
498
|
"/users/profile/check-throttler",
|
|
509
499
|
{
|
|
510
500
|
method: "sms",
|
|
@@ -518,22 +508,22 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
518
508
|
}
|
|
519
509
|
);
|
|
520
510
|
await Ne(1e3);
|
|
521
|
-
const w = (
|
|
522
|
-
return w ? (w.restTimeSec > 0 ? (
|
|
511
|
+
const w = (t = b.data) == null ? void 0 : t.data;
|
|
512
|
+
return w ? (w.restTimeSec > 0 ? (K(w.restTimeSec), o.value = !1, n.value = w.attempts.total, l.value = w.attempts.total - w.attempts.available, le.value = w.attempts.available ?? se) : o.value = !0, w) : null;
|
|
523
513
|
} catch {
|
|
524
514
|
return null;
|
|
525
515
|
}
|
|
526
516
|
}
|
|
527
|
-
const he = async ({ phone: s }) => (v.value = !0, await
|
|
528
|
-
var b, w, L, D,
|
|
517
|
+
const he = async ({ phone: s }) => (v.value = !0, await Z({ value: s, isOnlySms: !0 })), Z = async ({ value: s, isOnlySms: a, offLoading: t } = {}) => {
|
|
518
|
+
var b, w, L, D, U, $;
|
|
529
519
|
y.value = !0;
|
|
530
520
|
try {
|
|
531
|
-
const
|
|
521
|
+
const m = s ?? e.oldPhone, r = await _(
|
|
532
522
|
"/users/profile/phone/contact/send-code",
|
|
533
523
|
{
|
|
534
524
|
sessionId: C.value,
|
|
535
|
-
phone: A(
|
|
536
|
-
value: A(
|
|
525
|
+
phone: A(m),
|
|
526
|
+
value: A(m),
|
|
537
527
|
oldValue: A(e.oldPhone),
|
|
538
528
|
provider: c.provider,
|
|
539
529
|
isOnlySms: a ?? !1
|
|
@@ -548,70 +538,70 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
548
538
|
const P = (w = (b = r == null ? void 0 : r.data) == null ? void 0 : b.data) == null ? void 0 : w.deliveryType;
|
|
549
539
|
if ((P === "tg" || P === "sms") && (i.value = P, P === "tg" && (v.value = !1)), console.debug("sendContactCode before обработка 403 tooManyRequests", r), (r == null ? void 0 : r.status) === 403 && ((L = r.data) != null && L.tooManyRequests)) {
|
|
550
540
|
console.debug("sendContactCode IN обработка 403 tooManyRequests", r);
|
|
551
|
-
const I = (
|
|
541
|
+
const I = (U = (D = r.data) == null ? void 0 : D.tooManyRequests) == null ? void 0 : U.type;
|
|
552
542
|
i.value = I;
|
|
553
|
-
const
|
|
554
|
-
return
|
|
543
|
+
const q = r.data.tooManyRequests;
|
|
544
|
+
return q.restTimeSec > 0 ? (K(q.restTimeSec), n.value = q.attempts.total, l.value = q.attempts.total - q.attempts.available, le.value = q.attempts.available ?? se) : o.value = !0, r;
|
|
555
545
|
}
|
|
556
|
-
return console.debug("sendContactCode after обработка 403 tooManyRequests", r), await Ce(
|
|
557
|
-
} catch (
|
|
558
|
-
const r = ($ =
|
|
559
|
-
if ((
|
|
546
|
+
return console.debug("sendContactCode after обработка 403 tooManyRequests", r), await Ce(m), r;
|
|
547
|
+
} catch (m) {
|
|
548
|
+
const r = ($ = m == null ? void 0 : m.data) == null ? void 0 : $.tooManyRequests;
|
|
549
|
+
if ((m == null ? void 0 : m.status) === 403 && r) {
|
|
560
550
|
const { restTimeSec: P, attempts: I } = r;
|
|
561
|
-
return P > 0 ? (
|
|
551
|
+
return P > 0 ? (K(P), n.value = I.total, l.value = I.total - I.available, le.value = I.available ?? se) : o.value = !0, m;
|
|
562
552
|
}
|
|
563
|
-
throw
|
|
553
|
+
throw m;
|
|
564
554
|
} finally {
|
|
565
|
-
y.value = !1,
|
|
555
|
+
y.value = !1, t && (y.value = !1);
|
|
566
556
|
}
|
|
567
557
|
}, we = async (s, a) => {
|
|
568
|
-
var
|
|
558
|
+
var t, b, w, L, D, U, $, m;
|
|
569
559
|
y.value = !0;
|
|
570
560
|
try {
|
|
571
561
|
const r = await pe("phone");
|
|
572
562
|
C.value = r.sessionId, M.value = r.step, e.oldPhone = r.oldValue ?? e.oldPhone, e.newPhone = r.newValue ?? e.newPhone;
|
|
573
|
-
const P = await
|
|
574
|
-
phone: a ===
|
|
563
|
+
const P = await _("/users/profile/change/phone/match-code", {
|
|
564
|
+
phone: a === W.NEW ? A(e.newPhone) : A(e.oldPhone),
|
|
575
565
|
sessionId: C.value,
|
|
576
566
|
code: s,
|
|
577
567
|
step: a
|
|
578
|
-
}), I = ((
|
|
579
|
-
if (
|
|
580
|
-
|
|
568
|
+
}), I = ((t = P.data) == null ? void 0 : t.nextStep) ?? ((w = (b = P.data) == null ? void 0 : b.data) == null ? void 0 : w.nextStep), q = ((D = (L = P.data) == null ? void 0 : L.data) == null ? void 0 : D.rateLimit) ?? ((U = P.data) == null ? void 0 : U.rateLimit) ?? null, Re = (($ = P.data) == null ? void 0 : $.data.success) ?? ((m = P.data) == null ? void 0 : m.success);
|
|
569
|
+
if (R(q), !Re) {
|
|
570
|
+
z.value = !0;
|
|
581
571
|
return;
|
|
582
572
|
}
|
|
583
573
|
if (!I) return P;
|
|
584
|
-
if (M.value = I, I ===
|
|
574
|
+
if (M.value = I, I === W.NEW) {
|
|
585
575
|
const $e = await pe("phone");
|
|
586
576
|
e.oldPhone = $e.oldValue ?? e.oldPhone, e.newPhone = $e.newValue ?? e.newPhone, e.code = "";
|
|
587
577
|
}
|
|
588
|
-
return I ===
|
|
578
|
+
return I === W.COMPLETED && (e.code = "", p("update-phone-field", e.addPhone), p("submit-phone", { phone: e.oldPhone, code: s }), p("on-toast", { color: "success", text: "Номер телефона изменён" }), p("on-update-jwt", "phone", "edit", e.newPhone), C.value = null, p("close")), P;
|
|
589
579
|
} finally {
|
|
590
580
|
y.value = !1;
|
|
591
581
|
}
|
|
592
|
-
}, Pe = ({ code: s }) => we(s,
|
|
582
|
+
}, Pe = ({ code: s }) => we(s, W.OLD);
|
|
593
583
|
function Te(s) {
|
|
594
584
|
}
|
|
595
|
-
const Se = ({ code: s }) => we(s,
|
|
585
|
+
const Se = ({ code: s }) => we(s, W.NEW);
|
|
596
586
|
function Me(s) {
|
|
597
587
|
}
|
|
598
|
-
const
|
|
599
|
-
p("close"),
|
|
588
|
+
const re = () => {
|
|
589
|
+
p("close"), f.value = !1;
|
|
600
590
|
};
|
|
601
591
|
async function xe(s = "phone") {
|
|
602
|
-
var
|
|
603
|
-
return (
|
|
592
|
+
var t;
|
|
593
|
+
return (t = (await Ie("/users/profile/session/get-bind-session", { params: { field: s } })).data) == null ? void 0 : t.data;
|
|
604
594
|
}
|
|
605
595
|
async function be({
|
|
606
596
|
value: s,
|
|
607
597
|
field: a = "phone",
|
|
608
|
-
offLoading:
|
|
598
|
+
offLoading: t = !0
|
|
609
599
|
}) {
|
|
610
600
|
var b, w, L;
|
|
611
601
|
y.value = !0;
|
|
612
602
|
try {
|
|
613
603
|
if (!C.value) {
|
|
614
|
-
const D = await
|
|
604
|
+
const D = await _("/users/profile/session/bind/create", {
|
|
615
605
|
field: a,
|
|
616
606
|
newValue: A(s || e.addPhone)
|
|
617
607
|
});
|
|
@@ -619,10 +609,10 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
619
609
|
throw new Error("не удалось создать bind-сессию (sessionId отсутствует)");
|
|
620
610
|
}
|
|
621
611
|
} finally {
|
|
622
|
-
|
|
612
|
+
t && (y.value = !1);
|
|
623
613
|
}
|
|
624
614
|
}
|
|
625
|
-
async function
|
|
615
|
+
async function Fe() {
|
|
626
616
|
try {
|
|
627
617
|
const s = await xe("phone");
|
|
628
618
|
C.value = s.sessionId, M.value = s.step, e.addPhone = s.newValue ?? "", s.sessionId || await be({ field: "phone", value: e.addPhone });
|
|
@@ -633,7 +623,7 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
633
623
|
const ve = async ({
|
|
634
624
|
value: s,
|
|
635
625
|
field: a = "phone",
|
|
636
|
-
isOnlySms:
|
|
626
|
+
isOnlySms: t = !1,
|
|
637
627
|
offLoading: b = !0
|
|
638
628
|
} = {}) => {
|
|
639
629
|
var w, L, D;
|
|
@@ -641,175 +631,175 @@ const te = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
641
631
|
try {
|
|
642
632
|
if (!C.value)
|
|
643
633
|
throw new Error("bind-сессия не найдена. создайте её через createBindSession.");
|
|
644
|
-
const
|
|
634
|
+
const U = s ?? e.addPhone, $ = await _(
|
|
645
635
|
`/users/profile/bind/contact/send-code/${a}`,
|
|
646
636
|
{
|
|
647
637
|
sessionId: C.value,
|
|
648
|
-
phone: A(
|
|
638
|
+
phone: A(U),
|
|
649
639
|
provider: c.provider,
|
|
650
|
-
isOnlySms:
|
|
640
|
+
isOnlySms: t ?? !1
|
|
651
641
|
},
|
|
652
642
|
{
|
|
653
643
|
headers: {
|
|
654
|
-
"x-only-sms":
|
|
644
|
+
"x-only-sms": t ?? !1
|
|
655
645
|
}
|
|
656
646
|
}
|
|
657
|
-
),
|
|
658
|
-
(
|
|
647
|
+
), m = (L = (w = $ == null ? void 0 : $.data) == null ? void 0 : w.data) == null ? void 0 : L.deliveryType;
|
|
648
|
+
(m === "tg" || m === "sms") && (i.value = m, m === "tg" && (v.value = !1));
|
|
659
649
|
const r = (D = $.data) == null ? void 0 : D.tooManyRequests;
|
|
660
650
|
if ($.status === 403 && r) {
|
|
661
651
|
const I = r == null ? void 0 : r.type;
|
|
662
|
-
return i.value = I, r.restTimeSec > 0 ? (
|
|
652
|
+
return i.value = I, r.restTimeSec > 0 ? (K(r.restTimeSec), n.value = r.attempts.total, l.value = r.attempts.total - r.attempts.available, le.value = r.attempts.available ?? se) : o.value = !0, $;
|
|
663
653
|
}
|
|
664
|
-
const P = await Ce(
|
|
665
|
-
return P && P.restTimeSec > 0 ? (
|
|
654
|
+
const P = await Ce(U);
|
|
655
|
+
return P && P.restTimeSec > 0 ? (K(P.restTimeSec), o.value = !1) : o.value = !0, $;
|
|
666
656
|
} finally {
|
|
667
657
|
b && (y.value = !1);
|
|
668
658
|
}
|
|
669
|
-
},
|
|
670
|
-
var a,
|
|
659
|
+
}, Ve = async ({ code: s }) => {
|
|
660
|
+
var a, t, b, w, L, D, U, $;
|
|
671
661
|
y.value = !0;
|
|
672
662
|
try {
|
|
673
663
|
if (!C.value) {
|
|
674
|
-
const
|
|
675
|
-
C.value =
|
|
664
|
+
const q = await xe("phone");
|
|
665
|
+
C.value = q.sessionId, e.addPhone = q.newValue ?? e.addPhone;
|
|
676
666
|
}
|
|
677
|
-
const
|
|
667
|
+
const m = await _("/users/profile/bind/phone/match-code", {
|
|
678
668
|
phone: A(e.addPhone),
|
|
679
669
|
sessionId: C.value,
|
|
680
670
|
code: s
|
|
681
|
-
}), r = ((a =
|
|
682
|
-
if (
|
|
683
|
-
|
|
671
|
+
}), r = ((a = m.data) == null ? void 0 : a.nextStep) ?? ((b = (t = m.data) == null ? void 0 : t.data) == null ? void 0 : b.nextStep), P = ((L = (w = m.data) == null ? void 0 : w.data) == null ? void 0 : L.rateLimit) ?? ((D = m.data) == null ? void 0 : D.rateLimit) ?? null, I = ((U = m.data) == null ? void 0 : U.data.success) ?? (($ = m.data) == null ? void 0 : $.success);
|
|
672
|
+
if (R(P), !I) {
|
|
673
|
+
z.value = !0;
|
|
684
674
|
return;
|
|
685
675
|
}
|
|
686
|
-
return r && r ===
|
|
676
|
+
return r && r === W.COMPLETED && (e.code = "", p("update-phone-field", e.addPhone), p("submit-phone", { phone: e.addPhone, code: s }), p("on-update-jwt", "phone", "bind", e.addPhone), p("on-toast", { color: "success", text: "Номер телефона успешно привязан к аккаунту" }), C.value = null, p("close")), m;
|
|
687
677
|
} finally {
|
|
688
678
|
y.value = !1;
|
|
689
679
|
}
|
|
690
|
-
},
|
|
680
|
+
}, ke = async () => {
|
|
691
681
|
};
|
|
692
682
|
return Ue(async () => {
|
|
693
683
|
y.value = !0;
|
|
694
684
|
const s = await Ae("phone");
|
|
695
685
|
if (c.mode === "bind" && s === "bind") {
|
|
696
|
-
await
|
|
686
|
+
await Fe(), y.value = !1;
|
|
697
687
|
return;
|
|
698
688
|
}
|
|
699
|
-
await
|
|
689
|
+
await ze(), await Z({});
|
|
700
690
|
}), x({
|
|
701
|
-
localVisible:
|
|
691
|
+
localVisible: f,
|
|
702
692
|
form: e,
|
|
703
693
|
currentStep: M,
|
|
704
694
|
loading: y,
|
|
705
|
-
rateLimitText:
|
|
706
|
-
isAvailable:
|
|
707
|
-
title:
|
|
708
|
-
hintText:
|
|
709
|
-
handleClose:
|
|
710
|
-
sendContactCode:
|
|
695
|
+
rateLimitText: ie,
|
|
696
|
+
isAvailable: de,
|
|
697
|
+
title: H,
|
|
698
|
+
hintText: J,
|
|
699
|
+
handleClose: re,
|
|
700
|
+
sendContactCode: Z,
|
|
711
701
|
sendBindContactCode: ve,
|
|
712
702
|
handleOldCodeSuccess: Pe,
|
|
713
703
|
handleOldCodeError: Te,
|
|
714
704
|
handleNewCodeSuccess: Se,
|
|
715
705
|
handleNewCodeError: Me,
|
|
716
|
-
matchBindCode:
|
|
717
|
-
matchBindCodeError:
|
|
706
|
+
matchBindCode: Ve,
|
|
707
|
+
matchBindCodeError: ke
|
|
718
708
|
}), (s, a) => (h(), T(qe, null, [
|
|
719
709
|
S(u(Je), {
|
|
720
|
-
modelValue:
|
|
710
|
+
modelValue: f.value,
|
|
721
711
|
"onUpdate:modelValue": [
|
|
722
|
-
a[15] || (a[15] = (
|
|
723
|
-
|
|
712
|
+
a[15] || (a[15] = (t) => f.value = t),
|
|
713
|
+
re
|
|
724
714
|
],
|
|
725
715
|
width: "small",
|
|
726
716
|
"auto-height": !0,
|
|
727
717
|
"close-on-click-outside": !0,
|
|
728
|
-
"onClick:outside":
|
|
718
|
+
"onClick:outside": re
|
|
729
719
|
}, {
|
|
730
|
-
header:
|
|
731
|
-
|
|
720
|
+
header: Q(() => [
|
|
721
|
+
F("div", Mt, [
|
|
732
722
|
S(u(Ke), {
|
|
733
723
|
"slot-left": !1,
|
|
734
724
|
size: "small",
|
|
735
725
|
borded: !0,
|
|
736
726
|
"no-padding": !1
|
|
737
727
|
}, {
|
|
738
|
-
title:
|
|
739
|
-
|
|
728
|
+
title: Q(() => [
|
|
729
|
+
F("span", xt, j(u(ae) ? H.value : "Добавление номера телефона"), 1)
|
|
740
730
|
]),
|
|
741
|
-
"right-button":
|
|
731
|
+
"right-button": Q(() => [
|
|
742
732
|
S(u(Qe), {
|
|
743
733
|
class: "cross",
|
|
744
|
-
onClick:
|
|
734
|
+
onClick: re
|
|
745
735
|
})
|
|
746
736
|
]),
|
|
747
737
|
_: 1
|
|
748
738
|
})
|
|
749
739
|
])
|
|
750
740
|
]),
|
|
751
|
-
default:
|
|
752
|
-
u(
|
|
753
|
-
y.value ? (h(),
|
|
754
|
-
M.value === u(
|
|
741
|
+
default: Q(() => [
|
|
742
|
+
u(ae) ? (h(), T("div", bt, [
|
|
743
|
+
y.value ? (h(), G(Be, { key: 0 })) : k("", !0),
|
|
744
|
+
M.value === u(W).OLD ? (h(), G(lt, {
|
|
755
745
|
key: 1,
|
|
756
746
|
phone: e.oldPhone,
|
|
757
|
-
"onUpdate:phone": a[0] || (a[0] = (
|
|
747
|
+
"onUpdate:phone": a[0] || (a[0] = (t) => e.oldPhone = t),
|
|
758
748
|
code: e.code,
|
|
759
|
-
"onUpdate:code": a[1] || (a[1] = (
|
|
760
|
-
"rate-limit-text":
|
|
761
|
-
"is-final-limit":
|
|
762
|
-
"is-not-match-code":
|
|
749
|
+
"onUpdate:code": a[1] || (a[1] = (t) => e.code = t),
|
|
750
|
+
"rate-limit-text": ie.value,
|
|
751
|
+
"is-final-limit": de.value,
|
|
752
|
+
"is-not-match-code": z.value,
|
|
763
753
|
loading: y.value,
|
|
764
754
|
"is-tg": d.value,
|
|
765
|
-
onOnSendCode: a[2] || (a[2] = (
|
|
766
|
-
onOnSendCodeAgain: a[3] || (a[3] = (
|
|
755
|
+
onOnSendCode: a[2] || (a[2] = (t) => Z({ value: e.oldPhone })),
|
|
756
|
+
onOnSendCodeAgain: a[3] || (a[3] = (t) => Z({ value: e.oldPhone, isOnlySms: !d.value && v.value })),
|
|
767
757
|
onOnSendOnlySms: he,
|
|
768
758
|
onOnMatchCode: Pe,
|
|
769
759
|
onOnMatchCodeError: Te
|
|
770
|
-
}, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === u(
|
|
760
|
+
}, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === u(W).NEW ? (h(), G(vt, {
|
|
771
761
|
key: 2,
|
|
772
762
|
phone: e.newPhone,
|
|
773
|
-
"onUpdate:phone": a[4] || (a[4] = (
|
|
763
|
+
"onUpdate:phone": a[4] || (a[4] = (t) => e.newPhone = t),
|
|
774
764
|
oldPhone: e.oldPhone,
|
|
775
|
-
"onUpdate:oldPhone": a[5] || (a[5] = (
|
|
765
|
+
"onUpdate:oldPhone": a[5] || (a[5] = (t) => e.oldPhone = t),
|
|
776
766
|
code: e.code,
|
|
777
|
-
"onUpdate:code": a[6] || (a[6] = (
|
|
778
|
-
"hint-text":
|
|
779
|
-
"rate-limit-text":
|
|
780
|
-
"is-final-limit":
|
|
781
|
-
"is-not-match-code":
|
|
767
|
+
"onUpdate:code": a[6] || (a[6] = (t) => e.code = t),
|
|
768
|
+
"hint-text": J.value,
|
|
769
|
+
"rate-limit-text": ie.value,
|
|
770
|
+
"is-final-limit": de.value,
|
|
771
|
+
"is-not-match-code": z.value,
|
|
782
772
|
loading: y.value,
|
|
783
773
|
"is-tg": d.value,
|
|
784
|
-
onOnSendCode: a[7] || (a[7] = (
|
|
785
|
-
onOnSendCodeAgain: a[8] || (a[8] = (
|
|
774
|
+
onOnSendCode: a[7] || (a[7] = (t) => Z({ value: e.newPhone })),
|
|
775
|
+
onOnSendCodeAgain: a[8] || (a[8] = (t) => Z({ value: e.newPhone, isOnlySms: !d.value && v.value })),
|
|
786
776
|
onOnSendOnlySms: he,
|
|
787
777
|
onOnMatchCode: Se,
|
|
788
778
|
onOnMatchCodeError: Me,
|
|
789
|
-
onOnClearCodeError: a[9] || (a[9] = (
|
|
790
|
-
}, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === u(
|
|
791
|
-
|
|
792
|
-
])) :
|
|
793
|
-
])) : (h(), T("div",
|
|
794
|
-
y.value ? (h(),
|
|
779
|
+
onOnClearCodeError: a[9] || (a[9] = (t) => z.value = !1)
|
|
780
|
+
}, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === u(W).COMPLETED ? (h(), T("div", Vt, [
|
|
781
|
+
F("p", null, j(E("Телефон успешно изменен")), 1)
|
|
782
|
+
])) : k("", !0)
|
|
783
|
+
])) : (h(), T("div", kt, [
|
|
784
|
+
y.value ? (h(), G(Be, { key: 0 })) : k("", !0),
|
|
795
785
|
S(St, {
|
|
796
786
|
phone: e.addPhone,
|
|
797
|
-
"onUpdate:phone": a[10] || (a[10] = (
|
|
787
|
+
"onUpdate:phone": a[10] || (a[10] = (t) => e.addPhone = t),
|
|
798
788
|
oldPhone: e.oldPhone,
|
|
799
|
-
"onUpdate:oldPhone": a[11] || (a[11] = (
|
|
789
|
+
"onUpdate:oldPhone": a[11] || (a[11] = (t) => e.oldPhone = t),
|
|
800
790
|
code: e.addCode,
|
|
801
|
-
"onUpdate:code": a[12] || (a[12] = (
|
|
802
|
-
"hint-text": u(
|
|
803
|
-
"rate-limit-text":
|
|
804
|
-
"is-final-limit":
|
|
805
|
-
"is-not-match-code":
|
|
791
|
+
"onUpdate:code": a[12] || (a[12] = (t) => e.addCode = t),
|
|
792
|
+
"hint-text": u(ae) ? J.value : "Чтобы продолжить, введите новый номер",
|
|
793
|
+
"rate-limit-text": ie.value,
|
|
794
|
+
"is-final-limit": de.value,
|
|
795
|
+
"is-not-match-code": z.value,
|
|
806
796
|
loading: y.value,
|
|
807
797
|
"is-tg": d.value,
|
|
808
|
-
onOnSendCode: a[13] || (a[13] = (
|
|
809
|
-
onOnSendCodeAgain: a[14] || (a[14] = (
|
|
798
|
+
onOnSendCode: a[13] || (a[13] = (t) => ve({ value: e.addPhone, field: "phone" })),
|
|
799
|
+
onOnSendCodeAgain: a[14] || (a[14] = (t) => ve({ value: e.addPhone, field: "phone", isOnlySms: !d.value && v.value })),
|
|
810
800
|
onOnSendOnlySms: he,
|
|
811
|
-
onOnMatchCode:
|
|
812
|
-
onOnMatchCodeError:
|
|
801
|
+
onOnMatchCode: Ve,
|
|
802
|
+
onOnMatchCodeError: ke
|
|
813
803
|
}, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])
|
|
814
804
|
]))
|
|
815
805
|
]),
|