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