itube-specs 0.0.765 → 0.0.767

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 (103) hide show
  1. package/composables/__tests__/use-format-time-ago.test.ts +39 -0
  2. package/composables/__tests__/use-model-filter-chips.test.ts +19 -5
  3. package/composables/fetch/use-fetch-categories-by-letter.ts +4 -4
  4. package/composables/fetch/use-fetch-categories-by-name.ts +4 -4
  5. package/composables/fetch/use-fetch-categories-by-phrase.ts +4 -4
  6. package/composables/fetch/use-fetch-categories-group-by-letter.ts +3 -3
  7. package/composables/fetch/use-fetch-categories-related.ts +4 -4
  8. package/composables/fetch/use-fetch-channels-by-model.ts +4 -4
  9. package/composables/fetch/use-fetch-channels-by-name.ts +4 -4
  10. package/composables/fetch/use-fetch-channels-by-network-name.ts +4 -4
  11. package/composables/fetch/use-fetch-channels.ts +4 -4
  12. package/composables/fetch/use-fetch-dictionaries-countries.ts +4 -4
  13. package/composables/fetch/use-fetch-dictionaries-genders.ts +4 -4
  14. package/composables/fetch/use-fetch-footer-categories.ts +4 -4
  15. package/composables/fetch/use-fetch-groups-categories-lazy.ts +2 -2
  16. package/composables/fetch/use-fetch-groups-categories.ts +4 -4
  17. package/composables/fetch/use-fetch-model-by-name.ts +4 -4
  18. package/composables/fetch/use-fetch-models-by-category.ts +4 -4
  19. package/composables/fetch/use-fetch-models-by-channel.ts +4 -4
  20. package/composables/fetch/use-fetch-models-by-letter.ts +4 -4
  21. package/composables/fetch/use-fetch-models-by-phrases.ts +4 -4
  22. package/composables/fetch/use-fetch-models-by-tag.ts +4 -4
  23. package/composables/fetch/use-fetch-models-related.ts +4 -4
  24. package/composables/fetch/use-fetch-models.ts +4 -4
  25. package/composables/fetch/use-fetch-multi-suggest.ts +4 -4
  26. package/composables/fetch/use-fetch-playlists-by-id.ts +3 -3
  27. package/composables/fetch/use-fetch-playlists-by-niche.ts +4 -4
  28. package/composables/fetch/use-fetch-playlists-get-videos-by-id.ts +3 -3
  29. package/composables/fetch/use-fetch-popular-tags-by-channel-name.ts +4 -4
  30. package/composables/fetch/use-fetch-popular-tags-by-model-name.ts +4 -4
  31. package/composables/fetch/use-fetch-related-searches.ts +4 -4
  32. package/composables/fetch/use-fetch-related-videos.ts +4 -4
  33. package/composables/fetch/use-fetch-top-chips-models.ts +4 -4
  34. package/composables/fetch/use-fetch-top-models.ts +3 -3
  35. package/composables/fetch/use-fetch-top-random-categories.ts +4 -4
  36. package/composables/fetch/use-fetch-top-random-full.ts +5 -5
  37. package/composables/fetch/use-fetch-video-referer-phrases.ts +4 -4
  38. package/composables/fetch/use-fetch-video.ts +4 -4
  39. package/composables/fetch/use-fetch-videos-by-categories.ts +4 -4
  40. package/composables/fetch/use-fetch-videos-by-channel.ts +4 -4
  41. package/composables/fetch/use-fetch-videos-by-model-and-channel.ts +4 -4
  42. package/composables/fetch/use-fetch-videos-by-model-and-tag.ts +4 -4
  43. package/composables/fetch/use-fetch-videos-by-model.ts +4 -4
  44. package/composables/fetch/use-fetch-videos-by-tag.ts +4 -4
  45. package/composables/fetch/use-fetch-videos-search-by-niche.ts +4 -4
  46. package/composables/fetch/use-fetch-videos.ts +4 -4
  47. package/composables/use-auth-popup.ts +4 -4
  48. package/composables/use-format-time-ago.ts +13 -21
  49. package/composables/use-generate-link.ts +3 -3
  50. package/composables/use-model-filter-chips.ts +3 -2
  51. package/composables/use-playlist-add.ts +2 -2
  52. package/composables/use-playlist-edit.ts +5 -5
  53. package/lib/contact-forms-scheme.ts +6 -6
  54. package/lib/report-forms-scheme.ts +6 -6
  55. package/nuxt.config.ts +1 -1
  56. package/package.json +1 -1
  57. package/runtime/constants/async-data.ts +61 -0
  58. package/runtime/constants/auth-step.ts +7 -0
  59. package/runtime/constants/contacts-subjects.ts +9 -0
  60. package/runtime/constants/languages.ts +22 -0
  61. package/runtime/constants/niche.ts +8 -0
  62. package/runtime/constants/playlist-step.ts +7 -0
  63. package/runtime/constants/playlist-type.ts +6 -0
  64. package/runtime/constants/report-forms-subjects.ts +9 -0
  65. package/runtime/constants/thumb-size.ts +7 -0
  66. package/runtime/index.ts +9 -11
  67. package/runtime/utils/__tests__/get-month.test.ts +10 -8
  68. package/runtime/utils/cleaners/clean-category-card.ts +1 -1
  69. package/runtime/utils/cleaners/clean-category-info.ts +1 -1
  70. package/runtime/utils/cleaners/clean-channel-card.ts +1 -1
  71. package/runtime/utils/cleaners/clean-channel-info.ts +1 -1
  72. package/runtime/utils/cleaners/clean-model-card.ts +1 -1
  73. package/runtime/utils/cleaners/clean-model-info.ts +1 -1
  74. package/runtime/utils/cleaners/clean-playlist-card.ts +1 -1
  75. package/runtime/utils/cleaners/clean-user-playlists-card.ts +1 -1
  76. package/runtime/utils/cleaners/clean-video-card.ts +1 -1
  77. package/runtime/utils/converters/convert-model-card-to-chips.ts +1 -1
  78. package/runtime/utils/get-month.ts +5 -20
  79. package/types/contacts-form.d.ts +2 -2
  80. package/types/contacts-scheme.d.ts +2 -2
  81. package/types/playlist-card.d.ts +2 -2
  82. package/types/playlist-data.d.ts +2 -2
  83. package/types/playlist-short.d.ts +2 -2
  84. package/types/raw/raw-playlist-card.d.ts +2 -2
  85. package/types/raw/raw-playlist-data.d.ts +2 -2
  86. package/types/raw/raw-playlist-user.d.ts +2 -2
  87. package/types/raw/raw-thumbs-urls.d.ts +1 -1
  88. package/types/report-form.d.ts +2 -2
  89. package/types/report-scheme.d.ts +2 -2
  90. package/types/thumbs-urls.d.ts +1 -1
  91. package/runtime/enums/async-data.ts +0 -59
  92. package/runtime/enums/auth-step.ts +0 -5
  93. package/runtime/enums/contacts-subjects.ts +0 -7
  94. package/runtime/enums/languages.ts +0 -20
  95. package/runtime/enums/niche.ts +0 -6
  96. package/runtime/enums/playlist-step.ts +0 -5
  97. package/runtime/enums/playlist-type.ts +0 -4
  98. package/runtime/enums/report-forms-subjects.ts +0 -7
  99. package/runtime/enums/thumb-size.ts +0 -5
  100. package/runtime/utils/__tests__/format-number.test.ts +0 -24
  101. package/runtime/utils/__tests__/format-time-ago.test.ts +0 -49
  102. package/runtime/utils/format-number.ts +0 -12
  103. package/runtime/utils/format-time-ago.ts +0 -26
@@ -1,9 +1,9 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
 
4
4
  export const useFetchRelatedSearch = async (apiMethod: (...args: any[]) => Promise<Array<string>>) => {
5
- const lang = useLang() as ELanguage;
6
- const key = EAsyncData.RelatedSearch;
5
+ const lang = useLang() as Language;
6
+ const key = AsyncData.RelatedSearch;
7
7
 
8
8
  const { data, status, error } = await useAsyncData<Array<string>>(
9
9
  key,
@@ -1,18 +1,18 @@
1
1
  import { useRoute } from 'vue-router';
2
- import type { ELanguage } from '../../runtime';
3
- import { EAsyncData } from '../../runtime';
2
+ import type { Language } from '../../runtime';
3
+ import { AsyncData } from '../../runtime';
4
4
  import type { IVideoCard, PaginatedResponse } from '../../types';
5
5
 
6
6
  export const useFetchRelatedVideos = async (
7
7
  apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>
8
8
  ) => {
9
9
  const { locale } = useI18n();
10
- const lang = useLang() as ELanguage;
10
+ const lang = useLang() as Language;
11
11
  const route = useRoute();
12
12
  const mobile = !!useState<boolean>('isMobile').value;
13
13
  const perPage = mobile ? 6 : 14;
14
14
  const slug = useSlug();
15
- const key = EAsyncData.RelatedVideos;
15
+ const key = AsyncData.RelatedVideos;
16
16
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
17
17
 
18
18
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,10 +1,10 @@
1
- import type { ELanguage} from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language} from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
  import type { IModelTag } from '../../types';
4
4
 
5
5
  export const useFetchTopChipsModels = async (apiMethod: (...args: any[]) => Promise<IModelTag[]>, cacheId: string) => {
6
- const lang = useLang() as ELanguage;
7
- const key = EAsyncData.TopChipsModels;
6
+ const lang = useLang() as Language;
7
+ const key = AsyncData.TopChipsModels;
8
8
  const stateKey = computed(() => `data-${key}-${cacheId}-${lang}`);
9
9
 
10
10
  const { data: topChipsModels, refresh, status } = await useAsyncData<IModelTag[]>(
@@ -1,8 +1,8 @@
1
- import type { EAsyncData, ELanguage } from '../../runtime';
1
+ import type { AsyncData, Language } from '../../runtime';
2
2
  import type { IModelCard, PaginatedResponse } from '../../types';
3
3
 
4
- export const useFetchTopModels = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IModelCard>>, limit: number, eName: EAsyncData | string, cacheId: string) => {
5
- const lang = useLang() as ELanguage;
4
+ export const useFetchTopModels = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IModelCard>>, limit: number, eName: AsyncData | string, cacheId: string) => {
5
+ const lang = useLang() as Language;
6
6
  const key = eName;
7
7
  const stateKey = computed(() => `data-${key}-${cacheId}-${lang}`);
8
8
 
@@ -1,10 +1,10 @@
1
- import type { ELanguage} from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language} from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
  import type { IChipsItem } from '../../types';
4
4
 
5
5
  export const useFetchTopRandomCategories = async (apiMethod: (...args: any[]) => Promise<Array<IChipsItem>>, cacheId: string) => {
6
- const lang = useLang() as ELanguage;
7
- const key = EAsyncData.CategoriesTopRandom;
6
+ const lang = useLang() as Language;
7
+ const key = AsyncData.CategoriesTopRandom;
8
8
  const stateKey = computed(() => `data-${key}-${cacheId}-${lang}`);
9
9
 
10
10
  const { data: topRandomCategories, refresh, error } = await useAsyncData<Array<IChipsItem>>(
@@ -1,16 +1,16 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
  import type { ICategoryCard } from '../../types';
4
4
 
5
5
  export const useFetchTopRandomFull = async (
6
6
  apiMethod: (...args: any[]) => Promise<Array<ICategoryCard>>
7
7
  ) => {
8
- const lang = useLang() as ELanguage;
9
- const key = EAsyncData.CategoriesTopRandomFull;
8
+ const lang = useLang() as Language;
9
+ const key = AsyncData.CategoriesTopRandomFull;
10
10
  const stateKey = computed(() => `data-${key}-${lang}`);
11
11
 
12
12
  const { data, status, error } = await useAsyncData<Array<ICategoryCard>>(
13
- EAsyncData.CategoriesTopRandomFull,
13
+ AsyncData.CategoriesTopRandomFull,
14
14
  () => useApiFetcher<Array<ICategoryCard>>(
15
15
  stateKey.value,
16
16
  apiMethod,
@@ -1,11 +1,11 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
 
4
4
  export const useFetchVideoRefererPhrases = async (
5
5
  apiMethod: (...args: any[]) => Promise<string[]>) => {
6
- const lang = useLang() as ELanguage;
6
+ const lang = useLang() as Language;
7
7
  const slug = useSlug();
8
- const key = EAsyncData.RefererPhrases;
8
+ const key = AsyncData.RefererPhrases;
9
9
  const stateKey = computed(() => `data-${key}-${slug.value}-${lang}`);
10
10
 
11
11
  const { data, status, error } = await useAsyncData<string[]>(
@@ -1,13 +1,13 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
  import type { IVideoData } from '../../types';
4
4
 
5
5
  export const useFetchVideo = async (
6
6
  apiMethod: (...args: any[]) => Promise<IVideoData>,
7
7
  ) => {
8
- const lang = useLang() as ELanguage;
8
+ const lang = useLang() as Language;
9
9
  const slug = useSlug();
10
- const key = EAsyncData.Video;
10
+ const key = AsyncData.Video;
11
11
  const stateKey = computed(() => `data-${key}-${slug.value}-${lang}`);
12
12
 
13
13
  const headers: Record<string, string> = {};
@@ -1,5 +1,5 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { useRoute } from 'vue-router';
5
5
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
@@ -10,9 +10,9 @@ export const useFetchVideosByCategories = async (
10
10
  const route = useRoute();
11
11
  const mobile = !!useState<boolean>('isMobile').value;
12
12
  const perPage = mobile ? 12 : 48;
13
- const lang = useLang() as ELanguage;
13
+ const lang = useLang() as Language;
14
14
  const slug = useSlug();
15
- const key = EAsyncData.VideosByCategory;
15
+ const key = AsyncData.VideosByCategory;
16
16
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
17
17
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
18
18
 
@@ -1,5 +1,5 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
5
5
  import { useRoute } from 'vue-router';
@@ -8,10 +8,10 @@ export const useFetchVideosByChannel = async (apiMethod: (...args: any[]) => Pro
8
8
  const route = useRoute();
9
9
  const mobile = !!useState<boolean>('isMobile').value;
10
10
  const perPage = mobile ? 12 : 48;
11
- const lang = useLang() as ELanguage;
11
+ const lang = useLang() as Language;
12
12
  const slug = useSlug('channel');
13
13
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
14
- const key = EAsyncData.VideosByChannel;
14
+ const key = AsyncData.VideosByChannel;
15
15
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
16
16
 
17
17
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,12 +1,12 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { convertString, EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { convertString, AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
5
5
  import { useRoute } from 'vue-router';
6
6
 
7
7
  export const useFetchVideosByModelAndChannel = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
8
8
  const route = useRoute();
9
- const lang = useLang() as ELanguage;
9
+ const lang = useLang() as Language;
10
10
  const mobile = !!useState<boolean>('isMobile').value;
11
11
  const perPage = mobile ? 12 : 48;
12
12
  const slug = useSlug();
@@ -16,7 +16,7 @@ export const useFetchVideosByModelAndChannel = async (apiMethod: (...args: any[]
16
16
  return Array.isArray(slug) ? slug[0] : slug;
17
17
  });
18
18
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
19
- const key = EAsyncData.VideosByModelAndChannel;
19
+ const key = AsyncData.VideosByModelAndChannel;
20
20
  const stateKey = computed(() => `data-${key}-${slug.value}-${channel.value}-${JSON.stringify(route.query)}-${lang}`);
21
21
 
22
22
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,5 +1,5 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { convertString, EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { convertString, AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
5
5
  import { useRoute } from 'vue-router';
@@ -8,7 +8,7 @@ export const useFetchVideosByModelAndTag = async (apiMethod: (...args: any[]) =>
8
8
  const route = useRoute();
9
9
  const mobile = !!useState<boolean>('isMobile').value;
10
10
  const perPage = mobile ? 12 : 48;
11
- const lang = useLang() as ELanguage;
11
+ const lang = useLang() as Language;
12
12
  const slug = useSlug();
13
13
  const tag = computed(() => {
14
14
  const tagRaw = route.params['tag'];
@@ -16,7 +16,7 @@ export const useFetchVideosByModelAndTag = async (apiMethod: (...args: any[]) =>
16
16
  return Array.isArray(slug) ? slug[0] : slug;
17
17
  });
18
18
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
19
- const key = EAsyncData.VideosByModelAndTag;
19
+ const key = AsyncData.VideosByModelAndTag;
20
20
  const stateKey = computed(() => `data-${key}-${slug.value}-${tag.value}-${JSON.stringify(route.query)}-${lang}`);
21
21
 
22
22
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,17 +1,17 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
5
5
  import { useRoute } from 'vue-router';
6
6
 
7
7
  export const useFetchVideosByModel = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
8
8
  const route = useRoute();
9
- const lang = useLang() as ELanguage;
9
+ const lang = useLang() as Language;
10
10
  const mobile = !!useState<boolean>('isMobile').value;
11
11
  const perPage = mobile ? 12 : 48;
12
12
  const slug = useSlug();
13
13
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
14
- const key = EAsyncData.ModelsVideos;
14
+ const key = AsyncData.ModelsVideos;
15
15
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
16
16
 
17
17
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,17 +1,17 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData, getSelectedQuery } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData, getSelectedQuery } from '../../runtime';
3
3
  import { selectAddedItems, selectDurationItems, sortItemsDefault } from '../../lib';
4
4
  import { useRoute } from 'vue-router';
5
5
  import type { IVideoCard, PaginatedResponse } from '../../types';
6
6
 
7
7
  export const useFetchVideosByTag = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
8
8
  const route = useRoute();
9
- const lang = useLang() as ELanguage;
9
+ const lang = useLang() as Language;
10
10
  const mobile = !!useState<boolean>('isMobile').value;
11
11
  const perPage = mobile ? 12 : 48;
12
12
  const slug = useSlug('tag');
13
13
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
14
- const key = EAsyncData.VideosByTag;
14
+ const key = AsyncData.VideosByTag;
15
15
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
16
16
 
17
17
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,15 +1,15 @@
1
- import type { ELanguage } from '../../runtime';
2
- import { EAsyncData } from '../../runtime';
1
+ import type { Language } from '../../runtime';
2
+ import { AsyncData } from '../../runtime';
3
3
  import type { IVideoCard, PaginatedResponse } from '../../types';
4
4
  import { useRoute } from 'vue-router';
5
5
 
6
6
  export const useFetchVideosSearchByNiche = async (apiMethod: (...args: any[]) => Promise<PaginatedResponse<IVideoCard>>) => {
7
- const lang = useLang() as ELanguage;
7
+ const lang = useLang() as Language;
8
8
  const mobile = !!useState<boolean>('isMobile').value;
9
9
  const perPage = mobile ? 12 : 48;
10
10
  const route = useRoute();
11
11
  const slug = useSlug();
12
- const key = EAsyncData.VideosBySearch;
12
+ const key = AsyncData.VideosBySearch;
13
13
  const stateKey = computed(() => `data-${key}-${slug.value}-${JSON.stringify(route.query)}-${lang}`);
14
14
 
15
15
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,6 +1,6 @@
1
1
  import { selectDurationItems, sortItemsDefault, selectAddedItems } from '../../lib';
2
- import type { ELanguage } from '../../runtime';
3
- import { EAsyncData, getSelectedQuery } from '../../runtime';
2
+ import type { Language } from '../../runtime';
3
+ import { AsyncData, getSelectedQuery } from '../../runtime';
4
4
  import type { IVideoCard, PaginatedResponse } from '../../types';
5
5
  import { useRoute } from 'vue-router';
6
6
 
@@ -11,9 +11,9 @@ export const useFetchVideos = async (
11
11
 
12
12
  const mobile = !!useState<boolean>('isMobile').value;
13
13
  const perPage = mobile ? 12 : 48;
14
- const lang = useLang() as ELanguage;
14
+ const lang = useLang() as Language;
15
15
  const filters = computed(() => useGetVideosFilterRequest(route, selectDurationItems, selectAddedItems));
16
- const key = EAsyncData.Videos;
16
+ const key = AsyncData.Videos;
17
17
  const stateKey = computed(() => `data-${key}-${JSON.stringify(route.query)}-${lang}`);
18
18
 
19
19
  const { data, status, error } = await useAsyncData<PaginatedResponse<IVideoCard>>(
@@ -1,12 +1,12 @@
1
- import { EAuthSteps } from '../runtime';
1
+ import { AuthSteps } from '../runtime';
2
2
 
3
- /** Управляет состоянием попапа авторизации: открытие на нужном шаге EAuthSteps, закрытие, дополнительный текст. */
3
+ /** Управляет состоянием попапа авторизации: открытие на нужном шаге AuthSteps, закрытие, дополнительный текст. */
4
4
  export const useAuthPopup = () => {
5
5
  const isAuthPopupOpen = useState('auth-popup-open', () => false);
6
- const currentStep = useState<EAuthSteps>('auth-popup-step', () => EAuthSteps.Registration);
6
+ const currentStep = useState<AuthSteps>('auth-popup-step', () => AuthSteps.Registration);
7
7
  const additionalText = useState<string | undefined>('auth-popup-text', () => undefined);
8
8
 
9
- const openAuthPopup = (step: EAuthSteps, text?: string) => {
9
+ const openAuthPopup = (step: AuthSteps, text?: string) => {
10
10
  isAuthPopupOpen.value = true;
11
11
  currentStep.value = step;
12
12
  additionalText.value = text;
@@ -1,26 +1,18 @@
1
1
  /**
2
- * Форматирует Unix timestamp (в секундах) в относительную строку: «сегодня», «вчера», «3 дня назад» и т.д.
3
- * @param t - функция перевода (i18n)
2
+ * Форматирует Unix timestamp (в секундах) в относительную строку в локали пользователя
3
+ * («сегодня», «вчера», «5 дней назад») через Intl.RelativeTimeFormat.
4
4
  * @param time - Unix timestamp в секундах
5
+ * @param locale - активная локаль (код или BCP-47)
5
6
  */
6
- export const useFormatTimeAgo = (t, time: number) => {
7
- const pastDate = new Date(time * 1000);
8
- const now = new Date();
7
+ export const useFormatTimeAgo = (time: number, locale: string): string => {
8
+ const diffInDays = Math.floor((Date.now() - time * 1000) / 86_400_000);
9
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
9
10
 
10
- const diffInMs = Number(now) - Number(pastDate);
11
- const diffInDays = Math.floor(diffInMs / (1000 * 60 * 60 * 24));
12
-
13
- if (diffInDays === 0) {
14
- return t('date.today');
15
- } else if (diffInDays === 1) {
16
- return t('date.day_ago');
17
- } else if (diffInDays < 30) {
18
- return `${diffInDays} ${t('date.days_ago')}`;
19
- } else if (diffInDays < 365) {
20
- const diffInMonths = Math.floor(diffInDays / 30);
21
- return `${diffInMonths} ${t('date.month')}${diffInMonths > 1 ? 's' : ''}`;
22
- } else {
23
- const diffInYears = Math.floor(diffInDays / 365);
24
- return `${diffInYears} ${t('date.year')}${diffInYears > 1 ? 's' : ''}`;
11
+ if (diffInDays < 30) {
12
+ return rtf.format(-diffInDays, 'day');
13
+ }
14
+ if (diffInDays < 365) {
15
+ return rtf.format(-Math.floor(diffInDays / 30), 'month');
25
16
  }
26
- }
17
+ return rtf.format(-Math.floor(diffInDays / 365), 'year');
18
+ };
@@ -1,4 +1,4 @@
1
- import type { ELanguage, ENiche } from '~/runtime';
1
+ import type { Language, Niche } from '~/runtime';
2
2
 
3
3
  /** Возвращает generateLink — генерирует путь с учётом текущей ниши и локали. */
4
4
  export const useGenerateLink = () => {
@@ -11,11 +11,11 @@ export const useGenerateLink = () => {
11
11
  * @param localeArg - локаль
12
12
  * @returns string - корректный путь для <NuxtLink> и navigateTo()
13
13
  */
14
- const generateLink = (path: string, localeArg?: ELanguage): string => {
14
+ const generateLink = (path: string, localeArg?: Language): string => {
15
15
  const cleanPath = path.startsWith('/') ? path : `/${path}`
16
16
 
17
17
  const defaultNiche = useAppConfig().defaultNiche;
18
- const projectNiches = useAppConfig().niches as ENiche[];
18
+ const projectNiches = useAppConfig().niches as Niche[];
19
19
  const isOneNiche = projectNiches.length === 1;
20
20
 
21
21
  const withNiche =
@@ -6,7 +6,8 @@ import type { Ref } from 'vue';
6
6
  export function useFilterChipsItems(
7
7
  filters: Ref<IModelFilter[]>,
8
8
  route: { query: LocationQuery },
9
- t: (key: string) => string
9
+ t: (key: string) => string,
10
+ locale: Ref<string>
10
11
  ) {
11
12
  const chipsItems = computed<IChipsItem[]>(() => {
12
13
  const queryItems = Object.keys(route.query)
@@ -60,7 +61,7 @@ export function useFilterChipsItems(
60
61
 
61
62
  if (item.includes('month')) {
62
63
  return getMonth(
63
- t,
64
+ locale.value,
64
65
  Number(value ?? defaultValue?.name) - 1
65
66
  );
66
67
  }
@@ -1,6 +1,6 @@
1
1
  import type { Ref } from 'vue';
2
2
  import type { IVideoData, IVideoCard } from '../types';
3
- import { EAuthSteps } from '../runtime';
3
+ import { AuthSteps } from '../runtime';
4
4
 
5
5
  /** Управляет состоянием попапа добавления видео в плейлист; при неавторизованном пользователе открывает попап авторизации. */
6
6
  export const usePlaylistAdd = () => {
@@ -19,7 +19,7 @@ export const usePlaylistAdd = () => {
19
19
  onBack.value = onBackCallback ?? null;
20
20
  } else {
21
21
  const authPopupText = 'register_first';
22
- openAuthPopup(EAuthSteps.Registration, authPopupText);
22
+ openAuthPopup(AuthSteps.Registration, authPopupText);
23
23
  }
24
24
  };
25
25
 
@@ -1,15 +1,15 @@
1
- import { EPlaylistStep } from '../runtime';
1
+ import { PlaylistStep } from '../runtime';
2
2
  import type { IVideoCard, IPlaylistCard } from '../types';
3
3
 
4
- /** Управляет состоянием попапа редактирования плейлиста: шаги EPlaylistStep, выбранный плейлист, возврат назад. */
4
+ /** Управляет состоянием попапа редактирования плейлиста: шаги PlaylistStep, выбранный плейлист, возврат назад. */
5
5
  export const usePlaylistEdit = () => {
6
6
  const deletedVideo = useState<IVideoCard | null | undefined>('playlist-edit-deleted-video', () => null);
7
7
  const selectedPlaylist = useState<IPlaylistCard | undefined>('playlist-edit-selected', () => undefined);
8
8
  const isPlaylistEditOpen = useState('playlist-edit-open', () => false);
9
9
  const isBackToEdit = useState('playlist-edit-back', () => false);
10
- const currentStep = useState<EPlaylistStep>('playlist-edit-step', () => EPlaylistStep.Edit);
10
+ const currentStep = useState<PlaylistStep>('playlist-edit-step', () => PlaylistStep.Edit);
11
11
 
12
- const openPlaylistEdit = (step: EPlaylistStep, back: boolean = false, playlist?: IPlaylistCard, videoCard?: IVideoCard) => {
12
+ const openPlaylistEdit = (step: PlaylistStep, back: boolean = false, playlist?: IPlaylistCard, videoCard?: IVideoCard) => {
13
13
  selectedPlaylist.value = playlist;
14
14
  isPlaylistEditOpen.value = true;
15
15
  currentStep.value = step;
@@ -19,7 +19,7 @@ export const usePlaylistEdit = () => {
19
19
 
20
20
  const closePlaylistEdit = () => {
21
21
  if (isBackToEdit.value) {
22
- openPlaylistEdit(EPlaylistStep.Edit, false, selectedPlaylist.value);
22
+ openPlaylistEdit(PlaylistStep.Edit, false, selectedPlaylist.value);
23
23
  } else {
24
24
  isPlaylistEditOpen.value = false;
25
25
  isBackToEdit.value = false;
@@ -1,13 +1,13 @@
1
- import { EContactsSubjects } from '../runtime';
1
+ import { ContactsSubjects } from '../runtime';
2
2
  import type { IContactScheme } from '../types';
3
3
  import { reportReasonsItems } from '../lib';
4
4
 
5
5
  export const contactFormsScheme: Array<IContactScheme> = [
6
6
  {
7
- subject: EContactsSubjects.Feedback,
7
+ subject: ContactsSubjects.Feedback,
8
8
  },
9
9
  {
10
- subject: EContactsSubjects.Bugs,
10
+ subject: ContactsSubjects.Bugs,
11
11
  items: [
12
12
  {
13
13
  type: 'text',
@@ -19,7 +19,7 @@ export const contactFormsScheme: Array<IContactScheme> = [
19
19
  ]
20
20
  },
21
21
  {
22
- subject: EContactsSubjects.DMCA,
22
+ subject: ContactsSubjects.DMCA,
23
23
  items: [
24
24
  {
25
25
  type: 'text',
@@ -75,7 +75,7 @@ export const contactFormsScheme: Array<IContactScheme> = [
75
75
  ]
76
76
  },
77
77
  {
78
- subject: EContactsSubjects.Report,
78
+ subject: ContactsSubjects.Report,
79
79
  items: [
80
80
  ...(reportReasonsItems).map((value, index) => ({
81
81
  type: 'radio',
@@ -93,6 +93,6 @@ export const contactFormsScheme: Array<IContactScheme> = [
93
93
  ],
94
94
  },
95
95
  {
96
- subject: EContactsSubjects.Advertising,
96
+ subject: ContactsSubjects.Advertising,
97
97
  },
98
98
  ]
@@ -1,4 +1,4 @@
1
- import { EReportFormsSubjects } from '../runtime';
1
+ import { ReportFormsSubjects } from '../runtime';
2
2
  import type { IReportScheme } from '../types';
3
3
  import { reportReasonsItems } from './contacts/report-reasons-items';
4
4
  import { reportIssueItems } from './contacts/report-issue-items';
@@ -7,7 +7,7 @@ import { reportMalwareItems } from './contacts/report-malware-items';
7
7
 
8
8
  export const reportFormsScheme: Array<IReportScheme> = [
9
9
  {
10
- subject: EReportFormsSubjects.DMCA,
10
+ subject: ReportFormsSubjects.DMCA,
11
11
  title: 'dmca_title',
12
12
  items: [
13
13
  {
@@ -92,7 +92,7 @@ export const reportFormsScheme: Array<IReportScheme> = [
92
92
  ]
93
93
  },
94
94
  {
95
- subject: EReportFormsSubjects.Inappropriate,
95
+ subject: ReportFormsSubjects.Inappropriate,
96
96
  title: 'inappropriate_title',
97
97
  text: 'inappropriate_text',
98
98
  hasReason: true,
@@ -132,7 +132,7 @@ export const reportFormsScheme: Array<IReportScheme> = [
132
132
  ]
133
133
  },
134
134
  {
135
- subject: EReportFormsSubjects.Issue,
135
+ subject: ReportFormsSubjects.Issue,
136
136
  title: 'issue_title',
137
137
  text: 'issue_text',
138
138
  hasReason: true,
@@ -172,7 +172,7 @@ export const reportFormsScheme: Array<IReportScheme> = [
172
172
  ],
173
173
  },
174
174
  {
175
- subject: EReportFormsSubjects.Wrong,
175
+ subject: ReportFormsSubjects.Wrong,
176
176
  title: 'wrong_title',
177
177
  text: 'wrong_text',
178
178
  hasReason: true,
@@ -204,7 +204,7 @@ export const reportFormsScheme: Array<IReportScheme> = [
204
204
  ],
205
205
  },
206
206
  {
207
- subject: EReportFormsSubjects.Malware,
207
+ subject: ReportFormsSubjects.Malware,
208
208
  title: 'malware_title',
209
209
  text: 'malware_text',
210
210
  hasReason: true,
package/nuxt.config.ts CHANGED
@@ -16,7 +16,7 @@ export default defineNuxtConfig({
16
16
  dirs: [
17
17
  {
18
18
  path: './components',
19
- pathPrefix: false
19
+ pathPrefix: true
20
20
  }
21
21
  ]
22
22
  },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.765",
4
+ "version": "0.0.767",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {