pukaad-ui-lib 1.420.0 → 1.421.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.420.0",
4
+ "version": "1.421.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
@@ -81,16 +81,16 @@ declare const __VLS_base: import("vue").DefineComponent<DisplayVideoProps, {
81
81
  toggle: () => void;
82
82
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
83
83
  close: (payload: DisplayVideoAction) => any;
84
- fullscreen: (payload: DisplayVideoAction) => any;
85
- "play-click": (payload: DisplayVideoAction) => any;
86
84
  prev: (payload: DisplayVideoAction) => any;
87
85
  next: (payload: DisplayVideoAction) => any;
86
+ fullscreen: (payload: DisplayVideoAction) => any;
87
+ "play-click": (payload: DisplayVideoAction) => any;
88
88
  }, string, import("vue").PublicProps, Readonly<DisplayVideoProps> & Readonly<{
89
89
  onClose?: ((payload: DisplayVideoAction) => any) | undefined;
90
- onFullscreen?: ((payload: DisplayVideoAction) => any) | undefined;
91
- "onPlay-click"?: ((payload: DisplayVideoAction) => any) | undefined;
92
90
  onPrev?: ((payload: DisplayVideoAction) => any) | undefined;
93
91
  onNext?: ((payload: DisplayVideoAction) => any) | undefined;
92
+ onFullscreen?: ((payload: DisplayVideoAction) => any) | undefined;
93
+ "onPlay-click"?: ((payload: DisplayVideoAction) => any) | undefined;
94
94
  }>, {
95
95
  src: string;
96
96
  fullHeight: boolean;
@@ -81,16 +81,16 @@ declare const __VLS_base: import("vue").DefineComponent<DisplayVideoProps, {
81
81
  toggle: () => void;
82
82
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
83
83
  close: (payload: DisplayVideoAction) => any;
84
- fullscreen: (payload: DisplayVideoAction) => any;
85
- "play-click": (payload: DisplayVideoAction) => any;
86
84
  prev: (payload: DisplayVideoAction) => any;
87
85
  next: (payload: DisplayVideoAction) => any;
86
+ fullscreen: (payload: DisplayVideoAction) => any;
87
+ "play-click": (payload: DisplayVideoAction) => any;
88
88
  }, string, import("vue").PublicProps, Readonly<DisplayVideoProps> & Readonly<{
89
89
  onClose?: ((payload: DisplayVideoAction) => any) | undefined;
90
- onFullscreen?: ((payload: DisplayVideoAction) => any) | undefined;
91
- "onPlay-click"?: ((payload: DisplayVideoAction) => any) | undefined;
92
90
  onPrev?: ((payload: DisplayVideoAction) => any) | undefined;
93
91
  onNext?: ((payload: DisplayVideoAction) => any) | undefined;
92
+ onFullscreen?: ((payload: DisplayVideoAction) => any) | undefined;
93
+ "onPlay-click"?: ((payload: DisplayVideoAction) => any) | undefined;
94
94
  }>, {
95
95
  src: string;
96
96
  fullHeight: boolean;
@@ -1,10 +1,11 @@
1
1
  import type { SelectPlaceItem } from "../input/input-select-place.vue.js";
2
2
  import type { MentionItem } from "../input/input-mention.vue.js";
3
- interface IFileItem {
3
+ export interface IFileItem {
4
4
  file?: File;
5
5
  url: string;
6
6
  description?: string;
7
7
  duration?: string;
8
+ mediaType?: "image" | "video";
8
9
  }
9
10
  interface SelectedTag {
10
11
  id: string;
@@ -24,6 +25,7 @@ export interface DrawerPostContentItem {
24
25
  }
25
26
  export interface DrawerPostContentProps {
26
27
  item?: DrawerPostContentItem;
28
+ state?: "personal" | "business";
27
29
  }
28
30
  type __VLS_Props = DrawerPostContentProps;
29
31
  declare const modelValue: import("vue").ModelRef<boolean | undefined, string, boolean | undefined, boolean | undefined>;
@@ -41,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
41
43
  onSaveDraft?: ((data: unknown) => any) | undefined;
42
44
  }>, {
43
45
  item: DrawerPostContentItem;
46
+ state: "personal" | "business";
44
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
48
  declare const _default: typeof __VLS_export;
46
49
  export default _default;
@@ -171,7 +171,8 @@ const props = defineProps({
171
171
  tags: [],
172
172
  mentions: [],
173
173
  places: []
174
- }) }
174
+ }) },
175
+ state: { type: String, required: false, default: "personal" }
175
176
  });
176
177
  const modelValue = defineModel({ type: Boolean });
177
178
  const currentId = ref(void 0);
@@ -197,6 +198,7 @@ const hasCoverFile = computed(() => coverFiles.value.length > 0);
197
198
  const coverFileType = computed(() => {
198
199
  const first = coverFiles.value[0];
199
200
  if (!first) return null;
201
+ if (first.mediaType) return first.mediaType;
200
202
  return first.file?.type?.startsWith("video") ? "video" : "image";
201
203
  });
202
204
  const coverAccept = computed(() => {
@@ -319,6 +321,10 @@ const onClose = async () => {
319
321
  modelValue.value = false;
320
322
  };
321
323
  const onSaveDraft = async () => {
324
+ if (props.state === "business") {
325
+ await submitContent("DRAFT");
326
+ return;
327
+ }
322
328
  if (isSubmitting.value) return;
323
329
  isSubmitting.value = true;
324
330
  try {
@@ -331,13 +337,15 @@ const onSaveDraft = async () => {
331
337
  file: f.file,
332
338
  url: f.url,
333
339
  description: f.description,
334
- duration: f.duration
340
+ duration: f.duration,
341
+ mediaType: f.mediaType
335
342
  })),
336
343
  posterFiles: posterFiles.value.map((f) => ({
337
344
  file: f.file,
338
345
  url: f.url,
339
346
  description: f.description,
340
- duration: f.duration
347
+ duration: f.duration,
348
+ mediaType: f.mediaType
341
349
  })),
342
350
  description: description.value,
343
351
  tags: JSON.parse(JSON.stringify(selectedTags.value)),
@@ -373,6 +381,10 @@ const parseDurationToSeconds = (duration) => {
373
381
  if (Number.isNaN(m) || Number.isNaN(s)) return 0;
374
382
  return m * 60 + s;
375
383
  };
384
+ const endpointMap = {
385
+ personal: "/personal/contents",
386
+ business: "/business/contents"
387
+ };
376
388
  const submitContent = async (status) => {
377
389
  if (isSubmitting.value) return;
378
390
  if (!hasCoverText.value && !hasCoverFile.value) {
@@ -414,7 +426,8 @@ const submitContent = async (status) => {
414
426
  place_ids: selectedPlaces.value.map((p) => p.id),
415
427
  status
416
428
  };
417
- const endpoint = isEditMode.value ? `/personal/contents/${currentId.value}` : "/personal/contents";
429
+ const baseEndpoint = endpointMap[props.state];
430
+ const endpoint = isEditMode.value ? `${baseEndpoint}/${currentId.value}` : baseEndpoint;
418
431
  const method = isEditMode.value ? "PATCH" : "POST";
419
432
  const res = await api(
420
433
  endpoint,
@@ -426,7 +439,8 @@ const submitContent = async (status) => {
426
439
  if (currentId.value?.startsWith("draft_")) {
427
440
  await deleteDraft(currentId.value);
428
441
  }
429
- emit("success", res.data);
442
+ if (status === "DRAFT") emit("saveDraft", res.data);
443
+ else emit("success", res.data);
430
444
  modelValue.value = false;
431
445
  } catch (e) {
432
446
  const apiErr = e;
@@ -1,10 +1,11 @@
1
1
  import type { SelectPlaceItem } from "../input/input-select-place.vue.js";
2
2
  import type { MentionItem } from "../input/input-mention.vue.js";
3
- interface IFileItem {
3
+ export interface IFileItem {
4
4
  file?: File;
5
5
  url: string;
6
6
  description?: string;
7
7
  duration?: string;
8
+ mediaType?: "image" | "video";
8
9
  }
9
10
  interface SelectedTag {
10
11
  id: string;
@@ -24,6 +25,7 @@ export interface DrawerPostContentItem {
24
25
  }
25
26
  export interface DrawerPostContentProps {
26
27
  item?: DrawerPostContentItem;
28
+ state?: "personal" | "business";
27
29
  }
28
30
  type __VLS_Props = DrawerPostContentProps;
29
31
  declare const modelValue: import("vue").ModelRef<boolean | undefined, string, boolean | undefined, boolean | undefined>;
@@ -41,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
41
43
  onSaveDraft?: ((data: unknown) => any) | undefined;
42
44
  }>, {
43
45
  item: DrawerPostContentItem;
46
+ state: "personal" | "business";
44
47
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
45
48
  declare const _default: typeof __VLS_export;
46
49
  export default _default;
@@ -65,14 +65,14 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
65
65
  src: string;
66
66
  center: boolean;
67
67
  crossorigin: "" | "anonymous" | "use-credentials";
68
- background: boolean;
69
- modal: boolean;
70
68
  responsive: boolean;
71
69
  restore: boolean;
72
70
  checkCrossOrigin: boolean;
73
71
  checkOrientation: boolean;
72
+ modal: boolean;
74
73
  guides: boolean;
75
74
  highlight: boolean;
75
+ background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -65,14 +65,14 @@ declare const __VLS_export: import("vue").DefineComponent<ImageCropperProps, {
65
65
  src: string;
66
66
  center: boolean;
67
67
  crossorigin: "" | "anonymous" | "use-credentials";
68
- background: boolean;
69
- modal: boolean;
70
68
  responsive: boolean;
71
69
  restore: boolean;
72
70
  checkCrossOrigin: boolean;
73
71
  checkOrientation: boolean;
72
+ modal: boolean;
74
73
  guides: boolean;
75
74
  highlight: boolean;
75
+ background: boolean;
76
76
  autoCrop: boolean;
77
77
  movable: boolean;
78
78
  rotatable: boolean;
@@ -70,9 +70,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
70
70
  required: boolean;
71
71
  description: string;
72
72
  options: AutocompleteOption[] | string[] | number[];
73
- limit: number;
74
73
  labelKey: string;
75
74
  placeholder: string;
75
+ limit: number;
76
76
  disabledErrorMessage: boolean;
77
77
  disabledBorder: boolean;
78
78
  showCounter: boolean;
@@ -70,9 +70,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
70
70
  required: boolean;
71
71
  description: string;
72
72
  options: AutocompleteOption[] | string[] | number[];
73
- limit: number;
74
73
  labelKey: string;
75
74
  placeholder: string;
75
+ limit: number;
76
76
  disabledErrorMessage: boolean;
77
77
  disabledBorder: boolean;
78
78
  showCounter: boolean;
@@ -59,8 +59,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
59
59
  }>, {
60
60
  pageSize: number;
61
61
  name: string;
62
- limit: number;
63
62
  labelKey: string;
63
+ limit: number;
64
64
  valueKey: string;
65
65
  multiple: boolean;
66
66
  placeholderSearch: string;
@@ -59,8 +59,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
59
59
  }>, {
60
60
  pageSize: number;
61
61
  name: string;
62
- limit: number;
63
62
  labelKey: string;
63
+ limit: number;
64
64
  valueKey: string;
65
65
  multiple: boolean;
66
66
  placeholderSearch: string;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
14
  options: InputSelectItem[];
15
- limit: number;
16
15
  placeholder: string;
16
+ limit: number;
17
17
  showCounter: boolean;
18
18
  addLabel: string;
19
19
  removable: boolean;
@@ -12,8 +12,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
12
12
  name: string;
13
13
  modelValue: LocalizedNameItem[];
14
14
  options: InputSelectItem[];
15
- limit: number;
16
15
  placeholder: string;
16
+ limit: number;
17
17
  showCounter: boolean;
18
18
  addLabel: string;
19
19
  removable: boolean;
@@ -20,9 +20,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
20
20
  name: string;
21
21
  required: boolean;
22
22
  description: string;
23
- limit: number;
24
23
  labelKey: string;
25
24
  placeholder: string;
25
+ limit: number;
26
26
  disabledErrorMessage: boolean;
27
27
  disabledBorder: boolean;
28
28
  showCounter: boolean;
@@ -20,9 +20,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
20
20
  name: string;
21
21
  required: boolean;
22
22
  description: string;
23
- limit: number;
24
23
  labelKey: string;
25
24
  placeholder: string;
25
+ limit: number;
26
26
  disabledErrorMessage: boolean;
27
27
  disabledBorder: boolean;
28
28
  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
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
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
- limit: number;
30
29
  placeholder: string;
30
+ limit: number;
31
31
  ignore: string[];
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  declare const _default: typeof __VLS_export;
@@ -46,8 +46,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
46
46
  resize: "none" | "both" | "horizontal" | "vertical";
47
47
  fullHeight: boolean;
48
48
  fullWidth: boolean;
49
- limit: number;
50
49
  rows: number;
50
+ limit: number;
51
51
  readonly: boolean;
52
52
  disabledErrorMessage: boolean;
53
53
  disabledBorder: boolean;
@@ -46,8 +46,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
46
46
  resize: "none" | "both" | "horizontal" | "vertical";
47
47
  fullHeight: boolean;
48
48
  fullWidth: boolean;
49
- limit: number;
50
49
  rows: number;
50
+ limit: number;
51
51
  readonly: boolean;
52
52
  disabledErrorMessage: boolean;
53
53
  disabledBorder: boolean;
@@ -3,6 +3,7 @@ export const useApi = () => {
3
3
  const config = useRuntimeConfig();
4
4
  const baseURL = config.public.BASE_URL_API;
5
5
  const provinceIdState = useState("pukaad:province-id", () => null);
6
+ const businessProfileId = useCookie("PUKAAD_BUSINESS_PROFILE_ID");
6
7
  const configProvinceId = config.public.APP_PROVINCE_ID;
7
8
  const { APP_TYPE } = config.public;
8
9
  const secId = useCookie(
@@ -22,6 +23,9 @@ export const useApi = () => {
22
23
  if (pid) {
23
24
  headers.set("X-Province-ID", String(pid));
24
25
  }
26
+ if (businessProfileId.value) {
27
+ headers.set("X-Business-Profile-ID", businessProfileId.value);
28
+ }
25
29
  options.headers = headers;
26
30
  },
27
31
  onResponseError({ response }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pukaad-ui-lib",
3
- "version": "1.420.0",
3
+ "version": "1.421.0",
4
4
  "description": "pukaad-ui for MeMSG",
5
5
  "repository": {
6
6
  "type": "git",