@ibdop/platform-kit 1.0.12 → 1.0.14

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.
Files changed (63) hide show
  1. package/README.md +0 -0
  2. package/dist/components/ErrorBoundary.d.ts +0 -0
  3. package/dist/components/ErrorBoundary.d.ts.map +0 -0
  4. package/dist/components/Notification.d.ts +0 -0
  5. package/dist/components/Notification.d.ts.map +0 -0
  6. package/dist/components/VersionInfo.d.ts +0 -0
  7. package/dist/components/VersionInfo.d.ts.map +0 -0
  8. package/dist/components/index.d.ts +0 -0
  9. package/dist/components/index.d.ts.map +0 -0
  10. package/dist/hooks/index.d.ts +2 -1
  11. package/dist/hooks/index.d.ts.map +1 -1
  12. package/dist/hooks/useApi.d.ts +13 -2
  13. package/dist/hooks/useApi.d.ts.map +1 -1
  14. package/dist/hooks/useFeatures.d.ts +0 -0
  15. package/dist/hooks/useFeatures.d.ts.map +0 -0
  16. package/dist/hooks/useInfoData.d.ts +0 -0
  17. package/dist/hooks/useInfoData.d.ts.map +0 -0
  18. package/dist/hooks/usePermissions.d.ts +0 -0
  19. package/dist/hooks/usePermissions.d.ts.map +0 -0
  20. package/dist/hooks/useShellAuth.d.ts +0 -0
  21. package/dist/hooks/useShellAuth.d.ts.map +0 -0
  22. package/dist/hooks/useV1Config.d.ts +0 -0
  23. package/dist/hooks/useV1Config.d.ts.map +0 -0
  24. package/dist/index.d.ts +0 -0
  25. package/dist/index.d.ts.map +0 -0
  26. package/dist/index.js +10 -10
  27. package/dist/index.mjs +854 -809
  28. package/dist/index.umd.js +9 -9
  29. package/dist/services/api.d.ts +0 -0
  30. package/dist/services/api.d.ts.map +1 -1
  31. package/dist/services/index.d.ts +0 -0
  32. package/dist/services/index.d.ts.map +0 -0
  33. package/dist/services/logger.d.ts +0 -0
  34. package/dist/services/logger.d.ts.map +0 -0
  35. package/dist/types/index.d.ts +0 -23
  36. package/dist/types/index.d.ts.map +1 -1
  37. package/dist/utils/index.d.ts +0 -0
  38. package/dist/utils/index.d.ts.map +0 -0
  39. package/dist/utils/mfeName.d.ts +0 -0
  40. package/dist/utils/mfeName.d.ts.map +0 -0
  41. package/dist/utils/shellAuth.d.ts +1 -0
  42. package/dist/utils/shellAuth.d.ts.map +1 -1
  43. package/package.json +1 -1
  44. package/src/components/ErrorBoundary.tsx +0 -0
  45. package/src/components/Notification.tsx +0 -0
  46. package/src/components/VersionInfo.tsx +0 -0
  47. package/src/components/index.ts +0 -0
  48. package/src/global.d.ts +0 -0
  49. package/src/hooks/index.ts +2 -1
  50. package/src/hooks/useApi.ts +48 -40
  51. package/src/hooks/useFeatures.ts +0 -0
  52. package/src/hooks/useInfoData.ts +0 -0
  53. package/src/hooks/usePermissions.ts +0 -0
  54. package/src/hooks/useShellAuth.ts +0 -0
  55. package/src/hooks/useV1Config.ts +0 -0
  56. package/src/index.ts +0 -0
  57. package/src/services/api.ts +12 -1
  58. package/src/services/index.ts +0 -0
  59. package/src/services/logger.ts +0 -0
  60. package/src/types/index.ts +1 -24
  61. package/src/utils/index.ts +0 -0
  62. package/src/utils/mfeName.ts +0 -0
  63. package/src/utils/shellAuth.ts +31 -1
@@ -41,6 +41,7 @@ export function getShellAuth(): ShellAuth | null {
41
41
  export function getAuthState(): {
42
42
  isAuthenticated: boolean
43
43
  user?: {
44
+ access_token?: string
44
45
  profile?: {
45
46
  access_token?: string
46
47
  }
@@ -52,9 +53,38 @@ export function getAuthState(): {
52
53
  return { isAuthenticated: false }
53
54
  }
54
55
 
56
+ // Try to get token from auth.user or auth.user.profile
57
+ // Also try getAccessToken() method if available
58
+ let accessToken: string | undefined
59
+
60
+ // Use type assertion for auth object that may have getAccessToken method
61
+ const authWithToken = auth as unknown as {
62
+ getAccessToken?: () => Promise<string> | string
63
+ }
64
+
65
+ if (auth.user?.access_token) {
66
+ accessToken = auth.user.access_token
67
+ } else if (auth.user?.profile?.access_token) {
68
+ accessToken = auth.user.profile.access_token
69
+ } else if (typeof authWithToken.getAccessToken === 'function') {
70
+ // Try to get token via getAccessToken method (react-oidc-context)
71
+ try {
72
+ const token = authWithToken.getAccessToken()
73
+ // getAccessToken can return Promise or string
74
+ if (token instanceof Promise) {
75
+ // Handle async token - this shouldn't happen in sync context but just in case
76
+ console.warn('[shellAuth] getAccessToken returned Promise - token may not be available synchronously')
77
+ } else if (typeof token === 'string') {
78
+ accessToken = token
79
+ }
80
+ } catch (e) {
81
+ console.warn('[shellAuth] Failed to get access token via getAccessToken:', e)
82
+ }
83
+ }
84
+
55
85
  return {
56
86
  isAuthenticated: auth.isAuthenticated,
57
- user: auth.user ?? undefined,
87
+ user: auth.user ? { ...auth.user, access_token: accessToken } : undefined,
58
88
  }
59
89
  }
60
90