@oxy.so/services 9.1.0 → 9.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.
Files changed (38) hide show
  1. package/lib/commonjs/index.js +4 -3
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/ui/client.js +174 -0
  4. package/lib/commonjs/ui/client.js.map +1 -1
  5. package/lib/commonjs/ui/components/FollowTargetButton.js +11 -101
  6. package/lib/commonjs/ui/components/FollowTargetButton.js.map +1 -1
  7. package/lib/commonjs/ui/components/followRules.js +105 -0
  8. package/lib/commonjs/ui/components/followRules.js.map +1 -0
  9. package/lib/module/index.js +3 -2
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/module/ui/client.js +17 -4
  12. package/lib/module/ui/client.js.map +1 -1
  13. package/lib/module/ui/components/FollowTargetButton.js +1 -89
  14. package/lib/module/ui/components/FollowTargetButton.js.map +1 -1
  15. package/lib/module/ui/components/followRules.js +99 -0
  16. package/lib/module/ui/components/followRules.js.map +1 -0
  17. package/lib/typescript/commonjs/index.d.ts +4 -2
  18. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  19. package/lib/typescript/commonjs/ui/client.d.ts +19 -4
  20. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  21. package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts +2 -62
  22. package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts.map +1 -1
  23. package/lib/typescript/commonjs/ui/components/followRules.d.ts +71 -0
  24. package/lib/typescript/commonjs/ui/components/followRules.d.ts.map +1 -0
  25. package/lib/typescript/module/index.d.ts +4 -2
  26. package/lib/typescript/module/index.d.ts.map +1 -1
  27. package/lib/typescript/module/ui/client.d.ts +19 -4
  28. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  29. package/lib/typescript/module/ui/components/FollowTargetButton.d.ts +2 -62
  30. package/lib/typescript/module/ui/components/FollowTargetButton.d.ts.map +1 -1
  31. package/lib/typescript/module/ui/components/followRules.d.ts +71 -0
  32. package/lib/typescript/module/ui/components/followRules.d.ts.map +1 -0
  33. package/package.json +1 -1
  34. package/src/index.ts +3 -3
  35. package/src/ui/client.ts +55 -4
  36. package/src/ui/components/FollowTargetButton.tsx +8 -112
  37. package/src/ui/components/__tests__/followTargetButton.test.ts +1 -1
  38. package/src/ui/components/followRules.ts +121 -0
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The follow button's product rules, without the button.
3
+ *
4
+ * Pure: no React, no Bloom. `FollowTargetButton` renders them, and an
5
+ * application drawing its own affordance (a chip grid, a compact row) imports
6
+ * them from here — through `@oxy.so/services/ui/client` — without paying for the
7
+ * button's dropdown menu.
8
+ */
9
+ import type { FollowApplicationMode } from '@oxy.so/contracts';
10
+ /** A timed-follow choice offered in the menu. */
11
+ export interface FollowDuration {
12
+ label: string;
13
+ seconds: number;
14
+ }
15
+ /**
16
+ * Whether an action leaves the target ACTIVE in this application.
17
+ *
18
+ * One table, read by both the primary button and the menu, because the same
19
+ * action reached from two controls once reported differently — and a rule
20
+ * living in two switch statements is a rule that drifts. `Record` rather than
21
+ * a function with a default, so a new action is a compile error instead of a
22
+ * silent `false`.
23
+ */
24
+ export declare const FOLLOW_ACTION_LEAVES_ACTIVE: Record<'follow' | 'follow-timed' | 'enable-here' | 'disable-here' | 'unfollow', boolean>;
25
+ /** One line in the disclosure menu. */
26
+ export interface FollowMenuItem {
27
+ key: string;
28
+ label: string;
29
+ /** What the component should call. Named so the table below stays pure. */
30
+ action: {
31
+ type: 'follow-timed';
32
+ seconds: number;
33
+ durationLabel: string;
34
+ } | {
35
+ type: 'enable-here';
36
+ } | {
37
+ type: 'disable-here';
38
+ } | {
39
+ type: 'unfollow';
40
+ };
41
+ }
42
+ /**
43
+ * Which choices exist, given the state.
44
+ *
45
+ * Pure and exported because this is the product decision, not a rendering
46
+ * detail: a timed follow is only offered before following, turning it off here
47
+ * is only offered while following, and NEITHER is offered before the server has
48
+ * answered — every one of them addresses a relationship that does not exist
49
+ * yet, so offering them mid-write would mean sending a guessed id.
50
+ */
51
+ /**
52
+ * What the main button should do for the current state.
53
+ *
54
+ * Exported because the product rule is not obvious from the label alone: a
55
+ * follow switched off here still reads as "following" globally, so the primary
56
+ * press must re-enable here — not unfollow everywhere.
57
+ */
58
+ export declare function resolveFollowPrimaryAction(input: {
59
+ isFollowing: boolean;
60
+ applicationMode: FollowApplicationMode;
61
+ }): 'follow' | 'unfollow' | 'enable-here';
62
+ export declare function buildFollowMenuItems(input: {
63
+ following: boolean;
64
+ applicationMode: FollowApplicationMode;
65
+ hasRelationship: boolean;
66
+ isPending: boolean;
67
+ durations: FollowDuration[] | false;
68
+ idleVerb: string;
69
+ applicationName: string;
70
+ }): FollowMenuItem[];
71
+ //# sourceMappingURL=followRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followRules.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/followRules.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE/D,iDAAiD;AACjD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,QAAQ,GAAG,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,UAAU,EACvE,OAAO,CAUR,CAAC;AAEF,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,MAAM,EACF;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,GAChE;QAAE,IAAI,EAAE,aAAa,CAAA;KAAE,GACvB;QAAE,IAAI,EAAE,cAAc,CAAA;KAAE,GACxB;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,qBAAqB,CAAC;CACxC,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAIxC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,qBAAqB,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,cAAc,EAAE,CAmCnB"}
@@ -78,8 +78,10 @@ export type { RequireOxyAuthProps, RequireOxyAuthPrompt } from './ui/components/
78
78
  export type { AccountQueriesConfig } from './ui/hooks/accountQueryPersistence.js';
79
79
  export { default as FollowButton } from './ui/components/FollowButton.js';
80
80
  export type { FollowButtonProps, SingleFollowButtonProps, MultiFollowButtonProps } from './ui/components/FollowButton.js';
81
- export { FollowTargetButton, buildFollowMenuItems, resolveFollowPrimaryAction, FOLLOW_ACTION_LEAVES_ACTIVE, } from './ui/components/FollowTargetButton.js';
82
- export type { FollowTargetButtonProps, FollowVerb, FollowLabels, FollowDuration, } from './ui/components/FollowTargetButton.js';
81
+ export { FollowTargetButton } from './ui/components/FollowTargetButton.js';
82
+ export { buildFollowMenuItems, resolveFollowPrimaryAction, FOLLOW_ACTION_LEAVES_ACTIVE, } from './ui/components/followRules.js';
83
+ export type { FollowDuration, FollowMenuItem } from './ui/components/followRules.js';
84
+ export type { FollowTargetButtonProps, FollowVerb, FollowLabels, } from './ui/components/FollowTargetButton.js';
83
85
  export { useFollowTarget } from './ui/hooks/useFollowTarget.js';
84
86
  export type { UseFollowTargetResult } from './ui/hooks/useFollowTarget.js';
85
87
  export { useFollowTargetStore, UNKNOWN_FOLLOW_STATUS, isFollowedGlobally, withApplicationMode, isCompleteFollowStatus, followRecordToStatus, followRecordsToStatusMap, } from './ui/stores/followTargetStore.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;AAIjD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,4BAAyB,CAAC;AAKlF,OAAO,EACL,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,uBAAc,CAAC;AACtB,YAAY,EACV,aAAa,EACb,UAAU,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACf,MAAM,uBAAc,CAAC;AACtB,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAoB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AAC/F,OAAO,EAAE,8BAA8B,EAAE,MAAM,oCAAiC,CAAC;AACjF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,oCAAiC,CAAC;AAIzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAA8B,CAAC;AAKzE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAAuB,CAAC;AACrD,OAAO,EACH,aAAa,EACb,SAAS,IAAI,cAAc,EAC3B,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,E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E,MAAM,iDAA8C,CAAC;AACrF,YAAY,EAAE,0BAA0B,EAAE,MAAM,iDAA8C,CAAC;AAC/F,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,cAAc,EACd,YAAY,GACb,MAAM,yCAAsC,CAAC;AAC9C,YAAY,EAAE,wBAAwB,EAAE,MAAM,yCAAsC,CAAC;AAUrF,OAAO,EAAE,uBAAuB,EAAE,MAAM,4CAAyC,CAAC;AAClF,YAAY,EAAE,4BAA4B,EAAE,MAAM,4CAAyC,CAAC;AAC5F,YAAY,EAAE,sBAAsB,EAAE,MAAM,sCAAmC,CAAC;AAQhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAA8B,CAAC;AACjE,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAA8B,CAAC;AAU5E,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uCAAoC,CAAC;AACvF,YAAY,EAAE,SAAS,EAAE,MAAM,2BAAwB,CAAC;AAKxD,OAAO,EAAE,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,MAAM,gCAA6B,CAAC;AAC1F,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,wCAAqC,CAAC;AAMzG,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,yCAAsC,CAAC"}
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Client-only UI exports (tree-shakeable)
2
+ * Client-only UI exports — the lean entry.
3
3
  *
4
- * Import from this module for client-side bundles where tree-shaking is important.
5
- * These are direct exports without runtime detection overhead.
4
+ * Import from this module in an app's startup path. The root barrel also
5
+ * re-exports the sign-in panels (`OxySignInPanel`, `OxyLinkCommonsPanel` and
6
+ * its QR code, `OxyConsentScreen`, …) for apps that embed them, and Metro does
7
+ * not tree-shake, so importing ANY symbol from `@oxy.so/services` ships all of
8
+ * them — even though the account dialog that normally shows them is loaded on
9
+ * demand. Nothing exported here reaches those panels; the packaging test
10
+ * `clientEntryIsolation` pins it.
6
11
  *
7
12
  * @example
8
13
  * import { OxyProvider, useOxy, LogoIcon } from '@oxy.so/services/ui/client';
@@ -14,6 +19,8 @@ export type { OxyAuthPromptProps } from './components/OxyAuthPrompt.js';
14
19
  export { LogoIcon } from './components/logo/LogoIcon.js';
15
20
  export { LogoText } from './components/logo/LogoText.js';
16
21
  export { default as FollowButton } from './components/FollowButton.js';
22
+ export { default as ProfileButton } from './components/ProfileButton.js';
23
+ export type { ProfileButtonProps } from './components/ProfileButton.js';
17
24
  export { default as PeableButton } from './components/PeableButton.js';
18
25
  export type { PeableButtonProps } from './components/PeableButton.js';
19
26
  /** @deprecated Use `PeableButton` instead. */
@@ -25,9 +32,17 @@ export { useAuth } from './hooks/useAuth.js';
25
32
  export type { AuthState, AuthActions, SignInOutcome, UseAuthReturn } from './hooks/useAuth.js';
26
33
  export { createDeferredProductAnalytics } from './analytics/productAnalytics.js';
27
34
  export type { OxyProductEvent, ProductAnalytics } from './analytics/productAnalytics.js';
28
- export { useFollow } from './hooks/useFollow.js';
35
+ export { useFollow, useFollowerCounts, useSeedFollowStatuses } from './hooks/useFollow.js';
36
+ export { useFollowTarget } from './hooks/useFollowTarget.js';
37
+ export type { UseFollowTargetResult } from './hooks/useFollowTarget.js';
38
+ export { useUserProfile, useUserProfiles, useCurrentUser, useUserById, useUserByUsername, } from './hooks/queries/useAccountQueries.js';
29
39
  export { useStorage } from './hooks/useStorage.js';
30
40
  export type { UseStorageOptions, UseStorageResult } from './hooks/useStorage.js';
41
+ export { buildFollowMenuItems, resolveFollowPrimaryAction, FOLLOW_ACTION_LEAVES_ACTIVE, } from './components/followRules.js';
42
+ export type { FollowDuration, FollowMenuItem } from './components/followRules.js';
43
+ export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, invalidateAuthMethodsQueries, } from './hooks/queries/queryKeys.js';
44
+ export { upsertCachedUser, upsertCachedUsers, CLEARABLE_USER_FIELDS, clearedFieldsFromProfileUpdate, clearedFieldsFromAccountUpdate, } from './hooks/queries/userCache.js';
45
+ export type { CacheableUser, ClearableUserField, UpsertCachedUserOptions, } from './hooks/queries/userCache.js';
31
46
  export { useAuthStore } from './stores/authStore.js';
32
47
  export { handleAuthError, isInvalidSessionError, isTimeoutOrNetworkError, extractErrorMessage, } from './utils/errorHandlers.js';
33
48
  export type { HandleAuthErrorOptions } from './utils/errorHandlers.js';
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/ui/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,iCAA8B,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,+BAA4B,CAAC;AACtE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA4B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA4B,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8BAA2B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8BAA2B,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA2B,CAAC;AACnE,8CAA8C;AAC9C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,8BAA2B,CAAC;AACpE,mDAAmD;AACnD,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA2B,CAAC;AAGnE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,yBAAsB,CAAC;AAGvF,OAAO,EAAE,OAAO,EAAE,MAAM,oBA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,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,4BAA4B,GAC/B,MAAM,8BAA2B,CAAC;AACnC,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,8BAA8B,EAC9B,8BAA8B,GACjC,MAAM,8BAA2B,CAAC;AACnC,YAAY,EACR,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GAC1B,MAAM,8BAA2B,CAAC;AAGnC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAoB,CAAC;AAGlD,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,0BAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAAuB,CAAC"}
@@ -30,8 +30,9 @@
30
30
  * `/v2/follows`. When it is, that component is deleted and this one takes the
31
31
  * name — not aliased, not deprecated in place.
32
32
  */
33
- import type { FollowApplicationMode, FollowStatus } from '@oxy.so/contracts';
33
+ import type { FollowStatus } from '@oxy.so/contracts';
34
34
  import type { StyleProp, ViewStyle } from 'react-native';
35
+ import { type FollowDuration } from './followRules.js';
35
36
  /**
36
37
  * The small vocabulary of verbs the ecosystem actually uses. An application
37
38
  * whose verb is not here passes `labels` instead — the escape hatch exists so
@@ -48,67 +49,6 @@ export interface FollowLabels {
48
49
  /** Following globally, but switched off in this application. */
49
50
  disabled: string;
50
51
  }
51
- /** A timed-follow choice offered in the menu. */
52
- export interface FollowDuration {
53
- label: string;
54
- seconds: number;
55
- }
56
- /**
57
- * Whether an action leaves the target ACTIVE in this application.
58
- *
59
- * One table, read by both the primary button and the menu, because the same
60
- * action reached from two controls once reported differently — and a rule
61
- * living in two switch statements is a rule that drifts. `Record` rather than
62
- * a function with a default, so a new action is a compile error instead of a
63
- * silent `false`.
64
- */
65
- export declare const FOLLOW_ACTION_LEAVES_ACTIVE: Record<'follow' | 'follow-timed' | 'enable-here' | 'disable-here' | 'unfollow', boolean>;
66
- /** One line in the disclosure menu. */
67
- export interface FollowMenuItem {
68
- key: string;
69
- label: string;
70
- /** What the component should call. Named so the table below stays pure. */
71
- action: {
72
- type: 'follow-timed';
73
- seconds: number;
74
- durationLabel: string;
75
- } | {
76
- type: 'enable-here';
77
- } | {
78
- type: 'disable-here';
79
- } | {
80
- type: 'unfollow';
81
- };
82
- }
83
- /**
84
- * Which choices exist, given the state.
85
- *
86
- * Pure and exported because this is the product decision, not a rendering
87
- * detail: a timed follow is only offered before following, turning it off here
88
- * is only offered while following, and NEITHER is offered before the server has
89
- * answered — every one of them addresses a relationship that does not exist
90
- * yet, so offering them mid-write would mean sending a guessed id.
91
- */
92
- /**
93
- * What the main button should do for the current state.
94
- *
95
- * Exported because the product rule is not obvious from the label alone: a
96
- * follow switched off here still reads as "following" globally, so the primary
97
- * press must re-enable here — not unfollow everywhere.
98
- */
99
- export declare function resolveFollowPrimaryAction(input: {
100
- isFollowing: boolean;
101
- applicationMode: FollowApplicationMode;
102
- }): 'follow' | 'unfollow' | 'enable-here';
103
- export declare function buildFollowMenuItems(input: {
104
- following: boolean;
105
- applicationMode: FollowApplicationMode;
106
- hasRelationship: boolean;
107
- isPending: boolean;
108
- durations: FollowDuration[] | false;
109
- idleVerb: string;
110
- applicationName: string;
111
- }): FollowMenuItem[];
112
52
  export interface FollowTargetButtonProps {
113
53
  /** The registered target's id. Registration is separate — see the SDK. */
114
54
  targetId: string;
@@ -1 +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,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAmBzD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,WAAW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AEnE,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;AA2BD,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,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;;;OAGG;IACH,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,+DAkL7B,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The follow button's product rules, without the button.
3
+ *
4
+ * Pure: no React, no Bloom. `FollowTargetButton` renders them, and an
5
+ * application drawing its own affordance (a chip grid, a compact row) imports
6
+ * them from here — through `@oxy.so/services/ui/client` — without paying for the
7
+ * button's dropdown menu.
8
+ */
9
+ import type { FollowApplicationMode } from '@oxy.so/contracts';
10
+ /** A timed-follow choice offered in the menu. */
11
+ export interface FollowDuration {
12
+ label: string;
13
+ seconds: number;
14
+ }
15
+ /**
16
+ * Whether an action leaves the target ACTIVE in this application.
17
+ *
18
+ * One table, read by both the primary button and the menu, because the same
19
+ * action reached from two controls once reported differently — and a rule
20
+ * living in two switch statements is a rule that drifts. `Record` rather than
21
+ * a function with a default, so a new action is a compile error instead of a
22
+ * silent `false`.
23
+ */
24
+ export declare const FOLLOW_ACTION_LEAVES_ACTIVE: Record<'follow' | 'follow-timed' | 'enable-here' | 'disable-here' | 'unfollow', boolean>;
25
+ /** One line in the disclosure menu. */
26
+ export interface FollowMenuItem {
27
+ key: string;
28
+ label: string;
29
+ /** What the component should call. Named so the table below stays pure. */
30
+ action: {
31
+ type: 'follow-timed';
32
+ seconds: number;
33
+ durationLabel: string;
34
+ } | {
35
+ type: 'enable-here';
36
+ } | {
37
+ type: 'disable-here';
38
+ } | {
39
+ type: 'unfollow';
40
+ };
41
+ }
42
+ /**
43
+ * Which choices exist, given the state.
44
+ *
45
+ * Pure and exported because this is the product decision, not a rendering
46
+ * detail: a timed follow is only offered before following, turning it off here
47
+ * is only offered while following, and NEITHER is offered before the server has
48
+ * answered — every one of them addresses a relationship that does not exist
49
+ * yet, so offering them mid-write would mean sending a guessed id.
50
+ */
51
+ /**
52
+ * What the main button should do for the current state.
53
+ *
54
+ * Exported because the product rule is not obvious from the label alone: a
55
+ * follow switched off here still reads as "following" globally, so the primary
56
+ * press must re-enable here — not unfollow everywhere.
57
+ */
58
+ export declare function resolveFollowPrimaryAction(input: {
59
+ isFollowing: boolean;
60
+ applicationMode: FollowApplicationMode;
61
+ }): 'follow' | 'unfollow' | 'enable-here';
62
+ export declare function buildFollowMenuItems(input: {
63
+ following: boolean;
64
+ applicationMode: FollowApplicationMode;
65
+ hasRelationship: boolean;
66
+ isPending: boolean;
67
+ durations: FollowDuration[] | false;
68
+ idleVerb: string;
69
+ applicationName: string;
70
+ }): FollowMenuItem[];
71
+ //# sourceMappingURL=followRules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"followRules.d.ts","sourceRoot":"","sources":["../../../../../src/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@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/services",
3
- "version": "9.1.0",
3
+ "version": "9.2.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",
package/src/index.ts CHANGED
@@ -312,8 +312,8 @@ export type { AccountQueriesConfig } from './ui/hooks/accountQueryPersistence';
312
312
  export { default as FollowButton } from './ui/components/FollowButton';
313
313
  export type { FollowButtonProps, SingleFollowButtonProps, MultiFollowButtonProps } from './ui/components/FollowButton';
314
314
  // The follow graph (#809): follows anything registered, not just users.
315
+ export { FollowTargetButton } from './ui/components/FollowTargetButton';
315
316
  export {
316
- FollowTargetButton,
317
317
  // The product rules the button encodes, for an application drawing its own
318
318
  // affordance instead of using it — a chip grid, a compact row control.
319
319
  // Unexported, they get duplicated, and the duplicate is where the "off here"
@@ -322,12 +322,12 @@ export {
322
322
  buildFollowMenuItems,
323
323
  resolveFollowPrimaryAction,
324
324
  FOLLOW_ACTION_LEAVES_ACTIVE,
325
- } from './ui/components/FollowTargetButton';
325
+ } from './ui/components/followRules';
326
+ export type { FollowDuration, FollowMenuItem } from './ui/components/followRules';
326
327
  export type {
327
328
  FollowTargetButtonProps,
328
329
  FollowVerb,
329
330
  FollowLabels,
330
- FollowDuration,
331
331
  } from './ui/components/FollowTargetButton';
332
332
  export { useFollowTarget } from './ui/hooks/useFollowTarget';
333
333
  export type { UseFollowTargetResult } from './ui/hooks/useFollowTarget';
package/src/ui/client.ts CHANGED
@@ -1,8 +1,13 @@
1
1
  /**
2
- * Client-only UI exports (tree-shakeable)
2
+ * Client-only UI exports — the lean entry.
3
3
  *
4
- * Import from this module for client-side bundles where tree-shaking is important.
5
- * These are direct exports without runtime detection overhead.
4
+ * Import from this module in an app's startup path. The root barrel also
5
+ * re-exports the sign-in panels (`OxySignInPanel`, `OxyLinkCommonsPanel` and
6
+ * its QR code, `OxyConsentScreen`, …) for apps that embed them, and Metro does
7
+ * not tree-shake, so importing ANY symbol from `@oxy.so/services` ships all of
8
+ * them — even though the account dialog that normally shows them is loaded on
9
+ * demand. Nothing exported here reaches those panels; the packaging test
10
+ * `clientEntryIsolation` pins it.
6
11
  *
7
12
  * @example
8
13
  * import { OxyProvider, useOxy, LogoIcon } from '@oxy.so/services/ui/client';
@@ -16,6 +21,8 @@ export type { OxyAuthPromptProps } from './components/OxyAuthPrompt';
16
21
  export { LogoIcon } from './components/logo/LogoIcon';
17
22
  export { LogoText } from './components/logo/LogoText';
18
23
  export { default as FollowButton } from './components/FollowButton';
24
+ export { default as ProfileButton } from './components/ProfileButton';
25
+ export type { ProfileButtonProps } from './components/ProfileButton';
19
26
  export { default as PeableButton } from './components/PeableButton';
20
27
  export type { PeableButtonProps } from './components/PeableButton';
21
28
  /** @deprecated Use `PeableButton` instead. */
@@ -31,13 +38,57 @@ export { useAuth } from './hooks/useAuth';
31
38
  export type { AuthState, AuthActions, SignInOutcome, UseAuthReturn } from './hooks/useAuth';
32
39
  export { createDeferredProductAnalytics } from './analytics/productAnalytics';
33
40
  export type { OxyProductEvent, ProductAnalytics } from './analytics/productAnalytics';
34
- export { useFollow } from './hooks/useFollow';
41
+ export { useFollow, useFollowerCounts, useSeedFollowStatuses } from './hooks/useFollow';
42
+ export { useFollowTarget } from './hooks/useFollowTarget';
43
+ export type { UseFollowTargetResult } from './hooks/useFollowTarget';
44
+ export {
45
+ useUserProfile,
46
+ useUserProfiles,
47
+ useCurrentUser,
48
+ useUserById,
49
+ useUserByUsername,
50
+ } from './hooks/queries/useAccountQueries';
35
51
  export { useStorage } from './hooks/useStorage';
36
52
  export type { UseStorageOptions, UseStorageResult } from './hooks/useStorage';
37
53
 
38
54
  // Route screens live at `@oxy.so/services/screens` so client imports preserve
39
55
  // the route registry's lazy chunk boundaries.
40
56
 
57
+ // Follow rules, for an app drawing its own follow affordance
58
+ export {
59
+ buildFollowMenuItems,
60
+ resolveFollowPrimaryAction,
61
+ FOLLOW_ACTION_LEAVES_ACTIVE,
62
+ } from './components/followRules';
63
+ export type { FollowDuration, FollowMenuItem } from './components/followRules';
64
+
65
+ // Query keys, cache invalidation and the canonical user-cache upsert
66
+ export {
67
+ queryKeys,
68
+ invalidateAccountQueries,
69
+ invalidateUserQueries,
70
+ invalidateSessionQueries,
71
+ invalidateDeviceQueries,
72
+ invalidatePrivacyQueries,
73
+ invalidateSecurityQueries,
74
+ invalidateStorageQueries,
75
+ invalidatePaymentsQueries,
76
+ invalidateConnectedAppsQueries,
77
+ invalidateAuthMethodsQueries,
78
+ } from './hooks/queries/queryKeys';
79
+ export {
80
+ upsertCachedUser,
81
+ upsertCachedUsers,
82
+ CLEARABLE_USER_FIELDS,
83
+ clearedFieldsFromProfileUpdate,
84
+ clearedFieldsFromAccountUpdate,
85
+ } from './hooks/queries/userCache';
86
+ export type {
87
+ CacheableUser,
88
+ ClearableUserField,
89
+ UpsertCachedUserOptions,
90
+ } from './hooks/queries/userCache';
91
+
41
92
  // Stores
42
93
  export { useAuthStore } from './stores/authStore';
43
94
 
@@ -32,7 +32,7 @@
32
32
  */
33
33
 
34
34
  import { memo, useCallback, useMemo } from 'react';
35
- import type { FollowApplicationMode, FollowStatus } from '@oxy.so/contracts';
35
+ import type { FollowStatus } from '@oxy.so/contracts';
36
36
  import type { StyleProp, ViewStyle } from 'react-native';
37
37
  import { View } from 'react-native';
38
38
  import { FollowButton as BloomFollowButton } from '@oxy.so/bloom/media-header';
@@ -51,6 +51,13 @@ import {
51
51
  import { toast } from '@oxy.so/bloom/toast';
52
52
  import { useFollowTarget } from '../hooks/useFollowTarget';
53
53
  import { useFollowTargetStore } from '../stores/followTargetStore';
54
+ import {
55
+ buildFollowMenuItems,
56
+ FOLLOW_ACTION_LEAVES_ACTIVE,
57
+ resolveFollowPrimaryAction,
58
+ type FollowDuration,
59
+ type FollowMenuItem,
60
+ } from './followRules';
54
61
 
55
62
  /**
56
63
  * The small vocabulary of verbs the ecosystem actually uses. An application
@@ -82,12 +89,6 @@ const VERB_LABELS: Record<FollowVerb, FollowLabels> = {
82
89
  watch: { idle: 'Watch', active: 'Watching', pending: 'Requested', disabled: 'Off here' },
83
90
  };
84
91
 
85
- /** A timed-follow choice offered in the menu. */
86
- export interface FollowDuration {
87
- label: string;
88
- seconds: number;
89
- }
90
-
91
92
  const HOUR = 60 * 60;
92
93
 
93
94
  /**
@@ -101,111 +102,6 @@ const DEFAULT_DURATIONS: FollowDuration[] = [
101
102
  { label: 'A week', seconds: 7 * 24 * HOUR },
102
103
  ];
103
104
 
104
- /**
105
- * Whether an action leaves the target ACTIVE in this application.
106
- *
107
- * One table, read by both the primary button and the menu, because the same
108
- * action reached from two controls once reported differently — and a rule
109
- * living in two switch statements is a rule that drifts. `Record` rather than
110
- * a function with a default, so a new action is a compile error instead of a
111
- * silent `false`.
112
- */
113
- export const FOLLOW_ACTION_LEAVES_ACTIVE: Record<
114
- 'follow' | 'follow-timed' | 'enable-here' | 'disable-here' | 'unfollow',
115
- boolean
116
- > = {
117
- follow: true,
118
- 'follow-timed': true,
119
- // Re-enabling here does not change the global follow — the user already had
120
- // it — but it does change whether this application acts on it, which is what
121
- // a mirror is asking about.
122
- 'enable-here': true,
123
- 'disable-here': false,
124
- unfollow: false,
125
- };
126
-
127
- /** One line in the disclosure menu. */
128
- export interface FollowMenuItem {
129
- key: string;
130
- label: string;
131
- /** What the component should call. Named so the table below stays pure. */
132
- action:
133
- | { type: 'follow-timed'; seconds: number; durationLabel: string }
134
- | { type: 'enable-here' }
135
- | { type: 'disable-here' }
136
- | { type: 'unfollow' };
137
- }
138
-
139
- /**
140
- * Which choices exist, given the state.
141
- *
142
- * Pure and exported because this is the product decision, not a rendering
143
- * detail: a timed follow is only offered before following, turning it off here
144
- * is only offered while following, and NEITHER is offered before the server has
145
- * answered — every one of them addresses a relationship that does not exist
146
- * yet, so offering them mid-write would mean sending a guessed id.
147
- */
148
- /**
149
- * What the main button should do for the current state.
150
- *
151
- * Exported because the product rule is not obvious from the label alone: a
152
- * follow switched off here still reads as "following" globally, so the primary
153
- * press must re-enable here — not unfollow everywhere.
154
- */
155
- export function resolveFollowPrimaryAction(input: {
156
- isFollowing: boolean;
157
- applicationMode: FollowApplicationMode;
158
- }): 'follow' | 'unfollow' | 'enable-here' {
159
- if (!input.isFollowing) return 'follow';
160
- if (input.applicationMode === 'disabled') return 'enable-here';
161
- return 'unfollow';
162
- }
163
-
164
- export function buildFollowMenuItems(input: {
165
- following: boolean;
166
- applicationMode: FollowApplicationMode;
167
- hasRelationship: boolean;
168
- isPending: boolean;
169
- durations: FollowDuration[] | false;
170
- idleVerb: string;
171
- applicationName: string;
172
- }): FollowMenuItem[] {
173
- const items: FollowMenuItem[] = [];
174
-
175
- if (!input.following) {
176
- if (input.durations === false) return items;
177
- for (const d of input.durations) {
178
- items.push({
179
- key: `for-${d.seconds}`,
180
- label: `${input.idleVerb} for ${d.label.toLowerCase()}`,
181
- action: { type: 'follow-timed', seconds: d.seconds, durationLabel: d.label },
182
- });
183
- }
184
- return items;
185
- }
186
-
187
- if (!input.hasRelationship || input.isPending) return items;
188
-
189
- items.push(
190
- input.applicationMode === 'disabled'
191
- ? { key: 'enable-here', label: `Show in ${input.applicationName}`, action: { type: 'enable-here' } }
192
- : {
193
- key: 'disable-here',
194
- label: `Don’t show in ${input.applicationName}`,
195
- action: { type: 'disable-here' },
196
- }
197
- );
198
- items.push({
199
- // Named for what it does. "Unfollow" beside "don't show here" would read as
200
- // the same action twice, and the user would pick the wrong one.
201
- key: 'unfollow-everywhere',
202
- label: 'Unfollow everywhere',
203
- action: { type: 'unfollow' },
204
- });
205
-
206
- return items;
207
- }
208
-
209
105
  export interface FollowTargetButtonProps {
210
106
  /** The registered target's id. Registration is separate — see the SDK. */
211
107
  targetId: string;
@@ -16,7 +16,7 @@ import {
16
16
  buildFollowMenuItems,
17
17
  FOLLOW_ACTION_LEAVES_ACTIVE,
18
18
  resolveFollowPrimaryAction,
19
- } from '../FollowTargetButton';
19
+ } from '../followRules';
20
20
  import {
21
21
  isCompleteFollowStatus,
22
22
  followRecordToStatus,