adata-ui 3.1.36 → 3.1.38

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 (136) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +11 -1
  3. package/dist/runtime/components/Header.vue +8 -2
  4. package/dist/runtime/components/Modal.vue +286 -0
  5. package/dist/runtime/components/Modal.vue.d.ts +41 -0
  6. package/dist/runtime/components/header/ListItem.vue.d.ts +1 -1
  7. package/dist/runtime/components/mobile-navigation/BottomNavigation.vue +8 -2
  8. package/dist/runtime/components/modals/NoAccessContent.vue +8 -2
  9. package/dist/runtime/components/modals/id/IdAccessModal.vue +75 -0
  10. package/dist/runtime/components/modals/id/IdAccessModal.vue.d.ts +6 -0
  11. package/dist/runtime/components/modals/id/IdBanner.vue +45 -0
  12. package/dist/runtime/components/modals/id/IdBanner.vue.d.ts +2 -0
  13. package/dist/runtime/components/modals/id/IdConfirmAccountOtpModal.vue +169 -0
  14. package/dist/runtime/components/modals/id/IdConfirmAccountOtpModal.vue.d.ts +2 -0
  15. package/dist/runtime/components/modals/id/IdConfirmSuccessfulModal.vue +38 -0
  16. package/dist/runtime/components/modals/id/IdConfirmSuccessfulModal.vue.d.ts +2 -0
  17. package/dist/runtime/components/modals/id/IdLoginModal.vue +277 -0
  18. package/dist/runtime/components/modals/id/IdLoginModal.vue.d.ts +6 -0
  19. package/dist/runtime/components/modals/id/IdModals.vue +98 -0
  20. package/dist/runtime/components/modals/id/IdModals.vue.d.ts +2 -0
  21. package/dist/runtime/components/modals/id/IdNewPasswordModal.vue +113 -0
  22. package/dist/runtime/components/modals/id/IdNewPasswordModal.vue.d.ts +2 -0
  23. package/dist/runtime/components/modals/id/IdOtpInput.vue +128 -0
  24. package/dist/runtime/components/modals/id/IdOtpInput.vue.d.ts +15 -0
  25. package/dist/runtime/components/modals/id/IdPasswordSuccessfulModal.vue +23 -0
  26. package/dist/runtime/components/modals/id/IdPasswordSuccessfulModal.vue.d.ts +2 -0
  27. package/dist/runtime/components/modals/id/IdRecoveryModal.vue +103 -0
  28. package/dist/runtime/components/modals/id/IdRecoveryModal.vue.d.ts +2 -0
  29. package/dist/runtime/components/modals/id/IdRegistrationModal.vue +177 -0
  30. package/dist/runtime/components/modals/id/IdRegistrationModal.vue.d.ts +7 -0
  31. package/dist/runtime/components/modals/id/IdResetPasswordOtpModal.vue +141 -0
  32. package/dist/runtime/components/modals/id/IdResetPasswordOtpModal.vue.d.ts +2 -0
  33. package/dist/runtime/components/modals/id/IdTwoFactorModal.vue +114 -0
  34. package/dist/runtime/components/modals/id/IdTwoFactorModal.vue.d.ts +2 -0
  35. package/dist/runtime/components/tree-select/components/tree-select-nodes.vue.d.ts +1 -1
  36. package/dist/runtime/composables/projectState.d.ts +2 -2
  37. package/dist/runtime/composables/useIdModals.d.ts +23 -0
  38. package/dist/runtime/composables/useIdModals.js +32 -0
  39. package/dist/runtime/i18n/i18n.config.d.ts +333 -0
  40. package/dist/runtime/i18n.d.ts +1 -1
  41. package/dist/runtime/icons/hand-with-phone/hand-with-phone-dark.vue +52 -0
  42. package/dist/runtime/icons/hand-with-phone/hand-with-phone-dark.vue.d.ts +2 -0
  43. package/dist/runtime/icons/hand-with-phone/hand-with-phone-light.vue +52 -0
  44. package/dist/runtime/icons/hand-with-phone/hand-with-phone-light.vue.d.ts +2 -0
  45. package/dist/runtime/icons/socials/google.vue +41 -0
  46. package/dist/runtime/icons/socials/google.vue.d.ts +2 -0
  47. package/dist/runtime/icons/socials/mailru.vue +34 -0
  48. package/dist/runtime/icons/socials/mailru.vue.d.ts +2 -0
  49. package/dist/runtime/icons/socials/yandex.vue +28 -0
  50. package/dist/runtime/icons/socials/yandex.vue.d.ts +2 -0
  51. package/dist/runtime/icons/toasts/check-circle-toast.vue +6 -0
  52. package/dist/runtime/icons/toasts/check-circle-toast.vue.d.ts +2 -0
  53. package/dist/runtime/icons/toasts/warning-triangle-toast.vue +7 -0
  54. package/dist/runtime/icons/toasts/warning-triangle-toast.vue.d.ts +2 -0
  55. package/dist/runtime/illustrations/address-location.vue +38 -0
  56. package/dist/runtime/illustrations/address-location.vue.d.ts +2 -0
  57. package/dist/runtime/illustrations/ball-with-chain.vue +120 -0
  58. package/dist/runtime/illustrations/ball-with-chain.vue.d.ts +2 -0
  59. package/dist/runtime/illustrations/bill.vue +133 -0
  60. package/dist/runtime/illustrations/bill.vue.d.ts +2 -0
  61. package/dist/runtime/illustrations/buildings.vue +82 -0
  62. package/dist/runtime/illustrations/buildings.vue.d.ts +2 -0
  63. package/dist/runtime/illustrations/calendar.vue +156 -0
  64. package/dist/runtime/illustrations/calendar.vue.d.ts +2 -0
  65. package/dist/runtime/illustrations/chains.vue +152 -0
  66. package/dist/runtime/illustrations/chains.vue.d.ts +2 -0
  67. package/dist/runtime/illustrations/coin-percent.vue +126 -0
  68. package/dist/runtime/illustrations/coin-percent.vue.d.ts +2 -0
  69. package/dist/runtime/illustrations/coins-stack.vue +202 -0
  70. package/dist/runtime/illustrations/coins-stack.vue.d.ts +2 -0
  71. package/dist/runtime/illustrations/delete-dark.vue +31 -0
  72. package/dist/runtime/illustrations/delete-dark.vue.d.ts +2 -0
  73. package/dist/runtime/illustrations/delete.vue +32 -0
  74. package/dist/runtime/illustrations/delete.vue.d.ts +2 -0
  75. package/dist/runtime/illustrations/doc-with-stamp.vue +126 -0
  76. package/dist/runtime/illustrations/doc-with-stamp.vue.d.ts +2 -0
  77. package/dist/runtime/illustrations/document.vue +64 -0
  78. package/dist/runtime/illustrations/document.vue.d.ts +2 -0
  79. package/dist/runtime/illustrations/door.vue +74 -0
  80. package/dist/runtime/illustrations/door.vue.d.ts +2 -0
  81. package/dist/runtime/illustrations/empty-box.vue +77 -0
  82. package/dist/runtime/illustrations/empty-box.vue.d.ts +2 -0
  83. package/dist/runtime/illustrations/empty-wallet.vue +161 -0
  84. package/dist/runtime/illustrations/empty-wallet.vue.d.ts +2 -0
  85. package/dist/runtime/illustrations/graph-in-coin.vue +119 -0
  86. package/dist/runtime/illustrations/graph-in-coin.vue.d.ts +2 -0
  87. package/dist/runtime/illustrations/hammer.vue +156 -0
  88. package/dist/runtime/illustrations/hammer.vue.d.ts +2 -0
  89. package/dist/runtime/illustrations/hand-cash.vue +108 -0
  90. package/dist/runtime/illustrations/hand-cash.vue.d.ts +2 -0
  91. package/dist/runtime/illustrations/info.vue +39 -0
  92. package/dist/runtime/illustrations/info.vue.d.ts +2 -0
  93. package/dist/runtime/illustrations/mail.vue +68 -0
  94. package/dist/runtime/illustrations/mail.vue.d.ts +2 -0
  95. package/dist/runtime/illustrations/ok.vue +62 -0
  96. package/dist/runtime/illustrations/ok.vue.d.ts +2 -0
  97. package/dist/runtime/illustrations/people-group.vue +237 -0
  98. package/dist/runtime/illustrations/people-group.vue.d.ts +2 -0
  99. package/dist/runtime/illustrations/person-with-phone.vue +187 -0
  100. package/dist/runtime/illustrations/person-with-phone.vue.d.ts +2 -0
  101. package/dist/runtime/illustrations/person.vue +159 -0
  102. package/dist/runtime/illustrations/person.vue.d.ts +2 -0
  103. package/dist/runtime/illustrations/phone-check.vue +90 -0
  104. package/dist/runtime/illustrations/phone-check.vue.d.ts +2 -0
  105. package/dist/runtime/illustrations/phone-payment-method.vue +223 -0
  106. package/dist/runtime/illustrations/phone-payment-method.vue.d.ts +2 -0
  107. package/dist/runtime/illustrations/stop-hand.vue +77 -0
  108. package/dist/runtime/illustrations/stop-hand.vue.d.ts +2 -0
  109. package/dist/runtime/illustrations/stop-sign.vue +34 -0
  110. package/dist/runtime/illustrations/stop-sign.vue.d.ts +2 -0
  111. package/dist/runtime/illustrations/suit.vue +111 -0
  112. package/dist/runtime/illustrations/suit.vue.d.ts +2 -0
  113. package/dist/runtime/illustrations/suitcase.vue +105 -0
  114. package/dist/runtime/illustrations/suitcase.vue.d.ts +2 -0
  115. package/dist/runtime/illustrations/terminal-dark.vue +48 -0
  116. package/dist/runtime/illustrations/terminal-dark.vue.d.ts +2 -0
  117. package/dist/runtime/illustrations/terminal.vue +234 -0
  118. package/dist/runtime/illustrations/terminal.vue.d.ts +2 -0
  119. package/dist/runtime/illustrations/trash-can.vue +108 -0
  120. package/dist/runtime/illustrations/trash-can.vue.d.ts +2 -0
  121. package/dist/runtime/illustrations/turn-on-tariff.vue +38 -0
  122. package/dist/runtime/illustrations/turn-on-tariff.vue.d.ts +2 -0
  123. package/dist/runtime/illustrations/two-persons.vue +169 -0
  124. package/dist/runtime/illustrations/two-persons.vue.d.ts +2 -0
  125. package/dist/runtime/lang/en.js +113 -2
  126. package/dist/runtime/lang/kk.js +113 -2
  127. package/dist/runtime/lang/ru.d.ts +111 -0
  128. package/dist/runtime/lang/ru.js +113 -2
  129. package/dist/runtime/plugins/toast.d.ts +505 -0
  130. package/dist/runtime/plugins/toast.js +58 -0
  131. package/dist/runtime/utils/localizedNavigation.d.ts +1 -1
  132. package/dist/runtime/utils/removeTrailingSlash.d.ts +1 -0
  133. package/dist/runtime/utils/removeTrailingSlash.js +6 -0
  134. package/dist/runtime/utils/useUrls.d.ts +15 -0
  135. package/dist/runtime/utils/useUrls.js +20 -0
  136. package/package.json +5 -2
@@ -0,0 +1,169 @@
1
+ <script setup>
2
+ import IdOtpInput from "./IdOtpInput.vue";
3
+ import { ref, computed, onMounted, onBeforeUnmount } from "vue";
4
+ import { useCookie, useNuxtApp, useAppConfig, useI18n } from "#imports";
5
+ import { useIdModals } from "#adata-ui/composables/useIdModals";
6
+ import { removeTrailingSlash } from "#adata-ui/utils/removeTrailingSlash";
7
+ const { $toast } = useNuxtApp();
8
+ const { t, locale } = useI18n();
9
+ const { commonAuth } = useAppConfig();
10
+ const { confirmAccountOtpModal, confirmSuccessfulModal, intermediateState } = useIdModals();
11
+ const authApiURL = commonAuth.authApiURL;
12
+ const otp = ref(["", "", "", "", "", ""]);
13
+ const otpFormatted = computed(() => {
14
+ return otp.value.join("");
15
+ });
16
+ const showError = ref(false);
17
+ const isLoading = ref(false);
18
+ async function loginUser() {
19
+ const login = await fetch(`${removeTrailingSlash(authApiURL)}/login`, {
20
+ method: "POST",
21
+ credentials: "include",
22
+ headers: {
23
+ "Content-Type": "application/json",
24
+ "lang": locale.value
25
+ },
26
+ body: JSON.stringify({
27
+ username: intermediateState.value.email,
28
+ password: intermediateState.value.password
29
+ })
30
+ });
31
+ await login.json().catch(() => ({}));
32
+ const response = await fetch(`${removeTrailingSlash(authApiURL)}/access/cookie`, {
33
+ method: "GET",
34
+ credentials: "include",
35
+ headers: {
36
+ lang: locale.value
37
+ }
38
+ });
39
+ const { data: cookiesData } = await response.json();
40
+ if (cookiesData) {
41
+ const { access_token, expire_in } = cookiesData;
42
+ const hostname = location.hostname.split(".").reverse();
43
+ useCookie("accessToken", {
44
+ maxAge: expire_in,
45
+ domain: `.${hostname[1]}.${hostname[0]}`,
46
+ path: "/",
47
+ secure: true
48
+ }).value = access_token;
49
+ }
50
+ }
51
+ async function onConfirm() {
52
+ try {
53
+ isLoading.value = true;
54
+ await $fetch(`${removeTrailingSlash(authApiURL)}/email/verify-otp`, {
55
+ method: "GET",
56
+ credentials: "include",
57
+ headers: {
58
+ lang: locale.value
59
+ },
60
+ params: {
61
+ email: intermediateState.value.email,
62
+ otp_code: otpFormatted.value
63
+ }
64
+ });
65
+ await loginUser();
66
+ confirmAccountOtpModal.value = false;
67
+ confirmSuccessfulModal.value = true;
68
+ } catch (error) {
69
+ showError.value = true;
70
+ } finally {
71
+ isLoading.value = false;
72
+ }
73
+ }
74
+ function resetOtp() {
75
+ otp.value = ["", "", "", "", "", ""];
76
+ showError.value = false;
77
+ }
78
+ function onClose() {
79
+ resetOtp();
80
+ confirmAccountOtpModal.value = false;
81
+ }
82
+ const isResendLoading = ref(false);
83
+ async function onResend() {
84
+ try {
85
+ isResendLoading.value = true;
86
+ await $fetch(`${removeTrailingSlash(authApiURL)}/email/resend-otp`, {
87
+ method: "GET",
88
+ credentials: "include",
89
+ headers: {
90
+ lang: locale.value
91
+ },
92
+ params: {
93
+ email: intermediateState.value.email
94
+ }
95
+ });
96
+ resetOtp();
97
+ runTimer();
98
+ isResendLoading.value = false;
99
+ } catch (error) {
100
+ $toast.error(error.data);
101
+ }
102
+ }
103
+ const timer = ref(60);
104
+ function runTimer() {
105
+ timer.value = 60;
106
+ const intervalId = setInterval(() => {
107
+ if (!timer.value) clearInterval(intervalId);
108
+ return timer.value--;
109
+ }, 1e3);
110
+ }
111
+ function handleEnter(e) {
112
+ if (e.key === "Enter") {
113
+ onConfirm();
114
+ }
115
+ }
116
+ onMounted(() => {
117
+ runTimer();
118
+ document.addEventListener("keyup", handleEnter);
119
+ });
120
+ onBeforeUnmount(() => {
121
+ document.removeEventListener("keyup", handleEnter);
122
+ });
123
+ </script>
124
+
125
+ <template>
126
+ <div class="flex flex-col items-center gap-4 text-center">
127
+ <h2 class="text-2xl font-bold">
128
+ {{ t("modals.id.confirmAccount.title") }}
129
+ </h2>
130
+
131
+ <i-hand-with-phone-light class="size-32 dark:hidden" />
132
+ <i-hand-with-phone-dark class="hidden size-32 dark:block" />
133
+
134
+ <div class="text-sm">
135
+ <p class="mb-1">
136
+ {{ t("modals.id.resetPasswordOtp.content") }}
137
+ </p>
138
+
139
+ <div
140
+ v-if="timer > 0"
141
+ class="text-2xl font-bold"
142
+ >
143
+ {{ timer }} {{ t("modals.id.resetPasswordOtp.seconds") }}
144
+ </div>
145
+ <button
146
+ v-else
147
+ class="text-blue-700 dark:text-blue-500"
148
+ :disabled="isResendLoading"
149
+ @click="onResend"
150
+ >
151
+ {{ t("actions.resend") }}
152
+ </button>
153
+ </div>
154
+
155
+ <id-otp-input
156
+ v-model="otp"
157
+ v-model:error="showError"
158
+ @on-completed="onConfirm"
159
+ />
160
+
161
+ <adt-button
162
+ block
163
+ view="outline"
164
+ @click="onClose"
165
+ >
166
+ {{ t("actions.close") }}
167
+ </adt-button>
168
+ </div>
169
+ </template>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,38 @@
1
+ <script setup>
2
+ import { useI18n, navigateTo } from "#imports";
3
+ import { useUrls } from "#adata-ui/utils/useUrls";
4
+ import { useIdModals } from "#adata-ui/composables/useIdModals";
5
+ const { t } = useI18n();
6
+ const { confirmSuccessfulModal } = useIdModals();
7
+ const regex = /^\/counterparty\/main\/company\/\d+\/basic-info$/;
8
+ const { pk } = useUrls();
9
+ function onClose() {
10
+ confirmSuccessfulModal.value = false;
11
+ const path = window.location.pathname;
12
+ if (regex.test(path)) {
13
+ navigateTo(`${pk}/${path.split("/")[4]}`, { external: true });
14
+ } else {
15
+ window.location.reload();
16
+ }
17
+ }
18
+ </script>
19
+
20
+ <template>
21
+ <div class="flex flex-col gap-4 text-center">
22
+ <h2 class="text-2xl font-bold">
23
+ {{ t("modals.id.confirmSuccessful.title") }}
24
+ </h2>
25
+ <span class="mx-auto size-[100px] rounded-full bg-[#BDC7CE26]">
26
+ <ill-ok />
27
+ </span>
28
+ <p class="text-sm">
29
+ {{ t("modals.id.confirmSuccessful.content") }}
30
+ </p>
31
+ <adt-button
32
+ view="outline"
33
+ @click="onClose"
34
+ >
35
+ {{ t("actions.close") }}
36
+ </adt-button>
37
+ </div>
38
+ </template>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,277 @@
1
+ <script setup>
2
+ import { navigateToLocalizedPage } from "#adata-ui/utils/localizedNavigation";
3
+ import * as z from "zod";
4
+ import { ref, computed, reactive, onMounted, onBeforeUnmount } from "vue";
5
+ import { useCookie, useNuxtApp, useAppConfig, useI18n, navigateTo } from "#imports";
6
+ import { useIdModals } from "#adata-ui/composables/useIdModals";
7
+ import { useUrls } from "#adata-ui/utils/useUrls";
8
+ import { removeTrailingSlash } from "#adata-ui/utils/removeTrailingSlash";
9
+ const { $toast } = useNuxtApp();
10
+ const { commonAuth } = useAppConfig();
11
+ const { t, locale } = useI18n();
12
+ const { pk, landing } = useUrls();
13
+ const regex = /^\/counterparty\/main\/company\/\d+\/basic-info$/;
14
+ const { loginModal, registrationModal, recoveryModal, confirmAccountOtpModal, twoFactorModal, intermediateState } = useIdModals();
15
+ const authApiURL = commonAuth.authApiURL;
16
+ const submitted = ref(false);
17
+ const accessToken = ref(null);
18
+ const loginSchema = z.object({
19
+ username: z.string().nonempty(t("error.required")).email(t("error.email")),
20
+ password: z.string().nonempty(t("error.required"))
21
+ });
22
+ const validation = computed(() => {
23
+ if (!submitted.value) return null;
24
+ const result = loginSchema.safeParse(form);
25
+ return result.success ? null : result.error;
26
+ });
27
+ function getError(path) {
28
+ return validation.value?.issues.find((issue) => issue.path[0] === path)?.message;
29
+ }
30
+ function savePassAndLogin(form2) {
31
+ const { username, password } = form2;
32
+ const cookieOptions = {
33
+ expires: rememberMe.value ? new Date(Date.now() + 14 * 24 * 60 * 60 * 1e3) : void 0
34
+ // Срок действия 14 дней
35
+ };
36
+ useCookie("username", cookieOptions).value = username;
37
+ useCookie("password", cookieOptions).value = password;
38
+ }
39
+ function clearAuthCookie() {
40
+ useCookie("username").value = null;
41
+ useCookie("password").value = null;
42
+ }
43
+ const loading = ref(false);
44
+ const form = reactive({
45
+ username: useCookie("username").value || "",
46
+ password: useCookie("password").value || ""
47
+ });
48
+ const rememberMe = ref(false);
49
+ async function submit() {
50
+ submitted.value = true;
51
+ if (!validation.value) {
52
+ loading.value = true;
53
+ const login = await fetch(`${removeTrailingSlash(authApiURL)}/login`, {
54
+ method: "POST",
55
+ credentials: "include",
56
+ headers: {
57
+ "Content-Type": "application/json",
58
+ "lang": locale.value
59
+ },
60
+ body: JSON.stringify({
61
+ username: form.username.trim().toLowerCase(),
62
+ password: form.password.toString()
63
+ })
64
+ });
65
+ const { data, message } = await login.json().catch(() => ({}));
66
+ intermediateState.value.email = form.username;
67
+ intermediateState.value.password = form.password;
68
+ if (data) accessToken.value = data?.access_token;
69
+ if (login.status > 202) {
70
+ if (login.status === 422) {
71
+ $toast.error(t("error.validation"));
72
+ }
73
+ if (login.status === 206) {
74
+ confirmAccountOtpModal.value = true;
75
+ $fetch(`${removeTrailingSlash(authApiURL)}/email/resend-otp`, {
76
+ method: "GET",
77
+ credentials: "include",
78
+ headers: {
79
+ lang: locale.value
80
+ },
81
+ params: {
82
+ email: intermediateState.value.email
83
+ }
84
+ }).catch(() => {
85
+ });
86
+ } else {
87
+ $toast.error(message);
88
+ }
89
+ } else {
90
+ rememberMe.value ? savePassAndLogin(form) : clearAuthCookie();
91
+ if (data.is_2fa_enabled) {
92
+ loginModal.value = false;
93
+ twoFactorModal.value = true;
94
+ } else if (data.email_is_verified) {
95
+ const response = await fetch(`${removeTrailingSlash(authApiURL)}/access/cookie`, {
96
+ method: "GET",
97
+ credentials: "include",
98
+ headers: {
99
+ Authorization: `Bearer ${accessToken.value}`,
100
+ lang: locale.value
101
+ }
102
+ });
103
+ const { data: cookiesData } = await response.json();
104
+ if (cookiesData) {
105
+ const { access_token, expire_in } = cookiesData;
106
+ const hostname = location.hostname.split(".").reverse();
107
+ useCookie("accessToken", {
108
+ maxAge: expire_in,
109
+ domain: `.${hostname[1]}.${hostname[0]}`,
110
+ path: "/",
111
+ secure: true
112
+ }).value = access_token;
113
+ }
114
+ $toast.success(t("reuse.successfully"));
115
+ loginModal.value = false;
116
+ const path = window.location.pathname;
117
+ if (regex.test(path)) {
118
+ navigateTo(`${pk}/company/${path.split("/")[4]}`, { external: true });
119
+ } else {
120
+ window.location.reload();
121
+ }
122
+ } else {
123
+ confirmAccountOtpModal.value = true;
124
+ $fetch(`${removeTrailingSlash(authApiURL)}/email/resend-otp`, {
125
+ method: "GET",
126
+ credentials: "include",
127
+ headers: {
128
+ lang: locale.value
129
+ },
130
+ params: {
131
+ email: intermediateState.value.email
132
+ }
133
+ }).catch(() => {
134
+ });
135
+ }
136
+ }
137
+ loading.value = false;
138
+ }
139
+ }
140
+ function authWithSocial(social) {
141
+ const mode = useNuxtApp().$config.public.authApiURL.includes("adata") ? "adata" : "adtdev";
142
+ document.location.replace(`https://auth.${mode}.kz/api/login/social?source=${social}`);
143
+ }
144
+ function onRegister() {
145
+ loginModal.value = false;
146
+ registrationModal.value = true;
147
+ }
148
+ function toTariffs() {
149
+ return navigateToLocalizedPage({
150
+ locale,
151
+ projectUrl: landing,
152
+ path: "/tariffs",
153
+ target: "_self"
154
+ });
155
+ }
156
+ onMounted(() => {
157
+ rememberMe.value = !!useCookie("username").value && !!useCookie("password").value;
158
+ });
159
+ function handleEnter(e) {
160
+ if (e.key === "Enter") {
161
+ submit();
162
+ }
163
+ }
164
+ function onForgotPassword() {
165
+ loginModal.value = false;
166
+ recoveryModal.value = true;
167
+ }
168
+ onMounted(() => {
169
+ document.addEventListener("keyup", handleEnter);
170
+ });
171
+ onBeforeUnmount(() => {
172
+ document.removeEventListener("keyup", handleEnter);
173
+ });
174
+ </script>
175
+
176
+ <template>
177
+ <div class="flex flex-col gap-5">
178
+ <h1 class="heading-02 text-center">
179
+ {{ t("modals.id.login.title") }}
180
+ </h1>
181
+ <p class="body-400 text-center">
182
+ {{ t("modals.id.login.subtitle") }}
183
+ </p>
184
+ <div class="flex flex-col gap-4">
185
+ <adt-forms-input-standard
186
+ v-model="form.username"
187
+ type="email"
188
+ :label="t('modals.id.login.labels.email')"
189
+ :error="getError('username')"
190
+ />
191
+ <adt-forms-input-standard
192
+ v-model="form.password"
193
+ :label="t('modals.id.login.labels.password')"
194
+ :error="getError('password')"
195
+ />
196
+ <div class="flex items-center justify-between">
197
+ <div class="body-400 flex gap-2">
198
+ <adt-checkbox
199
+ v-model="rememberMe"
200
+ name="remember_me"
201
+ />
202
+ <label
203
+ for="remember_me"
204
+ class="cursor-pointer"
205
+ >{{
206
+ t("modals.id.login.remember_me")
207
+ }}</label>
208
+ </div>
209
+ <button
210
+ class="link-s-400"
211
+ @click="onForgotPassword"
212
+ >
213
+ {{ t("modals.id.login.forget_password") }}
214
+ </button>
215
+ </div>
216
+ </div>
217
+ <div class="flex items-center gap-4">
218
+ <div class="h-px w-full bg-deepblue-500/30" />
219
+ <div class="flex shrink-0 gap-4">
220
+ <span
221
+ class="cursor-pointer"
222
+ @click="authWithSocial('google')"
223
+ >
224
+ <i-socials-google />
225
+ </span>
226
+ <span
227
+ class="cursor-pointer"
228
+ @click="authWithSocial('yandex')"
229
+ >
230
+ <i-socials-yandex />
231
+ </span>
232
+ <span
233
+ class="cursor-pointer"
234
+ @click="authWithSocial('mailru')"
235
+ >
236
+ <i-socials-mailru />
237
+ </span>
238
+ </div>
239
+ <div class="h-px w-full bg-deepblue-500/30" />
240
+ </div>
241
+ <adt-button
242
+ :loading="loading"
243
+ type="submit"
244
+ @click="submit"
245
+ >
246
+ {{ t("actions.login") }}
247
+ </adt-button>
248
+ <p class="body-400 text-center">
249
+ {{ t("modals.id.login.first_time") }}
250
+ </p>
251
+
252
+ <adt-button
253
+ type="button"
254
+ view="outline"
255
+ class="w-full"
256
+ @click="onRegister"
257
+ >
258
+ {{ t("actions.register") }}
259
+ </adt-button>
260
+
261
+ <adt-button
262
+ type="button"
263
+ view="transparent"
264
+ class="w-full"
265
+ @click="toTariffs"
266
+ >
267
+ {{ t("actions.toTariffs") }}
268
+ </adt-button>
269
+
270
+ <adt-alert
271
+ class="max-w-screen-sm !text-[10px]"
272
+ size="xs"
273
+ >
274
+ {{ t("info.userAgreement") }}
275
+ </adt-alert>
276
+ </div>
277
+ </template>
@@ -0,0 +1,6 @@
1
+ export interface ILoginForm {
2
+ username: string;
3
+ password: string;
4
+ }
5
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -0,0 +1,98 @@
1
+ <script setup>
2
+ import IdConfirmAccountOtpModal from "./IdConfirmAccountOtpModal.vue";
3
+ import IdConfirmSuccessfulModal from "./IdConfirmSuccessfulModal.vue";
4
+ import IdLoginModal from "./IdLoginModal.vue";
5
+ import IdNewPasswordModal from "./IdNewPasswordModal.vue";
6
+ import IdPasswordSuccessfulModal from "./IdPasswordSuccessfulModal.vue";
7
+ import IdRecoveryModal from "./IdRecoveryModal.vue";
8
+ import IdRegistrationModal from "./IdRegistrationModal.vue";
9
+ import IdResetPasswordOtpModal from "./IdResetPasswordOtpModal.vue";
10
+ import IdTwoFactorModal from "./IdTwoFactorModal.vue";
11
+ import { useI18n, useAppConfig, useCookie } from "#imports";
12
+ import { onMounted } from "vue";
13
+ import { useIdModals } from "#adata-ui/composables/useIdModals";
14
+ import { removeTrailingSlash } from "#adata-ui/utils/removeTrailingSlash";
15
+ const {
16
+ loginModal,
17
+ registrationModal,
18
+ confirmAccountOtpModal,
19
+ recoveryModal,
20
+ resetPasswordOtpModal,
21
+ newPasswordModal,
22
+ passwordSuccessfulModal,
23
+ confirmSuccessfulModal,
24
+ twoFactorModal
25
+ } = useIdModals();
26
+ const { locale } = useI18n();
27
+ const { commonAuth } = useAppConfig();
28
+ const authApiURL = commonAuth.authApiURL;
29
+ onMounted(async () => {
30
+ const accessToken = useCookie("accessToken");
31
+ const response = await fetch(`${removeTrailingSlash(authApiURL)}/access/cookie`, {
32
+ method: "GET",
33
+ credentials: "include",
34
+ headers: {
35
+ lang: locale.value
36
+ }
37
+ });
38
+ const { data: cookiesData } = await response.json();
39
+ if (cookiesData?.access_token && !accessToken.value) {
40
+ const { access_token, expire_in } = cookiesData;
41
+ const hostname = location.hostname.split(".").reverse();
42
+ useCookie("accessToken", {
43
+ maxAge: expire_in,
44
+ domain: `.${hostname[1]}.${hostname[0]}`,
45
+ path: "/",
46
+ secure: true
47
+ }).value = access_token;
48
+ window.location.reload();
49
+ }
50
+ });
51
+ </script>
52
+
53
+ <template>
54
+ <adt-modal v-model="loginModal">
55
+ <id-login-modal v-if="loginModal" />
56
+ </adt-modal>
57
+ <adt-modal v-model="twoFactorModal">
58
+ <id-two-factor-modal v-if="twoFactorModal" />
59
+ </adt-modal>
60
+
61
+ <adt-modal v-model="registrationModal">
62
+ <id-registration-modal v-if="registrationModal" />
63
+ </adt-modal>
64
+ <adt-modal
65
+ v-model="confirmAccountOtpModal"
66
+ prevent-close
67
+ >
68
+ <id-confirm-account-otp-modal v-if="confirmAccountOtpModal" />
69
+ </adt-modal>
70
+ <adt-modal
71
+ v-model="confirmSuccessfulModal"
72
+ prevent-close
73
+ >
74
+ <id-confirm-successful-modal v-if="confirmSuccessfulModal" />
75
+ </adt-modal>
76
+
77
+ <adt-modal v-model="recoveryModal">
78
+ <id-recovery-modal v-if="recoveryModal" />
79
+ </adt-modal>
80
+ <adt-modal
81
+ v-model="resetPasswordOtpModal"
82
+ prevent-close
83
+ >
84
+ <id-reset-password-otp-modal v-if="resetPasswordOtpModal" />
85
+ </adt-modal>
86
+ <adt-modal
87
+ v-model="newPasswordModal"
88
+ prevent-close
89
+ >
90
+ <id-new-password-modal v-if="newPasswordModal" />
91
+ </adt-modal>
92
+ <adt-modal
93
+ v-model="passwordSuccessfulModal"
94
+ prevent-close
95
+ >
96
+ <id-password-successful-modal v-if="passwordSuccessfulModal" />
97
+ </adt-modal>
98
+ </template>
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;