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