@unsource/ui 2.9.30 → 2.9.31
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
|
@@ -26,6 +26,7 @@ export declare const useReload: () => import("vue").Ref<number, number>;
|
|
|
26
26
|
export declare const useUserId: () => import("#app").CookieRef<string | null | undefined>;
|
|
27
27
|
export declare const useToken: () => import("#app").CookieRef<string | null | undefined>;
|
|
28
28
|
export declare const useProviderId: () => import("#app").CookieRef<string | null | undefined>;
|
|
29
|
+
export declare const useUserType: () => import("#app").CookieRef<string | null | undefined>;
|
|
29
30
|
export declare const SettingToType: (setting: ServiceSetting) => ServiceSettingType;
|
|
30
31
|
export declare const NotInProcessBooking: (e: Booking["status"]) => boolean;
|
|
31
32
|
export declare const MinPrice: (bookingSetting: BookingSetting) => number | object | null | undefined;
|
|
@@ -34,12 +35,11 @@ export declare const authenticate: () => Promise<void>;
|
|
|
34
35
|
export declare const authenticateProvider: () => Promise<void>;
|
|
35
36
|
export declare const useConfig: () => import("@nuxt/schema").PublicRuntimeConfig;
|
|
36
37
|
export declare const useModuleConfig: () => unknown;
|
|
37
|
-
|
|
38
|
+
type Config = {
|
|
39
|
+
isDomain: string;
|
|
38
40
|
userType: string;
|
|
39
|
-
}
|
|
40
|
-
export declare const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export
|
|
44
|
-
userType: string;
|
|
45
|
-
}) => boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare const isProviderSide: (config: Config) => boolean;
|
|
43
|
+
export declare const isCoSide: (config: Config) => boolean;
|
|
44
|
+
export declare const isUserSide: (config: Config) => boolean;
|
|
45
|
+
export {};
|
|
@@ -24,6 +24,9 @@ export const useToken = () => useCookie("token", {
|
|
|
24
24
|
export const useProviderId = () => useCookie("providerId", {
|
|
25
25
|
maxAge: 365 * 24 * 60 * 60 * 1e3
|
|
26
26
|
});
|
|
27
|
+
export const useUserType = () => useCookie("userType", {
|
|
28
|
+
maxAge: 365 * 24 * 60 * 60 * 1e3
|
|
29
|
+
});
|
|
27
30
|
export const SettingToType = (setting) => ({
|
|
28
31
|
..._pick(setting, ["id", "price", "discount", "duration", "subCategoryKey", "description"]),
|
|
29
32
|
title: setting.subCategory?.title || "",
|
|
@@ -53,11 +56,23 @@ export const useModuleConfig = () => {
|
|
|
53
56
|
return config.unsourceUi;
|
|
54
57
|
};
|
|
55
58
|
export const isProviderSide = (config) => {
|
|
59
|
+
if (config.isDomain) {
|
|
60
|
+
const userType = useUserType();
|
|
61
|
+
return ["PROVIDER", "SHOP"].includes(userType.value || "");
|
|
62
|
+
}
|
|
56
63
|
return ["PROVIDER", "SHOP"].includes(config?.userType);
|
|
57
64
|
};
|
|
58
65
|
export const isCoSide = (config) => {
|
|
66
|
+
if (config.isDomain) {
|
|
67
|
+
const userType = useUserType();
|
|
68
|
+
return ["COURIER", "PLACE"].includes(userType.value || "");
|
|
69
|
+
}
|
|
59
70
|
return ["COURIER", "PLACE"].includes(config?.userType);
|
|
60
71
|
};
|
|
61
72
|
export const isUserSide = (config) => {
|
|
73
|
+
if (config.isDomain) {
|
|
74
|
+
const userType = useUserType();
|
|
75
|
+
return userType.value === "USER";
|
|
76
|
+
}
|
|
62
77
|
return config?.userType === "USER";
|
|
63
78
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unsource/ui",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.31",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "nuxt ui kit for unsource env",
|
|
6
6
|
"repository": "https://github.com/alisa2142/unsource-ui",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
+
"prepack": "nuxt-module-build build",
|
|
29
30
|
"dev": "npm run dev:prepare && nuxi dev playground",
|
|
30
31
|
"dev:build": "nuxi build playground",
|
|
31
32
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|