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