pukaad-ui-lib 1.213.0 → 1.214.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.213.0",
4
+ "version": "1.214.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -1,28 +1,34 @@
1
- interface BusinessHour {
2
- day: string;
3
- time_range: string;
1
+ export interface Category {
2
+ id: string;
3
+ category_name: string;
4
4
  }
5
- interface OpeningHours {
6
- Business_hour: BusinessHour[];
7
- Special_hour?: BusinessHour[];
5
+ export interface TimeSlot {
6
+ start: string;
7
+ end: string;
8
8
  }
9
- interface SocialLink {
10
- name: string;
11
- link: string;
9
+ export interface OpeningHour {
10
+ day: number;
11
+ isOpen: boolean;
12
+ isAllDay?: boolean;
13
+ timeSlots?: TimeSlot[];
12
14
  }
13
- interface PlaceDetail {
15
+ export interface ContactChannel {
16
+ channel_type: string;
17
+ value: string;
18
+ }
19
+ export interface PlaceDetailItem {
14
20
  description?: string;
15
- category?: string;
21
+ categories?: Category[];
16
22
  open_status?: string;
17
- opening_hour: OpeningHours;
23
+ opening_hours?: OpeningHour[];
18
24
  phone?: string;
19
- links?: SocialLink[];
25
+ contact_channels?: ContactChannel[];
20
26
  }
21
27
  type __VLS_Props = {
22
- item?: PlaceDetail;
28
+ item?: PlaceDetailItem;
23
29
  };
24
30
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
- item: PlaceDetail;
31
+ item: PlaceDetailItem;
26
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
33
  declare const _default: typeof __VLS_export;
28
34
  export default _default;
@@ -9,29 +9,18 @@
9
9
 
10
10
  <div class="flex gap-[12px]">
11
11
  <Icon name="lucide:tag" :size="20" class="text-primary shrink-0 mt-[2px]" />
12
- <div v-if="props.item.category">{{ props.item.category }}</div>
12
+ <div v-if="categoryText">{{ categoryText }}</div>
13
13
  <div v-else class="text-cloud">ไม่มีข้อมูลประเภท</div>
14
14
  </div>
15
15
 
16
16
  <div class="flex gap-[12px]">
17
17
  <Icon name="lucide:clock" :size="20" class="text-primary shrink-0 mt-[2px]" />
18
- <div v-if="props.item.opening_hour?.Business_hour?.length" class="flex flex-col gap-[4px] flex-1">
18
+ <div v-if="businessHours.length" class="flex flex-col gap-[4px] flex-1">
19
19
  <div class="font-body-large-prominent text-success">{{ props.item.open_status ?? "\u0E40\u0E1B\u0E34\u0E14\u0E2D\u0E22\u0E39\u0E48" }}</div>
20
-
21
- <div v-for="(time, index) in props.item.opening_hour?.Business_hour" :key="`bh-${index}`"
22
- class="flex items-center justify-between">
23
- <span>{{ time.day }}</span>
24
- <span>{{ time.time_range }}</span>
20
+ <div v-for="(hour, index) in businessHours" :key="index" class="flex items-center justify-between">
21
+ <span>{{ hour.day }}</span>
22
+ <span>{{ hour.time_range }}</span>
25
23
  </div>
26
-
27
- <template v-if="props.item.opening_hour?.Special_hour?.length">
28
- <div class="font-body-large-prominent text-warning mt-[8px]">วันทำการพิเศษ</div>
29
- <div v-for="(time, i) in props.item.opening_hour.Special_hour" :key="`sh-${i}`"
30
- class="flex items-center justify-between text-warning">
31
- <span>{{ time.day }}</span>
32
- <span>{{ time.time_range }}</span>
33
- </div>
34
- </template>
35
24
  </div>
36
25
  <div v-else class="text-cloud">ไม่มีข้อมูลเวลาทำการ</div>
37
26
  </div>
@@ -44,14 +33,17 @@
44
33
 
45
34
  <Divider />
46
35
 
47
- <div v-if="props.item.links?.length" class="flex flex-col gap-[8px]">
48
- <div v-for="(linkItem, index) in props.item.links" :key="index"
49
- class="flex gap-[12px] items-center cursor-pointer hover:underline" @click="onClickLink(linkItem.link)">
36
+ <div v-if="socialLinks.length" class="flex flex-col gap-[8px]">
37
+ <div
38
+ v-for="(linkItem, index) in socialLinks"
39
+ :key="index"
40
+ class="flex gap-[12px] items-center cursor-pointer hover:underline"
41
+ @click="onClickLink(linkItem.link)"
42
+ >
50
43
  <Icon :name="`pukaad-social:${linkItem.name}`" :size="20" class="shrink-0" />
51
44
  <span>{{ linkItem.link }}</span>
52
45
  </div>
53
46
  </div>
54
-
55
47
  <div v-else class="flex gap-[12px] items-center">
56
48
  <Icon name="lucide:link" :size="20" class="text-primary shrink-0" />
57
49
  <span class="text-cloud">ไม่มีข้อมูลช่องทางติดต่อ</span>
@@ -61,16 +53,26 @@
61
53
  </template>
62
54
 
63
55
  <script setup>
56
+ import { computed } from "vue";
57
+ const DAY_NAMES = ["\u0E2D\u0E32\u0E17\u0E34\u0E15\u0E22\u0E4C", "\u0E08\u0E31\u0E19\u0E17\u0E23\u0E4C", "\u0E2D\u0E31\u0E07\u0E04\u0E32\u0E23", "\u0E1E\u0E38\u0E18", "\u0E1E\u0E24\u0E2B\u0E31\u0E2A\u0E1A\u0E14\u0E35", "\u0E28\u0E38\u0E01\u0E23\u0E4C", "\u0E40\u0E2A\u0E32\u0E23\u0E4C"];
64
58
  const props = defineProps({
65
- item: { type: Object, required: false, default: () => ({
66
- description: "",
67
- category: "",
68
- open_status: "",
69
- opening_hour: { Business_hour: [], Special_hour: [] },
70
- phone: "",
71
- links: []
72
- }) }
59
+ item: { type: Object, required: false, default: () => ({}) }
73
60
  });
61
+ const categoryText = computed(
62
+ () => (props.item.categories ?? []).map((c) => c.category_name).join(", ")
63
+ );
64
+ const businessHours = computed(
65
+ () => (props.item.opening_hours ?? []).map((h) => ({
66
+ day: DAY_NAMES[h.day] ?? "",
67
+ time_range: !h.isOpen ? "\u0E1B\u0E34\u0E14" : h.isAllDay ? "\u0E15\u0E25\u0E2D\u0E14\u0E27\u0E31\u0E19" : (h.timeSlots ?? []).map((t) => `${t.start} - ${t.end}`).join(", ") || "\u0E40\u0E1B\u0E34\u0E14"
68
+ }))
69
+ );
70
+ const socialLinks = computed(
71
+ () => (props.item.contact_channels ?? []).filter((ch) => ch.value).map((ch) => ({
72
+ name: ch.channel_type?.toLowerCase() ?? "link",
73
+ link: ch.value
74
+ }))
75
+ );
74
76
  const onClickLink = (link) => {
75
77
  window.open(link, "_blank");
76
78
  };
@@ -1,28 +1,34 @@
1
- interface BusinessHour {
2
- day: string;
3
- time_range: string;
1
+ export interface Category {
2
+ id: string;
3
+ category_name: string;
4
4
  }
5
- interface OpeningHours {
6
- Business_hour: BusinessHour[];
7
- Special_hour?: BusinessHour[];
5
+ export interface TimeSlot {
6
+ start: string;
7
+ end: string;
8
8
  }
9
- interface SocialLink {
10
- name: string;
11
- link: string;
9
+ export interface OpeningHour {
10
+ day: number;
11
+ isOpen: boolean;
12
+ isAllDay?: boolean;
13
+ timeSlots?: TimeSlot[];
12
14
  }
13
- interface PlaceDetail {
15
+ export interface ContactChannel {
16
+ channel_type: string;
17
+ value: string;
18
+ }
19
+ export interface PlaceDetailItem {
14
20
  description?: string;
15
- category?: string;
21
+ categories?: Category[];
16
22
  open_status?: string;
17
- opening_hour: OpeningHours;
23
+ opening_hours?: OpeningHour[];
18
24
  phone?: string;
19
- links?: SocialLink[];
25
+ contact_channels?: ContactChannel[];
20
26
  }
21
27
  type __VLS_Props = {
22
- item?: PlaceDetail;
28
+ item?: PlaceDetailItem;
23
29
  };
24
30
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
- item: PlaceDetail;
31
+ item: PlaceDetailItem;
26
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
33
  declare const _default: typeof __VLS_export;
28
34
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.213.0",
3
+ "version": "1.214.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",