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