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