@oxyhq/services 26.2.0 → 27.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/index.js +50 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +3 -5
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/FollowTargetButton.js +292 -0
- package/lib/commonjs/ui/components/FollowTargetButton.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +14 -6
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +16 -3
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +164 -10
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollowTarget.js +140 -0
- package/lib/commonjs/ui/hooks/useFollowTarget.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +49 -6
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +6 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +73 -40
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/followTargetStore.js +113 -0
- package/lib/commonjs/ui/stores/followTargetStore.js.map +1 -0
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js +2 -0
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +5 -0
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/index.js +8 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +3 -5
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/FollowTargetButton.js +287 -0
- package/lib/module/ui/components/FollowTargetButton.js.map +1 -0
- package/lib/module/ui/components/authChooser/requestSurfaces.js +15 -7
- package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +16 -3
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +161 -10
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/module/ui/hooks/useFollowTarget.js +136 -0
- package/lib/module/ui/hooks/useFollowTarget.js.map +1 -0
- package/lib/module/ui/screens/AccountMembersScreen.js +49 -6
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +6 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +74 -41
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/stores/followTargetStore.js +107 -0
- package/lib/module/ui/stores/followTargetStore.js.map +1 -0
- package/lib/module/ui/stores/resetSessionScopedStores.js +2 -0
- package/lib/module/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +5 -0
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +7 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts +119 -0
- package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +6 -1
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +79 -2
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useFollowTarget.d.ts +41 -0
- package/lib/typescript/commonjs/ui/hooks/useFollowTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts +70 -0
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +7 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowTargetButton.d.ts +119 -0
- package/lib/typescript/module/ui/components/FollowTargetButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +6 -1
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +79 -2
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useFollowTarget.d.ts +41 -0
- package/lib/typescript/module/ui/hooks/useFollowTarget.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts +70 -0
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts.map +1 -0
- package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +26 -3
- package/src/ui/components/FollowButton.tsx +3 -5
- package/src/ui/components/FollowTargetButton.tsx +326 -0
- package/src/ui/components/__tests__/followTargetButton.test.ts +132 -0
- package/src/ui/components/authChooser/requestSurfaces.tsx +12 -4
- package/src/ui/hooks/mutations/useAccountMutations.ts +20 -3
- package/src/ui/hooks/queries/__tests__/userCacheClear.test.ts +301 -0
- package/src/ui/hooks/queries/userCache.ts +211 -10
- package/src/ui/hooks/useFollowTarget.ts +194 -0
- package/src/ui/screens/AccountMembersScreen.tsx +62 -6
- package/src/ui/screens/AccountSettingsScreen.tsx +9 -1
- package/src/ui/screens/CreateAccountScreen.tsx +66 -36
- package/src/ui/stores/__tests__/resetSessionScopedStores.test.ts +23 -0
- package/src/ui/stores/followTargetStore.ts +119 -0
- package/src/ui/stores/resetSessionScopedStores.ts +2 -0
- package/src/ui/utils/avatarUtils.ts +9 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `FollowTargetButton` — one button for everything an Oxy user can follow.
|
|
3
|
+
*
|
|
4
|
+
* Follows a TARGET of any registered kind: a person, a topic, a channel, a
|
|
5
|
+
* store, an artist. Nothing in this file branches on what the target is, which
|
|
6
|
+
* is the property that lets an application this package has never heard of use
|
|
7
|
+
* it without a release.
|
|
8
|
+
*
|
|
9
|
+
* ## Two controls, not one
|
|
10
|
+
*
|
|
11
|
+
* The main press does the obvious thing. The chevron beside it opens the
|
|
12
|
+
* choices that a single press cannot express — follow for a while, stop showing
|
|
13
|
+
* this here without giving it up everywhere — and those belong behind a
|
|
14
|
+
* disclosure precisely because they are not what most people want most of the
|
|
15
|
+
* time. Bloom's `Menu` renders as a bottom sheet on native and a dropdown on
|
|
16
|
+
* web, so this is one component and not a platform fork.
|
|
17
|
+
*
|
|
18
|
+
* ## Verbs
|
|
19
|
+
*
|
|
20
|
+
* "Follow" is wrong for half the things in the ecosystem: you subscribe to a
|
|
21
|
+
* channel, you join a community, you watch a listing. The verb is a prop with a
|
|
22
|
+
* small vocabulary of defaults and a full override, rather than a lookup keyed
|
|
23
|
+
* on kind — a kind→verb table in this package would need a release every time
|
|
24
|
+
* an application invents a kind, which is exactly the coupling #809 removes.
|
|
25
|
+
*
|
|
26
|
+
* ## Relationship to the legacy `FollowButton`
|
|
27
|
+
*
|
|
28
|
+
* `FollowButton` follows a USER through the Mongo-backed social graph and
|
|
29
|
+
* remains the correct component for that until the user graph is migrated onto
|
|
30
|
+
* `/v2/follows`. When it is, that component is deleted and this one takes the
|
|
31
|
+
* name — not aliased, not deprecated in place.
|
|
32
|
+
*/
|
|
33
|
+
import type { FollowApplicationMode } from '@oxyhq/contracts';
|
|
34
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
35
|
+
/**
|
|
36
|
+
* The small vocabulary of verbs the ecosystem actually uses. An application
|
|
37
|
+
* whose verb is not here passes `labels` instead — the escape hatch exists so
|
|
38
|
+
* this union never has to grow to accommodate one product's wording.
|
|
39
|
+
*/
|
|
40
|
+
export type FollowVerb = 'follow' | 'subscribe' | 'join' | 'watch';
|
|
41
|
+
export interface FollowLabels {
|
|
42
|
+
/** Not following yet. */
|
|
43
|
+
idle: string;
|
|
44
|
+
/** Following, and this application acts on it. */
|
|
45
|
+
active: string;
|
|
46
|
+
/** Asked, waiting for the other side to accept. */
|
|
47
|
+
pending: string;
|
|
48
|
+
/** Following globally, but switched off in this application. */
|
|
49
|
+
disabled: string;
|
|
50
|
+
}
|
|
51
|
+
/** A timed-follow choice offered in the menu. */
|
|
52
|
+
export interface FollowDuration {
|
|
53
|
+
label: string;
|
|
54
|
+
seconds: number;
|
|
55
|
+
}
|
|
56
|
+
/** One line in the disclosure menu. */
|
|
57
|
+
export interface FollowMenuItem {
|
|
58
|
+
key: string;
|
|
59
|
+
label: string;
|
|
60
|
+
/** What the component should call. Named so the table below stays pure. */
|
|
61
|
+
action: {
|
|
62
|
+
type: 'follow-timed';
|
|
63
|
+
seconds: number;
|
|
64
|
+
durationLabel: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: 'enable-here';
|
|
67
|
+
} | {
|
|
68
|
+
type: 'disable-here';
|
|
69
|
+
} | {
|
|
70
|
+
type: 'unfollow';
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Which choices exist, given the state.
|
|
75
|
+
*
|
|
76
|
+
* Pure and exported because this is the product decision, not a rendering
|
|
77
|
+
* detail: a timed follow is only offered before following, turning it off here
|
|
78
|
+
* is only offered while following, and NEITHER is offered before the server has
|
|
79
|
+
* answered — every one of them addresses a relationship that does not exist
|
|
80
|
+
* yet, so offering them mid-write would mean sending a guessed id.
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildFollowMenuItems(input: {
|
|
83
|
+
following: boolean;
|
|
84
|
+
applicationMode: FollowApplicationMode;
|
|
85
|
+
hasRelationship: boolean;
|
|
86
|
+
isPending: boolean;
|
|
87
|
+
durations: FollowDuration[] | false;
|
|
88
|
+
idleVerb: string;
|
|
89
|
+
applicationName: string;
|
|
90
|
+
}): FollowMenuItem[];
|
|
91
|
+
export interface FollowTargetButtonProps {
|
|
92
|
+
/** The registered target's id. Registration is separate — see the SDK. */
|
|
93
|
+
targetId: string;
|
|
94
|
+
verb?: FollowVerb;
|
|
95
|
+
/** Full override, for a verb the vocabulary above does not carry. */
|
|
96
|
+
labels?: Partial<FollowLabels>;
|
|
97
|
+
size?: 'small' | 'medium' | 'large';
|
|
98
|
+
style?: StyleProp<ViewStyle>;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Hide the chevron. For a dense list row where the extra target is more
|
|
102
|
+
* likely to be hit by accident than used on purpose.
|
|
103
|
+
*/
|
|
104
|
+
showOptions?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Offer timed follows. Pass `false` where a temporary follow makes no sense —
|
|
107
|
+
* a store you buy from, an account you know.
|
|
108
|
+
*/
|
|
109
|
+
durations?: FollowDuration[] | false;
|
|
110
|
+
/**
|
|
111
|
+
* This application's name, for the menu line that turns the follow off here.
|
|
112
|
+
* "Don't show in Mention" is a sentence the user can act on; "disable in this
|
|
113
|
+
* application" is not.
|
|
114
|
+
*/
|
|
115
|
+
applicationName?: string;
|
|
116
|
+
onChange?: (following: boolean) => void;
|
|
117
|
+
}
|
|
118
|
+
export declare const FollowTargetButton: import("react").NamedExoticComponent<FollowTargetButtonProps>;
|
|
119
|
+
//# sourceMappingURL=FollowTargetButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FollowTargetButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/FollowTargetButton.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;AAEnE,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAcD,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MA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AC;IACzB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,kBAAkB,+DA2I7B,CAAC"}
|
|
@@ -15,7 +15,12 @@ import type React from 'react';
|
|
|
15
15
|
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
16
16
|
import type { CommonsDeliveryRoute, SignInProgress } from '@oxyhq/core';
|
|
17
17
|
import type { Theme, Translate } from './types.js';
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The indeterminate leading visual: the request exists but has nothing to show yet.
|
|
20
|
+
* Uses RN's ActivityIndicator — `@oxyhq/bloom/loading` can tree-shake to `undefined`
|
|
21
|
+
* in rolldown-vite production bundles when co-imported with `@oxyhq/bloom/button`
|
|
22
|
+
* (auth.oxy.so/authorize blank screen, React #130).
|
|
23
|
+
*/
|
|
19
24
|
export declare const PreparingSurface: React.FC;
|
|
20
25
|
/** The leading glyph for a route whose surface is elsewhere (the phone, Commons). */
|
|
21
26
|
export declare const RouteGlyph: React.FC<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestSurfaces.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/authChooser/requestSurfaces.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAK/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAShD
|
|
1
|
+
{"version":3,"file":"requestSurfaces.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/authChooser/requestSurfaces.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,sBAAsB,MAAM,2CAA2C,CAAC;AAK/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAExE,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAS,CAAC;AAShD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAGpC,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAChC,IAAI,EAAE,MAAM,OAAO,sBAAsB,CAAC,QAAQ,CAAC;IACnD,KAAK,EAAE,MAAM,CAAC;CACf,CAEA,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC;IAAC,CAAC,EAAE,SAAS,CAAA;CAAE,CAa7E,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;IACb,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,CAcA,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC;IAC3C,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;CACd,CAmBA,CAAC"}
|
|
@@ -208,7 +208,7 @@ export declare const useUpdateAccountSettings: () => {
|
|
|
208
208
|
};
|
|
209
209
|
isManagedAccount?: boolean;
|
|
210
210
|
managedBy?: string;
|
|
211
|
-
|
|
211
|
+
accountCategories?: import("@oxyhq/contracts").AccountCategoryId[];
|
|
212
212
|
languages?: string[];
|
|
213
213
|
notificationPreferences?: NotificationPreferences;
|
|
214
214
|
userPreferences?: UserPreferences;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountMutations.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/mutations/useAccountMutations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,eAAe,EAChB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"useAccountMutations.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/mutations/useAccountMutations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,eAAe,EAChB,MAAM,aAAa,CAAC;AAoBrB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;aAioBrB,CAAC;YAAkC,CAAC;mBACtC,CAAF;;aAMc,CAAC;YAAkC,CAAC;mBAE7B,CAAC;;;;;;;;;;;;;;;;;;;;;mBAwBsN,CAAC;UAAgC,CAAC;aAAmC,CAAC;aAAmC,CAAC;;;mBAAuE,CAAC;UAAgC,CAAC;aAAmC,CAAC;aAAmC,CAAC;;;;;;;;;;EAxjB1gB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;SAMQ,MAAM;WAAS,MAAM;WAAS,MAAM;WAAS,MAAM;;;EA4EtF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,UAAU,8BAA8B;IACtC,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAClC;;;;OAIG;IACH,WAAW,EAAE,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;sBAoFf,OAAO,CAAC,eAAe,CAAC,KAAG,IAAI;2BAQpB,OAAO,CAAC,eAAe,CAAC,KAAG,OAAO,CAAC,IAAI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AAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CACxI;AAED,4EAA4E;AAC5E,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;EAmD5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;EA+CpC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,uFAoBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;UAWd,gBAAgB;iBACT,SAAS,GAAG,QAAQ,GAAG,UAAU;eACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;iBACrB,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI;WAS5C,CAAC"}
|
|
@@ -36,9 +36,37 @@
|
|
|
36
36
|
* never overwritten by a degraded/empty one (empty username, the
|
|
37
37
|
* `'Unknown user'` ghost-author sentinel, `null` avatar).
|
|
38
38
|
*
|
|
39
|
+
* EXPRESSING A DELIBERATE CLEAR ("remove my picture")
|
|
40
|
+
* ---------------------------------------------------
|
|
41
|
+
* The anti-degradation rule above is right for a sparse source and wrong for a
|
|
42
|
+
* user who just emptied the field — and the two are NOT distinguishable from the
|
|
43
|
+
* payload. Measured against oxy-api's canonical serializer (`formatUserResponse`
|
|
44
|
+
* in `packages/api/src/utils/userTransform.ts`, which passes every field through
|
|
45
|
+
* `typeof value === 'string' ? value : undefined`): an account whose avatar,
|
|
46
|
+
* bio and display name were all just CLEARED serializes to
|
|
47
|
+
* `{"id":…,"publicKey":…,"username":…,"name":{},"languages":[]}` — byte-identical
|
|
48
|
+
* to the same account read as a sparse projection. There is no `null` and no
|
|
49
|
+
* `''` on the wire to key on. The information that a field was deliberately
|
|
50
|
+
* emptied exists ONLY at the call site that performed the write.
|
|
51
|
+
*
|
|
52
|
+
* So the caller declares it: `upsertCachedUser(qc, user, viewerId, { cleared:
|
|
53
|
+
* ['avatar'] })`. For a declared field an incoming EMPTY value means the field
|
|
54
|
+
* IS empty and the stale value is dropped; a MEANINGFUL incoming value still
|
|
55
|
+
* wins as usual (so `{ cleared: ['name.displayName'] }` on a personal account,
|
|
56
|
+
* where clearing the explicit name makes the server return the COMPOSED one,
|
|
57
|
+
* keeps the composed name rather than blanking it).
|
|
58
|
+
*
|
|
59
|
+
* A blanket "this source is authoritative, treat every absent field as cleared"
|
|
60
|
+
* flag was considered and rejected: because the two payloads are byte-identical,
|
|
61
|
+
* such a flag is an unverifiable promise about provenance, and the failure mode
|
|
62
|
+
* of getting it wrong is blanking real identity data in every Oxy app. Naming
|
|
63
|
+
* the fields states something the caller actually observed — which fields the
|
|
64
|
+
* user emptied — and bounds the damage to exactly those.
|
|
65
|
+
*
|
|
39
66
|
* It is a cache write only — zero network, one `setQueryData` per key.
|
|
40
67
|
*/
|
|
41
|
-
import type { UserNameResponse } from "@oxyhq/contracts";
|
|
68
|
+
import type { UserNameResponse, UserProfileUpdate } from "@oxyhq/contracts";
|
|
69
|
+
import type { UpdateAccountInput } from "@oxyhq/core";
|
|
42
70
|
import type { QueryClient } from "@tanstack/react-query";
|
|
43
71
|
/**
|
|
44
72
|
* A user-shaped object that can be upserted into the cache. Intentionally
|
|
@@ -76,6 +104,47 @@ export interface CacheableUser {
|
|
|
76
104
|
} | null;
|
|
77
105
|
[key: string]: unknown;
|
|
78
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The profile fields a user can genuinely EMPTY through a real Oxy write, and
|
|
109
|
+
* for which "empty" is a state every renderer already handles.
|
|
110
|
+
*
|
|
111
|
+
* Deliberately a closed list rather than "any field": a clear DELETES data from
|
|
112
|
+
* the cache, so the blast radius of a mistaken declaration is bounded here
|
|
113
|
+
* instead of resting on each call site. `username` is absent because an account
|
|
114
|
+
* always has one; `_count` and `relationship` are absent because they are
|
|
115
|
+
* server-derived, never user-emptied — and dropping a viewer `relationship` is
|
|
116
|
+
* the exact "Follows you vanishes" bug this module exists to prevent.
|
|
117
|
+
*
|
|
118
|
+
* Each entry is clearable through a shipped write path: `avatar`, `bio`,
|
|
119
|
+
* `description` and `name.displayName` via `UserProfileUpdate` (`''` clears) and
|
|
120
|
+
* `UpdateAccountInput` (`null` clears avatar/bio; `accountCategories: []`
|
|
121
|
+
* clears the ordered category list), and `color` via its nullable field.
|
|
122
|
+
*/
|
|
123
|
+
export declare const CLEARABLE_USER_FIELDS: readonly ["avatar", "bio", "description", "color", "accountCategories", "name.displayName"];
|
|
124
|
+
/** A field nameable in {@link UpsertCachedUserOptions.cleared}. */
|
|
125
|
+
export type ClearableUserField = (typeof CLEARABLE_USER_FIELDS)[number];
|
|
126
|
+
/**
|
|
127
|
+
* Fields the caller deliberately emptied in a `PUT /users/me` patch. The wire
|
|
128
|
+
* response omits cleared scalars, so the cache needs this list to drop stale
|
|
129
|
+
* values immediately instead of waiting for a refetch that merges the same
|
|
130
|
+
* sparse payload.
|
|
131
|
+
*/
|
|
132
|
+
export declare function clearedFieldsFromProfileUpdate(updates: UserProfileUpdate): ClearableUserField[];
|
|
133
|
+
/**
|
|
134
|
+
* Same contract as {@link clearedFieldsFromProfileUpdate} for managed-account
|
|
135
|
+
* `PATCH /accounts/:id` writes (`null` clears avatar/bio/category).
|
|
136
|
+
*/
|
|
137
|
+
export declare function clearedFieldsFromAccountUpdate(input: UpdateAccountInput): ClearableUserField[];
|
|
138
|
+
/** Options for {@link upsertCachedUser}. */
|
|
139
|
+
export interface UpsertCachedUserOptions {
|
|
140
|
+
/**
|
|
141
|
+
* Fields the write that produced this user DELIBERATELY emptied. For each,
|
|
142
|
+
* an incoming empty value stops meaning "this source does not carry it" and
|
|
143
|
+
* starts meaning "it is empty" — so the stale value is dropped rather than
|
|
144
|
+
* preserved. Everything not named here keeps the anti-degradation guard.
|
|
145
|
+
*/
|
|
146
|
+
cleared?: readonly ClearableUserField[];
|
|
147
|
+
}
|
|
79
148
|
/**
|
|
80
149
|
* Merge-upsert a (possibly partial) user into the SDK's user query cache under
|
|
81
150
|
* both the by-id key and, when a username is present, the viewer-scoped
|
|
@@ -85,12 +154,20 @@ export interface CacheableUser {
|
|
|
85
154
|
* @param user A `User`-shaped object (may be sparse).
|
|
86
155
|
* @param viewerId The active viewer id for the by-username key. Defaults to
|
|
87
156
|
* the current auth-store user id.
|
|
157
|
+
* @param options `cleared` names the fields the write deliberately emptied
|
|
158
|
+
* — the ONLY way "remove my picture" can propagate, since a
|
|
159
|
+
* cleared field and an uncarried one are byte-identical on
|
|
160
|
+
* the wire (see the module docs).
|
|
88
161
|
*/
|
|
89
|
-
export declare function upsertCachedUser(queryClient: QueryClient, user: CacheableUser, viewerId?: string): void;
|
|
162
|
+
export declare function upsertCachedUser(queryClient: QueryClient, user: CacheableUser, viewerId?: string, options?: UpsertCachedUserOptions): void;
|
|
90
163
|
/**
|
|
91
164
|
* Batch merge-upsert many users at once (for a feed / list / search response).
|
|
92
165
|
* Resolves the viewer id once and upserts each user cumulatively — a user that
|
|
93
166
|
* appears twice merges both slices into the single cache entry.
|
|
167
|
+
*
|
|
168
|
+
* Takes NO `cleared`, deliberately: a batch is a multi-user projection, so it is
|
|
169
|
+
* exactly the sparse source the anti-degradation guard exists for, and one
|
|
170
|
+
* declaration could not be true of every user in the array anyway.
|
|
94
171
|
*/
|
|
95
172
|
export declare function upsertCachedUsers(queryClient: QueryClient, users: readonly CacheableUser[] | null | undefined, viewerId?: string): void;
|
|
96
173
|
//# sourceMappingURL=userCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/userCache.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/userCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;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uBtB;AAED,4CAA4C;AAC5C,MAAM,WAAW,uBAAuB;IACvC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACxC;AAgQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC/B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,aAAa,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,uBAAuB,GAC/B,IAAI,CAyBN;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,EAClD,QAAQ,CAAC,EAAE,MAAM,GACf,IAAI,CAMN"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useFollowTarget` — the one hook every application uses to follow anything.
|
|
3
|
+
*
|
|
4
|
+
* Wraps the `/v2/follows` SDK methods with the store above, an optimistic
|
|
5
|
+
* update, and a rollback. Nothing in here knows what kind of thing it is
|
|
6
|
+
* following, which is the property that lets an application the SDK has never
|
|
7
|
+
* heard of use it without a release of this package.
|
|
8
|
+
*
|
|
9
|
+
* ## Optimism, and its one limit
|
|
10
|
+
*
|
|
11
|
+
* A follow flips the button immediately and rolls back if the server refuses,
|
|
12
|
+
* because the round trip is long enough to feel like a bug otherwise. But an
|
|
13
|
+
* optimistic follow has no relationship id until the server answers, and every
|
|
14
|
+
* other operation addresses the relationship — so those stay disabled for the
|
|
15
|
+
* width of one request rather than being sent with a guessed id.
|
|
16
|
+
*/
|
|
17
|
+
import type { FollowStatus } from '@oxyhq/contracts';
|
|
18
|
+
export interface UseFollowTargetResult {
|
|
19
|
+
status: FollowStatus;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the user follows this at all — NOT `effectiveState`, which reports
|
|
22
|
+
* `not_following` for a follow merely switched off in this application.
|
|
23
|
+
*/
|
|
24
|
+
isFollowing: boolean;
|
|
25
|
+
/** True until the first read settles. Distinct from "not following". */
|
|
26
|
+
isUnknown: boolean;
|
|
27
|
+
isPending: boolean;
|
|
28
|
+
error: string | undefined;
|
|
29
|
+
follow: (options?: {
|
|
30
|
+
expiresIn?: number;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
unfollow: () => Promise<void>;
|
|
33
|
+
/** Stop acting on this follow HERE, without giving it up everywhere. */
|
|
34
|
+
disableHere: () => Promise<void>;
|
|
35
|
+
enableHere: () => Promise<void>;
|
|
36
|
+
refresh: () => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare function useFollowTarget(targetId: string | undefined, options?: {
|
|
39
|
+
initialStatus?: FollowStatus;
|
|
40
|
+
}): UseFollowTargetResult;
|
|
41
|
+
//# sourceMappingURL=useFollowTarget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFollowTarget.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hooks/useFollowTarget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AASrD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,YAAY,CAAC;IACrB;;;OAGG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,wEAAwE;IACxE,WAAW,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,OAAO,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,YAAY,CAAA;CAAE,GACzC,qBAAqB,CAgJvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountMembersScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountMembersScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountMembersScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountMembersScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAkB/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAkB3D;;;;GAIG;AACH,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgbnD,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSettingsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountSettingsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSettingsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/AccountSettingsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAgB3D;;;;;;GAMG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA6OpD,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAccountScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/CreateAccountScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"CreateAccountScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/CreateAccountScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;AAmG3D;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAkVlD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The follow-graph store — the client's single cache authority for #809.
|
|
3
|
+
*
|
|
4
|
+
* The SDK caches none of these reads on purpose (a status cached across a write
|
|
5
|
+
* is the "follow reverts after navigating away and back" bug), which makes this
|
|
6
|
+
* store the one place a status lives between a write and the next read. If a
|
|
7
|
+
* second cache appears above it, the two will disagree the moment one is
|
|
8
|
+
* invalidated and the other is not.
|
|
9
|
+
*
|
|
10
|
+
* ## Keyed by target id, not by user id
|
|
11
|
+
*
|
|
12
|
+
* The legacy `followStore` is keyed by user id because the only followable
|
|
13
|
+
* thing was a user. Here a key is a target of any kind — a topic, a store, an
|
|
14
|
+
* artist, a channel — so nothing in this file may assume what it is looking at.
|
|
15
|
+
* That is the property that lets an application the SDK has never heard of use
|
|
16
|
+
* it without a release.
|
|
17
|
+
*
|
|
18
|
+
* ## Why the status is stored whole
|
|
19
|
+
*
|
|
20
|
+
* Not a boolean. `globalState`, `applicationMode` and `effectiveState` are
|
|
21
|
+
* three separate answers, and a UI that keeps only the last one cannot explain
|
|
22
|
+
* why a follow the user can see in their list does nothing in this app.
|
|
23
|
+
*/
|
|
24
|
+
import type { FollowApplicationMode, FollowStatus } from '@oxyhq/contracts';
|
|
25
|
+
/** The status of one target, or `undefined` when it has never been read. */
|
|
26
|
+
type StatusMap = Record<string, FollowStatus | undefined>;
|
|
27
|
+
interface FollowTargetState {
|
|
28
|
+
statuses: StatusMap;
|
|
29
|
+
/** In-flight writes, per target. Reads do not set this — only mutations do. */
|
|
30
|
+
pending: Record<string, boolean>;
|
|
31
|
+
errors: Record<string, string | undefined>;
|
|
32
|
+
setStatus: (targetId: string, status: FollowStatus) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Seed many statuses at once — from a follow list, a feed payload, anything
|
|
35
|
+
* that already knows. Saves one request per rendered row, which is the
|
|
36
|
+
* difference between a list that paints and a list that flickers.
|
|
37
|
+
*/
|
|
38
|
+
seed: (entries: Record<string, FollowStatus>) => void;
|
|
39
|
+
setPending: (targetId: string, pending: boolean) => void;
|
|
40
|
+
setError: (targetId: string, error: string | undefined) => void;
|
|
41
|
+
/** Drop everything. Called on identity change — see the note below. */
|
|
42
|
+
reset: () => void;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The state one target is in before the server has been asked. Distinct from
|
|
46
|
+
* "not following": a button that renders a follow action while the answer is
|
|
47
|
+
* unknown invites a follow the user did not intend, so callers check
|
|
48
|
+
* `isUnknown` rather than reading this as an answer.
|
|
49
|
+
*/
|
|
50
|
+
export declare const UNKNOWN_FOLLOW_STATUS: FollowStatus;
|
|
51
|
+
export declare const useFollowTargetStore: import("zustand").UseBoundStore<import("zustand").StoreApi<FollowTargetState>>;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the user follows this at all, anywhere.
|
|
54
|
+
*
|
|
55
|
+
* Deliberately NOT `effectiveState !== 'not_following'`: a follow switched off
|
|
56
|
+
* in this application reports `not_following` — correctly, since the question
|
|
57
|
+
* that field answers is "does this act here" — and a button that read it as
|
|
58
|
+
* "not followed" would offer to follow something already followed.
|
|
59
|
+
*/
|
|
60
|
+
export declare function isFollowedGlobally(status: FollowStatus): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Apply a mode change to a cached status without a round trip.
|
|
63
|
+
*
|
|
64
|
+
* Exported because the optimistic path and the settled path must agree on what
|
|
65
|
+
* `effectiveState` becomes; deriving it in two places is how they drift. Mirrors
|
|
66
|
+
* the server's own derivation, which is the authority.
|
|
67
|
+
*/
|
|
68
|
+
export declare function withApplicationMode(status: FollowStatus, mode: FollowApplicationMode): FollowStatus;
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=followTargetStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"followTargetStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/followTargetStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5E,4EAA4E;AAC5E,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC,CAAC;AAE1D,UAAU,iBAAiB;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAE3C,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,IAAI,CAAC;IACtD,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACzD,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAChE,uEAAuE;IACvE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAInC,CAAC;AAEF,eAAO,MAAM,oBAAoB,gFAoB9B,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAEhE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,qBAAqB,GAC1B,YAAY,CAad"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resetSessionScopedStores.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/resetSessionScopedStores.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resetSessionScopedStores.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/resetSessionScopedStores.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,IAAI,IAAI,CAG/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAyCf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "27.1.0",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
"dependencies": {
|
|
141
|
-
"@oxyhq/contracts": "0.
|
|
141
|
+
"@oxyhq/contracts": "0.24.0",
|
|
142
142
|
"@simplewebauthn/browser": "^13.3.0",
|
|
143
143
|
"color": "^4.2.3"
|
|
144
144
|
},
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
"@commitlint/cli": "^21.2.1",
|
|
148
148
|
"@commitlint/config-conventional": "^21.2.0",
|
|
149
149
|
"@expo/vector-icons": "^15.0.3",
|
|
150
|
-
"@oxyhq/core": "
|
|
150
|
+
"@oxyhq/core": "19.1.0",
|
|
151
151
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
152
152
|
"@react-native-community/netinfo": "^11.4.1",
|
|
153
153
|
"@react-native/babel-preset": "^0.86.0",
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
"peerDependencies": {
|
|
191
191
|
"@expo/vector-icons": "^15.0.3",
|
|
192
192
|
"@oxyhq/bloom": ">=0.59.0",
|
|
193
|
-
"@oxyhq/core": "^
|
|
193
|
+
"@oxyhq/core": "^19.0.0",
|
|
194
194
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
195
195
|
"@react-native-community/netinfo": ">=11.4.1",
|
|
196
196
|
"@tanstack/query-async-storage-persister": "^5.101",
|
package/src/index.ts
CHANGED
|
@@ -173,9 +173,21 @@ export {
|
|
|
173
173
|
// SDK's user query cache under both keys it owns (by-id + viewer-scoped
|
|
174
174
|
// by-username). Consumers route ALL cache seeds (feed / list / search / profile
|
|
175
175
|
// hydration) through this so a sparse source can never strip a field an
|
|
176
|
-
// authoritative fetch already stored.
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
// authoritative fetch already stored. A write that DELIBERATELY empties a field
|
|
177
|
+
// ("remove my picture") says so with `{ cleared: [...] }` — the payload cannot
|
|
178
|
+
// express it, see the module docs.
|
|
179
|
+
export {
|
|
180
|
+
upsertCachedUser,
|
|
181
|
+
upsertCachedUsers,
|
|
182
|
+
CLEARABLE_USER_FIELDS,
|
|
183
|
+
clearedFieldsFromProfileUpdate,
|
|
184
|
+
clearedFieldsFromAccountUpdate,
|
|
185
|
+
} from './ui/hooks/queries/userCache';
|
|
186
|
+
export type {
|
|
187
|
+
CacheableUser,
|
|
188
|
+
ClearableUserField,
|
|
189
|
+
UpsertCachedUserOptions,
|
|
190
|
+
} from './ui/hooks/queries/userCache';
|
|
179
191
|
|
|
180
192
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
181
193
|
export { useMutationStatus } from './ui/hooks/useMutationStatus';
|
|
@@ -266,6 +278,17 @@ export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './ui/components/
|
|
|
266
278
|
|
|
267
279
|
export { default as FollowButton } from './ui/components/FollowButton';
|
|
268
280
|
export type { FollowButtonProps, SingleFollowButtonProps, MultiFollowButtonProps } from './ui/components/FollowButton';
|
|
281
|
+
// The follow graph (#809): follows anything registered, not just users.
|
|
282
|
+
export { FollowTargetButton } from './ui/components/FollowTargetButton';
|
|
283
|
+
export type {
|
|
284
|
+
FollowTargetButtonProps,
|
|
285
|
+
FollowVerb,
|
|
286
|
+
FollowLabels,
|
|
287
|
+
FollowDuration,
|
|
288
|
+
} from './ui/components/FollowTargetButton';
|
|
289
|
+
export { useFollowTarget } from './ui/hooks/useFollowTarget';
|
|
290
|
+
export type { UseFollowTargetResult } from './ui/hooks/useFollowTarget';
|
|
291
|
+
export { useFollowTargetStore, UNKNOWN_FOLLOW_STATUS } from './ui/stores/followTargetStore';
|
|
269
292
|
export { default as OxyPayButton } from './ui/components/OxyPayButton';
|
|
270
293
|
export { LogoIcon } from './ui/components/logo/LogoIcon';
|
|
271
294
|
export { LogoText } from './ui/components/logo/LogoText';
|
|
@@ -5,10 +5,10 @@ import type {
|
|
|
5
5
|
TextStyle,
|
|
6
6
|
StyleProp,
|
|
7
7
|
} from 'react-native';
|
|
8
|
+
import { ActivityIndicator } from 'react-native';
|
|
8
9
|
import { useOxy } from '../context/OxyContext';
|
|
9
10
|
import { toast } from '@oxyhq/bloom/toast';
|
|
10
11
|
import { Button } from '@oxyhq/bloom/button';
|
|
11
|
-
import { Loading } from '@oxyhq/bloom/loading';
|
|
12
12
|
import { useFollow, useFollowForButton } from '../hooks/useFollow';
|
|
13
13
|
import { useFollowStore } from '../stores/followStore';
|
|
14
14
|
import { useTheme } from '@oxyhq/bloom/theme';
|
|
@@ -119,8 +119,7 @@ const FollowButtonInner = memo(function FollowButtonInner({
|
|
|
119
119
|
style={style}
|
|
120
120
|
textStyle={textStyle}
|
|
121
121
|
icon={showSpinner ? (
|
|
122
|
-
<
|
|
123
|
-
variant="inline"
|
|
122
|
+
<ActivityIndicator
|
|
124
123
|
size="small"
|
|
125
124
|
color={showFollowing ? colors.text : colors.primaryForeground}
|
|
126
125
|
/>
|
|
@@ -247,8 +246,7 @@ const FollowButtonMultiInner = memo(function FollowButtonMultiInner({
|
|
|
247
246
|
style={style}
|
|
248
247
|
textStyle={textStyle}
|
|
249
248
|
icon={showSpinner ? (
|
|
250
|
-
<
|
|
251
|
-
variant="inline"
|
|
249
|
+
<ActivityIndicator
|
|
252
250
|
size="small"
|
|
253
251
|
color={allFollowing ? colors.text : colors.primaryForeground}
|
|
254
252
|
/>
|