@oxyhq/services 27.0.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 +29 -0
- 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/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/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/module/index.js +4 -0
- 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/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/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/typescript/commonjs/index.d.ts +5 -0
- 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/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/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/module/index.d.ts +5 -0
- 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/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/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/package.json +3 -3
- package/src/index.ts +11 -0
- 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/hooks/useFollowTarget.ts +194 -0
- package/src/ui/screens/AccountMembersScreen.tsx +62 -6
- 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
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The follow-graph store — the client's single cache authority for #809.
|
|
5
|
+
*
|
|
6
|
+
* The SDK caches none of these reads on purpose (a status cached across a write
|
|
7
|
+
* is the "follow reverts after navigating away and back" bug), which makes this
|
|
8
|
+
* store the one place a status lives between a write and the next read. If a
|
|
9
|
+
* second cache appears above it, the two will disagree the moment one is
|
|
10
|
+
* invalidated and the other is not.
|
|
11
|
+
*
|
|
12
|
+
* ## Keyed by target id, not by user id
|
|
13
|
+
*
|
|
14
|
+
* The legacy `followStore` is keyed by user id because the only followable
|
|
15
|
+
* thing was a user. Here a key is a target of any kind — a topic, a store, an
|
|
16
|
+
* artist, a channel — so nothing in this file may assume what it is looking at.
|
|
17
|
+
* That is the property that lets an application the SDK has never heard of use
|
|
18
|
+
* it without a release.
|
|
19
|
+
*
|
|
20
|
+
* ## Why the status is stored whole
|
|
21
|
+
*
|
|
22
|
+
* Not a boolean. `globalState`, `applicationMode` and `effectiveState` are
|
|
23
|
+
* three separate answers, and a UI that keeps only the last one cannot explain
|
|
24
|
+
* why a follow the user can see in their list does nothing in this app.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { create } from 'zustand';
|
|
28
|
+
|
|
29
|
+
/** The status of one target, or `undefined` when it has never been read. */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The state one target is in before the server has been asked. Distinct from
|
|
33
|
+
* "not following": a button that renders a follow action while the answer is
|
|
34
|
+
* unknown invites a follow the user did not intend, so callers check
|
|
35
|
+
* `isUnknown` rather than reading this as an answer.
|
|
36
|
+
*/
|
|
37
|
+
export const UNKNOWN_FOLLOW_STATUS = {
|
|
38
|
+
globalState: 'none',
|
|
39
|
+
applicationMode: 'inherit',
|
|
40
|
+
effectiveState: 'not_following'
|
|
41
|
+
};
|
|
42
|
+
export const useFollowTargetStore = create(set => ({
|
|
43
|
+
statuses: {},
|
|
44
|
+
pending: {},
|
|
45
|
+
errors: {},
|
|
46
|
+
setStatus: (targetId, status) => set(s => ({
|
|
47
|
+
statuses: {
|
|
48
|
+
...s.statuses,
|
|
49
|
+
[targetId]: status
|
|
50
|
+
}
|
|
51
|
+
})),
|
|
52
|
+
seed: entries => set(s => ({
|
|
53
|
+
statuses: {
|
|
54
|
+
...s.statuses,
|
|
55
|
+
...entries
|
|
56
|
+
}
|
|
57
|
+
})),
|
|
58
|
+
setPending: (targetId, pending) => set(s => ({
|
|
59
|
+
pending: {
|
|
60
|
+
...s.pending,
|
|
61
|
+
[targetId]: pending
|
|
62
|
+
}
|
|
63
|
+
})),
|
|
64
|
+
setError: (targetId, error) => set(s => ({
|
|
65
|
+
errors: {
|
|
66
|
+
...s.errors,
|
|
67
|
+
[targetId]: error
|
|
68
|
+
}
|
|
69
|
+
})),
|
|
70
|
+
// Every entry here is scoped to whoever was signed in when it was read. On an
|
|
71
|
+
// account switch the whole map is wrong, not stale — the next user's follows
|
|
72
|
+
// are a different set entirely, and showing one user their previous
|
|
73
|
+
// account's follow state is a privacy failure rather than a rendering one.
|
|
74
|
+
reset: () => set({
|
|
75
|
+
statuses: {},
|
|
76
|
+
pending: {},
|
|
77
|
+
errors: {}
|
|
78
|
+
})
|
|
79
|
+
}));
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Whether the user follows this at all, anywhere.
|
|
83
|
+
*
|
|
84
|
+
* Deliberately NOT `effectiveState !== 'not_following'`: a follow switched off
|
|
85
|
+
* in this application reports `not_following` — correctly, since the question
|
|
86
|
+
* that field answers is "does this act here" — and a button that read it as
|
|
87
|
+
* "not followed" would offer to follow something already followed.
|
|
88
|
+
*/
|
|
89
|
+
export function isFollowedGlobally(status) {
|
|
90
|
+
return status.globalState === 'active' || status.globalState === 'requested';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Apply a mode change to a cached status without a round trip.
|
|
95
|
+
*
|
|
96
|
+
* Exported because the optimistic path and the settled path must agree on what
|
|
97
|
+
* `effectiveState` becomes; deriving it in two places is how they drift. Mirrors
|
|
98
|
+
* the server's own derivation, which is the authority.
|
|
99
|
+
*/
|
|
100
|
+
export function withApplicationMode(status, mode) {
|
|
101
|
+
return {
|
|
102
|
+
...status,
|
|
103
|
+
applicationMode: mode,
|
|
104
|
+
effectiveState: mode === 'disabled' ? 'not_following' : status.globalState === 'active' ? 'following' : status.globalState === 'requested' ? 'requested' : 'not_following'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=followTargetStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["create","UNKNOWN_FOLLOW_STATUS","globalState","applicationMode","effectiveState","useFollowTargetStore","set","statuses","pending","errors","setStatus","targetId","status","s","seed","entries","setPending","setError","error","reset","isFollowedGlobally","withApplicationMode","mode"],"sourceRoot":"../../../../src","sources":["ui/stores/followTargetStore.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,SAAS;;AAGhC;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,qBAAmC,GAAG;EACjDC,WAAW,EAAE,MAAM;EACnBC,eAAe,EAAE,SAAS;EAC1BC,cAAc,EAAE;AAClB,CAAC;AAED,OAAO,MAAMC,oBAAoB,GAAGL,MAAM,CAAqBM,GAAG,KAAM;EACtEC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC,CAAC;EAEVC,SAAS,EAAEA,CAACC,QAAQ,EAAEC,MAAM,KAC1BN,GAAG,CAAEO,CAAC,KAAM;IAAEN,QAAQ,EAAE;MAAE,GAAGM,CAAC,CAACN,QAAQ;MAAE,CAACI,QAAQ,GAAGC;IAAO;EAAE,CAAC,CAAC,CAAC;EAEnEE,IAAI,EAAGC,OAAO,IAAKT,GAAG,C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1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useFollowStore } from "./followStore.js";
|
|
4
|
+
import { useFollowTargetStore } from "./followTargetStore.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Drop session-scoped Zustand slices so the next user/account never inherits
|
|
@@ -12,5 +13,6 @@ import { useFollowStore } from "./followStore.js";
|
|
|
12
13
|
*/
|
|
13
14
|
export function resetSessionScopedStores() {
|
|
14
15
|
useFollowStore.getState().resetFollowState();
|
|
16
|
+
useFollowTargetStore.getState().reset();
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=resetSessionScopedStores.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useFollowStore","resetSessionScopedStores","getState","resetFollowState"],"sourceRoot":"../../../../src","sources":["ui/stores/resetSessionScopedStores.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,kBAAe;;
|
|
1
|
+
{"version":3,"names":["useFollowStore","useFollowTargetStore","resetSessionScopedStores","getState","resetFollowState","reset"],"sourceRoot":"../../../../src","sources":["ui/stores/resetSessionScopedStores.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,kBAAe;AAC9C,SAASC,oBAAoB,QAAQ,wBAAqB;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,wBAAwBA,CAAA,EAAS;EAC/CF,cAAc,CAACG,QAAQ,CAAC,CAAC,CAACC,gBAAgB,CAAC,CAAC;EAC5CH,oBAAoB,CAACE,QAAQ,CAAC,CAAC,CAACE,KAAK,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -72,6 +72,11 @@ export { RequireOxyAuth } from './ui/components/RequireOxyAuth';
|
|
|
72
72
|
export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './ui/components/RequireOxyAuth';
|
|
73
73
|
export { default as FollowButton } from './ui/components/FollowButton';
|
|
74
74
|
export type { FollowButtonProps, SingleFollowButtonProps, MultiFollowButtonProps } from './ui/components/FollowButton';
|
|
75
|
+
export { FollowTargetButton } from './ui/components/FollowTargetButton';
|
|
76
|
+
export type { FollowTargetButtonProps, FollowVerb, FollowLabels, FollowDuration, } from './ui/components/FollowTargetButton';
|
|
77
|
+
export { useFollowTarget } from './ui/hooks/useFollowTarget';
|
|
78
|
+
export type { UseFollowTargetResult } from './ui/hooks/useFollowTarget';
|
|
79
|
+
export { useFollowTargetStore, UNKNOWN_FOLLOW_STATUS } from './ui/stores/followTargetStore';
|
|
75
80
|
export { default as OxyPayButton } from './ui/components/OxyPayButton';
|
|
76
81
|
export { LogoIcon } from './ui/components/logo/LogoIcon';
|
|
77
82
|
export { LogoText } from './ui/components/logo/LogoText';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAIhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAKzE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EACH,aAAa,EACb,SAAS,IAAI,cAAc,EAC3B,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,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C,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD;AAED,yEAAyE;AACzE,MAAM,WAAW,uBAAwB,SAAQ,qBAAqB;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,qFAAqF;AACrF,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AA6MjF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiD7C,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,YAAY,CAAC"}
|
|
@@ -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,E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O,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACrC;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,kBAAkB,+DA2I7B,CAAC"}
|
|
@@ -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,qBAAqB,CAAC;AAkB3D;;;;GAIG;AACH,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgbnD,CAAC;AAEF,eAAe,oBAAoB,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"}
|
|
@@ -72,6 +72,11 @@ export { RequireOxyAuth } from './ui/components/RequireOxyAuth.js';
|
|
|
72
72
|
export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './ui/components/RequireOxyAuth.js';
|
|
73
73
|
export { default as FollowButton } from './ui/components/FollowButton.js';
|
|
74
74
|
export type { FollowButtonProps, SingleFollowButtonProps, MultiFollowButtonProps } from './ui/components/FollowButton.js';
|
|
75
|
+
export { FollowTargetButton } from './ui/components/FollowTargetButton.js';
|
|
76
|
+
export type { FollowTargetButtonProps, FollowVerb, FollowLabels, FollowDuration, } from './ui/components/FollowTargetButton.js';
|
|
77
|
+
export { useFollowTarget } from './ui/hooks/useFollowTarget.js';
|
|
78
|
+
export type { UseFollowTargetResult } from './ui/hooks/useFollowTarget.js';
|
|
79
|
+
export { useFollowTargetStore, UNKNOWN_FOLLOW_STATUS } from './ui/stores/followTargetStore.js';
|
|
75
80
|
export { default as OxyPayButton } from './ui/components/OxyPayButton.js';
|
|
76
81
|
export { LogoIcon } from './ui/components/logo/LogoIcon.js';
|
|
77
82
|
export { LogoText } from './ui/components/logo/LogoText.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAA6B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAAyB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAoB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AAIhF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAA8B,CAAC;AAKzE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA0B,CAAC;AAC3D,OAAO,EACH,aAAa,EACb,SAAS,IAAI,cAAc,EAC3B,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACnB,MAAM,2BAAwB,CAAC;AAKhC,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,yBAAsB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAA+B,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,yBAAsB,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,0BAAuB,CAAC;AACnD,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAAuB,CAAC;AAKjF,O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AwB,SAAQ,qBAAqB;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,qFAAqF;AACrF,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACnE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACtD,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,sBAAsB,CAAC;AA6MjF,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAiD7C,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC;AACxB,eAAe,YAAY,CAAC"}
|
|
@@ -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,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAeD,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,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