pukaad-ui-lib 1.239.0 → 1.240.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.
Files changed (26) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/input/input-address.d.vue.ts +1 -1
  3. package/dist/runtime/components/input/input-address.vue.d.ts +1 -1
  4. package/dist/runtime/components/input/input-autocomplete.d.vue.ts +1 -1
  5. package/dist/runtime/components/input/input-autocomplete.vue.d.ts +1 -1
  6. package/dist/runtime/components/input/input-tag.d.vue.ts +1 -1
  7. package/dist/runtime/components/input/input-tag.vue.d.ts +1 -1
  8. package/dist/runtime/components/modal/modal-2FA-generate.vue +11 -25
  9. package/dist/runtime/components/modal/modal-password-verify.vue +3 -3
  10. package/dist/runtime/components/modal/modal-phone-OTP.d.vue.ts +1 -1
  11. package/dist/runtime/components/modal/modal-phone-OTP.vue.d.ts +1 -1
  12. package/dist/runtime/components/modal/modal-secure.vue +11 -18
  13. package/package.json +1 -1
  14. package/dist/runtime/components/dialog/dialog-2FA-generate.d.vue.ts +0 -18
  15. package/dist/runtime/components/dialog/dialog-2FA-generate.vue +0 -113
  16. package/dist/runtime/components/dialog/dialog-2FA-generate.vue.d.ts +0 -18
  17. package/dist/runtime/components/dialog/dialog-2FA.d.vue.ts +0 -18
  18. package/dist/runtime/components/dialog/dialog-2FA.vue +0 -65
  19. package/dist/runtime/components/dialog/dialog-2FA.vue.d.ts +0 -18
  20. package/dist/runtime/components/dialog/dialog-email-OTP.d.vue.ts +0 -20
  21. package/dist/runtime/components/dialog/dialog-email-OTP.vue +0 -120
  22. package/dist/runtime/components/dialog/dialog-email-OTP.vue.d.ts +0 -20
  23. package/dist/runtime/components/dialog/dialog-phone-OTP.d.vue.ts +0 -22
  24. package/dist/runtime/components/dialog/dialog-phone-OTP.vue +0 -62
  25. package/dist/runtime/components/dialog/dialog-phone-OTP.vue.d.ts +0 -22
  26. /package/dist/runtime/assets/svg/socials/{Whatsapp.svg → WhatsApp.svg} +0 -0
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
3
  "configKey": "pukaadUI",
4
- "version": "1.239.0",
4
+ "version": "1.240.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -48,11 +48,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
48
48
  label: string;
49
49
  required: boolean;
50
50
  name: string;
51
- gap: string;
52
51
  placeholder: string;
53
52
  labelDetail: string;
54
53
  placeholderDetail: string;
55
54
  requiredDetail: boolean;
55
+ gap: string;
56
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
57
  declare const _default: typeof __VLS_export;
58
58
  export default _default;
@@ -48,11 +48,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
48
48
  label: string;
49
49
  required: boolean;
50
50
  name: string;
51
- gap: string;
52
51
  placeholder: string;
53
52
  labelDetail: string;
54
53
  placeholderDetail: string;
55
54
  requiredDetail: boolean;
55
+ gap: string;
56
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
57
57
  declare const _default: typeof __VLS_export;
58
58
  export default _default;
@@ -50,8 +50,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  name: string;
51
51
  description: string;
52
52
  options: AutocompleteOption[] | string[] | number[];
53
- placeholder: string;
54
53
  limit: number;
54
+ placeholder: string;
55
55
  disabledErrorMessage: boolean;
56
56
  disabledBorder: boolean;
57
57
  showCounter: boolean;
@@ -50,8 +50,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
50
50
  name: string;
51
51
  description: string;
52
52
  options: AutocompleteOption[] | string[] | number[];
53
- placeholder: string;
54
53
  limit: number;
54
+ placeholder: string;
55
55
  disabledErrorMessage: boolean;
56
56
  disabledBorder: boolean;
57
57
  showCounter: boolean;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- placeholder: string;
30
29
  limit: number;
30
+ placeholder: string;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -26,8 +26,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
26
26
  }>, {
27
27
  name: string;
28
28
  state: "user" | "admin";
29
- placeholder: string;
30
29
  limit: number;
30
+ placeholder: string;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -1,20 +1,14 @@
1
1
  <template>
2
- <Modal
3
- width="550"
4
- title="คำแนะนำการตั้งค่า"
5
- title-position="center"
6
- :loading="isLoading"
7
- v-model="isOpen"
8
- >
2
+ <Modal class="w-[512px]" title="คำแนะนำการตั้งค่า" :loading="isLoading" v-model="isOpen">
9
3
  <div class="flex flex-col gap-[16px]">
10
- <div class="flex flex-col gap[8px] text-gray font-body-large">
11
- <div class="font-body-large-prominent">1.ดาวน์โหลดแอพยืนยันตัวตน</div>
4
+ <div class="flex flex-col gap-[8px] text-gray font-body-large">
5
+ <div class="font-body-large-prominent text-black">1.ดาวน์โหลดแอพยืนยันตัวตน</div>
12
6
  <div>
13
7
  เราแนะนำให้ดาวน์โหลด Google Authenticator หากคุณยังไม่ได้ติดตั้ง
14
8
  </div>
15
9
  </div>
16
- <div class="flex flex-col gap[8px] text-gray font-body-large">
17
- <div class="font-body-large-prominent">
10
+ <div class="flex flex-col gap-[8px] text-gray font-body-large">
11
+ <div class="font-body-large-prominent text-black">
18
12
  2.สแกนบาร์โค้ด/คิวอาร์โค้ดนี้หรือคัดลอกคีย์
19
13
  </div>
20
14
  <div>
@@ -29,17 +23,14 @@
29
23
  <div class="font-body-large-prominent">
30
24
  {{ key }}
31
25
  </div>
32
- <div
33
- class="cursor-pointer text-primary font-body-large"
34
- @click="copyToClipboard(key)"
35
- >
26
+ <div class="cursor-pointer text-primary font-body-large" @click="copyToClipboard(key)">
36
27
  คัดลอกคีย์
37
28
  </div>
38
29
  </div>
39
30
  </div>
40
31
  </div>
41
- <div class="flex flex-col gap[8px] text-gray font-body-large">
42
- <div class="font-body-large-prominent">
32
+ <div class="flex flex-col gap-[8px] text-gray font-body-large">
33
+ <div class="font-body-large-prominent text-black">
43
34
  3.คัดลอกแล้วป้อนรหัสตัวเลข 6 หลัก
44
35
  </div>
45
36
  <div>
@@ -51,12 +42,7 @@
51
42
  </div>
52
43
 
53
44
  <template #footer>
54
- <Button
55
- color="primary"
56
- full-width
57
- :disabled="isDisabled"
58
- @click="onComplete"
59
- >
45
+ <Button color="primary" class="w-full" :disabled="isDisabled" @click="onComplete">
60
46
  {{ props.confirmedText }}
61
47
  </Button>
62
48
  </template>
@@ -86,8 +72,8 @@ const isDisabled = ref(true);
86
72
  const twoFaGenerate = async () => {
87
73
  try {
88
74
  isLoading.value = true;
89
- const { status, data } = await api("/me/two-fa-generate");
90
- if (status !== "success") throw "Generate \u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08";
75
+ const { message, data } = await api("/me/two-fa-generate");
76
+ if (message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "Generate \u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08";
91
77
  key.value = data.key;
92
78
  barcode2FA.value = data.qr_code;
93
79
  isDisabled.value = false;
@@ -50,7 +50,7 @@ const handleSubmit = async () => {
50
50
  method: "POST",
51
51
  body: { password: password.value }
52
52
  });
53
- if (res.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
53
+ if (res.message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
54
54
  emit("complete", { secId: "" });
55
55
  isOpen.value = false;
56
56
  } else {
@@ -70,11 +70,11 @@ const handleSubmit = async () => {
70
70
  emit("complete", { secId: res.data?.sec_id || "" });
71
71
  isOpen.value = false;
72
72
  } else {
73
- inputRef.value?.setErrors?.(res.message || "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07");
73
+ inputRef.value?.setErrors?.(res.message.description);
74
74
  }
75
75
  }
76
76
  } catch (e) {
77
- inputRef.value?.setErrors?.(e?.data?.message || "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07");
77
+ inputRef.value?.setErrors?.(e?.data?.message.description);
78
78
  } finally {
79
79
  loading.value = false;
80
80
  }
@@ -14,8 +14,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
14
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
15
  onComplete?: ((value: string) => any) | undefined;
16
16
  }>, {
17
- confirmedText: string;
18
17
  phone: string;
18
+ confirmedText: string;
19
19
  phoneLabel: string;
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const _default: typeof __VLS_export;
@@ -14,8 +14,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
14
14
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
15
  onComplete?: ((value: string) => any) | undefined;
16
16
  }>, {
17
- confirmedText: string;
18
17
  phone: string;
18
+ confirmedText: string;
19
19
  phoneLabel: string;
20
20
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
21
  declare const _default: typeof __VLS_export;
@@ -1,15 +1,7 @@
1
1
  <template>
2
- <component
3
- v-for="modal in modals"
4
- :key="modal.key"
5
- :is="modal.component"
6
- :email="props.email"
7
- mode="secure"
8
- @complete="(data) => handleComplete(modal.key, data)"
9
- :confirmed-text="isLastStep ? '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19' : '\u0E16\u0E31\u0E14\u0E44\u0E1B'"
10
- @close="isOpen = false"
11
- v-model="modalStates[modal.key]"
12
- />
2
+ <component v-for="modal in modals" :key="modal.key" :is="modal.component" :email="props.email" mode="secure"
3
+ @complete="(data) => handleComplete(modal.key, data)" :confirmed-text="isLastStep ? '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19' : '\u0E16\u0E31\u0E14\u0E44\u0E1B'"
4
+ @close="isOpen = false" v-model="modalStates[modal.key]" />
13
5
  </template>
14
6
 
15
7
  <script setup>
@@ -126,30 +118,31 @@ const handleComplete = (key, data) => {
126
118
  };
127
119
  const onEnabled2FA = async (token) => {
128
120
  try {
129
- const { status } = await api("/me/two-fa-enabled", {
121
+ const { message } = await api("/me/two-fa-enabled", {
130
122
  method: "POST",
131
123
  body: { token }
132
124
  });
133
- if (status != "success") throw "2FA \u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
125
+ if (message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "2FA \u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
134
126
  $toast.success("\u0E40\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !");
135
127
  isOpen.value = false;
136
128
  emit("complete", "enabled-2fa");
137
129
  } catch (error) {
138
- $toast.error("\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E40\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !");
139
- console.error("Error:", error);
130
+ const errorMsg = error?.data?.message?.description || "\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E40\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !";
131
+ $toast.error(errorMsg);
140
132
  }
141
133
  };
142
134
  const onDisabled2FA = async () => {
143
135
  try {
144
- const { status } = await api("/me/two-fa-disabled", {
136
+ const { message } = await api("/me/two-fa-disabled", {
145
137
  method: "POST"
146
138
  });
147
- if (status != "success") throw "2FA \u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
139
+ if (message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "2FA \u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
148
140
  $toast.success("\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !");
149
141
  isOpen.value = false;
150
142
  emit("complete", "disabled-2fa");
151
143
  } catch (error) {
152
- $toast.error("\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !");
144
+ const errorMsg = error?.data?.message?.description || "\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E1B\u0E34\u0E14\u0E01\u0E32\u0E23\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E15\u0E31\u0E27\u0E15\u0E19\u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08 !";
145
+ $toast.error(errorMsg);
153
146
  console.error("Error:", error);
154
147
  }
155
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.239.0",
3
+ "version": "1.240.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,18 +0,0 @@
1
- import type { Modal2FAGenerateProps } from "@/types/components/modal/modal-2FA-generate";
2
- type __VLS_Props = Modal2FAGenerateProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- complete: () => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
- onComplete?: (() => any) | undefined;
14
- }>, {
15
- confirmedText: string;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,113 +0,0 @@
1
- <template>
2
- <ShadDialog v-model:open="isOpen">
3
- <ShadDialogContent class="w-[540px]">
4
- <ShadDialogHeader class="flex justify-center">
5
- <ShadDialogTitle class="text-center">คำแนะนำการตั้งค่า</ShadDialogTitle>
6
- </ShadDialogHeader>
7
- <div class="flex flex-col gap-[16px]">
8
- <div class="flex flex-col gap-[8px] text-gray font-body-large">
9
- <div class="font-body-large-prominent text-black">
10
- 1.ดาวน์โหลดแอพยืนยันตัวตน
11
- </div>
12
- <div>
13
- เราแนะนำให้ดาวน์โหลด Google Authenticator หากคุณยังไม่ได้ติดตั้ง
14
- </div>
15
- </div>
16
- <div class="flex flex-col gap-[8px] text-gray font-body-large">
17
- <div class="font-body-large-prominent text-black">
18
- 2.สแกนบาร์โค้ด/คิวอาร์โค้ดนี้หรือคัดลอกคีย์
19
- </div>
20
- <div>
21
- สแกนบาร์โค้ด/คิวอาร์โค้ดนี้ในแอพยืนยันตัวตนหรือคัดลอกคีย์แล้ววางลงในแอพ
22
- ยืนยันตัวตน
23
- </div>
24
- </div>
25
- <div class="flex justify-center items-center">
26
- <div class="flex items-center gap-[32px]">
27
- <Image width="146" height="145" :src="barcode2FA" />
28
- <div class="w-[168px] gap-[8px] flex flex-col justify-between">
29
- <div class="font-body-large-prominent">
30
- {{ key }}
31
- </div>
32
- <div
33
- class="cursor-pointer text-primary font-body-large"
34
- @click="copyToClipboard(key)"
35
- >
36
- คัดลอกคีย์
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
- <div class="flex flex-col gap-[8px] text-gray font-body-large">
42
- <div class="font-body-large-prominent text-black">
43
- 3.คัดลอกแล้วป้อนรหัสตัวเลข 6 หลัก
44
- </div>
45
- <div>
46
- หลังจากสแกนบาร์โค้ด/คิวอาร์โค้ด หรือคัดลอกคีย์แล้ว
47
- แอพยืนยันตัวตนจะสร้าง รหัสตัวเลข 6 หลัก
48
- ให้คัดลอกรหัสนั้นแล้วกลับมาป้อนบน Pukaad
49
- </div>
50
- </div>
51
- </div>
52
-
53
- <ShadDialogFooter>
54
- <Button class="w-full" @click="onComplete">
55
- {{ props.confirmedText }}
56
- </Button>
57
- </ShadDialogFooter>
58
- </ShadDialogContent>
59
- </ShadDialog>
60
- </template>
61
-
62
- <script setup>
63
- import { ref, watch } from "vue";
64
- import { useClipboard } from "@/runtime/composables/useCopy";
65
- import { useRuntimeConfig } from "nuxt/app";
66
- const { BASE_URL_API } = useRuntimeConfig().public;
67
- const { copyToClipboard } = useClipboard();
68
- const emit = defineEmits(["complete"]);
69
- const props = defineProps({
70
- confirmedText: { type: String, required: false, default: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19" },
71
- title: { type: String, required: false },
72
- description: { type: String, required: false },
73
- footer: { type: String, required: false }
74
- });
75
- const isOpen = defineModel({ type: Boolean, ...{
76
- default: false
77
- } });
78
- const key = ref("");
79
- const barcode2FA = ref("");
80
- const isLoading = ref(false);
81
- const isDisabled = ref(true);
82
- const twoFaGenerate = async () => {
83
- try {
84
- isLoading.value = true;
85
- const { status, data } = await $fetch(`${BASE_URL_API}/me/two-fa-generate`, {
86
- credentials: "include"
87
- });
88
- if (status !== "success") throw "Generate \u0E44\u0E21\u0E48\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08";
89
- key.value = data.key;
90
- barcode2FA.value = data.qr_code;
91
- isDisabled.value = false;
92
- } catch (error) {
93
- console.error("error:", error);
94
- } finally {
95
- isLoading.value = false;
96
- }
97
- };
98
- const onComplete = () => {
99
- emit("complete");
100
- isOpen.value = false;
101
- };
102
- watch(
103
- isOpen,
104
- (v) => {
105
- if (v) {
106
- twoFaGenerate();
107
- }
108
- },
109
- {
110
- immediate: true
111
- }
112
- );
113
- </script>
@@ -1,18 +0,0 @@
1
- import type { Modal2FAGenerateProps } from "@/types/components/modal/modal-2FA-generate";
2
- type __VLS_Props = Modal2FAGenerateProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- complete: () => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
- onComplete?: (() => any) | undefined;
14
- }>, {
15
- confirmedText: string;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,18 +0,0 @@
1
- import type { Modal2FAProps } from "@/types/components/modal/modal-2FA";
2
- type __VLS_Props = Modal2FAProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- complete: (verify: boolean) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
- onComplete?: ((verify: boolean) => any) | undefined;
14
- }>, {
15
- confirmedText: string;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,65 +0,0 @@
1
- <template>
2
- <Dialog v-model:open="isOpen">
3
- <DialogContent class="w-[425px]">
4
- <Form v-slot="{ meta }" @submit="onVerify2FA">
5
- <div class="flex flex-col gap-[24px]">
6
- <DialogHeader class="flex justify-center">
7
- <ShadDialogTitle>การยืนยันตัวตนแบบสองชั้น</ShadDialogTitle>
8
- <DialogDescription>
9
- ป้อนรหัสยืนยันที่คุณเห็นในแอปยืนยันตัวตน
10
- </DialogDescription>
11
- </DialogHeader>
12
- <InputOTP ref="twoFaRef" v-model="valueOTP" />
13
- <DialogFooter>
14
- <Button class="w-full" type="submit" :disabled="!meta.valid">
15
- {{ props.confirmedText }}
16
- </Button>
17
- </DialogFooter>
18
- </div>
19
- </Form>
20
- </DialogContent>
21
- </Dialog>
22
- </template>
23
-
24
- <script setup>
25
- import { ref, watch } from "vue";
26
- import { useRuntimeConfig } from "nuxt/app";
27
- const { BASE_URL_API } = useRuntimeConfig().public;
28
- const emit = defineEmits(["complete"]);
29
- const props = defineProps({
30
- phone: { type: String, required: false },
31
- confirmedText: { type: String, required: false, default: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19" },
32
- title: { type: String, required: false },
33
- description: { type: String, required: false },
34
- footer: { type: String, required: false }
35
- });
36
- const isOpen = defineModel({ type: Boolean, ...{
37
- default: false
38
- } });
39
- const twoFaRef = ref();
40
- const valueOTP = ref("");
41
- const isLoading = ref(false);
42
- const onVerify2FA = async () => {
43
- try {
44
- const { data } = await $fetch(
45
- !props.phone ? `${BASE_URL_API}/me/two-fa-verify` : `${BASE_URL_API}/auth/two-fa-verify`,
46
- {
47
- method: "POST",
48
- body: {
49
- phone: props.phone,
50
- code: valueOTP.value
51
- },
52
- credentials: "include"
53
- }
54
- );
55
- if (!data) throw "error";
56
- emit("complete", data);
57
- isOpen.value = false;
58
- } catch (e) {
59
- twoFaRef.value.setErrors(["\u0E23\u0E2B\u0E31\u0E2A\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07"]);
60
- }
61
- };
62
- watch(isOpen, (value) => {
63
- valueOTP.value = "";
64
- });
65
- </script>
@@ -1,18 +0,0 @@
1
- import type { Modal2FAProps } from "@/types/components/modal/modal-2FA";
2
- type __VLS_Props = Modal2FAProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- complete: (verify: boolean) => any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
- onComplete?: ((verify: boolean) => any) | undefined;
14
- }>, {
15
- confirmedText: string;
16
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
- declare const _default: typeof __VLS_export;
18
- export default _default;
@@ -1,20 +0,0 @@
1
- import type { ModalEmailOTPProps } from "~/types/components/modal/modal-email-otp";
2
- type __VLS_Props = ModalEmailOTPProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- close: () => any;
11
- complete: () => any;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
- onClose?: (() => any) | undefined;
14
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
- onComplete?: (() => any) | undefined;
16
- }>, {
17
- confirmedText: string;
18
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;
@@ -1,120 +0,0 @@
1
- <template>
2
- <Dialog v-model:open="isOpen">
3
- <DialogContent class="w-[425px]">
4
- <div>
5
- <Form v-slot="{ meta }" @submit="onVerifyOTP">
6
- <DialogHeader>
7
- <ShadDialogTitle>รหัสยืนยันตัวตน</ShadDialogTitle>
8
- <DialogDescription class="gap-[8px]">
9
- ป้อนรหัส 6 หลักที่ส่งไปยังอีเมล <span>{{ props.email }}</span>
10
- <span v-if="textRef">(Ref : {{ textRef }})</span>
11
- </DialogDescription>
12
- </DialogHeader>
13
-
14
- <div class="flex flex-col gap-[8px] font-body-large">
15
- <InputOTP ref="otpInputRef" v-model="valueOTP" />
16
-
17
- </div>
18
-
19
- <DialogFooter>
20
- <Button class="w-full" type="submit" :disabled="!meta.valid">
21
- {{ props.confirmedText }}
22
- </Button>
23
- </DialogFooter>
24
- </Form>
25
- </div>
26
- </DialogContent>
27
- </Dialog>
28
- </template>
29
-
30
- <script setup>
31
- import { computed, ref, watch } from "vue";
32
- import { useNuxtApp, useRuntimeConfig } from "nuxt/app";
33
- const { BASE_URL_API } = useRuntimeConfig().public;
34
- const { $toast } = useNuxtApp();
35
- const emit = defineEmits(["complete", "close"]);
36
- const props = defineProps({
37
- email: { type: String, required: false },
38
- confirmedText: { type: String, required: false, default: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19" },
39
- name: { type: String, required: false },
40
- type: { type: String, required: false },
41
- gap: { type: Number, required: false },
42
- digit: { type: Number, required: false },
43
- disabled: { type: Boolean, required: false },
44
- placeholder: { type: String, required: false }
45
- });
46
- const isOpen = defineModel({ type: Boolean, ...{
47
- default: false
48
- } });
49
- const textRef = ref("");
50
- const otpRef = ref();
51
- const valueOTP = ref("");
52
- const isLoading = ref(false);
53
- const isDisabledInput = ref(true);
54
- const timeExp = ref("");
55
- const onVerifyOTP = async () => {
56
- isLoading.value = true;
57
- try {
58
- await $fetch(`${BASE_URL_API}/me/email-otp-verify`, {
59
- method: "POST",
60
- credentials: "include",
61
- body: {
62
- code: valueOTP.value,
63
- email: props.email
64
- }
65
- });
66
- otpRef.value?.reset();
67
- valueOTP.value = "";
68
- isOpen.value = false;
69
- emit("complete");
70
- } catch (e) {
71
- $toast.error("\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07 !");
72
- otpRef.value?.reset();
73
- } finally {
74
- isLoading.value = false;
75
- }
76
- };
77
- const onEmailOTPRequest = async () => {
78
- alert();
79
- return;
80
- isLoading.value = true;
81
- isDisabledInput.value = true;
82
- try {
83
- if (!props.email) throw "\u0E01\u0E23\u0E38\u0E13\u0E32\u0E23\u0E30\u0E1A\u0E38 email";
84
- const { data } = await $fetch(
85
- `${BASE_URL_API}/me/email-otp-request`,
86
- {
87
- method: "POST",
88
- credentials: "include",
89
- body: {
90
- email: props.email
91
- }
92
- }
93
- );
94
- timeExp.value = data.expired_time;
95
- isDisabledInput.value = false;
96
- } catch (err) {
97
- console.log("Error:", err);
98
- onClose();
99
- $toast.error("\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 \u0E1A\u0E32\u0E07\u0E2D\u0E22\u0E48\u0E32\u0E07 !");
100
- } finally {
101
- isLoading.value = false;
102
- }
103
- };
104
- const onClose = () => {
105
- isOpen.value = false;
106
- emit("close");
107
- };
108
- watch(
109
- isOpen,
110
- (v) => {
111
- otpRef.value?.reset();
112
- if (v) {
113
- onEmailOTPRequest();
114
- }
115
- },
116
- {
117
- immediate: true
118
- }
119
- );
120
- </script>
@@ -1,20 +0,0 @@
1
- import type { ModalEmailOTPProps } from "~/types/components/modal/modal-email-otp";
2
- type __VLS_Props = ModalEmailOTPProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- close: () => any;
11
- complete: () => any;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
- onClose?: (() => any) | undefined;
14
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
- onComplete?: (() => any) | undefined;
16
- }>, {
17
- confirmedText: string;
18
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
- declare const _default: typeof __VLS_export;
20
- export default _default;
@@ -1,22 +0,0 @@
1
- import type { ModalPhoneOTPProps } from "@/types/components/modal/modal-phone-otp";
2
- type __VLS_Props = ModalPhoneOTPProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- close: () => any;
11
- complete: (value: string) => any;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
- onClose?: (() => any) | undefined;
14
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
- onComplete?: ((value: string) => any) | undefined;
16
- }>, {
17
- confirmedText: string;
18
- phone: string;
19
- phoneLabel: string;
20
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
- declare const _default: typeof __VLS_export;
22
- export default _default;
@@ -1,62 +0,0 @@
1
- <template>
2
- <Dialog v-model:open="isOpen">
3
- <Form v-slot="{ meta }" @submit="onVerifyOTP">
4
- <DialogContent class="w-[425px]">
5
- <DialogHeader>
6
- <ShadDialogTitle>ป้อนรหัสรักษาความปลอดภัย (OTP)</ShadDialogTitle>
7
- <DialogDescription class="gap-[8px]">
8
- ส่งรหัส 6 หลักไปที่เบอร์
9
- <span>{{ props.phoneLabel || props.phone }}</span>
10
- <div v-if="textRef">(Ref : {{ textRef }})</div>
11
- </DialogDescription>
12
- </DialogHeader>
13
-
14
- <div class="flex flex-col gap-[8px] font-body-large">
15
- <InputOTP ref="otpInputRef" v-model="valueOTP" />
16
-
17
- </div>
18
-
19
- <DialogFooter>
20
- <Button class="w-full" type="submit" :disabled="!meta.valid">
21
- {{ props.confirmedText }}
22
- </Button>
23
- </DialogFooter>
24
- </DialogContent>
25
- </Form>
26
- </Dialog>
27
- </template>
28
-
29
- <script setup>
30
- import { ref, watch, computed } from "vue";
31
- const emit = defineEmits(["complete", "close"]);
32
- const props = defineProps({
33
- phoneLabel: { type: String, required: false, default: "" },
34
- phone: { type: String, required: false, default: "" },
35
- confirmedText: { type: String, required: false, default: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19" },
36
- name: { type: String, required: false },
37
- type: { type: String, required: false },
38
- gap: { type: Number, required: false },
39
- digit: { type: Number, required: false },
40
- disabled: { type: Boolean, required: false },
41
- placeholder: { type: String, required: false }
42
- });
43
- const isOpen = defineModel({ type: Boolean, ...{
44
- default: false
45
- } });
46
- const textRef = ref("");
47
- const valueOTP = ref("");
48
- const loadingModal = ref(false);
49
- const timeExp = ref("");
50
- const onVerifyOTP = () => {
51
- loadingModal.value = true;
52
- setTimeout(() => {
53
- emit("complete", valueOTP.value);
54
- isOpen.value = false;
55
- loadingModal.value = false;
56
- }, 1e3);
57
- };
58
- watch(isOpen, (value) => {
59
- textRef.value = "";
60
- valueOTP.value = "";
61
- });
62
- </script>
@@ -1,22 +0,0 @@
1
- import type { ModalPhoneOTPProps } from "@/types/components/modal/modal-phone-otp";
2
- type __VLS_Props = ModalPhoneOTPProps;
3
- type __VLS_ModelProps = {
4
- modelValue?: boolean;
5
- };
6
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
7
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- "update:modelValue": (value: boolean) => any;
9
- } & {
10
- close: () => any;
11
- complete: (value: string) => any;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
- onClose?: (() => any) | undefined;
14
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
15
- onComplete?: ((value: string) => any) | undefined;
16
- }>, {
17
- confirmedText: string;
18
- phone: string;
19
- phoneLabel: string;
20
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
- declare const _default: typeof __VLS_export;
22
- export default _default;