@oxy.so/services 11.16.1 → 12.1.0

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 (47) hide show
  1. package/lib/commonjs/ui/client.js +33 -0
  2. package/lib/commonjs/ui/client.js.map +1 -1
  3. package/lib/commonjs/ui/components/OxyAuthChooser.js +1 -6
  4. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  5. package/lib/commonjs/ui/components/ProfileButton.js +2 -4
  6. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
  7. package/lib/commonjs/ui/hooks/useUsernameAvailability.js +3 -3
  8. package/lib/commonjs/ui/hooks/useUsernameAvailability.js.map +1 -1
  9. package/lib/commonjs/ui/navigation/accountDialogManager.js +5 -4
  10. package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
  11. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +4 -4
  12. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  13. package/lib/module/ui/client.js +5 -0
  14. package/lib/module/ui/client.js.map +1 -1
  15. package/lib/module/ui/components/OxyAuthChooser.js +1 -6
  16. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  17. package/lib/module/ui/components/ProfileButton.js +2 -4
  18. package/lib/module/ui/components/ProfileButton.js.map +1 -1
  19. package/lib/module/ui/hooks/useUsernameAvailability.js +3 -3
  20. package/lib/module/ui/hooks/useUsernameAvailability.js.map +1 -1
  21. package/lib/module/ui/navigation/accountDialogManager.js +5 -4
  22. package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
  23. package/lib/module/ui/screens/EditProfileFieldScreen.js +3 -3
  24. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  25. package/lib/typescript/commonjs/ui/client.d.ts +6 -0
  26. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  27. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  28. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +0 -2
  29. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +5 -5
  31. package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  33. package/lib/typescript/module/ui/client.d.ts +6 -0
  34. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  35. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  36. package/lib/typescript/module/ui/components/ProfileButton.d.ts +0 -2
  37. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
  38. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +5 -5
  39. package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
  40. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/ui/client.ts +15 -0
  43. package/src/ui/components/OxyAuthChooser.tsx +1 -6
  44. package/src/ui/components/ProfileButton.tsx +2 -12
  45. package/src/ui/hooks/useUsernameAvailability.ts +3 -3
  46. package/src/ui/navigation/accountDialogManager.ts +5 -5
  47. package/src/ui/screens/EditProfileFieldScreen.tsx +6 -3
package/src/ui/client.ts CHANGED
@@ -20,6 +20,12 @@ export type { OxyAuthPromptProps } from './components/OxyAuthPrompt';
20
20
  export { LogoIcon } from './components/logo/LogoIcon';
21
21
  export { LogoText } from './components/logo/LogoText';
22
22
  export { default as FollowButton } from './components/FollowButton';
23
+ export { FollowTargetButton } from './components/FollowTargetButton';
24
+ export type {
25
+ FollowTargetButtonProps,
26
+ FollowVerb,
27
+ FollowLabels,
28
+ } from './components/FollowTargetButton';
23
29
  export { default as ProfileButton } from './components/ProfileButton';
24
30
  export type { ProfileButtonProps } from './components/ProfileButton';
25
31
  export { default as PeableButton } from './components/PeableButton';
@@ -34,11 +40,20 @@ export { useOxy, useOptionalOxy, OxyProviderMissingError } from './context/OxyCo
34
40
 
35
41
  // Hooks
36
42
  export { useAuth } from './hooks/useAuth';
43
+ // This app's Oxy-signed assertion of which app it is (ADR 0045), for an SDK
44
+ // that attaches it to its own requests without pulling in the account screens.
45
+ export {
46
+ useAppAssertion,
47
+ AppAssertionProviderMissingError,
48
+ } from './appAssertion/AppAssertionContext';
49
+ export type { UseAppAssertionResult } from './appAssertion/AppAssertionContext';
50
+ export type { AppAssertionSnapshot, AppAssertionStatus } from './appAssertion/appAssertionManager';
37
51
  export type { AuthState, AuthActions, SignInOutcome, UseAuthReturn } from './hooks/useAuth';
38
52
  export { createDeferredProductAnalytics } from './analytics/productAnalytics';
39
53
  export type { OxyProductEvent, ProductAnalytics } from './analytics/productAnalytics';
40
54
  export { useFollow, useFollowerCounts, useSeedFollowStatuses } from './hooks/useFollow';
41
55
  export { useFollowTarget } from './hooks/useFollowTarget';
56
+ export { useSupervision, supervisionQueryKeys } from './hooks/queries/useSupervision';
42
57
  export type { UseFollowTargetResult } from './hooks/useFollowTarget';
43
58
  export {
44
59
  useUserProfile,
@@ -284,13 +284,8 @@ const OxyAuthChooser: React.FC<OxyAuthChooserProps> = ({ onComplete }) => {
284
284
  );
285
285
 
286
286
  const handleManage = useCallback(() => {
287
- if (consumerHooks?.onNavigateManage) {
288
- onComplete?.();
289
- consumerHooks.onNavigateManage();
290
- return;
291
- }
292
287
  showBottomSheet?.('ManageAccount');
293
- }, [consumerHooks, onComplete, showBottomSheet]);
288
+ }, [showBottomSheet]);
294
289
 
295
290
  const handleAdd = useCallback(() => {
296
291
  if (consumerHooks?.onAddAccount) {
@@ -33,8 +33,6 @@ export interface ProfileButtonProps {
33
33
  * Avatar diameter in px. Defaults to 40 when expanded, 32 when collapsed.
34
34
  */
35
35
  avatarSize?: number;
36
- /** Navigate to the "Manage account" surface (settings). */
37
- onNavigateManage?: () => void;
38
36
  /** Start the add-account / sign-in flow for an additional account. */
39
37
  onAddAccount?: () => void;
40
38
  /** Optional: navigate to the signed-in user's own profile. */
@@ -63,7 +61,6 @@ export interface ProfileButtonProps {
63
61
  const ProfileButton: React.FC<ProfileButtonProps> = ({
64
62
  expanded = true,
65
63
  avatarSize,
66
- onNavigateManage,
67
64
  onAddAccount,
68
65
  onNavigateProfile,
69
66
  menuItems,
@@ -83,23 +80,16 @@ const ProfileButton: React.FC<ProfileButtonProps> = ({
83
80
  }, [openAccountDialog]);
84
81
 
85
82
  useEffect(() => {
86
- if (
87
- !onNavigateManage &&
88
- !onAddAccount &&
89
- !onNavigateProfile &&
90
- !menuItems?.length &&
91
- !menuSections?.length
92
- ) {
83
+ if (!onAddAccount && !onNavigateProfile && !menuItems?.length && !menuSections?.length) {
93
84
  return undefined;
94
85
  }
95
86
  return registerAccountDialogConsumerHooks({
96
- onNavigateManage,
97
87
  onAddAccount,
98
88
  onNavigateProfile,
99
89
  menuItems,
100
90
  menuSections,
101
91
  });
102
- }, [onNavigateManage, onAddAccount, onNavigateProfile, menuItems, menuSections]);
92
+ }, [onAddAccount, onNavigateProfile, menuItems, menuSections]);
103
93
 
104
94
  const avatarUrl = useMemo(
105
95
  () => (user?.avatar ? oxyServices.assets.publicUrl(user.avatar, 'thumb') : undefined),
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
- import { usernameSchema } from '@oxy.so/contracts';
2
+ import { usernameCheck } from '@oxy.so/contracts/client';
3
3
  import { useOxy } from '../context/oxyRuntimeContext';
4
4
 
5
5
  type CheckResult = { candidate: string; status: 'available' | 'taken' | 'error' };
@@ -8,8 +8,8 @@ type CheckResult = { candidate: string; status: 'available' | 'taken' | 'error'
8
8
  export function useUsernameAvailability(value: string, enabled: boolean) {
9
9
  const { oxyServices, user } = useOxy();
10
10
  const candidate = value.trim();
11
- const parsed = usernameSchema.safeParse(candidate);
12
- const invalid = parsed.success ? undefined : parsed.error.issues[0]?.message;
11
+ const checked = usernameCheck(candidate, []);
12
+ const invalid = checked.ok ? undefined : checked.issue.message;
13
13
  const unchanged = candidate.toLowerCase() === user?.username?.toLowerCase();
14
14
  const [result, setResult] = useState<CheckResult>();
15
15
  const [attempt, setAttempt] = useState(0);
@@ -46,11 +46,11 @@ export interface AccountDialogControls {
46
46
 
47
47
  /**
48
48
  * Optional consumer overrides for account-dialog actions. `ProfileButton` (and
49
- * similar hosts) register these while mounted so inbox/accounts can route
50
- * "Manage" / "Add account" to app-local navigation instead of the SDK default.
49
+ * similar hosts) register these while mounted so an app can route "Add account"
50
+ * and "Profile" to app-local navigation, and add its own menu entries. "Manage
51
+ * your Oxy account" is not overridable: it always opens the SDK's ManageAccount.
51
52
  */
52
53
  export interface AccountDialogConsumerHooks {
53
- onNavigateManage?: () => void;
54
54
  onAddAccount?: () => void;
55
55
  onNavigateProfile?: () => void;
56
56
  menuItems?: readonly AccountDialogMenuItem[];
@@ -77,7 +77,7 @@ export function registerAccountDialogControls(next: AccountDialogControls): () =
77
77
  };
78
78
  }
79
79
 
80
- /** Register app-local manage/add/profile handlers for the account dialog. */
80
+ /** Register app-local add/profile handlers and menu entries for the account dialog. */
81
81
  export function registerAccountDialogConsumerHooks(
82
82
  next: AccountDialogConsumerHooks | null,
83
83
  ): () => void {
@@ -95,7 +95,7 @@ export function getAccountDialogConsumerHooks(): AccountDialogConsumerHooks | nu
95
95
  return consumerHooks;
96
96
  }
97
97
 
98
- /** Subscribe to consumer-hook registration changes (menu items, manage/add overrides). */
98
+ /** Subscribe to consumer-hook registration changes (menu items, add/profile overrides). */
99
99
  export function subscribeToAccountDialogConsumerHooks(listener: () => void): () => void {
100
100
  consumerHookListeners.add(listener);
101
101
  return () => {
@@ -9,7 +9,10 @@ import { PhoneInput, COUNTRIES, findCountry } from '@oxy.so/bloom/phone-input';
9
9
  import { Textarea } from '@oxy.so/bloom/textarea';
10
10
  import { DatePicker } from '@oxy.so/bloom/date-picker';
11
11
  import { Field } from '@oxy.so/bloom/field';
12
- import { usernameSchema, USERNAME_INVALID_MESSAGE } from '@oxy.so/contracts';
12
+ import {
13
+ USERNAME_INVALID_MESSAGE,
14
+ usernameCheck as usernamePolicyCheck,
15
+ } from '@oxy.so/contracts/client';
13
16
  import { useUsernameAvailability } from '../hooks/useUsernameAvailability';
14
17
  import { GroupedSection, GroupedSectionItem } from '@oxy.so/bloom/grouped-section';
15
18
  import type { User } from '@oxy.so/core';
@@ -257,8 +260,8 @@ const EditProfileFieldScreen: React.FC<EditProfileFieldScreenProps> = ({
257
260
  label: t('editProfile.items.username.label') || 'Username',
258
261
  placeholder: t('editProfile.items.username.placeholder') || 'Choose a username',
259
262
  validation: (value) => {
260
- const parsed = usernameSchema.safeParse(value);
261
- return parsed.success ? undefined : parsed.error.issues[0]?.message;
263
+ const checked = usernamePolicyCheck(value, []);
264
+ return checked.ok ? undefined : checked.issue.message;
262
265
  },
263
266
  inputProps: {
264
267
  autoCapitalize: 'none',