@oxy.so/services 14.1.1 → 14.2.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/components/signIn/OxyEmailPanel.js +2 -1
- package/lib/commonjs/ui/components/signIn/OxyEmailPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +2 -1
- package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -1
- package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js +2 -1
- package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAccountColor.js +16 -8
- package/lib/commonjs/ui/hooks/useAccountColor.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +2 -1
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/utils/withoutWhitespace.js +18 -0
- package/lib/commonjs/ui/utils/withoutWhitespace.js.map +1 -0
- package/lib/module/ui/components/signIn/OxyEmailPanel.js +2 -1
- package/lib/module/ui/components/signIn/OxyEmailPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxySignInPanel.js +2 -1
- package/lib/module/ui/components/signIn/OxySignInPanel.js.map +1 -1
- package/lib/module/ui/components/signIn/OxySignUpPanel.js +2 -1
- package/lib/module/ui/components/signIn/OxySignUpPanel.js.map +1 -1
- package/lib/module/ui/hooks/useAccountColor.js +16 -8
- package/lib/module/ui/hooks/useAccountColor.js.map +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js +2 -1
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/utils/withoutWhitespace.js +14 -0
- package/lib/module/ui/utils/withoutWhitespace.js.map +1 -0
- package/lib/typescript/commonjs/ui/components/signIn/OxyEmailPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAccountColor.d.ts +6 -4
- package/lib/typescript/commonjs/ui/hooks/useAccountColor.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/withoutWhitespace.d.ts +10 -0
- package/lib/typescript/commonjs/ui/utils/withoutWhitespace.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/signIn/OxyEmailPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAccountColor.d.ts +6 -4
- package/lib/typescript/module/ui/hooks/useAccountColor.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/withoutWhitespace.d.ts +10 -0
- package/lib/typescript/module/ui/utils/withoutWhitespace.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/ui/components/signIn/OxyEmailPanel.tsx +2 -1
- package/src/ui/components/signIn/OxySignInPanel.tsx +2 -1
- package/src/ui/components/signIn/OxySignUpPanel.tsx +2 -1
- package/src/ui/hooks/useAccountColor.ts +21 -8
- package/src/ui/screens/AccountMembersScreen.tsx +2 -1
- package/src/ui/utils/withoutWhitespace.ts +11 -0
|
@@ -34,11 +34,13 @@ export declare function entitledAccountColors(user: EntitlementSubject, now?: nu
|
|
|
34
34
|
/**
|
|
35
35
|
* Choose the account's colour: one `updateMe` writes `color` and the portable
|
|
36
36
|
* `themePreference.colorPreset` together (the mode already on the account is
|
|
37
|
-
* kept), the Bloom theme follows at once
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* kept), the Bloom theme follows at once and goes back if the write fails.
|
|
38
|
+
* `colors` is what the picker should list; an app with a stricter rule of its
|
|
39
|
+
* own passes the same `canUse` it gives `useAccountColor`.
|
|
40
40
|
*/
|
|
41
|
-
export declare function useAccountColorSave(
|
|
41
|
+
export declare function useAccountColorSave({ canUse, }?: {
|
|
42
|
+
canUse?: (name: AppColorName) => boolean;
|
|
43
|
+
}): {
|
|
42
44
|
colors: readonly AppColorName[];
|
|
43
45
|
value: AppColorName;
|
|
44
46
|
saveColor: (name: AppColorName) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAW1F,2EAA2E;AAC3E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/D,YAAY,GAAG,IAAI,CAGrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"useAccountColor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useAccountColor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAW1F,2EAA2E;AAC3E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,GAC/D,YAAY,GAAG,IAAI,CAGrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG,IAAI,CAgBZ;AAED,KAAK,kBAAkB,GAAG,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAExF;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,GAAG,GAAE,MAAmB,GACvB,SAAS,YAAY,EAAE,CAYzB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,GACP,GAAE;IACD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CACrC,GAAG;IACP,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,MAAM,EAAE,OAAO,CAAC;CACjB,CA+BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountMembersScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountMembersScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountMembersScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountMembersScreen.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAY3D;;;;GAIG;AACH,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAigBnD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drop every whitespace character, for a field whose value can never hold one:
|
|
3
|
+
* a username, an email address, or the sign-in identifier that is either.
|
|
4
|
+
*
|
|
5
|
+
* A typing aid, like `stripDisallowedUsernameCharacters`: the field never shows
|
|
6
|
+
* a space it would only refuse later, and a pasted ` ada@example.com ` arrives
|
|
7
|
+
* clean. The contract checks still decide.
|
|
8
|
+
*/
|
|
9
|
+
export declare function withoutWhitespace(value: string): string;
|
|
10
|
+
//# sourceMappingURL=withoutWhitespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withoutWhitespace.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/withoutWhitespace.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD"}
|
package/package.json
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
} from './accountFlowParts';
|
|
34
34
|
import { accountSecurityFallback, useAccountSecurityState } from './accountSecurityState';
|
|
35
35
|
import { describeApiError } from '../../utils/apiErrorMessage';
|
|
36
|
+
import { withoutWhitespace } from '../../utils/withoutWhitespace';
|
|
36
37
|
|
|
37
38
|
type Step =
|
|
38
39
|
| { name: 'status' }
|
|
@@ -120,7 +121,7 @@ export const OxyEmailPanel: React.FC<OxyEmailPanelProps> = ({ onDone }) => {
|
|
|
120
121
|
label={t('signInSecurity.email.newLabel')}
|
|
121
122
|
value={address}
|
|
122
123
|
onChange={(value) => {
|
|
123
|
-
setAddress(value);
|
|
124
|
+
setAddress(withoutWhitespace(value));
|
|
124
125
|
if (error) setError(null);
|
|
125
126
|
}}
|
|
126
127
|
onSubmit={submitAddress}
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
isRateLimited,
|
|
83
83
|
retryAfterSeconds,
|
|
84
84
|
} from '../../utils/apiErrorMessage';
|
|
85
|
+
import { withoutWhitespace } from '../../utils/withoutWhitespace';
|
|
85
86
|
|
|
86
87
|
/** Bloom `AuthCard`'s split card width, which the account dialog grows to for it. */
|
|
87
88
|
const SPLIT_WIDTH = 880;
|
|
@@ -819,7 +820,7 @@ export const OxySignInPanel: React.FC<OxySignInPanelProps> = ({
|
|
|
819
820
|
label={t('signin.identifier.label')}
|
|
820
821
|
value={identifier}
|
|
821
822
|
onChange={(value) => {
|
|
822
|
-
setIdentifier(value);
|
|
823
|
+
setIdentifier(withoutWhitespace(value));
|
|
823
824
|
clearError();
|
|
824
825
|
}}
|
|
825
826
|
onSubmit={submitIdentifier}
|
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
EmailCodeStep,
|
|
41
41
|
} from './accountFlowParts';
|
|
42
42
|
import { describeApiError, errorCode, isTicketExpired } from '../../utils/apiErrorMessage';
|
|
43
|
+
import { withoutWhitespace } from '../../utils/withoutWhitespace';
|
|
43
44
|
|
|
44
45
|
/** Commons' own identity-creation deep link. */
|
|
45
46
|
const COMMONS_CREATE_IDENTITY_URL = 'oxycommons://create-identity';
|
|
@@ -231,7 +232,7 @@ export const OxySignUpPanel: React.FC<OxySignUpPanelProps> = ({
|
|
|
231
232
|
label={t('signup.email.label')}
|
|
232
233
|
value={email}
|
|
233
234
|
onChange={(value) => {
|
|
234
|
-
setEmail(value);
|
|
235
|
+
setEmail(withoutWhitespace(value));
|
|
235
236
|
if (error) setError(null);
|
|
236
237
|
}}
|
|
237
238
|
onSubmit={submitEmail}
|
|
@@ -43,14 +43,20 @@ export function useAccountColor({
|
|
|
43
43
|
canUse?: (name: AppColorName) => boolean;
|
|
44
44
|
} = {}): void {
|
|
45
45
|
const { isAuthenticated, user } = useAuth();
|
|
46
|
-
const {
|
|
46
|
+
const { setColorPreset } = useBloomTheme();
|
|
47
47
|
const accountColor = resolveAccountColor(user);
|
|
48
48
|
const allowed = accountColor !== null && (canUse?.(accountColor) ?? true);
|
|
49
49
|
|
|
50
|
+
// Follow the ACCOUNT, never fight the theme: this applies when the account's
|
|
51
|
+
// colour (or the app's permission to wear it) changes, exactly like the mode
|
|
52
|
+
// sync in `useAccountTheme`. Re-running on every local preset change would
|
|
53
|
+
// pull a colour just chosen back to the stored one while its save is still in
|
|
54
|
+
// flight, so the root theme (and every surface painted from it, such as an
|
|
55
|
+
// open settings modal) showed the old colour after a pick.
|
|
50
56
|
useEffect(() => {
|
|
51
|
-
if (!isAuthenticated || !accountColor || !allowed
|
|
57
|
+
if (!isAuthenticated || !accountColor || !allowed) return;
|
|
52
58
|
setColorPreset(accountColor);
|
|
53
|
-
}, [isAuthenticated, accountColor, allowed,
|
|
59
|
+
}, [isAuthenticated, accountColor, allowed, setColorPreset]);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
type EntitlementSubject = Pick<User, 'username' | 'personalization'> | null | undefined;
|
|
@@ -82,11 +88,15 @@ export function entitledAccountColors(
|
|
|
82
88
|
/**
|
|
83
89
|
* Choose the account's colour: one `updateMe` writes `color` and the portable
|
|
84
90
|
* `themePreference.colorPreset` together (the mode already on the account is
|
|
85
|
-
* kept), the Bloom theme follows at once
|
|
86
|
-
*
|
|
87
|
-
*
|
|
91
|
+
* kept), the Bloom theme follows at once and goes back if the write fails.
|
|
92
|
+
* `colors` is what the picker should list; an app with a stricter rule of its
|
|
93
|
+
* own passes the same `canUse` it gives `useAccountColor`.
|
|
88
94
|
*/
|
|
89
|
-
export function useAccountColorSave(
|
|
95
|
+
export function useAccountColorSave({
|
|
96
|
+
canUse,
|
|
97
|
+
}: {
|
|
98
|
+
canUse?: (name: AppColorName) => boolean;
|
|
99
|
+
} = {}): {
|
|
90
100
|
colors: readonly AppColorName[];
|
|
91
101
|
value: AppColorName;
|
|
92
102
|
saveColor: (name: AppColorName) => Promise<void>;
|
|
@@ -95,7 +105,10 @@ export function useAccountColorSave(): {
|
|
|
95
105
|
const { user } = useAuth();
|
|
96
106
|
const { mode, colorPreset, setColorPreset } = useBloomTheme();
|
|
97
107
|
const { mutateAsync, isPending } = useUpdateProfile();
|
|
98
|
-
const colors = useMemo(
|
|
108
|
+
const colors = useMemo(
|
|
109
|
+
() => entitledAccountColors(user).filter((name) => canUse?.(name) ?? true),
|
|
110
|
+
[user, canUse],
|
|
111
|
+
);
|
|
99
112
|
const saveColor = useCallback(
|
|
100
113
|
async (name: AppColorName) => {
|
|
101
114
|
if (!colors.includes(name)) throw new Error('Color is not available for this account');
|
|
@@ -23,6 +23,7 @@ import { useOxy } from '../context/oxyRuntimeContext';
|
|
|
23
23
|
import { useI18n } from '../hooks/useI18n';
|
|
24
24
|
import { useSurfaceHeader } from '../hooks/useSurfaceHeader';
|
|
25
25
|
import { describeApiError } from '../utils/apiErrorMessage';
|
|
26
|
+
import { withoutWhitespace } from '../utils/withoutWhitespace';
|
|
26
27
|
|
|
27
28
|
/** Roles assignable via invite / role change — everything except `owner`. */
|
|
28
29
|
type AssignableRole = Exclude<AccountRole, 'owner'>;
|
|
@@ -310,7 +311,7 @@ const AccountMembersScreen: React.FC<BaseScreenProps> = ({ onClose, goBack, acco
|
|
|
310
311
|
label={t('accounts.members.invite.emailLabel')}
|
|
311
312
|
value={inviteIdentifier}
|
|
312
313
|
onChangeText={(value) => {
|
|
313
|
-
setInviteIdentifier(value);
|
|
314
|
+
setInviteIdentifier(withoutWhitespace(value));
|
|
314
315
|
if (inviteError) setInviteError(null);
|
|
315
316
|
}}
|
|
316
317
|
isInvalid={!!inviteError}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drop every whitespace character, for a field whose value can never hold one:
|
|
3
|
+
* a username, an email address, or the sign-in identifier that is either.
|
|
4
|
+
*
|
|
5
|
+
* A typing aid, like `stripDisallowedUsernameCharacters`: the field never shows
|
|
6
|
+
* a space it would only refuse later, and a pasted ` ada@example.com ` arrives
|
|
7
|
+
* clean. The contract checks still decide.
|
|
8
|
+
*/
|
|
9
|
+
export function withoutWhitespace(value: string): string {
|
|
10
|
+
return value.replace(/\s+/g, '');
|
|
11
|
+
}
|