@oxyhq/services 10.2.6 → 10.2.7
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/lib/commonjs/ui/stores/authStore.js +3 -3
- package/lib/commonjs/ui/stores/authStore.js.map +1 -1
- package/lib/module/ui/stores/authStore.js +4 -4
- package/lib/module/ui/stores/authStore.js.map +1 -1
- package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ui/stores/authStore.ts +5 -5
|
@@ -16,7 +16,7 @@ const useAuthStore = exports.useAuthStore = (0, _zustand.create)((set, get) => (
|
|
|
16
16
|
loginSuccess: user => set({
|
|
17
17
|
isLoading: false,
|
|
18
18
|
isAuthenticated: true,
|
|
19
|
-
user,
|
|
19
|
+
user: (0, _core.normalizeUserIdentity)(user),
|
|
20
20
|
lastUserFetch: Date.now()
|
|
21
21
|
}),
|
|
22
22
|
loginFailure: error => set({
|
|
@@ -29,7 +29,7 @@ const useAuthStore = exports.useAuthStore = (0, _zustand.create)((set, get) => (
|
|
|
29
29
|
lastUserFetch: null
|
|
30
30
|
}),
|
|
31
31
|
setUser: user => set({
|
|
32
|
-
user,
|
|
32
|
+
user: (0, _core.normalizeUserIdentity)(user),
|
|
33
33
|
lastUserFetch: Date.now()
|
|
34
34
|
}),
|
|
35
35
|
fetchUser: async (oxyServices, forceRefresh = false) => {
|
|
@@ -48,7 +48,7 @@ const useAuthStore = exports.useAuthStore = (0, _zustand.create)((set, get) => (
|
|
|
48
48
|
error: null
|
|
49
49
|
});
|
|
50
50
|
try {
|
|
51
|
-
const user = await oxyServices.getCurrentUser();
|
|
51
|
+
const user = (0, _core.normalizeUserIdentity)(await oxyServices.getCurrentUser());
|
|
52
52
|
set({
|
|
53
53
|
user,
|
|
54
54
|
isLoading: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_zustand","require","_core","debug","createDebugLogger","useAuthStore","exports","create","set","get","user","isAuthenticated","isLoading","error","lastUserFetch","loginSuccess","Date","now","loginFailure","logout","setUser","fetchUser","oxyServices","forceRefresh","state","cacheAge","Number","POSITIVE_INFINITY","cacheValid","log","getCurrentUser","errorMessage","Error","message"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;
|
|
1
|
+
{"version":3,"names":["_zustand","require","_core","debug","createDebugLogger","useAuthStore","exports","create","set","get","user","isAuthenticated","isLoading","error","lastUserFetch","loginSuccess","normalizeUserIdentity","Date","now","loginFailure","logout","setUser","fetchUser","oxyServices","forceRefresh","state","cacheAge","Number","POSITIVE_INFINITY","cacheValid","log","getCurrentUser","errorMessage","Error","message"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGA,MAAME,KAAK,GAAG,IAAAC,uBAAiB,EAAC,WAAW,CAAC;AAgBrC,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,eAAM,EAAY,CAACC,GAAwC,EAAEC,GAAoB,MAAM;EACjHC,IAAI,EAAE,IAAI;EACVC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,IAAI;EACXC,aAAa,EAAE,IAAI;EAEnBC,YAAY,EAAGL,IAAU,IAAKF,GAAG,CAAC;IAChCI,SAAS,EAAE,KAAK;IAChBD,eAAe,EAAE,IAAI;IACrBD,IAAI,EAAE,IAAAM,2BAAqB,EAACN,IAAI,CAAC;IACjCI,aAAa,EAAEG,IAAI,CAACC,GAAG,CAAC;EAC1B,CAAC,CAAC;EACFC,YAAY,EAAGN,KAAa,IAAKL,GAAG,CAAC;IAAEI,SAAS,EAAE,KAAK;IAAEC;EAAM,CAAC,CAAC;EACjEO,MAAM,EAAEA,CAAA,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BAAsB;MACpF/B,KAAK,CAACU,KAAK,CAAC,sBAAsB,EAAEA,KAAK,CAAC;MAC1CL,GAAG,CAAC;QAAEK,KAAK,EAAEmB,YAAY;QAAEpB,SAAS,EAAE;MAAM,CAAC,CAAC;IAChD;EACF;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { create } from 'zustand';
|
|
4
|
-
import { createDebugLogger } from '@oxyhq/core';
|
|
4
|
+
import { createDebugLogger, normalizeUserIdentity } from '@oxyhq/core';
|
|
5
5
|
const debug = createDebugLogger('AuthStore');
|
|
6
6
|
export const useAuthStore = create((set, get) => ({
|
|
7
7
|
user: null,
|
|
@@ -12,7 +12,7 @@ export const useAuthStore = create((set, get) => ({
|
|
|
12
12
|
loginSuccess: user => set({
|
|
13
13
|
isLoading: false,
|
|
14
14
|
isAuthenticated: true,
|
|
15
|
-
user,
|
|
15
|
+
user: normalizeUserIdentity(user),
|
|
16
16
|
lastUserFetch: Date.now()
|
|
17
17
|
}),
|
|
18
18
|
loginFailure: error => set({
|
|
@@ -25,7 +25,7 @@ export const useAuthStore = create((set, get) => ({
|
|
|
25
25
|
lastUserFetch: null
|
|
26
26
|
}),
|
|
27
27
|
setUser: user => set({
|
|
28
|
-
user,
|
|
28
|
+
user: normalizeUserIdentity(user),
|
|
29
29
|
lastUserFetch: Date.now()
|
|
30
30
|
}),
|
|
31
31
|
fetchUser: async (oxyServices, forceRefresh = false) => {
|
|
@@ -44,7 +44,7 @@ export const useAuthStore = create((set, get) => ({
|
|
|
44
44
|
error: null
|
|
45
45
|
});
|
|
46
46
|
try {
|
|
47
|
-
const user = await oxyServices.getCurrentUser();
|
|
47
|
+
const user = normalizeUserIdentity(await oxyServices.getCurrentUser());
|
|
48
48
|
set({
|
|
49
49
|
user,
|
|
50
50
|
isLoading: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["create","createDebugLogger","debug","useAuthStore","set","get","user","isAuthenticated","isLoading","error","lastUserFetch","loginSuccess","Date","now","loginFailure","logout","setUser","fetchUser","oxyServices","forceRefresh","state","cacheAge","Number","POSITIVE_INFINITY","cacheValid","log","getCurrentUser","errorMessage","Error","message"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;
|
|
1
|
+
{"version":3,"names":["create","createDebugLogger","normalizeUserIdentity","debug","useAuthStore","set","get","user","isAuthenticated","isLoading","error","lastUserFetch","loginSuccess","Date","now","loginFailure","logout","setUser","fetchUser","oxyServices","forceRefresh","state","cacheAge","Number","POSITIVE_INFINITY","cacheValid","log","getCurrentUser","errorMessage","Error","message"],"sourceRoot":"../../../../src","sources":["ui/stores/authStore.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,SAAS;AAChC,SAASC,iBAAiB,EAAEC,qBAAqB,QAAQ,aAAa;AAGtE,MAAMC,KAAK,GAAGF,iBAAiB,CAAC,WAAW,CAAC;AAgB5C,OAAO,MAAMG,YAAY,GAAGJ,MAAM,CAAY,CAACK,GAAwC,EAAEC,GAAoB,MAAM;EACjHC,IAAI,EAAE,IAAI;EACVC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAE,KAAK;EAChBC,KAAK,EAAE,IAAI;EACXC,aAAa,EAAE,IAAI;EAEnBC,YAAY,EAAGL,IAAU,IAAKF,GAAG,CAAC;IAChCI,SAAS,EAAE,KAAK;IAChBD,eAAe,EAAE,IAAI;IACrBD,IAAI,EAAEL,qBAAqB,CAACK,IAAI,CAAC;IACjCI,aAAa,EAAEE,IAAI,CAACC,GAAG,CAAC;EAC1B,CAAC,CAAC;EACFC,YAAY,EAAGL,KAAa,IAAKL,GAAG,CAAC;IAAEI,SAAS,EAAE,KAAK;IAAEC;EAAM,CAAC,CAAC;EACjEM,MAAM,EAAEA,CAAA,KAAMX,GAAG,CAAC;IAChBE,IAAI,EAAE,IAAI;IACVC,eA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AC;MAC1CL,GAAG,CAAC;QAAEK,KAAK,EAAEkB,YAAY;QAAEnB,SAAS,EAAE;MAAM,CAAC,CAAC;IAChD;EACF;AACF,CAAC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,WAAW,EAAE;QAAE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3G,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,wEA0CtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,WAAW,EAAE;QAAE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3G,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,wEA0CtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "10.2.
|
|
3
|
+
"version": "10.2.7",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"peerDependencies": {
|
|
161
161
|
"@expo/vector-icons": "^15.0.3",
|
|
162
162
|
"@oxyhq/bloom": ">=0.5.0",
|
|
163
|
-
"@oxyhq/core": "^3.4.
|
|
163
|
+
"@oxyhq/core": "^3.4.9",
|
|
164
164
|
"@react-native-community/netinfo": "^11.4.1",
|
|
165
165
|
"@tanstack/query-async-storage-persister": "^5.100",
|
|
166
166
|
"@tanstack/query-sync-storage-persister": "^5.100",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
+
import { createDebugLogger, normalizeUserIdentity } from '@oxyhq/core';
|
|
2
3
|
import type { User } from '@oxyhq/core';
|
|
3
|
-
import { createDebugLogger } from '@oxyhq/core';
|
|
4
4
|
|
|
5
5
|
const debug = createDebugLogger('AuthStore');
|
|
6
6
|
|
|
@@ -28,7 +28,7 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
28
28
|
loginSuccess: (user: User) => set({
|
|
29
29
|
isLoading: false,
|
|
30
30
|
isAuthenticated: true,
|
|
31
|
-
user,
|
|
31
|
+
user: normalizeUserIdentity(user),
|
|
32
32
|
lastUserFetch: Date.now(),
|
|
33
33
|
}),
|
|
34
34
|
loginFailure: (error: string) => set({ isLoading: false, error }),
|
|
@@ -37,7 +37,7 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
37
37
|
isAuthenticated: false,
|
|
38
38
|
lastUserFetch: null,
|
|
39
39
|
}),
|
|
40
|
-
setUser: (user: User) => set({ user, lastUserFetch: Date.now() }),
|
|
40
|
+
setUser: (user: User) => set({ user: normalizeUserIdentity(user), lastUserFetch: Date.now() }),
|
|
41
41
|
fetchUser: async (oxyServices, forceRefresh = false) => {
|
|
42
42
|
const state = get();
|
|
43
43
|
const now = Date.now();
|
|
@@ -52,7 +52,7 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
52
52
|
|
|
53
53
|
set({ isLoading: true, error: null });
|
|
54
54
|
try {
|
|
55
|
-
const user = await oxyServices.getCurrentUser();
|
|
55
|
+
const user = normalizeUserIdentity(await oxyServices.getCurrentUser());
|
|
56
56
|
set({ user, isLoading: false, isAuthenticated: true, lastUserFetch: now });
|
|
57
57
|
} catch (error) {
|
|
58
58
|
const errorMessage = error instanceof Error ? error.message : 'Failed to fetch user';
|
|
@@ -60,4 +60,4 @@ export const useAuthStore = create<AuthState>((set: (state: Partial<AuthState>)
|
|
|
60
60
|
set({ error: errorMessage, isLoading: false });
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
-
}));
|
|
63
|
+
}));
|