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