@dative-gpi/foundation-shared-services 0.0.10 → 0.0.12
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/composables/index.ts +1 -2
- package/composables/services/useApplications.ts +6 -6
- package/composables/services/useAuthTokens.ts +1 -1
- package/composables/services/useFrequentlyAskedQuestions.ts +1 -1
- package/composables/services/useImages.ts +10 -12
- package/composables/services/useLandingPages.ts +6 -6
- package/composables/services/useLayoutPages.ts +6 -6
- package/composables/services/useLegalInformations.ts +6 -6
- package/composables/services/useOrganisations.ts +1 -1
- package/composables/services/useSecuritySettings.ts +6 -6
- package/composables/services/useTimeZones.ts +1 -1
- package/composables/services/useTranslations.ts +6 -7
- package/composables/services/useUserLegalInformations.ts +6 -6
- package/composables/services/useUsers.ts +10 -10
- package/composables/useShared.ts +13 -5
- package/composables/useTimeZone.ts +1 -1
- package/package.json +5 -4
- package/composables/useTranslationsProvider.ts +0 -28
- package/index.ts +0 -1
- package/tools/datesTools.ts +0 -15
- package/tools/index.ts +0 -1
package/composables/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { ApplicationDetails, ApplicationDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { ApplicationDetails, ApplicationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { APPLICATION_CURRENT_URL } from "../../config/urls";
|
|
@@ -23,7 +23,7 @@ export const useCurrentApplication = () => {
|
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
25
|
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<ApplicationDetails | null>(null)
|
|
26
|
+
const fetched = ref<ApplicationDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -39,12 +39,12 @@ export const useCurrentApplication = () => {
|
|
|
39
39
|
fetching.value = false;
|
|
40
40
|
}
|
|
41
41
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return
|
|
42
|
+
return fetched;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
fetching
|
|
46
|
+
fetching,
|
|
47
47
|
fetch,
|
|
48
|
-
fetched
|
|
48
|
+
fetched
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthTokenDetails, AuthTokenDetailsDTO, CreateAuthTokenDTO } from "@dative-gpi/foundation-shared-domain";
|
|
1
|
+
import { AuthTokenDetails, AuthTokenDetailsDTO, CreateAuthTokenDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { AUTH_TOKENS_URL } from "../../config/urls";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FrequentlyAskedQuestionDetails, FrequentlyAskedQuestionDetailsDTO, FrequentlyAskedQuestionFilters, FrequentlyAskedQuestionInfos, FrequentlyAskedQuestionInfosDTO } from "@dative-gpi/foundation-shared-domain";
|
|
1
|
+
import { FrequentlyAskedQuestionDetails, FrequentlyAskedQuestionDetailsDTO, FrequentlyAskedQuestionFilters, FrequentlyAskedQuestionInfos, FrequentlyAskedQuestionInfosDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { FREQUENTLY_ASKED_QUESTIONS_URL } from "../../config/urls";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { BlurHash } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { BlurHash } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { IMAGE_RAW_URL, IMAGE_BLURHASH_URL } from "../../config/urls";
|
|
@@ -25,7 +25,7 @@ export const useImageRaw = () => {
|
|
|
25
25
|
const service = ImageServiceFactory();
|
|
26
26
|
|
|
27
27
|
const fetching = ref(false);
|
|
28
|
-
const fetched = ref<string | null>(null)
|
|
28
|
+
const fetched = ref<string | null>(null);
|
|
29
29
|
|
|
30
30
|
const fetch = async (imageId: string) => {
|
|
31
31
|
fetching.value = true;
|
|
@@ -35,21 +35,20 @@ export const useImageRaw = () => {
|
|
|
35
35
|
finally {
|
|
36
36
|
fetching.value = false;
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
return readonly(fetched as Ref<string>);
|
|
38
|
+
return fetched;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
41
|
return {
|
|
43
|
-
fetching
|
|
42
|
+
fetching,
|
|
44
43
|
fetch,
|
|
45
|
-
fetched
|
|
44
|
+
fetched
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
export const useImageBlurHash = () => {
|
|
49
48
|
const service = ImageServiceFactory();
|
|
50
49
|
|
|
51
50
|
const fetching = ref(false);
|
|
52
|
-
const fetched = ref<BlurHash | null>(null)
|
|
51
|
+
const fetched = ref<BlurHash | null>(null);
|
|
53
52
|
|
|
54
53
|
const fetch = async (imageId: string) => {
|
|
55
54
|
fetching.value = true;
|
|
@@ -59,13 +58,12 @@ export const useImageBlurHash = () => {
|
|
|
59
58
|
finally {
|
|
60
59
|
fetching.value = false;
|
|
61
60
|
}
|
|
62
|
-
|
|
63
|
-
return readonly(fetched as Ref<BlurHash>);
|
|
61
|
+
return fetched;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
return {
|
|
67
|
-
fetching
|
|
65
|
+
fetching,
|
|
68
66
|
fetch,
|
|
69
|
-
fetched
|
|
67
|
+
fetched
|
|
70
68
|
}
|
|
71
69
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { LandingPageDetails, LandingPageDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { LandingPageDetails, LandingPageDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { LANDING_PAGE_CURRENT_URL } from "../../config/urls";
|
|
@@ -23,7 +23,7 @@ export const useCurrentLandingPage = () => {
|
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
25
|
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LandingPageDetails | null>(null)
|
|
26
|
+
const fetched = ref<LandingPageDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -39,12 +39,12 @@ export const useCurrentLandingPage = () => {
|
|
|
39
39
|
fetching.value = false;
|
|
40
40
|
}
|
|
41
41
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return
|
|
42
|
+
return fetched;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
fetching
|
|
46
|
+
fetching,
|
|
47
47
|
fetch,
|
|
48
|
-
fetched
|
|
48
|
+
fetched
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { LayoutPageDetails, LayoutPageDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { LayoutPageDetails, LayoutPageDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { LAYOUT_PAGE_CURRENT_URL } from "../../config/urls";
|
|
@@ -23,7 +23,7 @@ export const useCurrentLayoutPage = () => {
|
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
25
|
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LayoutPageDetails | null>(null)
|
|
26
|
+
const fetched = ref<LayoutPageDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -39,12 +39,12 @@ export const useCurrentLayoutPage = () => {
|
|
|
39
39
|
fetching.value = false;
|
|
40
40
|
}
|
|
41
41
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return
|
|
42
|
+
return fetched;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
fetching
|
|
46
|
+
fetching,
|
|
47
47
|
fetch,
|
|
48
|
-
fetched
|
|
48
|
+
fetched
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { LegalInformationDetails, LegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { LegalInformationDetails, LegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { LEGAL_INFORMATION_CURRENT_URL } from "../../config/urls";
|
|
@@ -23,7 +23,7 @@ export const useCurrentLegalInformation = () => {
|
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
25
|
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<LegalInformationDetails | null>(null)
|
|
26
|
+
const fetched = ref<LegalInformationDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -39,12 +39,12 @@ export const useCurrentLegalInformation = () => {
|
|
|
39
39
|
fetching.value = false;
|
|
40
40
|
}
|
|
41
41
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return
|
|
42
|
+
return fetched;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
fetching
|
|
46
|
+
fetching,
|
|
47
47
|
fetch,
|
|
48
|
-
fetched
|
|
48
|
+
fetched
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateOrganisationDTO, OrganisationDetails, OrganisationDetailsDTO, OrganisationFilters, OrganisationInfos, OrganisationInfosDTO, UpdateOrganisationDTO } from "@dative-gpi/foundation-shared-domain";
|
|
1
|
+
import { CreateOrganisationDTO, OrganisationDetails, OrganisationDetailsDTO, OrganisationFilters, OrganisationInfos, OrganisationInfosDTO, UpdateOrganisationDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
2
|
import { ComposableFactory , ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { ORGANISATIONS_URL, ORGANISATION_URL } from "../../config/urls";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { SecuritySettingDetails, SecuritySettingDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { SecuritySettingDetails, SecuritySettingDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { SECURITY_SETTING_CURRENT_URL } from "../../config/urls";
|
|
@@ -23,7 +23,7 @@ export const useCurrentSecuritySettings = () => {
|
|
|
23
23
|
const subscribersIds: number[] = [];
|
|
24
24
|
|
|
25
25
|
const fetching = ref(false);
|
|
26
|
-
const fetched = ref<SecuritySettingDetails | null>(null)
|
|
26
|
+
const fetched = ref<SecuritySettingDetails | null>(null);
|
|
27
27
|
|
|
28
28
|
onUnmounted(() => {
|
|
29
29
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -39,12 +39,12 @@ export const useCurrentSecuritySettings = () => {
|
|
|
39
39
|
fetching.value = false;
|
|
40
40
|
}
|
|
41
41
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
42
|
-
return
|
|
42
|
+
return fetched;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
return {
|
|
46
|
-
fetching
|
|
46
|
+
fetching,
|
|
47
47
|
fetch,
|
|
48
|
-
fetched
|
|
48
|
+
fetched
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TimeZoneFilters, TimeZoneInfos, TimeZoneInfosDTO } from "@dative-gpi/foundation-shared-domain";
|
|
1
|
+
import { TimeZoneFilters, TimeZoneInfos, TimeZoneInfosDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
3
3
|
|
|
4
4
|
import { TIME_ZONES_URL } from "../../config/urls";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { TranslationInfos, TranslationInfosDTO, TranslationDetails, TranslationDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { TranslationInfos, TranslationInfosDTO, TranslationDetails, TranslationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { TRANSLATIONS_LANGUAGE_URL } from "../../config/urls";
|
|
@@ -20,7 +20,7 @@ export const useTranslations = () => {
|
|
|
20
20
|
const service = TranslationServiceFactory();
|
|
21
21
|
|
|
22
22
|
const fetching = ref(false);
|
|
23
|
-
const fetched = ref<TranslationInfos[]>([])
|
|
23
|
+
const fetched = ref<TranslationInfos[]>([]);
|
|
24
24
|
|
|
25
25
|
const fetch = async (languageCode: string) => {
|
|
26
26
|
fetching.value = true;
|
|
@@ -30,13 +30,12 @@ export const useTranslations = () => {
|
|
|
30
30
|
finally {
|
|
31
31
|
fetching.value = false;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
return readonly(fetched as Ref<TranslationInfos[]>);
|
|
33
|
+
return fetched;
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
return {
|
|
38
|
-
fetching
|
|
37
|
+
fetching,
|
|
39
38
|
fetch,
|
|
40
|
-
fetched
|
|
39
|
+
fetched
|
|
41
40
|
}
|
|
42
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { CreateUserLegalInformationDTO, UserLegalInformationDetails, UserLegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { CreateUserLegalInformationDTO, UserLegalInformationDetails, UserLegalInformationDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { ComposableFactory, onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { USER_LEGAL_INFORMATIONS_URL, USER_LEGAL_INFORMATION_CURRENT_URL } from "../../config/urls";
|
|
@@ -25,7 +25,7 @@ export const useCurrentUserLegalInformation = () => {
|
|
|
25
25
|
const subscribersIds: number[] = [];
|
|
26
26
|
|
|
27
27
|
const fetching = ref(false);
|
|
28
|
-
const fetched = ref<UserLegalInformationDetails | null>(null)
|
|
28
|
+
const fetched = ref<UserLegalInformationDetails | null>(null);
|
|
29
29
|
|
|
30
30
|
onUnmounted(() => {
|
|
31
31
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -41,12 +41,12 @@ export const useCurrentUserLegalInformation = () => {
|
|
|
41
41
|
fetching.value = false;
|
|
42
42
|
}
|
|
43
43
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
44
|
-
return
|
|
44
|
+
return fetched;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
return {
|
|
48
|
-
fetching
|
|
48
|
+
fetching,
|
|
49
49
|
fetch,
|
|
50
|
-
fetched
|
|
50
|
+
fetched
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
-
import { UpdateUserDTO, UserDetails, UserDetailsDTO } from "@dative-gpi/foundation-shared-domain";
|
|
3
|
+
import { UpdateUserDTO, UserDetails, UserDetailsDTO } from "@dative-gpi/foundation-shared-domain/models";
|
|
4
4
|
import { onEntityChanged, ServiceFactory } from "@dative-gpi/bones-ui";
|
|
5
5
|
|
|
6
6
|
import { USER_CURRENT_URL } from "../../config/urls";
|
|
@@ -31,7 +31,7 @@ export const useCurrentUser = () => {
|
|
|
31
31
|
const subscribersIds: number[] = [];
|
|
32
32
|
|
|
33
33
|
const fetching = ref(false);
|
|
34
|
-
const fetched = ref<UserDetails | null>(null)
|
|
34
|
+
const fetched = ref<UserDetails | null>(null);
|
|
35
35
|
|
|
36
36
|
onUnmounted(() => {
|
|
37
37
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -47,13 +47,13 @@ export const useCurrentUser = () => {
|
|
|
47
47
|
fetching.value = false;
|
|
48
48
|
}
|
|
49
49
|
subscribersIds.push(service.subscribe("all", onEntityChanged(fetched)));
|
|
50
|
-
return
|
|
50
|
+
return fetched;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return {
|
|
54
|
-
fetching
|
|
54
|
+
fetching,
|
|
55
55
|
fetch,
|
|
56
|
-
fetched
|
|
56
|
+
fetched
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
export const useUpdateCurrentUser = () => {
|
|
@@ -61,7 +61,7 @@ export const useUpdateCurrentUser = () => {
|
|
|
61
61
|
const subscribersIds: number[] = [];
|
|
62
62
|
|
|
63
63
|
const updating = ref(false);
|
|
64
|
-
const updated = ref<UserDetails | null>(null)
|
|
64
|
+
const updated = ref<UserDetails | null>(null);
|
|
65
65
|
|
|
66
66
|
onUnmounted(() => {
|
|
67
67
|
subscribersIds.forEach(id => service.unsubscribe(id));
|
|
@@ -77,12 +77,12 @@ export const useUpdateCurrentUser = () => {
|
|
|
77
77
|
updating.value = false;
|
|
78
78
|
}
|
|
79
79
|
subscribersIds.push(service.subscribe("all", onEntityChanged(updated)));
|
|
80
|
-
return
|
|
80
|
+
return updated;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
return {
|
|
84
|
-
updating
|
|
84
|
+
updating,
|
|
85
85
|
update,
|
|
86
|
-
updated
|
|
86
|
+
updated
|
|
87
87
|
}
|
|
88
88
|
}
|
package/composables/useShared.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { onMounted, ref } from "vue";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
4
|
+
|
|
5
|
+
import { useTranslations } from "./services/useTranslations";
|
|
6
|
+
import { useLanguageCode } from "./useLanguageCode";
|
|
7
|
+
import { useTimeZone } from "./useTimeZone";
|
|
3
8
|
|
|
4
9
|
let called = false;
|
|
5
10
|
|
|
@@ -14,15 +19,18 @@ export function useShared() {
|
|
|
14
19
|
|
|
15
20
|
called = true;
|
|
16
21
|
|
|
17
|
-
const { ready: languageCodeReady } = useLanguageCode();
|
|
22
|
+
const { ready: languageCodeReady, languageCode } = useLanguageCode();
|
|
18
23
|
const { ready: timeZoneReady } = useTimeZone();
|
|
19
|
-
|
|
20
|
-
const {
|
|
24
|
+
const { fetch, fetched } = useTranslations();
|
|
25
|
+
const { set } = useTranslationsProvider();
|
|
21
26
|
|
|
22
27
|
onMounted(async () => {
|
|
23
28
|
await languageCodeReady
|
|
24
29
|
await timeZoneReady;
|
|
25
|
-
|
|
30
|
+
if (languageCode.value) {
|
|
31
|
+
await fetch(languageCode.value!);
|
|
32
|
+
set(fetched.value.map(t => ({ code: t.code, value: t.value })));
|
|
33
|
+
}
|
|
26
34
|
ready.value = true;
|
|
27
35
|
});
|
|
28
36
|
|
|
@@ -3,9 +3,9 @@ import { ref, watch } from "vue";
|
|
|
3
3
|
import { enUS, enGB, fr, it, es, de, Locale } from "date-fns/locale";
|
|
4
4
|
import { format, subDays } from "date-fns";
|
|
5
5
|
|
|
6
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
6
7
|
import { TimeZoneInfos } from "@dative-gpi/foundation-shared-domain/models";
|
|
7
8
|
|
|
8
|
-
import { useTranslationsProvider } from "./useTranslationsProvider";
|
|
9
9
|
import { useLanguageCode } from "./useLanguageCode";
|
|
10
10
|
|
|
11
11
|
const timeZone = ref<TimeZoneInfos | null>({
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-services",
|
|
3
|
-
"
|
|
3
|
+
"sideEffects": false,
|
|
4
|
+
"version": "0.0.12",
|
|
4
5
|
"description": "",
|
|
5
6
|
"publishConfig": {
|
|
6
7
|
"access": "public"
|
|
@@ -9,12 +10,12 @@
|
|
|
9
10
|
"author": "",
|
|
10
11
|
"license": "ISC",
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@dative-gpi/bones-ui": "^0.0.
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
13
|
+
"@dative-gpi/bones-ui": "^0.0.61",
|
|
14
|
+
"@dative-gpi/foundation-shared-domain": "0.0.12",
|
|
14
15
|
"@microsoft/signalr": "^8.0.0",
|
|
15
16
|
"date-fns": "^3.2.0",
|
|
16
17
|
"vue": "^3.2.0",
|
|
17
18
|
"vue-router": "^4.2.5"
|
|
18
19
|
},
|
|
19
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "73c686b3b0343ac4b42d34c2aa7cf7604ad0d298"
|
|
20
21
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useLanguageCode, useTranslations } from "@dative-gpi/foundation-shared-services";
|
|
2
|
-
|
|
3
|
-
let initialized = false;
|
|
4
|
-
|
|
5
|
-
export const useTranslationsProvider = () => {
|
|
6
|
-
const $tr = (code: string, defaultValue: string, ...parameters: string[]): string => {
|
|
7
|
-
let translation = useTranslations().fetched.value.find(t => t.code === code)?.value ?? defaultValue;
|
|
8
|
-
if (translation && parameters.length) {
|
|
9
|
-
for (let p of parameters) {
|
|
10
|
-
translation = translation.replace(`{${parameters.indexOf(p)}}`, p.toString());
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return translation;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const init = async () => {
|
|
17
|
-
if (!initialized) {
|
|
18
|
-
initialized = true;
|
|
19
|
-
await useLanguageCode().ready;
|
|
20
|
-
await useTranslations().fetch(useLanguageCode().languageCode.value!);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
$tr,
|
|
26
|
-
init
|
|
27
|
-
}
|
|
28
|
-
}
|
package/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./composables";
|
package/tools/datesTools.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { parse } from "date-fns";
|
|
2
|
-
|
|
3
|
-
const removeArtifacts = (date: string): string => {
|
|
4
|
-
return date.substring(0, 19) + "Z";
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
const isoTimeFormat = (timeZone: boolean = false): string => {
|
|
8
|
-
return `yyyy-MM-dd'T'HH:mm:ss${timeZone ? "X" : ""}`;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const DatesTools = {
|
|
12
|
-
utcToEpoch: (value: string): number => {
|
|
13
|
-
return parse(removeArtifacts(value), isoTimeFormat(true), new Date()).getTime();
|
|
14
|
-
}
|
|
15
|
-
};
|
package/tools/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./datesTools";
|