@oxyhq/services 13.0.3 → 13.1.1

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 (78) hide show
  1. package/lib/commonjs/index.js +18 -0
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/components/ProfileButton.js +233 -0
  4. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -0
  5. package/lib/commonjs/ui/components/ProfileMenu.js +374 -0
  6. package/lib/commonjs/ui/components/ProfileMenu.js.map +1 -0
  7. package/lib/commonjs/ui/components/SettingsIcon.js.map +1 -1
  8. package/lib/commonjs/ui/components/fileManagement/FileViewer.js.map +1 -1
  9. package/lib/commonjs/ui/context/OxyContext.js +64 -11
  10. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  11. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +28 -1
  12. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  13. package/lib/commonjs/ui/index.js +14 -0
  14. package/lib/commonjs/ui/index.js.map +1 -1
  15. package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
  16. package/lib/commonjs/ui/utils/activeAuthuser.js +47 -0
  17. package/lib/commonjs/ui/utils/activeAuthuser.js.map +1 -1
  18. package/lib/module/index.js +5 -0
  19. package/lib/module/index.js.map +1 -1
  20. package/lib/module/ui/components/ProfileButton.js +228 -0
  21. package/lib/module/ui/components/ProfileButton.js.map +1 -0
  22. package/lib/module/ui/components/ProfileMenu.js +370 -0
  23. package/lib/module/ui/components/ProfileMenu.js.map +1 -0
  24. package/lib/module/ui/components/SettingsIcon.js.map +1 -1
  25. package/lib/module/ui/components/fileManagement/FileViewer.js.map +1 -1
  26. package/lib/module/ui/context/OxyContext.js +65 -12
  27. package/lib/module/ui/context/OxyContext.js.map +1 -1
  28. package/lib/module/ui/context/hooks/useAuthOperations.js +29 -2
  29. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  30. package/lib/module/ui/index.js +2 -0
  31. package/lib/module/ui/index.js.map +1 -1
  32. package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
  33. package/lib/module/ui/utils/activeAuthuser.js +45 -1
  34. package/lib/module/ui/utils/activeAuthuser.js.map +1 -1
  35. package/lib/typescript/commonjs/index.d.ts +4 -0
  36. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +46 -0
  38. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts +39 -0
  40. package/lib/typescript/commonjs/ui/components/ProfileMenu.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts +2 -1
  42. package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/ui/components/payment/types.d.ts +3 -1
  44. package/lib/typescript/commonjs/ui/components/payment/types.d.ts.map +1 -1
  45. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  46. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  47. package/lib/typescript/commonjs/ui/index.d.ts +2 -0
  48. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts +24 -0
  50. package/lib/typescript/commonjs/ui/utils/activeAuthuser.d.ts.map +1 -1
  51. package/lib/typescript/module/index.d.ts +4 -0
  52. package/lib/typescript/module/index.d.ts.map +1 -1
  53. package/lib/typescript/module/ui/components/ProfileButton.d.ts +46 -0
  54. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -0
  55. package/lib/typescript/module/ui/components/ProfileMenu.d.ts +39 -0
  56. package/lib/typescript/module/ui/components/ProfileMenu.d.ts.map +1 -0
  57. package/lib/typescript/module/ui/components/SettingsIcon.d.ts +2 -1
  58. package/lib/typescript/module/ui/components/SettingsIcon.d.ts.map +1 -1
  59. package/lib/typescript/module/ui/components/payment/types.d.ts +3 -1
  60. package/lib/typescript/module/ui/components/payment/types.d.ts.map +1 -1
  61. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  62. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  63. package/lib/typescript/module/ui/index.d.ts +2 -0
  64. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  65. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts +24 -0
  66. package/lib/typescript/module/ui/utils/activeAuthuser.d.ts.map +1 -1
  67. package/package.json +5 -4
  68. package/src/index.ts +8 -0
  69. package/src/ui/components/ProfileButton.tsx +270 -0
  70. package/src/ui/components/ProfileMenu.tsx +416 -0
  71. package/src/ui/components/SettingsIcon.tsx +2 -2
  72. package/src/ui/components/fileManagement/FileViewer.tsx +1 -1
  73. package/src/ui/components/payment/types.ts +3 -1
  74. package/src/ui/context/OxyContext.tsx +65 -11
  75. package/src/ui/context/hooks/useAuthOperations.ts +35 -2
  76. package/src/ui/index.ts +2 -0
  77. package/src/ui/screens/FeedbackScreen.tsx +3 -3
  78. package/src/ui/utils/activeAuthuser.ts +46 -0
@@ -12,7 +12,7 @@ import type { BaseScreenProps } from '../types/navigation';
12
12
  import { normalizeTheme } from '@oxyhq/core';
13
13
  import { packageInfo } from '@oxyhq/core';
14
14
  import { useTheme } from '@oxyhq/bloom/theme';
15
- import { Ionicons } from '@expo/vector-icons';
15
+ import { Ionicons, MaterialCommunityIcons } from '@expo/vector-icons';
16
16
  import { toast } from '@oxyhq/bloom';
17
17
  import { H2, Text } from '@oxyhq/bloom/typography';
18
18
  import { Button } from '@oxyhq/bloom/button';
@@ -38,7 +38,7 @@ const LAST_STEP_INDEX = TOTAL_STEPS - 1;
38
38
  const SUCCESS_RESET_DELAY_MS = 3000;
39
39
 
40
40
  /** Maps each feedback type to a Bloom theme role + MaterialCommunityIcons glyph. */
41
- const TYPE_ICON_GLYPH: Record<FeedbackData['type'], string> = {
41
+ const TYPE_ICON_GLYPH: Record<FeedbackData['type'], React.ComponentProps<typeof MaterialCommunityIcons>['name']> = {
42
42
  bug: 'bug',
43
43
  feature: 'lightbulb-on',
44
44
  general: 'chat',
@@ -46,7 +46,7 @@ const TYPE_ICON_GLYPH: Record<FeedbackData['type'], string> = {
46
46
  };
47
47
 
48
48
  /** Maps each priority level to a MaterialCommunityIcons glyph. */
49
- const PRIORITY_ICON_GLYPH: Record<FeedbackData['priority'], string> = {
49
+ const PRIORITY_ICON_GLYPH: Record<FeedbackData['priority'], React.ComponentProps<typeof MaterialCommunityIcons>['name']> = {
50
50
  low: 'arrow-down',
51
51
  medium: 'minus',
52
52
  high: 'arrow-up',
@@ -24,6 +24,8 @@ import {
24
24
  ssoGuardKey,
25
25
  ssoStateKey,
26
26
  ssoDestKey,
27
+ ssoSignedOutKey,
28
+ silentRestoreSuppressed,
27
29
  } from '@oxyhq/core';
28
30
 
29
31
  const ACTIVE_AUTHUSER_KEY = 'oxy_active_authuser';
@@ -92,6 +94,50 @@ export function clearActiveAuthuser(): void {
92
94
  }
93
95
  }
94
96
 
97
+ /**
98
+ * Mark this origin as DELIBERATELY signed out (durable `localStorage`, via the
99
+ * core {@link ssoSignedOutKey}). Called ONLY on EXPLICIT full sign-out so that
100
+ * the next cold boot does NOT silently re-mint a session from a still-live IdP
101
+ * session (`fedcm-silent` / per-apex `/auth/silent` iframe). Cleared by any
102
+ * deliberate sign-in (see {@link clearSignedOut}). No-ops on native / storage
103
+ * failure (best-effort).
104
+ */
105
+ export function markSignedOut(): void {
106
+ if (!hasLocalStorage()) return;
107
+ try {
108
+ window.localStorage.setItem(ssoSignedOutKey(window.location.origin), '1');
109
+ } catch {
110
+ // Best-effort; swallow QuotaExceededError / SecurityError (private mode).
111
+ }
112
+ }
113
+
114
+ /**
115
+ * Clear the durable deliberately-signed-out flag. Called on ANY deliberate
116
+ * sign-in (password, FedCM, account switch, device claim) so a real sign-in
117
+ * fully re-enables automatic silent restore — there is no "stuck signed out"
118
+ * state. No-ops on native / storage failure.
119
+ */
120
+ export function clearSignedOut(): void {
121
+ if (!hasLocalStorage()) return;
122
+ try {
123
+ window.localStorage.removeItem(ssoSignedOutKey(window.location.origin));
124
+ } catch {
125
+ // Best-effort.
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Whether AUTOMATIC silent restore is suppressed for the current origin because
131
+ * the user deliberately signed out. Reads the durable flag through the core
132
+ * {@link silentRestoreSuppressed} predicate. Returns `false` off-web and on any
133
+ * storage failure (fail safe toward normal restore). Used to gate the
134
+ * `fedcm-silent` and `silent-iframe` cold-boot steps.
135
+ */
136
+ export function isSilentRestoreSuppressed(): boolean {
137
+ if (!hasLocalStorage()) return false;
138
+ return silentRestoreSuppressed(window.localStorage, window.location.origin);
139
+ }
140
+
95
141
  /**
96
142
  * Clear all per-origin SSO bounce sessionStorage keys. Called ONLY on EXPLICIT
97
143
  * user sign-out (logout / logoutAll) — never on a cold-boot failure path — so a