@inzombieland/core 1.18.32 → 1.18.34

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/get-visitor.mjs CHANGED
@@ -15,10 +15,13 @@ const getVisitorRequest = async (config) => {
15
15
  const result = await fp.get();
16
16
  const { canvas, colorDepth, hdr, languages, screenFrame, screenResolution, ...components } = result.components;
17
17
  const id = hashComponents(components);
18
- const ip = "unknown";
19
- ofetch("https://api.ipify.org?format=json").then((data) => {
20
- setVisitor({ ip: data?.ip ?? "unknown" });
21
- });
18
+ let ip;
19
+ try {
20
+ const data = await ofetch("https://api.ipify.org?format=json", { timeout: 3e3 });
21
+ ip = data?.ip ?? "unknown";
22
+ } catch {
23
+ ip = "unknown";
24
+ }
22
25
  const device = await config.getDevice() || "unknown";
23
26
  const appName = config.appName || "unknown";
24
27
  setVisitor({ id, ip, device, appName });
package/index.d.ts CHANGED
@@ -64,6 +64,10 @@ export declare function initApiFetch($fetch: Fetch, config: FetchConfig): {
64
64
  }) => Promise<void>;
65
65
  changeAvatar: (body: FormData) => Promise<void>;
66
66
  deleteAvatar: () => Promise<void>;
67
+ logoutActiveSession: (body: {
68
+ sessionId: string;
69
+ visitorId: string;
70
+ }) => Promise<any>;
67
71
  logoutFromAllActiveSessions: () => Promise<any>;
68
72
  };
69
73
  };
@@ -123,6 +127,10 @@ export declare const useUserActions: () => Ref<{
123
127
  }) => Promise<void>;
124
128
  changeAvatar: (body: FormData) => Promise<void>;
125
129
  deleteAvatar: () => Promise<void>;
130
+ logoutActiveSession: (body: {
131
+ sessionId: string;
132
+ visitorId: string;
133
+ }) => Promise<any>;
126
134
  logoutFromAllActiveSessions: () => Promise<any>;
127
135
  }, {
128
136
  signIn: (body: Record<string, any>) => Promise<import("./types").GetUserResponse | {
@@ -180,5 +188,9 @@ export declare const useUserActions: () => Ref<{
180
188
  }) => Promise<void>;
181
189
  changeAvatar: (body: FormData) => Promise<void>;
182
190
  deleteAvatar: () => Promise<void>;
191
+ logoutActiveSession: (body: {
192
+ sessionId: string;
193
+ visitorId: string;
194
+ }) => Promise<any>;
183
195
  logoutFromAllActiveSessions: () => Promise<any>;
184
196
  }> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inzombieland/core",
3
- "version": "1.18.32",
3
+ "version": "1.18.34",
4
4
  "type": "module",
5
5
  "license": "ISC",
6
6
  "main": "./index.mjs",
package/user-actions.d.ts CHANGED
@@ -56,5 +56,9 @@ export declare const createApiUserActions: (fetch: Fetch, config: FetchConfig, g
56
56
  }) => Promise<void>;
57
57
  changeAvatar: (body: FormData) => Promise<void>;
58
58
  deleteAvatar: () => Promise<void>;
59
+ logoutActiveSession: (body: {
60
+ sessionId: string;
61
+ visitorId: string;
62
+ }) => Promise<any>;
59
63
  logoutFromAllActiveSessions: () => Promise<any>;
60
64
  };
package/user-actions.mjs CHANGED
@@ -109,6 +109,9 @@ export const createApiUserActions = once(
109
109
  await fetch("/account/1/delete/avatar", { body: { avatar: user.value?.avatar }, method: "DELETE" });
110
110
  updateUser({ avatar: "" });
111
111
  },
112
+ logoutActiveSession: async (body) => {
113
+ return await fetch("/account/1/logout/session", { body, method: "POST" });
114
+ },
112
115
  logoutFromAllActiveSessions: async () => {
113
116
  return await fetch("/account/1/logout/sessions", { method: "POST" });
114
117
  }