@yourgoods/ui-smart 0.20.0 → 0.21.0

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