pukaad-ui-lib 1.168.0 → 1.169.1

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.168.0",
4
+ "version": "1.169.1",
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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.168.0",
3
+ "version": "1.169.1",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,20 +0,0 @@
1
- export interface Profile {
2
- profileImageUrl: string;
3
- profileName: string;
4
- }
5
- export interface History {
6
- profile: Profile;
7
- action: string;
8
- page: string;
9
- createdAt: string;
10
- }
11
- type __VLS_ModelProps = {
12
- modelValue?: boolean;
13
- };
14
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
- "update:modelValue": (value: boolean) => any;
16
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
17
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;
@@ -1,76 +0,0 @@
1
- <template>
2
- <Drawer class="w-[748px]" title="ประวัติ" v-model="isDrawerOpen">
3
- <div class="flex flex-col gap-[24px]">
4
- <InputTextField
5
- name="search"
6
- placeholder="ค้นหาประวัติ"
7
- icon-prepend="lucide:search"
8
- v-model="search"
9
- />
10
- <div>
11
- <div
12
- v-for="(item, index) in histories"
13
- :key="index"
14
- class="p-[8px] flex gap-[8px] border-b-[1px] border-mercury items-center"
15
- >
16
- <Avatar :size="30" :src="item.profile.profileImageUrl" />
17
- <div class="flex flex-col gap-[4px]">
18
- <div class="flex gap-[4px]">
19
- <div class="font-body-medium-prominent">
20
- {{ item.profile.profileName }}
21
- </div>
22
- <div class="font-body-medium text-primary">
23
- {{ item.action }}
24
- </div>
25
- <div class="font-body-medium">
26
- {{ item.page }}
27
- </div>
28
- </div>
29
- <div class="font-body-small text-gray">
30
- ดำเนินการเมื่อ {{ convertDateTime(item.createdAt) }}
31
- </div>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </Drawer>
37
- </template>
38
-
39
- <script setup>
40
- import { ref } from "vue";
41
- import { useConvert } from "@/runtime/composables/useConvert";
42
- const search = ref("");
43
- const isDrawerOpen = defineModel({ type: Boolean, ...{
44
- default: false
45
- } });
46
- const { convertDateTime } = useConvert();
47
- const histories = ref([
48
- {
49
- profile: {
50
- profileImageUrl: "https://github.com/shadcn.png",
51
- profileName: "Janejira Somboon"
52
- },
53
- action: "\u0E44\u0E14\u0E49\u0E17\u0E33\u0E01\u0E32\u0E23\u0E40\u0E1E\u0E34\u0E48\u0E21",
54
- page: "\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25 (PDPA)",
55
- createdAt: "2024-01-01 12:00"
56
- },
57
- {
58
- profile: {
59
- profileImageUrl: "https://github.com/shadcn.png",
60
- profileName: "Janejira Somboon"
61
- },
62
- action: "\u0E44\u0E14\u0E49\u0E17\u0E33\u0E01\u0E32\u0E23\u0E41\u0E01\u0E49\u0E44\u0E02",
63
- page: "\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25 (PDPA)",
64
- createdAt: "2024-01-01 12:00"
65
- },
66
- {
67
- profile: {
68
- profileImageUrl: "https://github.com/shadcn.png",
69
- profileName: "Janejira Somboon"
70
- },
71
- action: "\u0E44\u0E14\u0E49\u0E17\u0E33\u0E01\u0E32\u0E23\u0E25\u0E1A",
72
- page: "\u0E19\u0E42\u0E22\u0E1A\u0E32\u0E22\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25\u0E2A\u0E48\u0E27\u0E19\u0E1A\u0E38\u0E04\u0E04\u0E25 (PDPA)",
73
- createdAt: "2024-01-01 12:00"
74
- }
75
- ]);
76
- </script>
@@ -1,20 +0,0 @@
1
- export interface Profile {
2
- profileImageUrl: string;
3
- profileName: string;
4
- }
5
- export interface History {
6
- profile: Profile;
7
- action: string;
8
- page: string;
9
- createdAt: string;
10
- }
11
- type __VLS_ModelProps = {
12
- modelValue?: boolean;
13
- };
14
- declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
- "update:modelValue": (value: boolean) => any;
16
- }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
17
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
18
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;