@yourgoods/ui-smart 0.23.0 → 0.24.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-DPTEe3Y3.js +782 -0
- package/dist/{ProfilePasswordDialog-3Ob3HwjU.js → ProfilePasswordDialog-DPOBi_fa.js} +1 -1
- package/dist/{ProfilePhoneDialog-Zze9Yipg.js → ProfilePhoneDialog-DFy1u-gG.js} +265 -269
- package/dist/{index-Du1aTQoC.js → index-BMP0GdRz.js} +3 -3
- package/dist/index.js +1 -1
- package/dist/{useRateLimitToast-CF0qx7i_.js → useRateLimitToast-BSzwSahA.js} +1 -1
- package/package.json +1 -1
- package/dist/ProfileEmailDialog-CPVQCZFW.js +0 -778
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
2
|
-
import { T as ge, c as Oe, a as qe, u as We, P as Be, b as He } from "./useRateLimitToast-
|
|
1
|
+
import { createElementBlock as S, openBlock as p, createElementVNode as U, defineComponent as ce, reactive as pe, watch as te, ref as D, toRefs as fe, computed as z, createCommentVNode as $, createVNode as T, toDisplayString as K, createBlock as Q, createTextVNode as oe, unref as r, isRef as se, withCtx as _, onMounted as Ue, Fragment as je } from "vue";
|
|
2
|
+
import { T as ge, c as Oe, a as qe, u as We, P as Be, b as He } from "./useRateLimitToast-BSzwSahA.js";
|
|
3
3
|
import { IconTelegramSm as ye, PInput as de, IconPhoneMd as Ke, IconMailMd as De, PButton as Ae, PDialog as Ge, PTopBar as Je, IconCrossMd as Qe, PTeleportContainer as Xe } from "@profeat/ui-kit";
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as H, t as Ie, p as le, g as Le } from "./index-BMP0GdRz.js";
|
|
5
5
|
const Ye = {
|
|
6
6
|
xmlns: "http://www.w3.org/2000/svg",
|
|
7
7
|
width: "12",
|
|
8
8
|
height: "16",
|
|
9
9
|
fill: "none"
|
|
10
10
|
};
|
|
11
|
-
function Ze(R,
|
|
12
|
-
return p(),
|
|
11
|
+
function Ze(R, V) {
|
|
12
|
+
return p(), S("svg", Ye, V[0] || (V[0] = [
|
|
13
13
|
U("path", {
|
|
14
14
|
fill: "#1C7EF1",
|
|
15
15
|
"fill-rule": "evenodd",
|
|
@@ -42,11 +42,11 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
42
42
|
isTg: { type: Boolean }
|
|
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
|
-
setup(R, { emit:
|
|
46
|
-
const
|
|
45
|
+
setup(R, { emit: V }) {
|
|
46
|
+
const E = R, u = V, c = pe({
|
|
47
47
|
touched: { phone: !1, code: !1 },
|
|
48
|
-
phoneModel:
|
|
49
|
-
codeModel:
|
|
48
|
+
phoneModel: E.phone,
|
|
49
|
+
codeModel: E.code
|
|
50
50
|
});
|
|
51
51
|
te(
|
|
52
52
|
() => c.phoneModel,
|
|
@@ -63,23 +63,23 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
63
63
|
u("on-clear-code-error");
|
|
64
64
|
const h = d.target;
|
|
65
65
|
let m = ((h == null ? void 0 : h.value) ?? "").replace(/\D/g, "");
|
|
66
|
-
m.length > 4 && (m = m.slice(0, 4)),
|
|
67
|
-
},
|
|
66
|
+
m.length > 4 && (m = m.slice(0, 4)), M.value = m, h && h.value !== m && (h.value = m), m.length === 4 && m !== g.value && (g.value = m, u("on-match-code", { phone: e.value, code: m }));
|
|
67
|
+
}, G = () => u("on-send-code-again", { phone: c.phoneModel }), X = () => {
|
|
68
68
|
console.debug("onSendCodeViaSms"), u("on-send-only-sms", { phone: c.phoneModel });
|
|
69
|
-
}, { phoneModel: e, codeModel:
|
|
70
|
-
return (d, h) => (p(),
|
|
69
|
+
}, { phoneModel: e, codeModel: M, touched: C } = fe(c), y = z(() => C.value.phone && !e.value.trim() ? "Введите телефон" : E.phoneError), x = z(() => E.isNotMatchCode ? "Неверный код" : C.value.code ? M.value.trim() ? E.codeError ?? null : "Введите код" : "");
|
|
70
|
+
return (d, h) => (p(), S("div", _e, [
|
|
71
71
|
U("div", eo, [
|
|
72
|
-
U("div", oo,
|
|
72
|
+
U("div", oo, K(d.hintText), 1),
|
|
73
73
|
U("div", to, [
|
|
74
|
-
d.isTg ? (p(),
|
|
74
|
+
d.isTg ? (p(), Q(r(ye), { key: 0 })) : (p(), Q(r(ie), {
|
|
75
75
|
key: 1,
|
|
76
76
|
style: { "margin-left": "5px" }
|
|
77
77
|
})),
|
|
78
|
-
oe(" " +
|
|
78
|
+
oe(" " + K(d.isTg ? "Telegram" : "СМС"), 1)
|
|
79
79
|
])
|
|
80
80
|
]),
|
|
81
|
-
d.showPhone ? (p(),
|
|
82
|
-
|
|
81
|
+
d.showPhone ? (p(), S("div", no, [
|
|
82
|
+
T(r(de), {
|
|
83
83
|
modelValue: r(e),
|
|
84
84
|
"onUpdate:modelValue": h[0] || (h[0] = (m) => se(e) ? e.value = m : null),
|
|
85
85
|
size: "large",
|
|
@@ -91,53 +91,53 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
91
91
|
onBlur: h[1] || (h[1] = (m) => v("phone")),
|
|
92
92
|
onInput: h[2] || (h[2] = (m) => v("phone"))
|
|
93
93
|
}, null, 8, ["modelValue", "error"]),
|
|
94
|
-
|
|
94
|
+
T(r(Ke), {
|
|
95
95
|
class: "icon-locked",
|
|
96
96
|
onClick: h[3] || (h[3] = (m) => d.$emit("edit", "phone"))
|
|
97
97
|
})
|
|
98
|
-
])) :
|
|
99
|
-
d.showCode ? (p(),
|
|
100
|
-
|
|
101
|
-
modelValue: r(
|
|
102
|
-
"onUpdate:modelValue": h[4] || (h[4] = (m) => se(
|
|
98
|
+
])) : $("", !0),
|
|
99
|
+
d.showCode ? (p(), S("div", ao, [
|
|
100
|
+
T(r(de), {
|
|
101
|
+
modelValue: r(M),
|
|
102
|
+
"onUpdate:modelValue": h[4] || (h[4] = (m) => se(M) ? M.value = m : null),
|
|
103
103
|
size: "large",
|
|
104
104
|
"text-size": "medium",
|
|
105
105
|
label: "Код",
|
|
106
106
|
type: "text",
|
|
107
|
-
error:
|
|
107
|
+
error: x.value,
|
|
108
108
|
onInput: L,
|
|
109
109
|
onBlur: h[5] || (h[5] = (m) => v("code"))
|
|
110
110
|
}, null, 8, ["modelValue", "error"])
|
|
111
|
-
])) :
|
|
112
|
-
|
|
111
|
+
])) : $("", !0),
|
|
112
|
+
T(ge, {
|
|
113
113
|
loading: d.loading,
|
|
114
114
|
"rate-limit-text": d.rateLimitText,
|
|
115
115
|
"is-final-limit": d.isFinalLimit,
|
|
116
|
-
"on-send-again":
|
|
116
|
+
"on-send-again": G
|
|
117
117
|
}, {
|
|
118
118
|
extra: _(() => [
|
|
119
|
-
d.isTg ? (p(),
|
|
119
|
+
d.isTg ? (p(), S("span", {
|
|
120
120
|
key: 0,
|
|
121
121
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
122
|
-
onClick:
|
|
122
|
+
onClick: X
|
|
123
123
|
}, [
|
|
124
|
-
oe(
|
|
125
|
-
|
|
126
|
-
])) :
|
|
124
|
+
oe(K(d.sendCodeBySmsText) + " ", 1),
|
|
125
|
+
T(r(ie), { style: { "margin-left": "5px" } })
|
|
126
|
+
])) : $("", !0)
|
|
127
127
|
]),
|
|
128
128
|
_: 1
|
|
129
129
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
130
130
|
]));
|
|
131
131
|
}
|
|
132
132
|
}), F = (R) => {
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
136
|
-
return `+7${
|
|
137
|
-
if (
|
|
138
|
-
return `+${
|
|
133
|
+
const V = R.replace(/\D/g, "");
|
|
134
|
+
if (V.length >= 10 && V.length <= 15) {
|
|
135
|
+
if (V.startsWith("8"))
|
|
136
|
+
return `+7${V.slice(1)}`;
|
|
137
|
+
if (V.startsWith("7"))
|
|
138
|
+
return `+${V}`;
|
|
139
139
|
}
|
|
140
|
-
return R.trim().startsWith("+") ? R.trim() : `+${
|
|
140
|
+
return R.trim().startsWith("+") ? R.trim() : `+${V}`;
|
|
141
141
|
}, so = { class: "dialogDefaultContainerInsideContent" }, io = { style: { display: "flex", width: "100%", gap: "4px", "align-items": "center", "justify-content": "center", "text-align": "center" } }, ro = { class: "dialogDefaultContainerTextHint" }, uo = {
|
|
142
142
|
key: 0,
|
|
143
143
|
class: "chip"
|
|
@@ -167,8 +167,8 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
167
167
|
isTg: { type: Boolean }
|
|
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
|
-
setup(R, { emit:
|
|
171
|
-
const
|
|
170
|
+
setup(R, { emit: V }) {
|
|
171
|
+
const E = R, u = V, c = D(!1), v = D(""), g = pe({
|
|
172
172
|
touched: { phone: !1, code: !1 },
|
|
173
173
|
phoneModel: "",
|
|
174
174
|
codeModel: ""
|
|
@@ -182,33 +182,31 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
182
182
|
() => g.codeModel,
|
|
183
183
|
(l) => u("update:code", l)
|
|
184
184
|
);
|
|
185
|
-
const L = (l) => g.touched[l] = !0,
|
|
186
|
-
const
|
|
187
|
-
return /^\+?\d{10,15}$/.test(
|
|
188
|
-
}),
|
|
189
|
-
var l,
|
|
185
|
+
const L = (l) => g.touched[l] = !0, G = z(() => {
|
|
186
|
+
const t = g.phoneModel.trim().replace(/[()\-\s]/g, "");
|
|
187
|
+
return /^\+?\d{10,15}$/.test(t);
|
|
188
|
+
}), X = async () => {
|
|
189
|
+
var l, t;
|
|
190
190
|
try {
|
|
191
|
-
if (L("phone"), !
|
|
191
|
+
if (L("phone"), !G.value) {
|
|
192
192
|
v.value = "Это не похоже на номер телефона";
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
const {
|
|
196
|
-
|
|
197
|
-
} = await Oe(void 0, F(g.phoneModel));
|
|
198
|
-
if (!(((l = o == null ? void 0 : o[0]) == null ? void 0 : l.available) ?? !1)) {
|
|
195
|
+
const n = await Oe(void 0, F(g.phoneModel)), { data: P } = n.data;
|
|
196
|
+
if (!(((l = P == null ? void 0 : P[0]) == null ? void 0 : l.available) ?? !1)) {
|
|
199
197
|
v.value = "Такой номер уже используется";
|
|
200
198
|
return;
|
|
201
199
|
}
|
|
202
|
-
v.value = "", u("on-send-code", { phone: g.phoneModel, prevPhone:
|
|
203
|
-
} catch (
|
|
204
|
-
console.debug(
|
|
205
|
-
const
|
|
200
|
+
v.value = "", u("on-send-code", { phone: g.phoneModel, prevPhone: E.oldPhone, offLoading: !0 }), c.value = !0;
|
|
201
|
+
} catch (n) {
|
|
202
|
+
console.debug(n);
|
|
203
|
+
const P = (t = n == null ? void 0 : n.response) == null ? void 0 : t.data, B = P == null ? void 0 : P.message;
|
|
206
204
|
if (console.debug("global middle check onSendCode: ", {
|
|
207
|
-
errorData:
|
|
205
|
+
errorData: P,
|
|
208
206
|
message: B,
|
|
209
207
|
phoneTakenError: v
|
|
210
208
|
}), B) {
|
|
211
|
-
const
|
|
209
|
+
const Z = Array.isArray(B) ? B.join(" ") : String(B), ne = Z.toLowerCase(), J = [
|
|
212
210
|
"телефон должен быть в формате",
|
|
213
211
|
"valid phone number",
|
|
214
212
|
"phone must be a valid phone number",
|
|
@@ -217,107 +215,107 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
217
215
|
"newValue must be a valid phone number",
|
|
218
216
|
"addValue must be a valid phone number",
|
|
219
217
|
"addPhone must be a valid phone number"
|
|
220
|
-
],
|
|
218
|
+
], j = J.some(
|
|
221
219
|
(ee) => ne.includes(ee)
|
|
222
220
|
);
|
|
223
221
|
if (console.debug("global end check onSendCode: ", {
|
|
224
|
-
errorMessage:
|
|
222
|
+
errorMessage: Z,
|
|
225
223
|
lowerCaseError: ne,
|
|
226
|
-
phoneValidationKeywords:
|
|
227
|
-
hasPhoneError:
|
|
228
|
-
}),
|
|
224
|
+
phoneValidationKeywords: J,
|
|
225
|
+
hasPhoneError: j
|
|
226
|
+
}), j) {
|
|
229
227
|
v.value = "Это не похоже на номер телефона";
|
|
230
228
|
return;
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
|
-
console.error("Неизвестная ошибка при проверке доступности телефона:",
|
|
231
|
+
console.error("Неизвестная ошибка при проверке доступности телефона:", n), v.value = "Произошла ошибка сервера. Попробуйте позже";
|
|
234
232
|
}
|
|
235
233
|
};
|
|
236
234
|
let e = D("");
|
|
237
|
-
const
|
|
235
|
+
const M = (l) => {
|
|
238
236
|
u("on-clear-code-error");
|
|
239
|
-
const
|
|
240
|
-
let
|
|
241
|
-
|
|
237
|
+
const t = l.target;
|
|
238
|
+
let n = ((t == null ? void 0 : t.value) ?? "").replace(/\D/g, "");
|
|
239
|
+
n.length > 4 && (n = n.slice(0, 4)), d.value = n, t && t.value !== n && (t.value = n), n.length === 4 && n !== e.value && (e.value = n, u("on-match-code", { phone: x.value, code: n }));
|
|
242
240
|
}, C = () => {
|
|
243
241
|
u("on-send-code-again", { phone: g.phoneModel });
|
|
244
242
|
}, y = () => {
|
|
245
243
|
console.debug("onSendCodeViaSms"), u("on-send-only-sms", { phone: g.phoneModel });
|
|
246
|
-
}, { phoneModel:
|
|
247
|
-
return (l,
|
|
244
|
+
}, { phoneModel: x, codeModel: d, touched: h } = fe(g), m = z(() => v.value ? v.value : h.value.phone && !x.value.trim() ? "Это не похоже на номер телефона" : E.phoneError || ""), Y = z(() => E.isNotMatchCode ? "Неверный код" : h.value.code ? d.value.trim() ? E.codeError ?? null : "Введите код" : "");
|
|
245
|
+
return (l, t) => (p(), S("div", so, [
|
|
248
246
|
U("div", io, [
|
|
249
|
-
U("div", ro,
|
|
250
|
-
c.value ? (p(),
|
|
251
|
-
l.isTg ? (p(),
|
|
247
|
+
U("div", ro, K(c.value ? "Чтобы продолжить, введите код подтверждения из" : l.hintText), 1),
|
|
248
|
+
c.value ? (p(), S("div", uo, [
|
|
249
|
+
l.isTg ? (p(), Q(r(ye), { key: 0 })) : (p(), Q(r(ie), {
|
|
252
250
|
key: 1,
|
|
253
251
|
style: { "margin-left": "5px" }
|
|
254
252
|
})),
|
|
255
|
-
oe(" " +
|
|
256
|
-
])) :
|
|
253
|
+
oe(" " + K(l.isTg ? "Telegram" : "СМС"), 1)
|
|
254
|
+
])) : $("", !0)
|
|
257
255
|
]),
|
|
258
|
-
l.showPhone ? (p(),
|
|
259
|
-
|
|
260
|
-
modelValue: r(
|
|
261
|
-
"onUpdate:modelValue":
|
|
256
|
+
l.showPhone ? (p(), S("div", co, [
|
|
257
|
+
T(r(de), {
|
|
258
|
+
modelValue: r(x),
|
|
259
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => se(x) ? x.value = n : null),
|
|
262
260
|
size: "large",
|
|
263
261
|
"text-size": "medium",
|
|
264
262
|
label: "Телефон",
|
|
265
263
|
type: "tel",
|
|
266
264
|
error: m.value,
|
|
267
|
-
onBlur:
|
|
268
|
-
onInput:
|
|
265
|
+
onBlur: t[1] || (t[1] = (n) => L("phone")),
|
|
266
|
+
onInput: t[2] || (t[2] = (n) => L("phone"))
|
|
269
267
|
}, null, 8, ["modelValue", "error"]),
|
|
270
|
-
|
|
268
|
+
T(r(De), {
|
|
271
269
|
class: "icon-locked",
|
|
272
|
-
onClick:
|
|
270
|
+
onClick: t[3] || (t[3] = (n) => l.$emit("edit", "phone"))
|
|
273
271
|
})
|
|
274
|
-
])) :
|
|
275
|
-
c.value ?
|
|
276
|
-
|
|
272
|
+
])) : $("", !0),
|
|
273
|
+
c.value ? $("", !0) : (p(), S("div", po, [
|
|
274
|
+
T(r(Ae), {
|
|
277
275
|
style: { width: "100%" },
|
|
278
|
-
disabled: !
|
|
279
|
-
onClick:
|
|
276
|
+
disabled: !G.value,
|
|
277
|
+
onClick: X
|
|
280
278
|
}, {
|
|
281
|
-
default: _(() =>
|
|
279
|
+
default: _(() => t[6] || (t[6] = [
|
|
282
280
|
oe(" Отправить код ")
|
|
283
281
|
])),
|
|
284
282
|
_: 1,
|
|
285
283
|
__: [6]
|
|
286
284
|
}, 8, ["disabled"])
|
|
287
285
|
])),
|
|
288
|
-
c.value ? (p(),
|
|
289
|
-
|
|
286
|
+
c.value ? (p(), S("div", ho, [
|
|
287
|
+
T(r(de), {
|
|
290
288
|
modelValue: r(d),
|
|
291
|
-
"onUpdate:modelValue":
|
|
289
|
+
"onUpdate:modelValue": t[4] || (t[4] = (n) => se(d) ? d.value = n : null),
|
|
292
290
|
size: "large",
|
|
293
291
|
"text-size": "medium",
|
|
294
292
|
label: "Код",
|
|
295
293
|
type: "text",
|
|
296
|
-
error:
|
|
297
|
-
onInput:
|
|
298
|
-
onBlur:
|
|
294
|
+
error: Y.value,
|
|
295
|
+
onInput: M,
|
|
296
|
+
onBlur: t[5] || (t[5] = (n) => L("code"))
|
|
299
297
|
}, null, 8, ["modelValue", "error"])
|
|
300
|
-
])) :
|
|
301
|
-
!l.loading && c.value ? (p(),
|
|
302
|
-
|
|
298
|
+
])) : $("", !0),
|
|
299
|
+
!l.loading && c.value ? (p(), S("div", vo, [
|
|
300
|
+
T(ge, {
|
|
303
301
|
loading: l.loading,
|
|
304
302
|
"rate-limit-text": l.rateLimitText,
|
|
305
303
|
"is-final-limit": l.isFinalLimit,
|
|
306
304
|
"on-send-again": C
|
|
307
305
|
}, {
|
|
308
306
|
extra: _(() => [
|
|
309
|
-
l.isTg ? (p(),
|
|
307
|
+
l.isTg ? (p(), S("span", {
|
|
310
308
|
key: 0,
|
|
311
309
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
312
310
|
onClick: y
|
|
313
311
|
}, [
|
|
314
|
-
oe(
|
|
315
|
-
|
|
316
|
-
])) :
|
|
312
|
+
oe(K(l.sendCodeBySmsText) + " ", 1),
|
|
313
|
+
T(r(ie), { style: { "margin-left": "5px" } })
|
|
314
|
+
])) : $("", !0)
|
|
317
315
|
]),
|
|
318
316
|
_: 1
|
|
319
317
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
320
|
-
])) :
|
|
318
|
+
])) : $("", !0)
|
|
321
319
|
]));
|
|
322
320
|
}
|
|
323
321
|
}), fo = { class: "dialogDefaultContainerInsideContent" }, go = { style: { display: "flex", width: "100%", gap: "4px", "align-items": "center", "justify-content": "center", "text-align": "center" } }, yo = { class: "dialogDefaultContainerTextHint" }, Co = { class: "chip" }, wo = {
|
|
@@ -346,8 +344,8 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
346
344
|
isTg: { type: Boolean }
|
|
347
345
|
},
|
|
348
346
|
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"],
|
|
349
|
-
setup(R, { emit:
|
|
350
|
-
const
|
|
347
|
+
setup(R, { emit: V }) {
|
|
348
|
+
const E = R, u = V, c = D(!1), v = D(""), g = pe({
|
|
351
349
|
touched: { phone: !1, code: !1 },
|
|
352
350
|
phoneModel: "",
|
|
353
351
|
codeModel: ""
|
|
@@ -361,32 +359,30 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
361
359
|
() => g.codeModel,
|
|
362
360
|
(l) => u("update:code", l)
|
|
363
361
|
);
|
|
364
|
-
const L = (l) => g.touched[l] = !0,
|
|
365
|
-
const
|
|
366
|
-
return /^\+?\d{10,15}$/.test(
|
|
367
|
-
}),
|
|
368
|
-
var l,
|
|
362
|
+
const L = (l) => g.touched[l] = !0, G = z(() => {
|
|
363
|
+
const t = g.phoneModel.trim().replace(/[()\-\s]/g, "");
|
|
364
|
+
return /^\+?\d{10,15}$/.test(t);
|
|
365
|
+
}), X = async () => {
|
|
366
|
+
var l, t;
|
|
369
367
|
try {
|
|
370
|
-
if (L("phone"), !
|
|
368
|
+
if (L("phone"), !G.value) {
|
|
371
369
|
v.value = "Это не похоже на номер телефона";
|
|
372
370
|
return;
|
|
373
371
|
}
|
|
374
|
-
const {
|
|
375
|
-
|
|
376
|
-
} = await Oe(void 0, F(g.phoneModel));
|
|
377
|
-
if (!(((l = o == null ? void 0 : o[0]) == null ? void 0 : l.available) ?? !1)) {
|
|
372
|
+
const n = await Oe(void 0, F(g.phoneModel)), { data: P } = n.data;
|
|
373
|
+
if (!(((l = P == null ? void 0 : P[0]) == null ? void 0 : l.available) ?? !1)) {
|
|
378
374
|
v.value = "Такой номер уже используется";
|
|
379
375
|
return;
|
|
380
376
|
}
|
|
381
|
-
v.value = "", u("on-send-code", { phone: g.phoneModel, prevPhone:
|
|
382
|
-
} catch (
|
|
383
|
-
const
|
|
377
|
+
v.value = "", u("on-send-code", { phone: g.phoneModel, prevPhone: E.oldPhone, offLoading: !0 }), c.value = !0;
|
|
378
|
+
} catch (n) {
|
|
379
|
+
const P = (t = n == null ? void 0 : n.response) == null ? void 0 : t.data, B = P == null ? void 0 : P.message;
|
|
384
380
|
if (console.debug("global middle check onSendCode: ", {
|
|
385
|
-
errorData:
|
|
381
|
+
errorData: P,
|
|
386
382
|
message: B,
|
|
387
383
|
phoneTakenError: v
|
|
388
384
|
}), B) {
|
|
389
|
-
const
|
|
385
|
+
const Z = Array.isArray(B) ? B.join(" ") : String(B), ne = Z.toLowerCase(), J = [
|
|
390
386
|
"телефон должен быть в формате",
|
|
391
387
|
"valid phone number",
|
|
392
388
|
"phone must be a valid phone number",
|
|
@@ -395,107 +391,107 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
395
391
|
"newValue must be a valid phone number",
|
|
396
392
|
"addValue must be a valid phone number",
|
|
397
393
|
"addPhone must be a valid phone number"
|
|
398
|
-
],
|
|
394
|
+
], j = J.some(
|
|
399
395
|
(ee) => ne.includes(ee)
|
|
400
396
|
);
|
|
401
397
|
if (console.debug("global end check onSendCode: ", {
|
|
402
|
-
errorMessage:
|
|
398
|
+
errorMessage: Z,
|
|
403
399
|
lowerCaseError: ne,
|
|
404
|
-
phoneValidationKeywords:
|
|
405
|
-
hasPhoneError:
|
|
406
|
-
}),
|
|
400
|
+
phoneValidationKeywords: J,
|
|
401
|
+
hasPhoneError: j
|
|
402
|
+
}), j) {
|
|
407
403
|
v.value = "Это не похоже на номер телефона";
|
|
408
404
|
return;
|
|
409
405
|
}
|
|
410
406
|
}
|
|
411
|
-
console.error("Неизвестная ошибка при проверке доступности телефона:",
|
|
407
|
+
console.error("Неизвестная ошибка при проверке доступности телефона:", n), v.value = "Произошла ошибка сервера. Попробуйте позже";
|
|
412
408
|
}
|
|
413
409
|
};
|
|
414
410
|
let e = "";
|
|
415
|
-
const
|
|
411
|
+
const M = (l) => {
|
|
416
412
|
u("on-clear-code-error");
|
|
417
|
-
const
|
|
418
|
-
let
|
|
419
|
-
|
|
413
|
+
const t = l.target;
|
|
414
|
+
let n = t.value.replace(/\D/g, "");
|
|
415
|
+
n.length > 4 && (n = n.slice(0, 4), t.value = n), g.codeModel = n, n.length === 4 && n !== e && (e = n, u("on-match-code", { phone: g.phoneModel, code: n }));
|
|
420
416
|
}, C = () => {
|
|
421
417
|
u("on-send-code-again", { phone: g.phoneModel });
|
|
422
418
|
}, y = () => {
|
|
423
419
|
console.debug("onSendCodeViaSms"), u("on-send-only-sms", { phone: g.phoneModel });
|
|
424
|
-
}, { phoneModel:
|
|
425
|
-
return (l,
|
|
420
|
+
}, { phoneModel: x, codeModel: d, touched: h } = fe(g), m = z(() => v.value ? v.value : h.value.phone && !x.value.trim() ? "Это не похоже на номер телефона" : E.phoneError || ""), Y = z(() => E.isNotMatchCode ? "Неверный код" : g.touched.code ? d.value.trim() ? E.codeError ?? null : "Введите код" : "");
|
|
421
|
+
return (l, t) => (p(), S("div", fo, [
|
|
426
422
|
U("div", go, [
|
|
427
|
-
U("div", yo,
|
|
423
|
+
U("div", yo, K(c.value ? "Чтобы продолжить, введите код подтверждения из" : l.hintText), 1),
|
|
428
424
|
U("div", Co, [
|
|
429
|
-
l.isTg ? (p(),
|
|
425
|
+
l.isTg ? (p(), Q(r(ye), { key: 0 })) : (p(), Q(r(ie), {
|
|
430
426
|
key: 1,
|
|
431
427
|
style: { "margin-left": "5px" }
|
|
432
428
|
})),
|
|
433
|
-
oe(" " +
|
|
429
|
+
oe(" " + K(l.isTg ? "Telegram" : "СМС"), 1)
|
|
434
430
|
])
|
|
435
431
|
]),
|
|
436
|
-
l.showPhone ? (p(),
|
|
437
|
-
|
|
438
|
-
modelValue: r(
|
|
439
|
-
"onUpdate:modelValue":
|
|
432
|
+
l.showPhone ? (p(), S("div", wo, [
|
|
433
|
+
T(r(de), {
|
|
434
|
+
modelValue: r(x),
|
|
435
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => se(x) ? x.value = n : null),
|
|
440
436
|
size: "large",
|
|
441
437
|
"text-size": "medium",
|
|
442
438
|
label: "Телефон",
|
|
443
439
|
type: "tel",
|
|
444
440
|
error: m.value,
|
|
445
|
-
onBlur:
|
|
446
|
-
onInput:
|
|
441
|
+
onBlur: t[1] || (t[1] = (n) => L("phone")),
|
|
442
|
+
onInput: t[2] || (t[2] = (n) => L("phone"))
|
|
447
443
|
}, null, 8, ["modelValue", "error"]),
|
|
448
|
-
|
|
444
|
+
T(r(De), {
|
|
449
445
|
class: "icon-locked",
|
|
450
|
-
onClick:
|
|
446
|
+
onClick: t[3] || (t[3] = (n) => l.$emit("edit", "phone"))
|
|
451
447
|
})
|
|
452
|
-
])) :
|
|
453
|
-
c.value ?
|
|
454
|
-
|
|
448
|
+
])) : $("", !0),
|
|
449
|
+
c.value ? $("", !0) : (p(), S("div", Po, [
|
|
450
|
+
T(r(Ae), {
|
|
455
451
|
style: { width: "100%" },
|
|
456
|
-
disabled: !
|
|
457
|
-
onClick:
|
|
452
|
+
disabled: !G.value,
|
|
453
|
+
onClick: X
|
|
458
454
|
}, {
|
|
459
|
-
default: _(() =>
|
|
455
|
+
default: _(() => t[6] || (t[6] = [
|
|
460
456
|
oe(" Отправить код ")
|
|
461
457
|
])),
|
|
462
458
|
_: 1,
|
|
463
459
|
__: [6]
|
|
464
460
|
}, 8, ["disabled"])
|
|
465
461
|
])),
|
|
466
|
-
c.value ? (p(),
|
|
467
|
-
|
|
462
|
+
c.value ? (p(), S("div", bo, [
|
|
463
|
+
T(r(de), {
|
|
468
464
|
modelValue: r(d),
|
|
469
|
-
"onUpdate:modelValue":
|
|
465
|
+
"onUpdate:modelValue": t[4] || (t[4] = (n) => se(d) ? d.value = n : null),
|
|
470
466
|
size: "large",
|
|
471
467
|
"text-size": "medium",
|
|
472
468
|
label: "Код",
|
|
473
469
|
type: "text",
|
|
474
|
-
error:
|
|
475
|
-
onInput:
|
|
476
|
-
onBlur:
|
|
470
|
+
error: Y.value,
|
|
471
|
+
onInput: M,
|
|
472
|
+
onBlur: t[5] || (t[5] = (n) => L("code"))
|
|
477
473
|
}, null, 8, ["modelValue", "error"])
|
|
478
|
-
])) :
|
|
479
|
-
c.value ? (p(),
|
|
480
|
-
|
|
474
|
+
])) : $("", !0),
|
|
475
|
+
c.value ? (p(), S("div", So, [
|
|
476
|
+
T(ge, {
|
|
481
477
|
loading: l.loading,
|
|
482
478
|
"rate-limit-text": l.rateLimitText,
|
|
483
479
|
"is-final-limit": l.isFinalLimit,
|
|
484
480
|
"on-send-again": C
|
|
485
481
|
}, {
|
|
486
482
|
extra: _(() => [
|
|
487
|
-
l.isTg ? (p(),
|
|
483
|
+
l.isTg ? (p(), S("span", {
|
|
488
484
|
key: 0,
|
|
489
485
|
class: "dialogDefaultContainerSendCodeBySmsText",
|
|
490
486
|
onClick: y
|
|
491
487
|
}, [
|
|
492
|
-
oe(
|
|
493
|
-
|
|
494
|
-
])) :
|
|
488
|
+
oe(K(l.sendCodeBySmsText) + " ", 1),
|
|
489
|
+
T(r(ie), { style: { "margin-left": "5px" } })
|
|
490
|
+
])) : $("", !0)
|
|
495
491
|
]),
|
|
496
492
|
_: 1
|
|
497
493
|
}, 8, ["loading", "rate-limit-text", "is-final-limit"])
|
|
498
|
-
])) :
|
|
494
|
+
])) : $("", !0)
|
|
499
495
|
]));
|
|
500
496
|
}
|
|
501
497
|
}), Mo = { class: "text-center w-full" }, xo = { class: "dialogTitle" }, Vo = {
|
|
@@ -516,43 +512,43 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
516
512
|
mode: { default: void 0 }
|
|
517
513
|
},
|
|
518
514
|
emits: ["update:modelValue", "submit-phone", "edit", "close", "clean-input-errors", "on-update-jwt", "update-phone-field", "on-toast"],
|
|
519
|
-
setup(R, { expose:
|
|
520
|
-
const u = R, c =
|
|
515
|
+
setup(R, { expose: V, emit: E }) {
|
|
516
|
+
const u = R, c = E, v = D(u.modelValue);
|
|
521
517
|
te(
|
|
522
518
|
() => u.modelValue,
|
|
523
519
|
(s) => v.value = s
|
|
524
520
|
), te(v, (s) => c("update:modelValue", s));
|
|
525
|
-
const g = z(() => u.language ?? "ru"), L = (s) => Ie[g.value] && Ie[g.value][s] || (u.title ?? s),
|
|
521
|
+
const g = z(() => u.language ?? "ru"), L = (s) => Ie[g.value] && Ie[g.value][s] || (u.title ?? s), G = z(() => u.title ?? L("Смена номера телефона")), X = z(() => u.hintText ?? L("Чтобы продолжить, введите новый номер")), e = pe({
|
|
526
522
|
oldPhone: u.initialPhone ?? "",
|
|
527
523
|
newPhone: "",
|
|
528
524
|
code: "",
|
|
529
525
|
addPhone: "",
|
|
530
526
|
addCode: ""
|
|
531
|
-
}),
|
|
527
|
+
}), M = D(H.OLD), C = D(null), y = D(!1), x = D(!1), d = D("tg"), h = z(() => d.value === "tg"), m = D(!1), { startTimer: Y, remainingSeconds: l, isAvailableForSendAgain: t, totalRateAttempts: n, currentRateAttempt: P } = qe(), { showRateLimitToast: B } = He(c), { isEditFlow: Z, getFlow: ne } = We(D(u.mode)), J = z(() => t.value ? "Повторить" : `${l.value}`), j = D(re), ee = z(() => j.value === 0), Ne = (s) => new Promise((a) => setTimeout(a, s));
|
|
532
528
|
async function he(s = "email") {
|
|
533
|
-
var
|
|
534
|
-
return (
|
|
529
|
+
var o;
|
|
530
|
+
return (o = (await Le("/users/profile/session/get-edit-session", { params: { field: s } })).data) == null ? void 0 : o.data;
|
|
535
531
|
}
|
|
536
532
|
async function Ce(s = "phone") {
|
|
537
|
-
var
|
|
538
|
-
const
|
|
533
|
+
var k;
|
|
534
|
+
const o = (k = (await le("/users/profile/session/create-if-not-exists", {
|
|
539
535
|
field: s,
|
|
540
536
|
oldValue: F(u.initialPhone)
|
|
541
|
-
})).data) == null ? void 0 :
|
|
542
|
-
C.value = (
|
|
537
|
+
})).data) == null ? void 0 : k.data;
|
|
538
|
+
C.value = (o == null ? void 0 : o.sessionId) ?? null, M.value = (o == null ? void 0 : o.step) ?? H.OLD, e.oldPhone = (o == null ? void 0 : o.oldValue) ?? "", e.newPhone = (o == null ? void 0 : o.newValue) ?? "";
|
|
543
539
|
}
|
|
544
540
|
async function ze() {
|
|
545
541
|
try {
|
|
546
542
|
const s = await he("phone");
|
|
547
|
-
C.value = s.sessionId,
|
|
543
|
+
C.value = s.sessionId, M.value = s.step, e.oldPhone = s.oldValue ?? "", s.sessionId || await Ce("phone");
|
|
548
544
|
} catch {
|
|
549
545
|
await Ce("phone");
|
|
550
546
|
}
|
|
551
547
|
}
|
|
552
548
|
async function we(s, a = !1) {
|
|
553
|
-
var
|
|
549
|
+
var o;
|
|
554
550
|
try {
|
|
555
|
-
const
|
|
551
|
+
const k = await le(
|
|
556
552
|
"/users/profile/check-throttler",
|
|
557
553
|
{
|
|
558
554
|
method: "sms",
|
|
@@ -566,14 +562,14 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
566
562
|
}
|
|
567
563
|
);
|
|
568
564
|
await Ne(1e3);
|
|
569
|
-
const w = (
|
|
570
|
-
return w ? (w.restTimeSec > 0 ? (
|
|
565
|
+
const w = (o = k.data) == null ? void 0 : o.data;
|
|
566
|
+
return w ? (w.restTimeSec > 0 ? (Y(w.restTimeSec), t.value = !1, n.value = w.attempts.total, P.value = w.attempts.total - w.attempts.available, j.value = w.attempts.available ?? re) : t.value = !0, w) : null;
|
|
571
567
|
} catch {
|
|
572
568
|
return null;
|
|
573
569
|
}
|
|
574
570
|
}
|
|
575
|
-
const ve = async ({ phone: s }) => (m.value = !0, await ae({ value: s, isOnlySms: !0 })), ae = async ({ value: s, isOnlySms: a, offLoading:
|
|
576
|
-
var
|
|
571
|
+
const ve = async ({ phone: s }) => (m.value = !0, await ae({ value: s, isOnlySms: !0 })), ae = async ({ value: s, isOnlySms: a, offLoading: o } = {}) => {
|
|
572
|
+
var k, w, A, N, q, I;
|
|
577
573
|
y.value = !0;
|
|
578
574
|
try {
|
|
579
575
|
const f = s ?? e.oldPhone, i = await le(
|
|
@@ -593,69 +589,69 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
593
589
|
}
|
|
594
590
|
);
|
|
595
591
|
console.debug("response sendContactCode: ", i);
|
|
596
|
-
const
|
|
597
|
-
if ((
|
|
592
|
+
const b = (w = (k = i == null ? void 0 : i.data) == null ? void 0 : k.data) == null ? void 0 : w.deliveryType;
|
|
593
|
+
if ((b === "tg" || b === "sms") && (d.value = b, b === "tg" && (m.value = !1)), console.debug("sendContactCode before обработка 403 tooManyRequests", i), (i == null ? void 0 : i.status) === 403 && ((A = i.data) != null && A.tooManyRequests)) {
|
|
598
594
|
console.debug("sendContactCode IN обработка 403 tooManyRequests", i);
|
|
599
|
-
const O = (
|
|
595
|
+
const O = (q = (N = i.data) == null ? void 0 : N.tooManyRequests) == null ? void 0 : q.type;
|
|
600
596
|
d.value = O;
|
|
601
|
-
const
|
|
602
|
-
return
|
|
597
|
+
const W = i.data.tooManyRequests;
|
|
598
|
+
return W.restTimeSec > 0 ? (Y(W.restTimeSec), n.value = W.attempts.total, P.value = W.attempts.total - W.attempts.available, j.value = W.attempts.available ?? re) : t.value = !0, i;
|
|
603
599
|
}
|
|
604
600
|
return console.debug("sendContactCode after обработка 403 tooManyRequests", i), await we(f), i;
|
|
605
601
|
} catch (f) {
|
|
606
602
|
const i = (I = f == null ? void 0 : f.data) == null ? void 0 : I.tooManyRequests;
|
|
607
603
|
if ((f == null ? void 0 : f.status) === 403 && i) {
|
|
608
|
-
const { restTimeSec:
|
|
609
|
-
return
|
|
604
|
+
const { restTimeSec: b, attempts: O } = i;
|
|
605
|
+
return b > 0 ? (Y(b), n.value = O.total, P.value = O.total - O.available, j.value = O.available ?? re) : t.value = !0, f;
|
|
610
606
|
}
|
|
611
607
|
throw f;
|
|
612
608
|
} finally {
|
|
613
|
-
y.value = !1,
|
|
609
|
+
y.value = !1, o && (y.value = !1);
|
|
614
610
|
}
|
|
615
611
|
}, Pe = async (s, a) => {
|
|
616
|
-
var
|
|
612
|
+
var o, k, w, A, N, q, I, f;
|
|
617
613
|
y.value = !0;
|
|
618
614
|
try {
|
|
619
615
|
const i = await he("phone");
|
|
620
|
-
C.value = i.sessionId,
|
|
621
|
-
const
|
|
622
|
-
phone: a ===
|
|
616
|
+
C.value = i.sessionId, M.value = i.step, e.oldPhone = i.oldValue ?? e.oldPhone, e.newPhone = i.newValue ?? e.newPhone;
|
|
617
|
+
const b = await le("/users/profile/change/phone/match-code", {
|
|
618
|
+
phone: a === H.NEW ? F(e.newPhone) : F(e.oldPhone),
|
|
623
619
|
sessionId: C.value,
|
|
624
620
|
code: s,
|
|
625
621
|
step: a
|
|
626
|
-
}), O = ((
|
|
627
|
-
if (B(
|
|
628
|
-
|
|
622
|
+
}), O = ((o = b.data) == null ? void 0 : o.nextStep) ?? ((w = (k = b.data) == null ? void 0 : k.data) == null ? void 0 : w.nextStep), W = ((N = (A = b.data) == null ? void 0 : A.data) == null ? void 0 : N.rateLimit) ?? ((q = b.data) == null ? void 0 : q.rateLimit) ?? null, Re = ((I = b.data) == null ? void 0 : I.data.success) ?? ((f = b.data) == null ? void 0 : f.success);
|
|
623
|
+
if (B(W), !Re) {
|
|
624
|
+
x.value = !0;
|
|
629
625
|
return;
|
|
630
626
|
}
|
|
631
|
-
if (!O) return
|
|
632
|
-
if (
|
|
627
|
+
if (!O) return b;
|
|
628
|
+
if (M.value = O, O === H.NEW) {
|
|
633
629
|
const $e = await he("phone");
|
|
634
630
|
e.oldPhone = $e.oldValue ?? e.oldPhone, e.newPhone = $e.newValue ?? e.newPhone, e.code = "";
|
|
635
631
|
}
|
|
636
|
-
return O ===
|
|
632
|
+
return O === H.COMPLETED && (e.code = "", c("update-phone-field", e.addPhone), c("submit-phone", { phone: e.oldPhone, code: s }), c("on-toast", { color: "success", text: "Номер телефона изменён" }), c("on-update-jwt", "phone", "edit", e.newPhone), C.value = null, c("close")), b;
|
|
637
633
|
} finally {
|
|
638
634
|
y.value = !1;
|
|
639
635
|
}
|
|
640
|
-
}, be = ({ code: s }) => Pe(s,
|
|
636
|
+
}, be = ({ code: s }) => Pe(s, H.OLD);
|
|
641
637
|
function Se(s) {
|
|
642
638
|
}
|
|
643
|
-
const Te = ({ code: s }) => Pe(s,
|
|
639
|
+
const Te = ({ code: s }) => Pe(s, H.NEW);
|
|
644
640
|
function Me(s) {
|
|
645
641
|
}
|
|
646
642
|
const ue = () => {
|
|
647
643
|
c("close"), v.value = !1;
|
|
648
644
|
};
|
|
649
645
|
async function xe(s = "phone") {
|
|
650
|
-
var
|
|
651
|
-
return (
|
|
646
|
+
var o;
|
|
647
|
+
return (o = (await Le("/users/profile/session/get-bind-session", { params: { field: s } })).data) == null ? void 0 : o.data;
|
|
652
648
|
}
|
|
653
649
|
async function Ve({
|
|
654
650
|
value: s,
|
|
655
651
|
field: a = "phone",
|
|
656
|
-
offLoading:
|
|
652
|
+
offLoading: o = !0
|
|
657
653
|
}) {
|
|
658
|
-
var
|
|
654
|
+
var k, w, A;
|
|
659
655
|
y.value = !0;
|
|
660
656
|
try {
|
|
661
657
|
if (!C.value) {
|
|
@@ -663,17 +659,17 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
663
659
|
field: a,
|
|
664
660
|
newValue: F(s || e.addPhone)
|
|
665
661
|
});
|
|
666
|
-
if (C.value = ((w = (
|
|
662
|
+
if (C.value = ((w = (k = N.data) == null ? void 0 : k.data) == null ? void 0 : w.sessionId) ?? ((A = N.data) == null ? void 0 : A.sessionId) ?? null, !C.value)
|
|
667
663
|
throw new Error("не удалось создать bind-сессию (sessionId отсутствует)");
|
|
668
664
|
}
|
|
669
665
|
} finally {
|
|
670
|
-
|
|
666
|
+
o && (y.value = !1);
|
|
671
667
|
}
|
|
672
668
|
}
|
|
673
669
|
async function Fe() {
|
|
674
670
|
try {
|
|
675
671
|
const s = await xe("phone");
|
|
676
|
-
C.value = s.sessionId,
|
|
672
|
+
C.value = s.sessionId, M.value = s.step, e.addPhone = s.newValue ?? "", s.sessionId || await Ve({ field: "phone", value: e.addPhone });
|
|
677
673
|
} catch {
|
|
678
674
|
await Ve({ field: "phone", value: e.addPhone });
|
|
679
675
|
}
|
|
@@ -681,25 +677,25 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
681
677
|
const me = async ({
|
|
682
678
|
value: s,
|
|
683
679
|
field: a = "phone",
|
|
684
|
-
isOnlySms:
|
|
685
|
-
offLoading:
|
|
680
|
+
isOnlySms: o = !1,
|
|
681
|
+
offLoading: k = !0
|
|
686
682
|
} = {}) => {
|
|
687
683
|
var w, A, N;
|
|
688
684
|
y.value = !0;
|
|
689
685
|
try {
|
|
690
686
|
if (!C.value)
|
|
691
687
|
throw new Error("bind-сессия не найдена. создайте её через createBindSession.");
|
|
692
|
-
const
|
|
688
|
+
const q = s ?? e.addPhone, I = await le(
|
|
693
689
|
`/users/profile/bind/contact/send-code/${a}`,
|
|
694
690
|
{
|
|
695
691
|
sessionId: C.value,
|
|
696
|
-
phone: F(
|
|
692
|
+
phone: F(q),
|
|
697
693
|
provider: u.provider,
|
|
698
|
-
isOnlySms:
|
|
694
|
+
isOnlySms: o ?? !1
|
|
699
695
|
},
|
|
700
696
|
{
|
|
701
697
|
headers: {
|
|
702
|
-
"x-only-sms":
|
|
698
|
+
"x-only-sms": o ?? !1
|
|
703
699
|
}
|
|
704
700
|
}
|
|
705
701
|
), f = (A = (w = I == null ? void 0 : I.data) == null ? void 0 : w.data) == null ? void 0 : A.deliveryType;
|
|
@@ -707,31 +703,31 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
707
703
|
const i = (N = I.data) == null ? void 0 : N.tooManyRequests;
|
|
708
704
|
if (I.status === 403 && i) {
|
|
709
705
|
const O = i == null ? void 0 : i.type;
|
|
710
|
-
return d.value = O, i.restTimeSec > 0 ? (
|
|
706
|
+
return d.value = O, i.restTimeSec > 0 ? (Y(i.restTimeSec), n.value = i.attempts.total, P.value = i.attempts.total - i.attempts.available, j.value = i.attempts.available ?? re) : t.value = !0, I;
|
|
711
707
|
}
|
|
712
|
-
const
|
|
713
|
-
return
|
|
708
|
+
const b = await we(q);
|
|
709
|
+
return b && b.restTimeSec > 0 ? (Y(b.restTimeSec), t.value = !1) : t.value = !0, I;
|
|
714
710
|
} finally {
|
|
715
|
-
|
|
711
|
+
k && (y.value = !1);
|
|
716
712
|
}
|
|
717
713
|
}, ke = async ({ code: s }) => {
|
|
718
|
-
var a,
|
|
714
|
+
var a, o, k, w, A, N, q, I;
|
|
719
715
|
y.value = !0;
|
|
720
716
|
try {
|
|
721
717
|
if (!C.value) {
|
|
722
|
-
const
|
|
723
|
-
C.value =
|
|
718
|
+
const W = await xe("phone");
|
|
719
|
+
C.value = W.sessionId, e.addPhone = W.newValue ?? e.addPhone;
|
|
724
720
|
}
|
|
725
721
|
const f = await le("/users/profile/bind/phone/match-code", {
|
|
726
722
|
phone: F(e.addPhone),
|
|
727
723
|
sessionId: C.value,
|
|
728
724
|
code: s
|
|
729
|
-
}), i = ((a = f.data) == null ? void 0 : a.nextStep) ?? ((
|
|
730
|
-
if (B(
|
|
731
|
-
|
|
725
|
+
}), i = ((a = f.data) == null ? void 0 : a.nextStep) ?? ((k = (o = f.data) == null ? void 0 : o.data) == null ? void 0 : k.nextStep), b = ((A = (w = f.data) == null ? void 0 : w.data) == null ? void 0 : A.rateLimit) ?? ((N = f.data) == null ? void 0 : N.rateLimit) ?? null, O = ((q = f.data) == null ? void 0 : q.data.success) ?? ((I = f.data) == null ? void 0 : I.success);
|
|
726
|
+
if (B(b), !O) {
|
|
727
|
+
x.value = !0;
|
|
732
728
|
return;
|
|
733
729
|
}
|
|
734
|
-
return i && i ===
|
|
730
|
+
return i && i === H.COMPLETED && (e.code = "", c("update-phone-field", e.addPhone), c("submit-phone", { phone: e.addPhone, code: s }), c("on-update-jwt", "phone", "bind", e.addPhone), c("on-toast", { color: "success", text: "Номер телефона успешно привязан к аккаунту" }), C.value = null, c("close")), f;
|
|
735
731
|
} finally {
|
|
736
732
|
y.value = !1;
|
|
737
733
|
}
|
|
@@ -745,15 +741,15 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
745
741
|
return;
|
|
746
742
|
}
|
|
747
743
|
await ze(), await ae({});
|
|
748
|
-
}),
|
|
744
|
+
}), V({
|
|
749
745
|
localVisible: v,
|
|
750
746
|
form: e,
|
|
751
|
-
currentStep:
|
|
747
|
+
currentStep: M,
|
|
752
748
|
loading: y,
|
|
753
|
-
rateLimitText:
|
|
749
|
+
rateLimitText: J,
|
|
754
750
|
isAvailable: ee,
|
|
755
|
-
title:
|
|
756
|
-
hintText:
|
|
751
|
+
title: G,
|
|
752
|
+
hintText: X,
|
|
757
753
|
handleClose: ue,
|
|
758
754
|
sendContactCode: ae,
|
|
759
755
|
sendBindContactCode: me,
|
|
@@ -763,11 +759,11 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
763
759
|
handleNewCodeError: Me,
|
|
764
760
|
matchBindCode: ke,
|
|
765
761
|
matchBindCodeError: Ee
|
|
766
|
-
}), (s, a) => (p(),
|
|
767
|
-
|
|
762
|
+
}), (s, a) => (p(), S(je, null, [
|
|
763
|
+
T(r(Ge), {
|
|
768
764
|
modelValue: v.value,
|
|
769
765
|
"onUpdate:modelValue": [
|
|
770
|
-
a[15] || (a[15] = (
|
|
766
|
+
a[15] || (a[15] = (o) => v.value = o),
|
|
771
767
|
ue
|
|
772
768
|
],
|
|
773
769
|
width: "small",
|
|
@@ -777,17 +773,17 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
777
773
|
}, {
|
|
778
774
|
header: _(() => [
|
|
779
775
|
U("div", Mo, [
|
|
780
|
-
|
|
776
|
+
T(r(Je), {
|
|
781
777
|
"slot-left": !1,
|
|
782
778
|
size: "small",
|
|
783
779
|
borded: !0,
|
|
784
780
|
"no-padding": !1
|
|
785
781
|
}, {
|
|
786
782
|
title: _(() => [
|
|
787
|
-
U("span", xo,
|
|
783
|
+
U("span", xo, K(r(Z) ? G.value : "Добавление номера телефона"), 1)
|
|
788
784
|
]),
|
|
789
785
|
"right-button": _(() => [
|
|
790
|
-
|
|
786
|
+
T(r(Qe), {
|
|
791
787
|
class: "cross",
|
|
792
788
|
onClick: ue
|
|
793
789
|
})
|
|
@@ -797,64 +793,64 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
797
793
|
])
|
|
798
794
|
]),
|
|
799
795
|
default: _(() => [
|
|
800
|
-
r(
|
|
801
|
-
y.value ? (p(),
|
|
802
|
-
|
|
796
|
+
r(Z) ? (p(), S("div", Vo, [
|
|
797
|
+
y.value ? (p(), Q(Be, { key: 0 })) : $("", !0),
|
|
798
|
+
M.value === r(H).OLD ? (p(), Q(lo, {
|
|
803
799
|
key: 1,
|
|
804
800
|
phone: e.oldPhone,
|
|
805
|
-
"onUpdate:phone": a[0] || (a[0] = (
|
|
801
|
+
"onUpdate:phone": a[0] || (a[0] = (o) => e.oldPhone = o),
|
|
806
802
|
code: e.code,
|
|
807
|
-
"onUpdate:code": a[1] || (a[1] = (
|
|
808
|
-
"rate-limit-text":
|
|
803
|
+
"onUpdate:code": a[1] || (a[1] = (o) => e.code = o),
|
|
804
|
+
"rate-limit-text": J.value,
|
|
809
805
|
"is-final-limit": ee.value,
|
|
810
|
-
"is-not-match-code":
|
|
806
|
+
"is-not-match-code": x.value,
|
|
811
807
|
loading: y.value,
|
|
812
808
|
"is-tg": h.value,
|
|
813
|
-
onOnSendCode: a[2] || (a[2] = (
|
|
814
|
-
onOnSendCodeAgain: a[3] || (a[3] = (
|
|
809
|
+
onOnSendCode: a[2] || (a[2] = (o) => ae({ value: e.oldPhone })),
|
|
810
|
+
onOnSendCodeAgain: a[3] || (a[3] = (o) => ae({ value: e.oldPhone, isOnlySms: !h.value && m.value })),
|
|
815
811
|
onOnSendOnlySms: ve,
|
|
816
812
|
onOnMatchCode: be,
|
|
817
813
|
onOnMatchCodeError: Se
|
|
818
|
-
}, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) :
|
|
814
|
+
}, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === r(H).NEW ? (p(), Q(mo, {
|
|
819
815
|
key: 2,
|
|
820
816
|
phone: e.newPhone,
|
|
821
|
-
"onUpdate:phone": a[4] || (a[4] = (
|
|
817
|
+
"onUpdate:phone": a[4] || (a[4] = (o) => e.newPhone = o),
|
|
822
818
|
oldPhone: e.oldPhone,
|
|
823
|
-
"onUpdate:oldPhone": a[5] || (a[5] = (
|
|
819
|
+
"onUpdate:oldPhone": a[5] || (a[5] = (o) => e.oldPhone = o),
|
|
824
820
|
code: e.code,
|
|
825
|
-
"onUpdate:code": a[6] || (a[6] = (
|
|
826
|
-
"hint-text":
|
|
827
|
-
"rate-limit-text":
|
|
821
|
+
"onUpdate:code": a[6] || (a[6] = (o) => e.code = o),
|
|
822
|
+
"hint-text": X.value,
|
|
823
|
+
"rate-limit-text": J.value,
|
|
828
824
|
"is-final-limit": ee.value,
|
|
829
|
-
"is-not-match-code":
|
|
825
|
+
"is-not-match-code": x.value,
|
|
830
826
|
loading: y.value,
|
|
831
827
|
"is-tg": h.value,
|
|
832
|
-
onOnSendCode: a[7] || (a[7] = (
|
|
833
|
-
onOnSendCodeAgain: a[8] || (a[8] = (
|
|
828
|
+
onOnSendCode: a[7] || (a[7] = (o) => ae({ value: e.newPhone })),
|
|
829
|
+
onOnSendCodeAgain: a[8] || (a[8] = (o) => ae({ value: e.newPhone, isOnlySms: !h.value && m.value })),
|
|
834
830
|
onOnSendOnlySms: ve,
|
|
835
831
|
onOnMatchCode: Te,
|
|
836
832
|
onOnMatchCodeError: Me,
|
|
837
|
-
onOnClearCodeError: a[9] || (a[9] = (
|
|
838
|
-
}, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) :
|
|
839
|
-
U("p", null,
|
|
840
|
-
])) :
|
|
841
|
-
])) : (p(),
|
|
842
|
-
y.value ? (p(),
|
|
843
|
-
|
|
833
|
+
onOnClearCodeError: a[9] || (a[9] = (o) => x.value = !1)
|
|
834
|
+
}, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : M.value === r(H).COMPLETED ? (p(), S("div", ko, [
|
|
835
|
+
U("p", null, K(L("Телефон успешно изменен")), 1)
|
|
836
|
+
])) : $("", !0)
|
|
837
|
+
])) : (p(), S("div", Eo, [
|
|
838
|
+
y.value ? (p(), Q(Be, { key: 0 })) : $("", !0),
|
|
839
|
+
T(To, {
|
|
844
840
|
phone: e.addPhone,
|
|
845
|
-
"onUpdate:phone": a[10] || (a[10] = (
|
|
841
|
+
"onUpdate:phone": a[10] || (a[10] = (o) => e.addPhone = o),
|
|
846
842
|
oldPhone: e.oldPhone,
|
|
847
|
-
"onUpdate:oldPhone": a[11] || (a[11] = (
|
|
843
|
+
"onUpdate:oldPhone": a[11] || (a[11] = (o) => e.oldPhone = o),
|
|
848
844
|
code: e.addCode,
|
|
849
|
-
"onUpdate:code": a[12] || (a[12] = (
|
|
850
|
-
"hint-text": r(
|
|
851
|
-
"rate-limit-text":
|
|
845
|
+
"onUpdate:code": a[12] || (a[12] = (o) => e.addCode = o),
|
|
846
|
+
"hint-text": r(Z) ? X.value : "Чтобы продолжить, введите новый номер",
|
|
847
|
+
"rate-limit-text": J.value,
|
|
852
848
|
"is-final-limit": ee.value,
|
|
853
|
-
"is-not-match-code":
|
|
849
|
+
"is-not-match-code": x.value,
|
|
854
850
|
loading: y.value,
|
|
855
851
|
"is-tg": h.value,
|
|
856
|
-
onOnSendCode: a[13] || (a[13] = (
|
|
857
|
-
onOnSendCodeAgain: a[14] || (a[14] = (
|
|
852
|
+
onOnSendCode: a[13] || (a[13] = (o) => me({ value: e.addPhone, field: "phone" })),
|
|
853
|
+
onOnSendCodeAgain: a[14] || (a[14] = (o) => me({ value: e.addPhone, field: "phone", isOnlySms: !h.value && m.value })),
|
|
858
854
|
onOnSendOnlySms: ve,
|
|
859
855
|
onOnMatchCode: ke,
|
|
860
856
|
onOnMatchCodeError: Ee
|
|
@@ -863,7 +859,7 @@ const ie = { render: Ze }, _e = { class: "dialogDefaultContainerInsideContent" }
|
|
|
863
859
|
]),
|
|
864
860
|
_: 1
|
|
865
861
|
}, 8, ["modelValue"]),
|
|
866
|
-
|
|
862
|
+
T(r(Xe))
|
|
867
863
|
], 64));
|
|
868
864
|
}
|
|
869
865
|
});
|