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