abckit 0.0.60 → 0.0.62
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.mjs
CHANGED
|
@@ -329,21 +329,29 @@ function setupBetterAuth(nuxt, options, _resolve) {
|
|
|
329
329
|
guest: "/"
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
|
-
nuxt.hook("better-auth:
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
332
|
+
nuxt.hook("better-auth:client:extend", (config) => {
|
|
333
|
+
config.plugins = config.plugins || [];
|
|
334
|
+
config.plugins.push({
|
|
335
|
+
from: "better-auth/client/plugins",
|
|
336
|
+
name: "twoFactorClient"
|
|
337
|
+
});
|
|
338
|
+
config.plugins.push({
|
|
339
|
+
from: "better-auth/client/plugins",
|
|
340
|
+
name: "adminClient"
|
|
341
|
+
});
|
|
336
342
|
if (isCapacitor) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
343
|
+
config.plugins.push({
|
|
344
|
+
from: "abckit/plugins/capacitor",
|
|
345
|
+
name: "capacitorClient",
|
|
346
|
+
options: { storagePrefix: "better-auth" }
|
|
347
|
+
});
|
|
341
348
|
}
|
|
342
349
|
if (options.auth?.oauthProvider) {
|
|
343
|
-
|
|
344
|
-
|
|
350
|
+
config.plugins.push({
|
|
351
|
+
from: "@better-auth/oauth-provider/client",
|
|
352
|
+
name: "oauthProviderClient"
|
|
353
|
+
});
|
|
345
354
|
}
|
|
346
|
-
config.plugins = plugins;
|
|
347
355
|
});
|
|
348
356
|
}
|
|
349
357
|
|
|
@@ -10,16 +10,10 @@ import {
|
|
|
10
10
|
} from "better-auth/cookies";
|
|
11
11
|
import { setupCapacitorFocusManager } from "./focus-manager.js";
|
|
12
12
|
import { setupCapacitorOnlineManager } from "./online-manager.js";
|
|
13
|
-
function isNativePlatform() {
|
|
14
|
-
try {
|
|
15
|
-
return Capacitor.isNativePlatform();
|
|
16
|
-
} catch {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
13
|
let managersInitialized = false;
|
|
21
14
|
function initializeManagers() {
|
|
22
|
-
if (managersInitialized || !isNativePlatform())
|
|
15
|
+
if (managersInitialized || !Capacitor.isNativePlatform())
|
|
16
|
+
return;
|
|
23
17
|
managersInitialized = true;
|
|
24
18
|
setupCapacitorFocusManager();
|
|
25
19
|
setupCapacitorOnlineManager();
|
|
@@ -183,7 +177,7 @@ export function capacitorClient(opts) {
|
|
|
183
177
|
name: "Capacitor Auth",
|
|
184
178
|
hooks: {
|
|
185
179
|
async onSuccess(context) {
|
|
186
|
-
if (!isNativePlatform())
|
|
180
|
+
if (!Capacitor.isNativePlatform())
|
|
187
181
|
return;
|
|
188
182
|
const normalizedCookieName = normalizeCookieName(cookieName);
|
|
189
183
|
const authToken = context.response.headers.get("set-auth-token");
|
|
@@ -256,7 +250,7 @@ export function capacitorClient(opts) {
|
|
|
256
250
|
}
|
|
257
251
|
},
|
|
258
252
|
async init(url, options) {
|
|
259
|
-
if (!isNativePlatform()) {
|
|
253
|
+
if (!Capacitor.isNativePlatform()) {
|
|
260
254
|
return { url, options };
|
|
261
255
|
}
|
|
262
256
|
initializeManagers();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { App } from "@capacitor/app";
|
|
1
2
|
import { kFocusManager } from "better-auth/client";
|
|
2
3
|
class CapacitorFocusManager {
|
|
3
4
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -16,13 +17,10 @@ class CapacitorFocusManager {
|
|
|
16
17
|
this.listeners.forEach((listener) => listener(focused));
|
|
17
18
|
}
|
|
18
19
|
setup() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.unsubscribe = () => handle.remove();
|
|
24
|
-
}).catch(() => {
|
|
25
|
-
});
|
|
20
|
+
App.addListener("appStateChange", (state) => {
|
|
21
|
+
this.setFocused(state.isActive);
|
|
22
|
+
}).then((handle) => {
|
|
23
|
+
this.unsubscribe = () => handle.remove();
|
|
26
24
|
}).catch(() => {
|
|
27
25
|
});
|
|
28
26
|
return () => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Network } from "@capacitor/network";
|
|
1
2
|
import { kOnlineManager } from "better-auth/client";
|
|
2
3
|
class CapacitorOnlineManager {
|
|
3
4
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -16,14 +17,10 @@ class CapacitorOnlineManager {
|
|
|
16
17
|
this.listeners.forEach((listener) => listener(online));
|
|
17
18
|
}
|
|
18
19
|
setup() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.unsubscribe = () => handle.remove();
|
|
24
|
-
}).catch(() => {
|
|
25
|
-
this.setOnline(true);
|
|
26
|
-
});
|
|
20
|
+
Network.addListener("networkStatusChange", (status) => {
|
|
21
|
+
this.setOnline(status.connected);
|
|
22
|
+
}).then((handle) => {
|
|
23
|
+
this.unsubscribe = () => handle.remove();
|
|
27
24
|
}).catch(() => {
|
|
28
25
|
this.setOnline(true);
|
|
29
26
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "abckit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.62",
|
|
5
5
|
"description": "Nuxt 4 module — UI components, auth, storage, GraphQL",
|
|
6
6
|
"author": "productdevbook",
|
|
7
7
|
"license": "MIT",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"@better-auth/oauth-provider": "^1.4.12",
|
|
92
|
-
"better-auth-nuxt": "^0.0.2-beta.
|
|
92
|
+
"better-auth-nuxt": "^0.0.2-beta.23",
|
|
93
93
|
"@capacitor/android": "^8.0.1",
|
|
94
94
|
"@capacitor/app": "^8.0.0",
|
|
95
95
|
"@capacitor/browser": "^8.0.0",
|