adata-ui 2.0.28 → 2.0.29

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.
package/.nuxtrc CHANGED
@@ -1 +1 @@
1
- typescript.includeWorkspace = true
1
+ typescript.includeWorkspace = true
@@ -1,5 +1,5 @@
1
- export default defineAppConfig({
2
- myLayer: {
3
- name: 'My amazing Nuxt layer (overwritten)'
4
- }
5
- })
1
+ export default defineAppConfig({
2
+ myLayer: {
3
+ name: 'My amazing Nuxt layer (overwritten)'
4
+ }
5
+ })
package/README.md CHANGED
@@ -1,75 +1,75 @@
1
- # Adata UI with Nuxt 3 using Layers
2
-
3
- Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4
-
5
- ## Setup
6
-
7
- Make sure to install the dependencies:
8
-
9
- ```bash
10
- # npm
11
- npm install
12
-
13
- # pnpm
14
- pnpm install
15
-
16
- # yarn
17
- yarn install
18
-
19
- # bun
20
- bun install
21
- ```
22
-
23
- ## Development Server
24
-
25
- Start the development server on `https://localhost:3000`:
26
-
27
- ```bash
28
- # npm
29
- npm run dev
30
-
31
- # pnpm
32
- pnpm run dev
33
-
34
- # yarn
35
- yarn dev
36
-
37
- # bun
38
- bun run dev
39
- ```
40
-
41
- ## Production
42
-
43
- Build the application for production:
44
-
45
- ```bash
46
- # npm
47
- npm run build
48
-
49
- # pnpm
50
- pnpm run build
51
-
52
- # yarn
53
- yarn build
54
-
55
- # bun
56
- bun run build
57
- ```
58
-
59
- Locally preview production build:
60
-
61
- ```bash
62
- # npm
63
- npm run preview
64
-
65
- # pnpm
66
- pnpm run preview
67
-
68
- # yarn
69
- yarn preview
70
-
71
- # bun
72
- bun run preview
73
- ```
74
-
75
- Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
1
+ # Adata UI with Nuxt 3 using Layers
2
+
3
+ Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4
+
5
+ ## Setup
6
+
7
+ Make sure to install the dependencies:
8
+
9
+ ```bash
10
+ # npm
11
+ npm install
12
+
13
+ # pnpm
14
+ pnpm install
15
+
16
+ # yarn
17
+ yarn install
18
+
19
+ # bun
20
+ bun install
21
+ ```
22
+
23
+ ## Development Server
24
+
25
+ Start the development server on `https://localhost:3000`:
26
+
27
+ ```bash
28
+ # npm
29
+ npm run dev
30
+
31
+ # pnpm
32
+ pnpm run dev
33
+
34
+ # yarn
35
+ yarn dev
36
+
37
+ # bun
38
+ bun run dev
39
+ ```
40
+
41
+ ## Production
42
+
43
+ Build the application for production:
44
+
45
+ ```bash
46
+ # npm
47
+ npm run build
48
+
49
+ # pnpm
50
+ pnpm run build
51
+
52
+ # yarn
53
+ yarn build
54
+
55
+ # bun
56
+ bun run build
57
+ ```
58
+
59
+ Locally preview production build:
60
+
61
+ ```bash
62
+ # npm
63
+ npm run preview
64
+
65
+ # pnpm
66
+ pnpm run preview
67
+
68
+ # yarn
69
+ yarn preview
70
+
71
+ # bun
72
+ bun run preview
73
+ ```
74
+
75
+ Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
@@ -1 +1 @@
1
- # button, alerts, dropdown
1
+ # button, alerts, dropdown
@@ -1 +1 @@
1
- # inputs
1
+ # inputs
@@ -1,40 +1,40 @@
1
- <script setup lang="ts">
2
- const emit = defineEmits<{
3
- (e: 'resend'): void
4
- (e: 'close'): void
5
- }>()
6
- </script>
7
-
8
- <template>
9
- <div class="flex flex-col justify-center items-center gap-5">
10
- <p class="heading-02">
11
- {{ $t('login.modal.title') }}
12
- </p>
13
- <a-ill-mail />
14
- <p class="body-400 text-center">
15
- {{ $t('login.modal.subtitle1') }}
16
- </p>
17
- <p class="body-400 text-center">
18
- {{ $t('login.modal.confirmationEmail') }}
19
- </p>
20
- <div class="flex flex-col gap-2 w-full">
21
- <a-button
22
- class="w-full"
23
- view="outline"
24
- @click="emit('close')"
25
- >
26
- {{ $t('login.modal.back') }}
27
- </a-button>
28
- <a-button
29
- class="w-full"
30
- @click="emit('resend')"
31
- >
32
- {{ $t('login.modal.resend') }}
33
- </a-button>
34
- </div>
35
- </div>
36
- </template>
37
-
38
- <style scoped>
39
-
40
- </style>
1
+ <script setup lang="ts">
2
+ const emit = defineEmits<{
3
+ (e: 'resend'): void
4
+ (e: 'close'): void
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <div class="flex flex-col justify-center items-center gap-5">
10
+ <p class="heading-02">
11
+ {{ $t('login.modal.title') }}
12
+ </p>
13
+ <a-ill-mail />
14
+ <p class="body-400 text-center">
15
+ {{ $t('login.modal.subtitle1') }}
16
+ </p>
17
+ <p class="body-400 text-center">
18
+ {{ $t('login.modal.confirmationEmail') }}
19
+ </p>
20
+ <div class="flex flex-col gap-2 w-full">
21
+ <a-button
22
+ class="w-full"
23
+ view="outline"
24
+ @click="emit('close')"
25
+ >
26
+ {{ $t('login.modal.back') }}
27
+ </a-button>
28
+ <a-button
29
+ class="w-full"
30
+ @click="emit('resend')"
31
+ >
32
+ {{ $t('login.modal.resend') }}
33
+ </a-button>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <style scoped>
39
+
40
+ </style>
@@ -1,81 +1,81 @@
1
- <script setup lang="ts">
2
-
3
- const emit = defineEmits<{
4
- (e: 'resend'): void
5
- (e: 'close'): void
6
- }>()
7
-
8
- const timer = ref(60)
9
- const isResend = ref(false)
10
- const route = useRoute()
11
- const appConfig = useAppConfig()
12
- const landingUrl = appConfig.myLayer.landingUrl
13
-
14
- function runTimer() {
15
- timer.value = 60
16
- const intervalId = setInterval(() => {
17
- if (timer.value <= 0) {
18
- isResend.value = true
19
- clearInterval(intervalId);
20
- return;
21
- }
22
- timer.value--;
23
- }, 1000);
24
- }
25
-
26
- onMounted(() => resend())
27
-
28
- const resend = () => {
29
- isResend.value = false
30
- runTimer()
31
- emit('resend')
32
- }
33
- const goToMain = () => {
34
- if (route.query.url) {
35
- document.location.replace(route.query.url)
36
- } else {
37
- document.location.replace(landingUrl)
38
- }
39
- emit('close')
40
-
41
- }
42
- </script>
43
-
44
- <template>
45
- <div class="flex flex-col justify-center items-center gap-5">
46
- <p class="heading-02">
47
- {{ $t('login.modal.title') }}
48
- </p>
49
- <a-ill-mail />
50
- <p class="body-400 text-center">
51
- {{ $t('login.modal.subtitle1') }}
52
- </p>
53
- <p class="body-400 text-center">
54
- {{ $t('login.modal.subtitle2') }}
55
- </p>
56
- <p
57
- v-if="!isResend"
58
- class="heading-02"
59
- >
60
- {{ timer }} {{ $t('login.modal.seconds') }}
61
- </p>
62
- <a-button
63
- v-else
64
- class="w-full"
65
- view="outline"
66
- @click="resend"
67
- >
68
- {{ $t('login.modal.resend') }}
69
- </a-button>
70
- <a-button
71
- class="w-full"
72
- @click="goToMain"
73
- >
74
- {{ $t('login.modal.back') }}
75
- </a-button>
76
- </div>
77
- </template>
78
-
79
- <style scoped>
80
-
81
- </style>
1
+ <script setup lang="ts">
2
+
3
+ const emit = defineEmits<{
4
+ (e: 'resend'): void
5
+ (e: 'close'): void
6
+ }>()
7
+
8
+ const timer = ref(60)
9
+ const isResend = ref(false)
10
+ const route = useRoute()
11
+ const appConfig = useAppConfig()
12
+ const landingUrl = appConfig.myLayer.landingUrl
13
+
14
+ function runTimer() {
15
+ timer.value = 60
16
+ const intervalId = setInterval(() => {
17
+ if (timer.value <= 0) {
18
+ isResend.value = true
19
+ clearInterval(intervalId);
20
+ return;
21
+ }
22
+ timer.value--;
23
+ }, 1000);
24
+ }
25
+
26
+ onMounted(() => resend())
27
+
28
+ const resend = () => {
29
+ isResend.value = false
30
+ runTimer()
31
+ emit('resend')
32
+ }
33
+ const goToMain = () => {
34
+ if (route.query.url) {
35
+ document.location.replace(route.query.url)
36
+ } else {
37
+ document.location.replace(landingUrl)
38
+ }
39
+ emit('close')
40
+
41
+ }
42
+ </script>
43
+
44
+ <template>
45
+ <div class="flex flex-col justify-center items-center gap-5">
46
+ <p class="heading-02">
47
+ {{ $t('login.modal.title') }}
48
+ </p>
49
+ <a-ill-mail />
50
+ <p class="body-400 text-center">
51
+ {{ $t('login.modal.subtitle1') }}
52
+ </p>
53
+ <p class="body-400 text-center">
54
+ {{ $t('login.modal.subtitle2') }}
55
+ </p>
56
+ <p
57
+ v-if="!isResend"
58
+ class="heading-02"
59
+ >
60
+ {{ timer }} {{ $t('login.modal.seconds') }}
61
+ </p>
62
+ <a-button
63
+ v-else
64
+ class="w-full"
65
+ view="outline"
66
+ @click="resend"
67
+ >
68
+ {{ $t('login.modal.resend') }}
69
+ </a-button>
70
+ <a-button
71
+ class="w-full"
72
+ @click="goToMain"
73
+ >
74
+ {{ $t('login.modal.back') }}
75
+ </a-button>
76
+ </div>
77
+ </template>
78
+
79
+ <style scoped>
80
+
81
+ </style>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import OtpInput from '#adata-ui/components/modals/two-factor/otp-input.vue'
2
+ import OtpInput from '#adata-ui/components/modals/id/otp-input.vue'
3
3
  import { useAuthStore } from '#adata-ui/stores/auth.store'
4
4
 
5
5
  const { $toast } = useNuxtApp()
@@ -17,6 +17,7 @@ const otp = ref(['', '', '', '', '', ''])
17
17
  const otpFormatted = computed(() => {
18
18
  return otp.value.join('')
19
19
  })
20
+ const attempts = ref(5)
20
21
  const showError = ref(false)
21
22
  const isLoading = ref(false)
22
23
 
@@ -28,7 +29,7 @@ async function onResend() {
28
29
  headers: {
29
30
  lang: locale.value,
30
31
  },
31
- body: {
32
+ params: {
32
33
  email: intermediateState.value.email,
33
34
  },
34
35
  })
@@ -59,6 +60,12 @@ async function onConfirm() {
59
60
  confirmSuccessfulModal.value = true
60
61
  }
61
62
  catch (error) {
63
+ if (error.data?.retry_after) {
64
+ attempts.value = 0
65
+ }
66
+ else {
67
+ attempts.value--
68
+ }
62
69
  showError.value = true
63
70
  $toast.error(error.data.message)
64
71
  }
@@ -70,12 +77,14 @@ async function onConfirm() {
70
77
  function onClose() {
71
78
  otp.value = ['', '', '', '', '', '']
72
79
  showError.value = false
80
+ attempts.value = 5
73
81
  confirmAccountOtpModal.value = false
74
82
  }
75
83
 
76
84
  const timer = ref(60)
77
85
 
78
86
  function runTimer() {
87
+ timer.value = 60
79
88
  const intervalId = setInterval(() => {
80
89
  if (!timer.value) clearInterval(intervalId)
81
90
  return timer.value--
@@ -101,7 +110,7 @@ onBeforeUnmount(() => {
101
110
  <template>
102
111
  <div class="flex flex-col items-center gap-4 text-center">
103
112
  <h2 class="text-2xl font-bold">
104
- {{ t('register.modal.title') }}
113
+ {{ t('modals.id.confirmAccount.title') }}
105
114
  </h2>
106
115
 
107
116
  <a-icon-hand-with-phone-light class="size-32 dark:hidden" />
@@ -113,7 +122,7 @@ onBeforeUnmount(() => {
113
122
  </p>
114
123
 
115
124
  <div v-if="timer > 0" class="text-2xl font-bold">
116
- {{ timer }} {{ t('register.modal.seconds') }}
125
+ {{ timer }} {{ t('modals.id.resetPasswordOtp.seconds') }}
117
126
  </div>
118
127
  <button
119
128
  v-else
@@ -124,7 +133,11 @@ onBeforeUnmount(() => {
124
133
  </button>
125
134
  </div>
126
135
 
127
- <otp-input v-model="otp" v-model:error="showError" />
136
+ <otp-input
137
+ v-model="otp"
138
+ v-model:error="showError"
139
+ :attempts="attempts"
140
+ />
128
141
 
129
142
  <div class="flex w-full gap-2">
130
143
  <a-button
@@ -137,7 +150,7 @@ onBeforeUnmount(() => {
137
150
  <a-button
138
151
  block
139
152
  :loading="isLoading"
140
- :disabled="otpFormatted.length < 6"
153
+ :disabled="otpFormatted.length < 6 || attempts === 0"
141
154
  @click="onConfirm"
142
155
  >
143
156
  {{ t('actions.confirm') }}