@yourgoods/ui-smart 0.1.1 → 0.2.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,14 +1,14 @@
1
- import { defineComponent as ie, reactive as de, watch as H, ref as I, toRefs as ce, computed as L, createElementBlock as w, openBlock as u, createElementVNode as A, createCommentVNode as b, createVNode as C, toDisplayString as N, createBlock as R, createTextVNode as W, unref as i, isRef as Y, withCtx as q, onMounted as Fe, Fragment as Ue } from "vue";
2
- import { _ as he, c as Ee, b as ze, u as Re, P as ke, d as je } from "./useRateLimitToast-DsEVCh0F.js";
3
- import { IconFilledTelegramSm as ve, IconFilledMobileSm as Z, PInput as _, IconPhoneMd as qe, IconMailMd as Be, PButton as Ie, PDialog as We, PTopBar as He, IconCrossMd as Ge, PTeleportContainer as Je } from "@profeat/ui-kit";
4
- import { C as O, t as be, p as K, g as $e } from "./index-DtHlzO1x.js";
1
+ import { defineComponent as se, reactive as ie, watch as W, ref as I, toRefs as pe, computed as L, createElementBlock as w, openBlock as u, createElementVNode as A, createCommentVNode as b, createVNode as C, toDisplayString as N, createBlock as z, createTextVNode as q, unref as i, isRef as X, withCtx as j, onMounted as Fe, Fragment as Ue } from "vue";
2
+ import { T as ce, c as Ee, a as ze, u as Re, P as ke, b as je } from "./useRateLimitToast-DGwU_bUG.js";
3
+ import { IconFilledTelegramSm as he, IconFilledMobileSm as Y, PInput as Z, IconPhoneMd as qe, IconMailMd as Be, PButton as Ie, PDialog as We, PTopBar as He, IconCrossMd as Ge, PTeleportContainer as Je } from "@profeat/ui-kit";
4
+ import { C as O, t as be, p as J, g as $e } from "./index-D9_chX1D.js";
5
5
  const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { display: "flex", width: "100%", gap: "4px", "align-items": "center", "justify-content": "center", "text-align": "center" } }, Xe = { class: "dialogDefaultContainerTextHint" }, Ye = { class: "chip" }, Ze = {
6
6
  key: 0,
7
7
  class: "input-wrapper"
8
8
  }, _e = {
9
9
  key: 1,
10
10
  class: "input-wrapper"
11
- }, et = /* @__PURE__ */ ie({
11
+ }, et = /* @__PURE__ */ se({
12
12
  __name: "OldPhoneContent",
13
13
  props: {
14
14
  phone: {},
@@ -26,16 +26,16 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
26
26
  isTg: { type: Boolean }
27
27
  },
28
28
  emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code-again"],
29
- setup(G, { emit: J }) {
30
- const x = G, p = J, r = de({
29
+ setup(H, { emit: G }) {
30
+ const V = H, p = G, r = ie({
31
31
  touched: { phone: !1, code: !1 },
32
- phoneModel: x.phone,
33
- codeModel: x.code
32
+ phoneModel: V.phone,
33
+ codeModel: V.code
34
34
  });
35
- H(
35
+ W(
36
36
  () => r.phoneModel,
37
37
  (d) => p("update:phone", d)
38
- ), H(
38
+ ), W(
39
39
  () => r.codeModel,
40
40
  (d) => p("update:code", d)
41
41
  );
@@ -47,24 +47,24 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
47
47
  const c = d.target;
48
48
  let h = ((c == null ? void 0 : c.value) ?? "").replace(/\D/g, "");
49
49
  h.length > 4 && (h = h.slice(0, 4)), T.value = h, c && c.value !== h && (c.value = h), h.length === 4 && h !== v.value && (v.value = h, p("on-match-code", { phone: e.value, code: h }));
50
- }, F = () => p("on-send-code-again", { phone: r.phoneModel }), j = () => {
50
+ }, F = () => p("on-send-code-again", { phone: r.phoneModel }), R = () => {
51
51
  console.debug("onSendCodeViaSms");
52
- }, { phoneModel: e, codeModel: T, touched: g } = ce(r), f = L(() => g.value.phone && !e.value.trim() ? "Введите телефон" : x.phoneError), V = L(() => x.isNotMatchCode ? "Неверный код" : g.value.code ? T.value.trim() ? x.codeError ?? null : "Введите код" : "");
52
+ }, { phoneModel: e, codeModel: T, touched: g } = pe(r), f = L(() => g.value.phone && !e.value.trim() ? "Введите телефон" : V.phoneError), x = L(() => V.isNotMatchCode ? "Неверный код" : g.value.code ? T.value.trim() ? V.codeError ?? null : "Введите код" : "");
53
53
  return (d, c) => (u(), w("div", Ke, [
54
54
  A("div", Qe, [
55
55
  A("div", Xe, N(d.hintText), 1),
56
56
  A("div", Ye, [
57
- d.isTg ? (u(), R(i(ve), { key: 0 })) : (u(), R(i(Z), {
57
+ d.isTg ? (u(), z(i(he), { key: 0 })) : (u(), z(i(Y), {
58
58
  key: 1,
59
59
  style: { "margin-left": "5px" }
60
60
  })),
61
- W(" " + N(d.isTg ? "Telegram" : "СМС"), 1)
61
+ q(" " + N(d.isTg ? "Telegram" : "СМС"), 1)
62
62
  ])
63
63
  ]),
64
64
  d.showPhone ? (u(), w("div", Ze, [
65
- C(i(_), {
65
+ C(i(Z), {
66
66
  modelValue: i(e),
67
- "onUpdate:modelValue": c[0] || (c[0] = (h) => Y(e) ? e.value = h : null),
67
+ "onUpdate:modelValue": c[0] || (c[0] = (h) => X(e) ? e.value = h : null),
68
68
  size: "large",
69
69
  "text-size": "medium",
70
70
  label: "Телефон",
@@ -80,33 +80,32 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
80
80
  })
81
81
  ])) : b("", !0),
82
82
  d.showCode ? (u(), w("div", _e, [
83
- C(i(_), {
83
+ C(i(Z), {
84
84
  modelValue: i(T),
85
- "onUpdate:modelValue": c[4] || (c[4] = (h) => Y(T) ? T.value = h : null),
85
+ "onUpdate:modelValue": c[4] || (c[4] = (h) => X(T) ? T.value = h : null),
86
86
  size: "large",
87
87
  "text-size": "medium",
88
88
  label: "Код",
89
89
  type: "text",
90
- disabled: x.isFinalLimit,
91
- error: V.value,
90
+ error: x.value,
92
91
  onInput: E,
93
92
  onBlur: c[5] || (c[5] = (h) => m("code"))
94
- }, null, 8, ["modelValue", "disabled", "error"])
93
+ }, null, 8, ["modelValue", "error"])
95
94
  ])) : b("", !0),
96
- C(he, {
95
+ C(ce, {
97
96
  loading: d.loading,
98
97
  "rate-limit-text": d.rateLimitText,
99
98
  "is-final-limit": d.isFinalLimit,
100
99
  "on-send-again": F
101
100
  }, {
102
- extra: q(() => [
101
+ extra: j(() => [
103
102
  d.isTg ? (u(), w("span", {
104
103
  key: 0,
105
104
  class: "dialogDefaultContainerSendCodeBySmsText",
106
- onClick: j
105
+ onClick: R
107
106
  }, [
108
- W(N(d.sendCodeBySmsText) + " ", 1),
109
- C(i(Z), { style: { "margin-left": "5px" } })
107
+ q(N(d.sendCodeBySmsText) + " ", 1),
108
+ C(i(Y), { style: { "margin-left": "5px" } })
110
109
  ])) : b("", !0)
111
110
  ]),
112
111
  _: 1
@@ -125,7 +124,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
125
124
  }, it = {
126
125
  key: 2,
127
126
  class: "input-wrapper"
128
- }, dt = { key: 3 }, rt = /* @__PURE__ */ ie({
127
+ }, dt = { key: 3 }, rt = /* @__PURE__ */ se({
129
128
  __name: "NewPhoneContent",
130
129
  props: {
131
130
  phone: {},
@@ -142,25 +141,25 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
142
141
  isTg: { type: Boolean }
143
142
  },
144
143
  emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code", "on-send-code-again"],
145
- setup(G, { emit: J }) {
146
- const x = G, p = J, r = I(!1), m = I(""), v = de({
144
+ setup(H, { emit: G }) {
145
+ const V = H, p = G, r = I(!1), m = I(""), v = ie({
147
146
  touched: { phone: !1, code: !1 },
148
147
  phoneModel: "",
149
148
  codeModel: ""
150
149
  });
151
- H(
150
+ W(
152
151
  () => v.phoneModel,
153
152
  (t) => {
154
153
  p("update:phone", t), m.value = "";
155
154
  }
156
- ), H(
155
+ ), W(
157
156
  () => v.codeModel,
158
157
  (t) => p("update:code", t)
159
158
  );
160
159
  const E = (t) => v.touched[t] = !0, F = L(() => {
161
160
  const n = v.phoneModel.trim().replace(/[()\-\s]/g, "");
162
161
  return /^\+?\d{10,15}$/.test(n);
163
- }), j = async () => {
162
+ }), R = async () => {
164
163
  var s;
165
164
  if (E("phone"), !F.value) {
166
165
  m.value = "Это не похоже на номер телефона";
@@ -173,33 +172,33 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
173
172
  m.value = "Такой номер уже используется";
174
173
  return;
175
174
  }
176
- m.value = "", p("on-send-code", { phone: v.phoneModel, prevPhone: x.oldPhone, offLoading: !0 }), r.value = !0;
175
+ m.value = "", p("on-send-code", { phone: v.phoneModel, prevPhone: V.oldPhone, offLoading: !0 }), r.value = !0;
177
176
  };
178
177
  let e = I("");
179
178
  const T = (t) => {
180
179
  const n = t.target;
181
180
  let s = ((n == null ? void 0 : n.value) ?? "").replace(/\D/g, "");
182
- s.length > 4 && (s = s.slice(0, 4)), d.value = s, n && n.value !== s && (n.value = s), s.length === 4 && s !== e.value && (e.value = s, p("on-match-code", { phone: V.value, code: s }));
181
+ s.length > 4 && (s = s.slice(0, 4)), d.value = s, n && n.value !== s && (n.value = s), s.length === 4 && s !== e.value && (e.value = s, p("on-match-code", { phone: x.value, code: s }));
183
182
  }, g = () => {
184
183
  p("on-send-code-again", { phone: v.phoneModel });
185
184
  }, f = () => {
186
185
  console.debug("onSendCodeViaSms");
187
- }, { phoneModel: V, codeModel: d, touched: c } = ce(v), h = L(() => m.value ? m.value : c.value.phone && !V.value.trim() ? "Это не похоже на номер телефона" : x.phoneError || ""), ee = L(() => x.isNotMatchCode ? "Неверный код" : c.value.code ? d.value.trim() ? x.codeError ?? null : "Введите код" : "");
186
+ }, { phoneModel: x, codeModel: d, touched: c } = pe(v), h = L(() => m.value ? m.value : c.value.phone && !x.value.trim() ? "Это не похоже на номер телефона" : V.phoneError || ""), _ = L(() => V.isNotMatchCode ? "Неверный код" : c.value.code ? d.value.trim() ? V.codeError ?? null : "Введите код" : "");
188
187
  return (t, n) => (u(), w("div", tt, [
189
188
  A("div", ot, [
190
189
  A("div", nt, N(r.value ? "Чтобы продолжить, введите код подтверждения из" : t.hintText), 1),
191
190
  r.value ? (u(), w("div", at, [
192
- t.isTg ? (u(), R(i(ve), { key: 0 })) : (u(), R(i(Z), {
191
+ t.isTg ? (u(), z(i(he), { key: 0 })) : (u(), z(i(Y), {
193
192
  key: 1,
194
193
  style: { "margin-left": "5px" }
195
194
  })),
196
- W(" " + N(t.isTg ? "Telegram" : "СМС"), 1)
195
+ q(" " + N(t.isTg ? "Telegram" : "СМС"), 1)
197
196
  ])) : b("", !0)
198
197
  ]),
199
198
  t.showPhone ? (u(), w("div", lt, [
200
- C(i(_), {
201
- modelValue: i(V),
202
- "onUpdate:modelValue": n[0] || (n[0] = (s) => Y(V) ? V.value = s : null),
199
+ C(i(Z), {
200
+ modelValue: i(x),
201
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => X(x) ? x.value = s : null),
203
202
  size: "large",
204
203
  "text-size": "medium",
205
204
  label: "Телефон",
@@ -217,43 +216,43 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
217
216
  C(i(Ie), {
218
217
  style: { width: "100%" },
219
218
  disabled: !F.value,
220
- onClick: j
219
+ onClick: R
221
220
  }, {
222
- default: q(() => n[6] || (n[6] = [
223
- W(" Отправить код ")
221
+ default: j(() => n[6] || (n[6] = [
222
+ q(" Отправить код ")
224
223
  ])),
225
224
  _: 1,
226
225
  __: [6]
227
226
  }, 8, ["disabled"])
228
227
  ])),
229
228
  r.value ? (u(), w("div", it, [
230
- C(i(_), {
229
+ C(i(Z), {
231
230
  modelValue: i(d),
232
- "onUpdate:modelValue": n[4] || (n[4] = (s) => Y(d) ? d.value = s : null),
231
+ "onUpdate:modelValue": n[4] || (n[4] = (s) => X(d) ? d.value = s : null),
233
232
  size: "large",
234
233
  "text-size": "medium",
235
234
  label: "Код",
236
235
  type: "text",
237
- error: ee.value,
236
+ error: _.value,
238
237
  onInput: T,
239
238
  onBlur: n[5] || (n[5] = (s) => E("code"))
240
239
  }, null, 8, ["modelValue", "error"])
241
240
  ])) : b("", !0),
242
241
  !t.loading && r.value ? (u(), w("div", dt, [
243
- C(he, {
242
+ C(ce, {
244
243
  loading: t.loading,
245
244
  "rate-limit-text": t.rateLimitText,
246
245
  "is-final-limit": t.isFinalLimit,
247
246
  "on-send-again": g
248
247
  }, {
249
- extra: q(() => [
248
+ extra: j(() => [
250
249
  t.isTg ? (u(), w("span", {
251
250
  key: 0,
252
251
  class: "dialogDefaultContainerSendCodeBySmsText",
253
252
  onClick: f
254
253
  }, [
255
- W(N(t.sendCodeBySmsText) + " ", 1),
256
- C(i(Z), { style: { "margin-left": "5px" } })
254
+ q(N(t.sendCodeBySmsText) + " ", 1),
255
+ C(i(Y), { style: { "margin-left": "5px" } })
257
256
  ])) : b("", !0)
258
257
  ]),
259
258
  _: 1
@@ -270,7 +269,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
270
269
  }, ft = {
271
270
  key: 2,
272
271
  class: "input-wrapper"
273
- }, gt = { key: 3 }, yt = /* @__PURE__ */ ie({
272
+ }, gt = { key: 3 }, yt = /* @__PURE__ */ se({
274
273
  __name: "AddNewPhoneContent",
275
274
  props: {
276
275
  phone: {},
@@ -287,25 +286,25 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
287
286
  isTg: { type: Boolean }
288
287
  },
289
288
  emits: ["update:phone", "update:code", "edit", "on-match-code", "on-match-code-error", "on-send-code", "on-send-code-again"],
290
- setup(G, { emit: J }) {
291
- const x = G, p = J, r = I(!1), m = I(""), v = de({
289
+ setup(H, { emit: G }) {
290
+ const V = H, p = G, r = I(!1), m = I(""), v = ie({
292
291
  touched: { phone: !1, code: !1 },
293
292
  phoneModel: "",
294
293
  codeModel: ""
295
294
  });
296
- H(
295
+ W(
297
296
  () => v.phoneModel,
298
297
  (t) => {
299
298
  p("update:phone", t), m.value = "";
300
299
  }
301
- ), H(
300
+ ), W(
302
301
  () => v.codeModel,
303
302
  (t) => p("update:code", t)
304
303
  );
305
304
  const E = (t) => v.touched[t] = !0, F = L(() => {
306
305
  const n = v.phoneModel.trim().replace(/[()\-\s]/g, "");
307
306
  return /^\+?\d{10,15}$/.test(n);
308
- }), j = async () => {
307
+ }), R = async () => {
309
308
  var s;
310
309
  if (E("phone"), !F.value) {
311
310
  m.value = "Это не похоже на номер телефона";
@@ -318,7 +317,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
318
317
  m.value = "Такой номер уже используется";
319
318
  return;
320
319
  }
321
- m.value = "", p("on-send-code", { phone: v.phoneModel, prevPhone: x.oldPhone, offLoading: !0 }), r.value = !0;
320
+ m.value = "", p("on-send-code", { phone: v.phoneModel, prevPhone: V.oldPhone, offLoading: !0 }), r.value = !0;
322
321
  };
323
322
  let e = "";
324
323
  const T = (t) => {
@@ -329,85 +328,82 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
329
328
  p("on-send-code-again", { phone: v.phoneModel });
330
329
  }, f = () => {
331
330
  console.debug("onSendCodeViaSms");
332
- }, { phoneModel: V, codeModel: d, touched: c } = ce(v), h = L(() => m.value ? m.value : c.value.phone && !V.value.trim() ? "Это не похоже на номер телефона" : x.phoneError || ""), ee = L(() => x.isNotMatchCode ? "Неверный код" : v.touched.code ? d.value.trim() ? x.codeError ?? null : "Введите код" : "");
333
- return (t, n) => {
334
- const s = he;
335
- return u(), w("div", ut, [
336
- A("div", pt, [
337
- A("div", ct, N(r.value ? "Чтобы продолжить, введите код подтверждения из" : t.hintText), 1),
338
- A("div", ht, [
339
- t.isTg ? (u(), R(i(ve), { key: 0 })) : (u(), R(i(Z), {
340
- key: 1,
341
- style: { "margin-left": "5px" }
342
- })),
343
- W(" " + N(t.isTg ? "Telegram" : "СМС"), 1)
344
- ])
345
- ]),
346
- t.showPhone ? (u(), w("div", vt, [
347
- C(i(_), {
348
- modelValue: i(V),
349
- "onUpdate:modelValue": n[0] || (n[0] = (U) => Y(V) ? V.value = U : null),
350
- size: "large",
351
- "text-size": "medium",
352
- label: "Телефон",
353
- type: "tel",
354
- error: h.value,
355
- onBlur: n[1] || (n[1] = (U) => E("phone")),
356
- onInput: n[2] || (n[2] = (U) => E("phone"))
357
- }, null, 8, ["modelValue", "error"]),
358
- C(i(Be), {
359
- class: "icon-locked",
360
- onClick: n[3] || (n[3] = (U) => t.$emit("edit", "phone"))
361
- })
362
- ])) : b("", !0),
363
- r.value ? b("", !0) : (u(), w("div", mt, [
364
- C(i(Ie), {
365
- style: { width: "100%" },
366
- disabled: !F.value,
367
- onClick: j
368
- }, {
369
- default: q(() => n[6] || (n[6] = [
370
- W(" Отправить код ")
371
- ])),
372
- _: 1,
373
- __: [6]
374
- }, 8, ["disabled"])
375
- ])),
376
- r.value ? (u(), w("div", ft, [
377
- C(i(_), {
378
- modelValue: i(d),
379
- "onUpdate:modelValue": n[4] || (n[4] = (U) => Y(d) ? d.value = U : null),
380
- size: "large",
381
- "text-size": "medium",
382
- label: "Код",
383
- type: "text",
384
- error: ee.value,
385
- onInput: T,
386
- onBlur: n[5] || (n[5] = (U) => E("code"))
387
- }, null, 8, ["modelValue", "error"])
388
- ])) : b("", !0),
389
- r.value ? (u(), w("div", gt, [
390
- C(s, {
391
- loading: t.loading,
392
- "rate-limit-text": t.rateLimitText,
393
- "is-final-limit": t.isFinalLimit,
394
- "on-send-again": g
395
- }, {
396
- extra: q(() => [
397
- t.isTg ? (u(), w("span", {
398
- key: 0,
399
- class: "dialogDefaultContainerSendCodeBySmsText",
400
- onClick: f
401
- }, [
402
- W(N(t.sendCodeBySmsText) + " ", 1),
403
- C(i(Z), { style: { "margin-left": "5px" } })
404
- ])) : b("", !0)
405
- ]),
406
- _: 1
407
- }, 8, ["loading", "rate-limit-text", "is-final-limit"])
408
- ])) : b("", !0)
409
- ]);
410
- };
331
+ }, { phoneModel: x, codeModel: d, touched: c } = pe(v), h = L(() => m.value ? m.value : c.value.phone && !x.value.trim() ? "Это не похоже на номер телефона" : V.phoneError || ""), _ = L(() => V.isNotMatchCode ? "Неверный код" : v.touched.code ? d.value.trim() ? V.codeError ?? null : "Введите код" : "");
332
+ return (t, n) => (u(), w("div", ut, [
333
+ A("div", pt, [
334
+ A("div", ct, N(r.value ? "Чтобы продолжить, введите код подтверждения из" : t.hintText), 1),
335
+ A("div", ht, [
336
+ t.isTg ? (u(), z(i(he), { key: 0 })) : (u(), z(i(Y), {
337
+ key: 1,
338
+ style: { "margin-left": "5px" }
339
+ })),
340
+ q(" " + N(t.isTg ? "Telegram" : "СМС"), 1)
341
+ ])
342
+ ]),
343
+ t.showPhone ? (u(), w("div", vt, [
344
+ C(i(Z), {
345
+ modelValue: i(x),
346
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => X(x) ? x.value = s : null),
347
+ size: "large",
348
+ "text-size": "medium",
349
+ label: "Телефон",
350
+ type: "tel",
351
+ error: h.value,
352
+ onBlur: n[1] || (n[1] = (s) => E("phone")),
353
+ onInput: n[2] || (n[2] = (s) => E("phone"))
354
+ }, null, 8, ["modelValue", "error"]),
355
+ C(i(Be), {
356
+ class: "icon-locked",
357
+ onClick: n[3] || (n[3] = (s) => t.$emit("edit", "phone"))
358
+ })
359
+ ])) : b("", !0),
360
+ r.value ? b("", !0) : (u(), w("div", mt, [
361
+ C(i(Ie), {
362
+ style: { width: "100%" },
363
+ disabled: !F.value,
364
+ onClick: R
365
+ }, {
366
+ default: j(() => n[6] || (n[6] = [
367
+ q(" Отправить код ")
368
+ ])),
369
+ _: 1,
370
+ __: [6]
371
+ }, 8, ["disabled"])
372
+ ])),
373
+ r.value ? (u(), w("div", ft, [
374
+ C(i(Z), {
375
+ modelValue: i(d),
376
+ "onUpdate:modelValue": n[4] || (n[4] = (s) => X(d) ? d.value = s : null),
377
+ size: "large",
378
+ "text-size": "medium",
379
+ label: "Код",
380
+ type: "text",
381
+ error: _.value,
382
+ onInput: T,
383
+ onBlur: n[5] || (n[5] = (s) => E("code"))
384
+ }, null, 8, ["modelValue", "error"])
385
+ ])) : b("", !0),
386
+ r.value ? (u(), w("div", gt, [
387
+ C(ce, {
388
+ loading: t.loading,
389
+ "rate-limit-text": t.rateLimitText,
390
+ "is-final-limit": t.isFinalLimit,
391
+ "on-send-again": g
392
+ }, {
393
+ extra: j(() => [
394
+ t.isTg ? (u(), w("span", {
395
+ key: 0,
396
+ class: "dialogDefaultContainerSendCodeBySmsText",
397
+ onClick: f
398
+ }, [
399
+ q(N(t.sendCodeBySmsText) + " ", 1),
400
+ C(i(Y), { style: { "margin-left": "5px" } })
401
+ ])) : b("", !0)
402
+ ]),
403
+ _: 1
404
+ }, 8, ["loading", "rate-limit-text", "is-final-limit"])
405
+ ])) : b("", !0)
406
+ ]));
411
407
  }
412
408
  }), Ct = { class: "text-center w-full" }, wt = { class: "dialogTitle" }, Pt = {
413
409
  key: 0,
@@ -415,7 +411,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
415
411
  }, Tt = { key: 3 }, St = {
416
412
  key: 1,
417
413
  class: "dialogDefaultContainer"
418
- }, se = 3, bt = /* @__PURE__ */ ie({
414
+ }, le = 3, bt = /* @__PURE__ */ se({
419
415
  __name: "ProfilePhoneDialog",
420
416
  props: {
421
417
  modelValue: { type: Boolean },
@@ -427,26 +423,26 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
427
423
  mode: { default: void 0 }
428
424
  },
429
425
  emits: ["update:modelValue", "submit-phone", "edit", "close", "clean-input-errors", "on-update-jwt", "update-phone-field", "on-toast"],
430
- setup(G, { expose: J, emit: x }) {
431
- const p = G, r = x, m = I(p.modelValue);
432
- H(
426
+ setup(H, { expose: G, emit: V }) {
427
+ const p = H, r = V, m = I(p.modelValue);
428
+ W(
433
429
  () => p.modelValue,
434
430
  (l) => m.value = l
435
- ), H(m, (l) => r("update:modelValue", l));
436
- const v = L(() => p.language ?? "ru"), E = (l) => be[v.value] && be[v.value][l] || (p.title ?? l), F = L(() => p.title ?? E("Смена номера телефона")), j = L(() => p.hintText ?? E("Чтобы продолжить, введите новый номер")), e = de({
431
+ ), W(m, (l) => r("update:modelValue", l));
432
+ const v = L(() => p.language ?? "ru"), E = (l) => be[v.value] && be[v.value][l] || (p.title ?? l), F = L(() => p.title ?? E("Смена номера телефона")), R = L(() => p.hintText ?? E("Чтобы продолжить, введите новый номер")), e = ie({
437
433
  oldPhone: p.initialPhone ?? "",
438
434
  newPhone: "",
439
435
  code: "",
440
436
  addPhone: "",
441
437
  addCode: ""
442
- }), T = I(O.OLD), g = I(null), f = I(!1), V = I(!1), d = I("tg"), c = L(() => d.value === "tg"), { startTimer: h, remainingSeconds: ee, isAvailableForSendAgain: t, totalRateAttempts: n, currentRateAttempt: s } = ze(), { showRateLimitToast: U } = je(r), { isEditFlow: re, getFlow: Le } = Re(I(p.mode)), te = L(() => t.value ? "Повторить" : `${ee.value}`), oe = I(se), ne = L(() => oe.value === 0), De = (l) => new Promise((a) => setTimeout(a, l));
443
- async function ue(l = "email") {
438
+ }), T = I(O.OLD), g = I(null), f = I(!1), x = I(!1), d = I("tg"), c = L(() => d.value === "tg"), { startTimer: h, remainingSeconds: _, isAvailableForSendAgain: t, totalRateAttempts: n, currentRateAttempt: s } = ze(), { showRateLimitToast: ve } = je(r), { isEditFlow: de, getFlow: Le } = Re(I(p.mode)), ee = L(() => t.value ? "Повторить" : `${_.value}`), te = I(le), oe = L(() => te.value === 0), De = (l) => new Promise((a) => setTimeout(a, l));
439
+ async function re(l = "email") {
444
440
  var o;
445
441
  return (o = (await $e("/users/profile/session/get-edit-session", { params: { field: l } })).data) == null ? void 0 : o.data;
446
442
  }
447
443
  async function me(l = "phone") {
448
444
  var S;
449
- const o = (S = (await K("/users/profile/session/create-if-not-exists", {
445
+ const o = (S = (await J("/users/profile/session/create-if-not-exists", {
450
446
  field: l,
451
447
  oldValue: p.initialPhone
452
448
  })).data) == null ? void 0 : S.data;
@@ -454,7 +450,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
454
450
  }
455
451
  async function Oe() {
456
452
  try {
457
- const l = await ue("phone");
453
+ const l = await re("phone");
458
454
  g.value = l.sessionId, T.value = l.step, e.oldPhone = l.oldValue ?? "", l.sessionId || await me("phone");
459
455
  } catch {
460
456
  await me("phone");
@@ -463,23 +459,23 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
463
459
  async function fe(l, a = !1) {
464
460
  var o;
465
461
  try {
466
- const S = await K("/users/profile/check-throttler", {
462
+ const S = await J("/users/profile/check-throttler", {
467
463
  method: "sms",
468
464
  phone: l,
469
465
  isInvite: a
470
466
  });
471
467
  await De(1e3);
472
468
  const y = (o = S.data) == null ? void 0 : o.data;
473
- return y ? (y.restTimeSec > 0 ? (h(y.restTimeSec), t.value = !1, n.value = y.attempts.total, s.value = y.attempts.total - y.attempts.available, oe.value = y.attempts.available ?? se) : t.value = !0, y) : null;
469
+ return y ? (y.restTimeSec > 0 ? (h(y.restTimeSec), t.value = !1, n.value = y.attempts.total, s.value = y.attempts.total - y.attempts.available, te.value = y.attempts.available ?? le) : t.value = !0, y) : null;
474
470
  } catch {
475
471
  return null;
476
472
  }
477
473
  }
478
- const Q = async ({ value: l, offLoading: a = !0 } = {}) => {
474
+ const K = async ({ value: l, offLoading: a = !0 } = {}) => {
479
475
  var o, S, y;
480
476
  f.value = !0;
481
477
  try {
482
- const B = l ?? e.oldPhone, P = await K("/users/profile/phone/contact/send-code", {
478
+ const B = l ?? e.oldPhone, P = await J("/users/profile/phone/contact/send-code", {
483
479
  sessionId: g.value,
484
480
  phone: B,
485
481
  value: B,
@@ -488,34 +484,34 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
488
484
  }), k = (S = (o = P == null ? void 0 : P.data) == null ? void 0 : o.data) == null ? void 0 : S.deliveryType;
489
485
  if ((k === "tg" || k === "sms") && (d.value = k), P.status === 403 && ((y = P.data) != null && y.tooManyRequests)) {
490
486
  const $ = P.data.tooManyRequests;
491
- return $.restTimeSec > 0 ? (h($.restTimeSec), n.value = $.attempts.total, s.value = $.attempts.total - $.attempts.available, oe.value = $.attempts.available ?? se) : t.value = !0, P;
487
+ return $.restTimeSec > 0 ? (h($.restTimeSec), n.value = $.attempts.total, s.value = $.attempts.total - $.attempts.available, te.value = $.attempts.available ?? le) : t.value = !0, P;
492
488
  }
493
489
  return await fe(B), P;
494
490
  } finally {
495
- a && (f.value = !1);
491
+ f.value = !1;
496
492
  }
497
493
  }, ge = async (l, a) => {
498
494
  var o, S, y, B, P, k, $, M;
499
495
  f.value = !0;
500
496
  try {
501
- const D = await ue("phone");
497
+ const D = await re("phone");
502
498
  g.value = D.sessionId, T.value = D.step, e.oldPhone = D.oldValue ?? e.oldPhone, e.newPhone = D.newValue ?? e.newPhone;
503
- const z = await K("/users/profile/change/phone/match-code", {
499
+ const U = await J("/users/profile/change/phone/match-code", {
504
500
  phone: a === O.NEW ? e.newPhone : e.oldPhone,
505
501
  sessionId: g.value,
506
502
  code: l,
507
503
  step: a
508
- }), X = ((o = z.data) == null ? void 0 : o.nextStep) ?? ((y = (S = z.data) == null ? void 0 : S.data) == null ? void 0 : y.nextStep), le = ((P = (B = z.data) == null ? void 0 : B.data) == null ? void 0 : P.rateLimit) ?? ((k = z.data) == null ? void 0 : k.rateLimit) ?? null, Ne = (($ = z.data) == null ? void 0 : $.data.success) ?? ((M = z.data) == null ? void 0 : M.success);
509
- if (U(le), !Ne) {
510
- V.value = !0;
504
+ }), Q = ((o = U.data) == null ? void 0 : o.nextStep) ?? ((y = (S = U.data) == null ? void 0 : S.data) == null ? void 0 : y.nextStep), ae = ((P = (B = U.data) == null ? void 0 : B.data) == null ? void 0 : P.rateLimit) ?? ((k = U.data) == null ? void 0 : k.rateLimit) ?? null, Ne = (($ = U.data) == null ? void 0 : $.data.success) ?? ((M = U.data) == null ? void 0 : M.success);
505
+ if (ve(ae), !Ne) {
506
+ x.value = !0;
511
507
  return;
512
508
  }
513
- if (!X) return z;
514
- if (T.value = X, X === O.NEW) {
515
- const Ve = await ue("phone");
509
+ if (!Q) return U;
510
+ if (T.value = Q, Q === O.NEW) {
511
+ const Ve = await re("phone");
516
512
  e.oldPhone = Ve.oldValue ?? e.oldPhone, e.newPhone = Ve.newValue ?? e.newPhone, e.code = "";
517
513
  }
518
- return X === O.COMPLETED && (e.code = "", r("update-phone-field", e.addPhone), r("submit-phone", { phone: e.oldPhone, code: l }), r("on-toast", { color: "success", text: "Номер телефона изменён" }), r("on-update-jwt", "phone", "edit", e.newPhone), g.value = null, r("close")), z;
514
+ return Q === O.COMPLETED && (e.code = "", r("update-phone-field", e.addPhone), r("submit-phone", { phone: e.oldPhone, code: l }), r("on-toast", { color: "success", text: "Номер телефона изменён" }), r("on-update-jwt", "phone", "edit", e.newPhone), g.value = null, r("close")), U;
519
515
  } finally {
520
516
  f.value = !1;
521
517
  }
@@ -525,7 +521,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
525
521
  const we = ({ code: l }) => ge(l, O.NEW);
526
522
  function Pe(l) {
527
523
  }
528
- const ae = () => {
524
+ const ne = () => {
529
525
  r("close"), m.value = !1;
530
526
  };
531
527
  async function Te(l = "phone") {
@@ -541,7 +537,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
541
537
  f.value = !0;
542
538
  try {
543
539
  if (!g.value) {
544
- const P = await K("/users/profile/session/bind/create", {
540
+ const P = await J("/users/profile/session/bind/create", {
545
541
  field: a,
546
542
  newValue: l ?? e.addPhone
547
543
  });
@@ -560,7 +556,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
560
556
  await Se({ field: "phone", value: e.addPhone });
561
557
  }
562
558
  }
563
- const pe = async ({
559
+ const ue = async ({
564
560
  value: l,
565
561
  field: a = "phone",
566
562
  offLoading: o = !0
@@ -570,7 +566,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
570
566
  try {
571
567
  if (!g.value)
572
568
  throw new Error("bind-сессия не найдена. создайте её через createBindSession.");
573
- const P = l ?? e.addPhone, k = await K(`/users/profile/bind/contact/send-code/${a}`, {
569
+ const P = l ?? e.addPhone, k = await J(`/users/profile/bind/contact/send-code/${a}`, {
574
570
  sessionId: g.value,
575
571
  phone: P,
576
572
  provider: p.provider
@@ -578,7 +574,7 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
578
574
  ($ === "tg" || $ === "sms") && (d.value = $);
579
575
  const M = (B = k.data) == null ? void 0 : B.tooManyRequests;
580
576
  if (k.status === 403 && M)
581
- return M.restTimeSec > 0 ? (h(M.restTimeSec), n.value = M.attempts.total, s.value = M.attempts.total - M.attempts.available, oe.value = M.attempts.available ?? se) : t.value = !0, k;
577
+ return M.restTimeSec > 0 ? (h(M.restTimeSec), n.value = M.attempts.total, s.value = M.attempts.total - M.attempts.available, te.value = M.attempts.available ?? le) : t.value = !0, k;
582
578
  const D = await fe(P);
583
579
  return D && D.restTimeSec > 0 ? (h(D.restTimeSec), t.value = !1) : t.value = !0, k;
584
580
  } finally {
@@ -589,16 +585,16 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
589
585
  f.value = !0;
590
586
  try {
591
587
  if (!g.value) {
592
- const le = await Te("phone");
593
- g.value = le.sessionId, e.addPhone = le.newValue ?? e.addPhone;
588
+ const ae = await Te("phone");
589
+ g.value = ae.sessionId, e.addPhone = ae.newValue ?? e.addPhone;
594
590
  }
595
- const M = await K("/users/profile/bind/phone/match-code", {
591
+ const M = await J("/users/profile/bind/phone/match-code", {
596
592
  phone: e.addPhone,
597
593
  sessionId: g.value,
598
594
  code: l
599
- }), D = ((a = M.data) == null ? void 0 : a.nextStep) ?? ((S = (o = M.data) == null ? void 0 : o.data) == null ? void 0 : S.nextStep), z = ((B = (y = M.data) == null ? void 0 : y.data) == null ? void 0 : B.rateLimit) ?? ((P = M.data) == null ? void 0 : P.rateLimit) ?? null, X = ((k = M.data) == null ? void 0 : k.data.success) ?? (($ = M.data) == null ? void 0 : $.success);
600
- if (U(z), !X) {
601
- V.value = !0;
595
+ }), D = ((a = M.data) == null ? void 0 : a.nextStep) ?? ((S = (o = M.data) == null ? void 0 : o.data) == null ? void 0 : S.nextStep), U = ((B = (y = M.data) == null ? void 0 : y.data) == null ? void 0 : B.rateLimit) ?? ((P = M.data) == null ? void 0 : P.rateLimit) ?? null, Q = ((k = M.data) == null ? void 0 : k.data.success) ?? (($ = M.data) == null ? void 0 : $.success);
596
+ if (ve(U), !Q) {
597
+ x.value = !0;
602
598
  return;
603
599
  }
604
600
  return D && D === O.COMPLETED && (e.code = "", r("update-phone-field", e.addPhone), r("submit-phone", { phone: e.addPhone, code: l }), r("on-update-jwt", "phone", "bind", e.addPhone), g.value = null, r("close")), M;
@@ -608,24 +604,25 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
608
604
  }, xe = async () => {
609
605
  };
610
606
  return Fe(async () => {
607
+ f.value = !0;
611
608
  const l = await Le("phone");
612
609
  if (p.mode === "bind" && l === "bind") {
613
610
  await Ae(), f.value = !1;
614
611
  return;
615
612
  }
616
- await Oe(), await Q({}), f.value = !1;
617
- }), J({
613
+ await Oe(), await K({});
614
+ }), G({
618
615
  localVisible: m,
619
616
  form: e,
620
617
  currentStep: T,
621
618
  loading: f,
622
- rateLimitText: te,
623
- isAvailable: ne,
619
+ rateLimitText: ee,
620
+ isAvailable: oe,
624
621
  title: F,
625
- hintText: j,
626
- handleClose: ae,
627
- sendContactCode: Q,
628
- sendBindContactCode: pe,
622
+ hintText: R,
623
+ handleClose: ne,
624
+ sendContactCode: K,
625
+ sendBindContactCode: ue,
629
626
  handleOldCodeSuccess: ye,
630
627
  handleOldCodeError: Ce,
631
628
  handleNewCodeSuccess: we,
@@ -637,14 +634,14 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
637
634
  modelValue: m.value,
638
635
  "onUpdate:modelValue": [
639
636
  a[14] || (a[14] = (o) => m.value = o),
640
- ae
637
+ ne
641
638
  ],
642
639
  width: "small",
643
640
  "auto-height": !0,
644
641
  "close-on-click-outside": !0,
645
- "onClick:outside": ae
642
+ "onClick:outside": ne
646
643
  }, {
647
- header: q(() => [
644
+ header: j(() => [
648
645
  A("div", Ct, [
649
646
  C(i(He), {
650
647
  "slot-left": !1,
@@ -652,38 +649,38 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
652
649
  borded: !0,
653
650
  "no-padding": !1
654
651
  }, {
655
- title: q(() => [
656
- A("span", wt, N(i(re) ? F.value : "Добавление номера телефона"), 1)
652
+ title: j(() => [
653
+ A("span", wt, N(i(de) ? F.value : "Добавление номера телефона"), 1)
657
654
  ]),
658
- "right-button": q(() => [
655
+ "right-button": j(() => [
659
656
  C(i(Ge), {
660
657
  class: "cross",
661
- onClick: ae
658
+ onClick: ne
662
659
  })
663
660
  ]),
664
661
  _: 1
665
662
  })
666
663
  ])
667
664
  ]),
668
- default: q(() => [
669
- i(re) ? (u(), w("div", Pt, [
670
- f.value ? (u(), R(ke, { key: 0 })) : b("", !0),
671
- T.value === i(O).OLD ? (u(), R(et, {
665
+ default: j(() => [
666
+ i(de) ? (u(), w("div", Pt, [
667
+ f.value ? (u(), z(ke, { key: 0 })) : b("", !0),
668
+ T.value === i(O).OLD ? (u(), z(et, {
672
669
  key: 1,
673
670
  phone: e.oldPhone,
674
671
  "onUpdate:phone": a[0] || (a[0] = (o) => e.oldPhone = o),
675
672
  code: e.code,
676
673
  "onUpdate:code": a[1] || (a[1] = (o) => e.code = o),
677
- "rate-limit-text": te.value,
678
- "is-final-limit": ne.value,
679
- "is-not-match-code": V.value,
674
+ "rate-limit-text": ee.value,
675
+ "is-final-limit": oe.value,
676
+ "is-not-match-code": x.value,
680
677
  loading: f.value,
681
678
  "is-tg": c.value,
682
- onOnSendCode: a[2] || (a[2] = (o) => Q({ value: e.oldPhone })),
683
- onOnSendCodeAgain: a[3] || (a[3] = (o) => Q({ value: e.oldPhone })),
679
+ onOnSendCode: a[2] || (a[2] = (o) => K({ value: e.oldPhone })),
680
+ onOnSendCodeAgain: a[3] || (a[3] = (o) => K({ value: e.oldPhone })),
684
681
  onOnMatchCode: ye,
685
682
  onOnMatchCodeError: Ce
686
- }, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : T.value === i(O).NEW ? (u(), R(rt, {
683
+ }, null, 8, ["phone", "code", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : T.value === i(O).NEW ? (u(), z(rt, {
687
684
  key: 2,
688
685
  phone: e.newPhone,
689
686
  "onUpdate:phone": a[4] || (a[4] = (o) => e.newPhone = o),
@@ -691,21 +688,21 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
691
688
  "onUpdate:oldPhone": a[5] || (a[5] = (o) => e.oldPhone = o),
692
689
  code: e.code,
693
690
  "onUpdate:code": a[6] || (a[6] = (o) => e.code = o),
694
- "hint-text": j.value,
695
- "rate-limit-text": te.value,
696
- "is-final-limit": ne.value,
697
- "is-not-match-code": V.value,
691
+ "hint-text": R.value,
692
+ "rate-limit-text": ee.value,
693
+ "is-final-limit": oe.value,
694
+ "is-not-match-code": x.value,
698
695
  loading: f.value,
699
696
  "is-tg": c.value,
700
- onOnSendCode: a[7] || (a[7] = (o) => Q({ value: e.newPhone })),
701
- onOnSendCodeAgain: a[8] || (a[8] = (o) => Q({ value: e.newPhone })),
697
+ onOnSendCode: a[7] || (a[7] = (o) => K({ value: e.newPhone })),
698
+ onOnSendCodeAgain: a[8] || (a[8] = (o) => K({ value: e.newPhone })),
702
699
  onOnMatchCode: we,
703
700
  onOnMatchCodeError: Pe
704
701
  }, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])) : T.value === i(O).COMPLETED ? (u(), w("div", Tt, [
705
702
  A("p", null, N(E("Телефон успешно изменен")), 1)
706
703
  ])) : b("", !0)
707
704
  ])) : (u(), w("div", St, [
708
- f.value ? (u(), R(ke, { key: 0 })) : b("", !0),
705
+ f.value ? (u(), z(ke, { key: 0 })) : b("", !0),
709
706
  C(yt, {
710
707
  phone: e.addPhone,
711
708
  "onUpdate:phone": a[9] || (a[9] = (o) => e.addPhone = o),
@@ -713,14 +710,14 @@ const Ke = { class: "dialogDefaultContainerInsideContent" }, Qe = { style: { dis
713
710
  "onUpdate:oldPhone": a[10] || (a[10] = (o) => e.oldPhone = o),
714
711
  code: e.addCode,
715
712
  "onUpdate:code": a[11] || (a[11] = (o) => e.addCode = o),
716
- "hint-text": i(re) ? j.value : "Чтобы продолжить, введите новый номер",
717
- "rate-limit-text": te.value,
718
- "is-final-limit": ne.value,
719
- "is-not-match-code": V.value,
713
+ "hint-text": i(de) ? R.value : "Чтобы продолжить, введите новый номер",
714
+ "rate-limit-text": ee.value,
715
+ "is-final-limit": oe.value,
716
+ "is-not-match-code": x.value,
720
717
  loading: f.value,
721
718
  "is-tg": c.value,
722
- onOnSendCode: a[12] || (a[12] = (o) => pe({ value: e.addPhone, field: "phone" })),
723
- onOnSendCodeAgain: a[13] || (a[13] = (o) => pe({ value: e.addPhone, field: "phone" })),
719
+ onOnSendCode: a[12] || (a[12] = (o) => ue({ value: e.addPhone, field: "phone" })),
720
+ onOnSendCodeAgain: a[13] || (a[13] = (o) => ue({ value: e.addPhone, field: "phone" })),
724
721
  onOnMatchCode: Me,
725
722
  onOnMatchCodeError: xe
726
723
  }, null, 8, ["phone", "oldPhone", "code", "hint-text", "rate-limit-text", "is-final-limit", "is-not-match-code", "loading", "is-tg"])