abckit 0.0.63 → 0.0.64

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.
@@ -1,4 +1,11 @@
1
- import { Preferences } from "@capacitor/preferences";
1
+ let _Preferences = null;
2
+ async function getPreferences() {
3
+ if (!_Preferences) {
4
+ const mod = await import("@capacitor/preferences");
5
+ _Preferences = mod.Preferences;
6
+ }
7
+ return _Preferences;
8
+ }
2
9
  const paths = [
3
10
  "/callback/",
4
11
  "/oauth2/callback/",
@@ -33,6 +40,7 @@ export function lastLoginMethodClient(config) {
33
40
  if (!lastMethod) {
34
41
  return;
35
42
  }
43
+ const Preferences = await getPreferences();
36
44
  await Preferences.set({ key: lastLoginMethodName, value: lastMethod });
37
45
  }
38
46
  }
@@ -46,6 +54,7 @@ export function lastLoginMethodClient(config) {
46
54
  * @returns The last used login method or null if not found
47
55
  */
48
56
  getLastUsedLoginMethod: async () => {
57
+ const Preferences = await getPreferences();
49
58
  const result = await Preferences.get({ key: lastLoginMethodName });
50
59
  return result?.value ?? null;
51
60
  },
@@ -53,6 +62,7 @@ export function lastLoginMethodClient(config) {
53
62
  * Clear the last used login method from storage
54
63
  */
55
64
  clearLastUsedLoginMethod: async () => {
65
+ const Preferences = await getPreferences();
56
66
  await Preferences.remove({ key: lastLoginMethodName });
57
67
  },
58
68
  /**
@@ -61,6 +71,7 @@ export function lastLoginMethodClient(config) {
61
71
  * @returns True if the method was the last used, false otherwise
62
72
  */
63
73
  isLastUsedLoginMethod: async (method) => {
74
+ const Preferences = await getPreferences();
64
75
  const result = await Preferences.get({ key: lastLoginMethodName });
65
76
  return result?.value === method;
66
77
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "abckit",
3
3
  "type": "module",
4
- "version": "0.0.63",
4
+ "version": "0.0.64",
5
5
  "description": "Nuxt 4 module — UI components, auth, storage, GraphQL",
6
6
  "author": "productdevbook",
7
7
  "license": "MIT",