pukaad-ui-lib 1.167.0 → 1.169.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.167.0",
4
+ "version": "1.169.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
31
31
  fullHeight: boolean;
32
32
  name: string;
33
33
  limit: number;
34
- accept: string;
35
34
  disabledErrorMessage: boolean;
35
+ accept: string;
36
36
  labelIcon: string;
37
37
  disabledDrop: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -31,8 +31,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
31
31
  fullHeight: boolean;
32
32
  name: string;
33
33
  limit: number;
34
- accept: string;
35
34
  disabledErrorMessage: boolean;
35
+ accept: string;
36
36
  labelIcon: string;
37
37
  disabledDrop: boolean;
38
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -18,8 +18,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
18
18
  }>, {
19
19
  id: string;
20
20
  name: string;
21
- disabledForgotPassword: boolean;
22
21
  new: boolean;
22
+ disabledForgotPassword: boolean;
23
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
24
  declare const _default: typeof __VLS_export;
25
25
  export default _default;
@@ -18,8 +18,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
18
18
  }>, {
19
19
  id: string;
20
20
  name: string;
21
- disabledForgotPassword: boolean;
22
21
  new: boolean;
22
+ disabledForgotPassword: boolean;
23
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
24
  declare const _default: typeof __VLS_export;
25
25
  export default _default;
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  label: string;
13
13
  color: InputSliderColor;
14
14
  fullWidth: boolean;
15
- step: number;
16
15
  max: number;
17
16
  min: number;
17
+ step: number;
18
18
  lineHeight: number | string;
19
19
  appearance: boolean;
20
20
  thumbSize: number | string;
@@ -12,9 +12,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
12
12
  label: string;
13
13
  color: InputSliderColor;
14
14
  fullWidth: boolean;
15
- step: number;
16
15
  max: number;
17
16
  min: number;
17
+ step: number;
18
18
  lineHeight: number | string;
19
19
  appearance: boolean;
20
20
  thumbSize: number | string;
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
52
51
  readonly: boolean;
52
+ resize: "none" | "both" | "horizontal" | "vertical";
53
53
  rows: number;
54
54
  heightScroll: boolean;
55
55
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -45,11 +45,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
45
45
  name: string;
46
46
  disabled: boolean;
47
47
  limit: number;
48
- resize: "none" | "both" | "horizontal" | "vertical";
49
48
  disabledErrorMessage: boolean;
50
49
  disabledBorder: boolean;
51
50
  showCounter: boolean;
52
51
  readonly: boolean;
52
+ resize: "none" | "both" | "horizontal" | "vertical";
53
53
  rows: number;
54
54
  heightScroll: boolean;
55
55
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <Modal
3
3
  title="รหัสยืนยันตัวตน"
4
- :description="`\u0E1B\u0E49\u0E2D\u0E19\u0E23\u0E2B\u0E31\u0E2A 6 \u0E2B\u0E25\u0E31\u0E01\u0E17\u0E35\u0E48\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E2D\u0E35\u0E40\u0E21\u0E25 ${props.email}`"
4
+ :description="`\u0E1B\u0E49\u0E2D\u0E19\u0E23\u0E2B\u0E31\u0E2A 6 \u0E2B\u0E25\u0E31\u0E01\u0E17\u0E35\u0E48\u0E2A\u0E48\u0E07\u0E44\u0E1B\u0E22\u0E31\u0E07\u0E2D\u0E35\u0E40\u0E21\u0E25 ${maskedEmail}`"
5
5
  @submit="onVerifyOTP"
6
6
  v-model="isOpen"
7
7
  >
@@ -19,12 +19,12 @@
19
19
  จะส่งรหัสยืนยันอีกครั้ง
20
20
  </div>
21
21
  </div>
22
- <template #footer="{ meta }">
22
+ <template #footer>
23
23
  <Button
24
24
  class="w-full"
25
25
  color="primary"
26
26
  type="submit"
27
- :disabled="!meta.valid"
27
+ :disabled="valueOTP.length !== 6"
28
28
  >
29
29
  {{ props.confirmedText }}
30
30
  </Button>
@@ -33,12 +33,13 @@
33
33
  </template>
34
34
 
35
35
  <script setup>
36
- import { ref, onMounted, computed } from "vue";
37
- import { useNuxtApp, useRuntimeConfig } from "nuxt/app";
36
+ import { ref, onMounted, computed, watch } from "vue";
37
+ import { useNuxtApp } from "nuxt/app";
38
38
  import { useCountDown } from "@/runtime/composables/useCountDown";
39
- const { CountdownTime } = useCountDown();
39
+ import { useApi } from "@/runtime/composables/useApi";
40
40
  const { $toast } = useNuxtApp();
41
- const { BASE_URL_API } = useRuntimeConfig().public;
41
+ const api = useApi();
42
+ const { CountdownTime } = useCountDown();
42
43
  const emits = defineEmits(["complete"]);
43
44
  const props = defineProps({
44
45
  email: { type: String, required: false },
@@ -51,14 +52,18 @@ const valueOTP = ref("");
51
52
  const timeExp = ref("");
52
53
  const displayTimeExp = CountdownTime(timeExp);
53
54
  const isTimeExp = computed(() => {
54
- if (displayTimeExp.value !== "00:00") return false;
55
- return true;
55
+ return !timeExp.value || displayTimeExp.value === "00:00";
56
+ });
57
+ const maskedEmail = computed(() => {
58
+ if (!props.email) return "";
59
+ const [local, domain] = props.email.split("@");
60
+ if (!local || !domain || local.length <= 2) return props.email;
61
+ return `${local[0]}${"*".repeat(local.length - 2)}${local[local.length - 1]}@${domain}`;
56
62
  });
57
63
  const onVerifyOTP = async () => {
58
64
  try {
59
- await $fetch(`${BASE_URL_API}/me/email-otp-verify`, {
65
+ await api("/me/email-otp-verify", {
60
66
  method: "POST",
61
- credentials: "include",
62
67
  body: {
63
68
  code: valueOTP.value,
64
69
  email: props.email
@@ -73,23 +78,27 @@ const onVerifyOTP = async () => {
73
78
  };
74
79
  const handleSendEmail = async () => {
75
80
  try {
76
- if (!props.email) throw "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38 email";
77
- const { data } = await $fetch(
78
- `${BASE_URL_API}/me/email-otp-request`,
81
+ if (!props.email) throw new Error("\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38 email");
82
+ const response = await api(
83
+ "/me/email-otp-request",
79
84
  {
80
85
  method: "POST",
81
- credentials: "include",
82
86
  body: {
83
87
  email: props.email
84
88
  }
85
89
  }
86
90
  );
87
- timeExp.value = data.expired_time;
91
+ timeExp.value = response.expired_time;
88
92
  } catch (err) {
89
93
  $toast.error("\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07 !");
90
94
  }
91
95
  };
92
- onMounted(() => {
93
- handleSendEmail();
96
+ watch(isOpen, (v) => {
97
+ if (v) {
98
+ valueOTP.value = "";
99
+ handleSendEmail();
100
+ } else {
101
+ timeExp.value = "";
102
+ }
94
103
  });
95
104
  </script>
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  onClose?: (() => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -24,8 +24,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
24
24
  onClose?: (() => any) | undefined;
25
25
  }>, {
26
26
  title: string;
27
- confirmText: string;
28
27
  disabledForgotPassword: boolean;
28
+ confirmText: string;
29
29
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
30
  declare const _default: typeof __VLS_export;
31
31
  export default _default;
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  }>, {
29
29
  title: string;
30
30
  mode: "login" | "secure";
31
- confirmText: string;
32
31
  disabledForgotPassword: boolean;
32
+ confirmText: string;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
@@ -28,8 +28,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
28
28
  }>, {
29
29
  title: string;
30
30
  mode: "login" | "secure";
31
- confirmText: string;
32
31
  disabledForgotPassword: boolean;
32
+ confirmText: string;
33
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
34
  declare const _default: typeof __VLS_export;
35
35
  export default _default;
@@ -85,6 +85,9 @@ const handleComplete = (key, data) => {
85
85
  isLastStep.value = true;
86
86
  modalStates.emailOTP = true;
87
87
  }
88
+ } else if (key === "twoFa") {
89
+ isLastStep.value = true;
90
+ modalStates.emailOTP = true;
88
91
  } else if (key === "emailOTP") {
89
92
  isOpen.value = false;
90
93
  emit("complete", "add-email");
@@ -93,9 +96,9 @@ const handleComplete = (key, data) => {
93
96
  if (props.state === "delete-email") {
94
97
  if (key === "password") {
95
98
  if (props.twoFaEnabled) {
99
+ isLastStep.value = true;
96
100
  modalStates.twoFa = true;
97
101
  } else {
98
- isLastStep.value = true;
99
102
  isOpen.value = false;
100
103
  emit("complete", "delete-email");
101
104
  }
@@ -159,7 +162,9 @@ watch(isOpen, (v) => {
159
162
  if (!v) return;
160
163
  modalStates.password = true;
161
164
  if (["delete-phone", "delete-email"].includes(props.state)) {
162
- isLastStep.value = true;
165
+ isLastStep.value = !props.twoFaEnabled;
166
+ } else {
167
+ isLastStep.value = false;
163
168
  }
164
169
  });
165
170
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.167.0",
3
+ "version": "1.169.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",