@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.
- package/lib/commonjs/ui/client.js +33 -0
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +1 -6
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +2 -4
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/hooks/useUsernameAvailability.js +3 -3
- package/lib/commonjs/ui/hooks/useUsernameAvailability.js.map +1 -1
- package/lib/commonjs/ui/navigation/accountDialogManager.js +5 -4
- package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +4 -4
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/client.js +5 -0
- package/lib/module/ui/client.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +1 -6
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +2 -4
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/hooks/useUsernameAvailability.js +3 -3
- package/lib/module/ui/hooks/useUsernameAvailability.js.map +1 -1
- package/lib/module/ui/navigation/accountDialogManager.js +5 -4
- package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +3 -3
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +6 -0
- package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +0 -2
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +5 -5
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +6 -0
- package/lib/typescript/module/ui/client.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts +0 -2
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +5 -5
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ui/client.ts +15 -0
- package/src/ui/components/OxyAuthChooser.tsx +1 -6
- package/src/ui/components/ProfileButton.tsx +2 -12
- package/src/ui/hooks/useUsernameAvailability.ts +3 -3
- package/src/ui/navigation/accountDialogManager.ts +5 -5
- 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
|
-
}, [
|
|
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
|
-
}, [
|
|
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 {
|
|
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
|
|
12
|
-
const invalid =
|
|
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
|
|
50
|
-
*
|
|
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
|
|
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,
|
|
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 {
|
|
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
|
|
261
|
-
return
|
|
263
|
+
const checked = usernamePolicyCheck(value, []);
|
|
264
|
+
return checked.ok ? undefined : checked.issue.message;
|
|
262
265
|
},
|
|
263
266
|
inputProps: {
|
|
264
267
|
autoCapitalize: 'none',
|