@goweekdays/layer-common 1.4.6 → 1.5.1
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/CHANGELOG.md +13 -0
- package/components/Input/Currency.vue +60 -0
- package/components/Input/Infinity.vue +112 -0
- package/components/Input/Slug.vue +50 -0
- package/components/InvitationMain.vue +4 -4
- package/components/MemberInvite.vue +4 -1
- package/composables/useAddress.ts +4 -4
- package/composables/useApps.ts +4 -4
- package/composables/useChartOfAccount.ts +12 -7
- package/composables/useFile.ts +7 -4
- package/composables/useInvoice.ts +17 -11
- package/composables/useJobPost.ts +67 -0
- package/composables/useLedgerBilling.ts +8 -5
- package/composables/useLocalAuth.ts +10 -7
- package/composables/useMember.ts +34 -22
- package/composables/useOrder.ts +1 -1
- package/composables/useOrg.ts +21 -14
- package/composables/usePaymentMethod.ts +37 -24
- package/composables/usePermission.ts +8 -8
- package/composables/usePlan.ts +1 -1
- package/composables/usePrice.ts +1 -1
- package/composables/usePromo.ts +78 -0
- package/composables/usePromoCode.ts +4 -4
- package/composables/useRole.ts +7 -7
- package/composables/useSubscription.ts +29 -10
- package/composables/useUser.ts +11 -11
- package/composables/useUtils.ts +1 -1
- package/composables/useVerification.ts +22 -13
- package/nuxt.config.ts +3 -2
- package/package.json +1 -1
- package/pages/member-suspended.vue +1 -1
- package/plugins/API.ts +6 -46
- package/plugins/secure.client.ts +3 -1
- package/plugins/vuetify.ts +4 -0
- package/types/job-post.d.ts +18 -0
- package/types/org.d.ts +1 -0
- package/types/promo.d.ts +22 -0
package/composables/useUser.ts
CHANGED
|
@@ -7,49 +7,49 @@ export default function useUser() {
|
|
|
7
7
|
org = "",
|
|
8
8
|
orgName = "",
|
|
9
9
|
} = {}) {
|
|
10
|
-
return
|
|
10
|
+
return useNuxtApp().$api<Record<string, any>>("/api/auth/invite", {
|
|
11
11
|
method: "POST",
|
|
12
12
|
body: { email, app, role, roleName, org, orgName },
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
function updateName({ firstName = "", lastName = "" } = {}) {
|
|
17
|
-
return
|
|
17
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/name", {
|
|
18
18
|
method: "PUT",
|
|
19
19
|
body: { firstName, lastName },
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function updateBirthday({ month = "", day = 0, year = 0 } = {}) {
|
|
24
|
-
return
|
|
24
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/birthday", {
|
|
25
25
|
method: "PUT",
|
|
26
26
|
body: { month, day, year },
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
function updateGender(gender = "") {
|
|
31
|
-
return
|
|
31
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/gender", {
|
|
32
32
|
method: "PUT",
|
|
33
33
|
body: { gender },
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function updateEmail(email = "") {
|
|
38
|
-
return
|
|
38
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/email", {
|
|
39
39
|
method: "PUT",
|
|
40
40
|
body: { email },
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function updateContact(contact = "") {
|
|
45
|
-
return
|
|
45
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users/contact", {
|
|
46
46
|
method: "PUT",
|
|
47
47
|
body: { contact },
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function updateUserFieldById(id = "", field = "", value = "") {
|
|
52
|
-
return
|
|
52
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/field/${id}`, {
|
|
53
53
|
method: "PATCH",
|
|
54
54
|
body: { field, value },
|
|
55
55
|
});
|
|
@@ -61,14 +61,14 @@ export default function useUser() {
|
|
|
61
61
|
search = "",
|
|
62
62
|
page = 1,
|
|
63
63
|
} = {}) {
|
|
64
|
-
return
|
|
64
|
+
return useNuxtApp().$api<Record<string, any>>("/api/users", {
|
|
65
65
|
method: "GET",
|
|
66
66
|
query: { status, search, page, type },
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function getById(id = "") {
|
|
71
|
-
return
|
|
71
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/id/${id}`, {
|
|
72
72
|
method: "GET",
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -81,7 +81,7 @@ export default function useUser() {
|
|
|
81
81
|
referralCode = "",
|
|
82
82
|
type = "",
|
|
83
83
|
} = {}) {
|
|
84
|
-
return
|
|
84
|
+
return useNuxtApp().$api<Record<string, any>>(`/api/users/invite/${id}`, {
|
|
85
85
|
method: "POST",
|
|
86
86
|
body: { firstName, lastName, password, referralCode, type },
|
|
87
87
|
});
|
|
@@ -92,7 +92,7 @@ export default function useUser() {
|
|
|
92
92
|
newPassword: string;
|
|
93
93
|
confirmPassword: string;
|
|
94
94
|
}) {
|
|
95
|
-
return
|
|
95
|
+
return useNuxtApp().$api("/api/users/password", {
|
|
96
96
|
method: "PATCH",
|
|
97
97
|
body: value,
|
|
98
98
|
});
|
package/composables/useUtils.ts
CHANGED
|
@@ -140,7 +140,7 @@ export default function useUtils() {
|
|
|
140
140
|
|
|
141
141
|
async function getCountries() {
|
|
142
142
|
try {
|
|
143
|
-
const countries = await
|
|
143
|
+
const countries = await useNuxtApp().$api<Array<Record<string, any>>>(
|
|
144
144
|
"https://restcountries.com/v3.1/all?fields=name,currencies,idd",
|
|
145
145
|
{ method: "GET" }
|
|
146
146
|
);
|
|
@@ -8,7 +8,7 @@ export default function useUser() {
|
|
|
8
8
|
app = "",
|
|
9
9
|
org = "",
|
|
10
10
|
} = {}) {
|
|
11
|
-
return
|
|
11
|
+
return useNuxtApp().$api<Record<string, any>>("/api/verifications", {
|
|
12
12
|
method: "GET",
|
|
13
13
|
query: { status, search, page, type, email, app, org },
|
|
14
14
|
});
|
|
@@ -20,23 +20,29 @@ export default function useUser() {
|
|
|
20
20
|
org: string;
|
|
21
21
|
role: string;
|
|
22
22
|
}) {
|
|
23
|
-
return
|
|
23
|
+
return useNuxtApp().$api<Record<string, any>>("/api/verifications/member", {
|
|
24
24
|
method: "POST",
|
|
25
25
|
body: value,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
function signUp(email: string) {
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
31
|
+
"/api/verifications/sign-up",
|
|
32
|
+
{
|
|
33
|
+
method: "POST",
|
|
34
|
+
body: { email },
|
|
35
|
+
}
|
|
36
|
+
);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
function cancelInvite(id: string) {
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
41
|
+
`/api/verifications/invite/id/${id}`,
|
|
42
|
+
{
|
|
43
|
+
method: "DELETE",
|
|
44
|
+
}
|
|
45
|
+
);
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
function orgSetupFee(
|
|
@@ -44,10 +50,13 @@ export default function useUser() {
|
|
|
44
50
|
seats: number;
|
|
45
51
|
}
|
|
46
52
|
) {
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
return useNuxtApp().$api<Record<string, any>>(
|
|
54
|
+
"/api/verifications/org-setup-fee",
|
|
55
|
+
{
|
|
56
|
+
method: "POST",
|
|
57
|
+
body: value,
|
|
58
|
+
}
|
|
59
|
+
);
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
return {
|
package/nuxt.config.ts
CHANGED
|
@@ -15,6 +15,7 @@ export default defineNuxtConfig({
|
|
|
15
15
|
secure: true,
|
|
16
16
|
maxAge: 30 * 24 * 60 * 60,
|
|
17
17
|
},
|
|
18
|
+
API_CORE: (process.env.API_CORE as string) ?? "http://localhost:5001",
|
|
18
19
|
APP: (process.env.APP as string) ?? "app",
|
|
19
20
|
APP_NAME: (process.env.APP_NAME as string) ?? "App",
|
|
20
21
|
APP_NAME_ROUTE: (process.env.APP_NAME_ROUTE as string) ?? "index",
|
|
@@ -69,8 +70,8 @@ export default defineNuxtConfig({
|
|
|
69
70
|
"/api/entities/**": { proxy: `${process.env.API_CORE}/api/entities/**` },
|
|
70
71
|
"/api/workflows/**": { proxy: `${process.env.API_CORE}/api/workflows/**` },
|
|
71
72
|
"/api/roles/**": { proxy: `${process.env.API_CORE}/api/roles/**` },
|
|
72
|
-
"/api/
|
|
73
|
-
proxy: `${process.env.API_CORE}/api/
|
|
73
|
+
"/api/promos/**": {
|
|
74
|
+
proxy: `${process.env.API_CORE}/api/promos/**`,
|
|
74
75
|
},
|
|
75
76
|
"/api/verifications/**": {
|
|
76
77
|
proxy: `${process.env.API_CORE}/api/verifications/**`,
|
package/package.json
CHANGED
package/plugins/API.ts
CHANGED
|
@@ -1,58 +1,18 @@
|
|
|
1
|
-
import { useFetch } from "nuxt/app";
|
|
2
|
-
type useFetchType = typeof useFetch;
|
|
3
|
-
|
|
4
1
|
export default defineNuxtPlugin(() => {
|
|
5
|
-
const { cookieConfig
|
|
2
|
+
const { cookieConfig } = useRuntimeConfig().public;
|
|
6
3
|
|
|
7
4
|
const api = $fetch.create({
|
|
8
|
-
baseURL:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onRequest({ options }) {
|
|
13
|
-
const accessToken = useCookie("accessToken", cookieConfig).value;
|
|
14
|
-
options.headers.set("Authorization", `Bearer ${accessToken}`);
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
async onResponseError({ response }) {
|
|
18
|
-
if (response.status === 401) {
|
|
19
|
-
await $fetch("/api/auth/refresh", {
|
|
20
|
-
method: "POST",
|
|
21
|
-
body: JSON.stringify({
|
|
22
|
-
token: useCookie("refreshToken", cookieConfig).value,
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
onResponse({ response }) {
|
|
26
|
-
if (response.status === 200) {
|
|
27
|
-
useCookie("accessToken", cookieConfig).value =
|
|
28
|
-
response._data.token;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
}
|
|
5
|
+
baseURL: useRuntimeConfig().public.API_CORE,
|
|
6
|
+
credentials: "include",
|
|
7
|
+
headers: {
|
|
8
|
+
cookie: `domain=${cookieConfig.domain}; Max-Age=${cookieConfig.maxAge}; Secure=${cookieConfig.secure}`,
|
|
33
9
|
},
|
|
34
10
|
});
|
|
35
11
|
|
|
36
|
-
|
|
37
|
-
options.lazy = true;
|
|
38
|
-
options.retry = 1;
|
|
39
|
-
options.retryStatusCodes = [401];
|
|
40
|
-
options.retryDelay = 500;
|
|
41
|
-
options.baseURL = (BASE_URL as string) ?? "/";
|
|
42
|
-
|
|
43
|
-
options.headers = {
|
|
44
|
-
...options.headers,
|
|
45
|
-
Authorization: `Bearer ${useCookie("accessToken", cookieConfig).value}`,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return useFetch(path, options);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
// Expose to $fetch
|
|
12
|
+
// Expose to useNuxtApp().$api
|
|
52
13
|
return {
|
|
53
14
|
provide: {
|
|
54
15
|
api,
|
|
55
|
-
useAPI,
|
|
56
16
|
},
|
|
57
17
|
};
|
|
58
18
|
});
|
package/plugins/secure.client.ts
CHANGED
|
@@ -14,7 +14,9 @@ export default defineNuxtPlugin(() => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
try {
|
|
17
|
-
currentUser.value = await
|
|
17
|
+
currentUser.value = await useNuxtApp().$api<TUser>(
|
|
18
|
+
`/api/users/id/${user}`
|
|
19
|
+
);
|
|
18
20
|
} catch (error) {
|
|
19
21
|
navigateTo({ name: "index" });
|
|
20
22
|
}
|
package/plugins/vuetify.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare type TJobPost = {
|
|
2
|
+
_id?: ObjectId;
|
|
3
|
+
org: ObjectId;
|
|
4
|
+
orgName?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
setup: string;
|
|
7
|
+
location: string;
|
|
8
|
+
type: string;
|
|
9
|
+
minSalary?: number;
|
|
10
|
+
maxSalary?: number;
|
|
11
|
+
currency?: string;
|
|
12
|
+
payPeriod?: string;
|
|
13
|
+
description: string;
|
|
14
|
+
status?: string;
|
|
15
|
+
createdAt?: Date;
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
deletedAt?: Date;
|
|
18
|
+
};
|
package/types/org.d.ts
CHANGED
package/types/promo.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare type TPromo = {
|
|
2
|
+
_id?: string;
|
|
3
|
+
code: string;
|
|
4
|
+
type: "flat" | "fixed" | "volume";
|
|
5
|
+
flatRate?: number; // regardless of seats
|
|
6
|
+
fixedRate?: number; // per seat
|
|
7
|
+
tiers?: Array<{
|
|
8
|
+
minSeats: number;
|
|
9
|
+
maxSeats: number;
|
|
10
|
+
rate: number;
|
|
11
|
+
}>;
|
|
12
|
+
currency: string;
|
|
13
|
+
startDate?: Date | string;
|
|
14
|
+
endDate?: Date | string;
|
|
15
|
+
seats?: number;
|
|
16
|
+
usage?: number;
|
|
17
|
+
apps?: string[];
|
|
18
|
+
status?: "active" | "inactive" | "expired";
|
|
19
|
+
createdAt?: Date | string;
|
|
20
|
+
updatedAt?: Date | string;
|
|
21
|
+
deletedAt?: Date | string;
|
|
22
|
+
};
|