adata-ui 3.1.36 → 3.1.37

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.client.d.ts +505 -0
  130. package/dist/runtime/plugins/toast.client.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,141 @@
1
+ <script setup>
2
+ import IdOtpInput from "./IdOtpInput.vue";
3
+ import { ref, computed, onMounted, onBeforeUnmount } from "vue";
4
+ import { 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 { resetPasswordOtpModal, newPasswordModal, 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 onConfirm() {
19
+ try {
20
+ isLoading.value = true;
21
+ const response = await $fetch(`${removeTrailingSlash(authApiURL)}/password/validate-otp`, {
22
+ method: "POST",
23
+ credentials: "include",
24
+ headers: {
25
+ lang: locale.value
26
+ },
27
+ body: {
28
+ email: intermediateState.value.email,
29
+ otp: otpFormatted.value
30
+ }
31
+ });
32
+ intermediateState.value.token = response.data;
33
+ intermediateState.value.otp = otpFormatted.value;
34
+ resetPasswordOtpModal.value = false;
35
+ newPasswordModal.value = true;
36
+ } catch (error) {
37
+ showError.value = true;
38
+ } finally {
39
+ isLoading.value = false;
40
+ }
41
+ }
42
+ function resetOtp() {
43
+ otp.value = ["", "", "", "", "", ""];
44
+ showError.value = false;
45
+ }
46
+ function onClose() {
47
+ resetOtp();
48
+ resetPasswordOtpModal.value = false;
49
+ }
50
+ const isResendLoading = ref(false);
51
+ async function onResend() {
52
+ try {
53
+ isResendLoading.value = true;
54
+ await $fetch(`${removeTrailingSlash(authApiURL)}/password/email-otp`, {
55
+ method: "POST",
56
+ credentials: "include",
57
+ headers: {
58
+ lang: locale.value
59
+ },
60
+ body: {
61
+ email: intermediateState.value.email
62
+ }
63
+ });
64
+ resetOtp();
65
+ runTimer();
66
+ isResendLoading.value = false;
67
+ } catch (error) {
68
+ $toast.error(error.data.message);
69
+ }
70
+ }
71
+ function handleEnter(e) {
72
+ if (e.key === "Enter") {
73
+ onConfirm();
74
+ }
75
+ }
76
+ const timer = ref(60);
77
+ function runTimer() {
78
+ timer.value = 60;
79
+ const intervalId = setInterval(() => {
80
+ if (!timer.value) clearInterval(intervalId);
81
+ return timer.value--;
82
+ }, 1e3);
83
+ }
84
+ onMounted(() => {
85
+ runTimer();
86
+ document.addEventListener("keyup", handleEnter);
87
+ });
88
+ onBeforeUnmount(() => {
89
+ document.removeEventListener("keyup", handleEnter);
90
+ });
91
+ </script>
92
+
93
+ <template>
94
+ <div class="flex flex-col items-center gap-4 text-center">
95
+ <h2 class="text-2xl font-bold">
96
+ {{ t("modals.id.resetPasswordOtp.title") }}
97
+ </h2>
98
+
99
+ <i-hand-with-phone-light class="size-32 dark:hidden" />
100
+ <i-hand-with-phone-dark class="hidden size-32 dark:block" />
101
+
102
+ <div class="text-sm">
103
+ <p class="mb-1">
104
+ {{ t("modals.id.resetPasswordOtp.content") }}
105
+ </p>
106
+
107
+ <div
108
+ v-if="timer > 0"
109
+ class="text-2xl font-bold"
110
+ >
111
+ {{ timer }} {{ t("modals.id.resetPasswordOtp.seconds") }}
112
+ </div>
113
+ <button
114
+ v-else
115
+ class="text-blue-700 dark:text-blue-500 flex items-center gap-2 mx-auto"
116
+ :disabled="isResendLoading"
117
+ @click="onResend"
118
+ >
119
+ <i-loader-circle
120
+ v-if="isResendLoading"
121
+ class="animate-spin"
122
+ />
123
+ <span>{{ t("actions.resend") }}</span>
124
+ </button>
125
+ </div>
126
+
127
+ <id-otp-input
128
+ v-model="otp"
129
+ v-model:error="showError"
130
+ @on-completed="onConfirm"
131
+ />
132
+
133
+ <adt-button
134
+ block
135
+ view="outline"
136
+ @click="onClose"
137
+ >
138
+ {{ t("actions.close") }}
139
+ </adt-button>
140
+ </div>
141
+ </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,114 @@
1
+ <script setup>
2
+ import { removeTrailingSlash } from "#adata-ui/utils/removeTrailingSlash";
3
+ import IdOtpInput from "./IdOtpInput.vue";
4
+ import { ref, computed, onMounted, onBeforeUnmount } from "vue";
5
+ import { useCookie, useNuxtApp, useAppConfig, useI18n, navigateTo } from "#imports";
6
+ import { useUrls } from "#adata-ui/utils/useUrls";
7
+ import { useIdModals } from "#adata-ui/composables/useIdModals";
8
+ const { $toast } = useNuxtApp();
9
+ const { t, locale } = useI18n();
10
+ const { commonAuth } = useAppConfig();
11
+ const { pk } = useUrls();
12
+ const { twoFactorModal, intermediateState } = useIdModals();
13
+ const authApiURL = commonAuth.authApiURL;
14
+ const regex = /^\/counterparty\/main\/company\/\d+\/basic-info$/;
15
+ const otp = ref(["", "", "", "", "", ""]);
16
+ const otpFormatted = computed(() => {
17
+ return otp.value.join("");
18
+ });
19
+ const showError = ref(false);
20
+ const isLoading = ref(false);
21
+ async function onConfirm() {
22
+ isLoading.value = true;
23
+ const login = await fetch(`${removeTrailingSlash(authApiURL)}/login`, {
24
+ method: "POST",
25
+ credentials: "include",
26
+ headers: {
27
+ "Content-Type": "application/json",
28
+ "lang": locale.value
29
+ },
30
+ body: JSON.stringify({
31
+ "username": intermediateState.value.email,
32
+ "password": intermediateState.value.password,
33
+ "2fa_code": otpFormatted.value
34
+ })
35
+ });
36
+ const { data, message } = await login.json().catch(() => ({}));
37
+ if (login.status > 202) {
38
+ if (login.status === 403) {
39
+ showError.value = true;
40
+ isLoading.value = false;
41
+ }
42
+ } else {
43
+ const response = await fetch(`${removeTrailingSlash(authApiURL)}/access/cookie`, {
44
+ method: "GET",
45
+ credentials: "include",
46
+ headers: {
47
+ lang: locale.value
48
+ }
49
+ });
50
+ const { data: cookiesData } = await response.json();
51
+ if (cookiesData?.access_token) {
52
+ const { access_token, expire_in } = cookiesData;
53
+ const hostname = location.hostname.split(".").reverse();
54
+ useCookie("accessToken", {
55
+ maxAge: expire_in,
56
+ domain: `.${hostname[1]}.${hostname[0]}`,
57
+ path: "/",
58
+ secure: true
59
+ }).value = access_token;
60
+ }
61
+ $toast.success(t("login.successfully"));
62
+ twoFactorModal.value = false;
63
+ const path = window.location.pathname;
64
+ if (regex.test(path)) {
65
+ navigateTo(`${pk}/company/${path.split("/")[4]}`, { external: true });
66
+ } else {
67
+ window.location.reload();
68
+ }
69
+ }
70
+ isLoading.value = false;
71
+ }
72
+ function onClose() {
73
+ otp.value = ["", "", "", "", "", ""];
74
+ showError.value = false;
75
+ twoFactorModal.value = false;
76
+ }
77
+ function handleEnter(e) {
78
+ if (e.key === "Enter") {
79
+ onConfirm();
80
+ }
81
+ }
82
+ onMounted(() => {
83
+ document.addEventListener("keyup", handleEnter);
84
+ });
85
+ onBeforeUnmount(() => {
86
+ document.removeEventListener("keyup", handleEnter);
87
+ });
88
+ </script>
89
+
90
+ <template>
91
+ <div class="flex flex-col items-center gap-4">
92
+ <p class="heading-02 text-center">
93
+ {{ t("modals.id.twoFactor.title") }}
94
+ </p>
95
+ <i-hand-with-phone-light class="size-32 dark:hidden" />
96
+ <i-hand-with-phone-dark class="hidden size-32 dark:block" />
97
+ <id-otp-input
98
+ v-model="otp"
99
+ v-model:error="showError"
100
+ @on-completed="onConfirm"
101
+ />
102
+ <p class="body-400 text-center">
103
+ {{ t("modals.id.twoFactor.code") }}
104
+ </p>
105
+
106
+ <adt-button
107
+ class="w-full"
108
+ view="outline"
109
+ @click="onClose"
110
+ >
111
+ {{ t("actions.close") }}
112
+ </adt-button>
113
+ </div>
114
+ </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;
@@ -1,4 +1,4 @@
1
- import type { TreeNestedNode } from '~/src/runtime/components/tree-select/types';
1
+ import type { TreeNestedNode } from '#adata-ui/components/tree-select/types';
2
2
  interface Props {
3
3
  node: TreeNestedNode;
4
4
  toggleExpand: Function;
@@ -1,2 +1,2 @@
1
- export declare const useCurrentModule: () => any;
2
- export declare const useContacts: () => any;
1
+ export declare const useCurrentModule: () => import("vue").Ref<string, string>;
2
+ export declare const useContacts: () => import("vue").Ref<any, any>;
@@ -0,0 +1,23 @@
1
+ export declare function useIdModals(): {
2
+ accessModal: import("vue").Ref<boolean, boolean>;
3
+ loginModal: import("vue").Ref<boolean, boolean>;
4
+ twoFactorModal: import("vue").Ref<boolean, boolean>;
5
+ registrationModal: import("vue").Ref<boolean, boolean>;
6
+ confirmAccountOtpModal: import("vue").Ref<boolean, boolean>;
7
+ recoveryModal: import("vue").Ref<boolean, boolean>;
8
+ resetPasswordOtpModal: import("vue").Ref<boolean, boolean>;
9
+ newPasswordModal: import("vue").Ref<boolean, boolean>;
10
+ passwordSuccessfulModal: import("vue").Ref<boolean, boolean>;
11
+ confirmSuccessfulModal: import("vue").Ref<boolean, boolean>;
12
+ intermediateState: import("vue").Ref<{
13
+ email: string;
14
+ password: string;
15
+ otp: string;
16
+ token: string;
17
+ }, {
18
+ email: string;
19
+ password: string;
20
+ otp: string;
21
+ token: string;
22
+ }>;
23
+ };
@@ -0,0 +1,32 @@
1
+ import { useState } from "#imports";
2
+ export function useIdModals() {
3
+ const accessModal = useState("access-modal", () => false);
4
+ const loginModal = useState("login-modal", () => false);
5
+ const twoFactorModal = useState("two-factor-modal", () => false);
6
+ const registrationModal = useState("registration-modal", () => false);
7
+ const confirmAccountOtpModal = useState("confirm-account-otp-modal", () => false);
8
+ const confirmSuccessfulModal = useState("confirm-successful-modal", () => false);
9
+ const recoveryModal = useState("recovery-modal", () => false);
10
+ const resetPasswordOtpModal = useState("reset-password-otp-modal", () => false);
11
+ const newPasswordModal = useState("new-password-modal", () => false);
12
+ const passwordSuccessfulModal = useState("password-successful-modal", () => false);
13
+ const intermediateState = useState("id-intermediate-state", () => ({
14
+ email: "",
15
+ password: "",
16
+ otp: "",
17
+ token: ""
18
+ }));
19
+ return {
20
+ accessModal,
21
+ loginModal,
22
+ twoFactorModal,
23
+ registrationModal,
24
+ confirmAccountOtpModal,
25
+ recoveryModal,
26
+ resetPasswordOtpModal,
27
+ newPasswordModal,
28
+ passwordSuccessfulModal,
29
+ confirmSuccessfulModal,
30
+ intermediateState
31
+ };
32
+ }