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