@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
package/lib/commonjs/index.js
CHANGED
|
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "AccountSettingsScreen", {
|
|
|
15
15
|
return _AccountSettingsScreen.default;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "CLEARABLE_USER_FIELDS", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _userCache.CLEARABLE_USER_FIELDS;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(exports, "ConnectedAppsScreen", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
get: function () {
|
|
@@ -33,6 +39,12 @@ Object.defineProperty(exports, "FollowButton", {
|
|
|
33
39
|
return _FollowButton.default;
|
|
34
40
|
}
|
|
35
41
|
});
|
|
42
|
+
Object.defineProperty(exports, "FollowTargetButton", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _FollowTargetButton.FollowTargetButton;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
36
48
|
Object.defineProperty(exports, "IdentityBoundSessionError", {
|
|
37
49
|
enumerable: true,
|
|
38
50
|
get: function () {
|
|
@@ -153,6 +165,24 @@ Object.defineProperty(exports, "SurfaceHeaderAction", {
|
|
|
153
165
|
return _SurfaceHeaderAction.SurfaceHeaderAction;
|
|
154
166
|
}
|
|
155
167
|
});
|
|
168
|
+
Object.defineProperty(exports, "UNKNOWN_FOLLOW_STATUS", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _followTargetStore.UNKNOWN_FOLLOW_STATUS;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "clearedFieldsFromAccountUpdate", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _userCache.clearedFieldsFromAccountUpdate;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "clearedFieldsFromProfileUpdate", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _userCache.clearedFieldsFromProfileUpdate;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
156
186
|
Object.defineProperty(exports, "closeAccountDialog", {
|
|
157
187
|
enumerable: true,
|
|
158
188
|
get: function () {
|
|
@@ -435,6 +465,18 @@ Object.defineProperty(exports, "useFollow", {
|
|
|
435
465
|
return _useFollow.useFollow;
|
|
436
466
|
}
|
|
437
467
|
});
|
|
468
|
+
Object.defineProperty(exports, "useFollowTarget", {
|
|
469
|
+
enumerable: true,
|
|
470
|
+
get: function () {
|
|
471
|
+
return _useFollowTarget.useFollowTarget;
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
Object.defineProperty(exports, "useFollowTargetStore", {
|
|
475
|
+
enumerable: true,
|
|
476
|
+
get: function () {
|
|
477
|
+
return _followTargetStore.useFollowTargetStore;
|
|
478
|
+
}
|
|
479
|
+
});
|
|
438
480
|
Object.defineProperty(exports, "useFollowerCounts", {
|
|
439
481
|
enumerable: true,
|
|
440
482
|
get: function () {
|
|
@@ -717,6 +759,9 @@ var _OxyOAuthCallback = require("./ui/components/OxyOAuthCallback.js");
|
|
|
717
759
|
var _OxyConsentScreen = require("./ui/components/OxyConsentScreen.js");
|
|
718
760
|
var _RequireOxyAuth = require("./ui/components/RequireOxyAuth.js");
|
|
719
761
|
var _FollowButton = _interopRequireDefault(require("./ui/components/FollowButton.js"));
|
|
762
|
+
var _FollowTargetButton = require("./ui/components/FollowTargetButton.js");
|
|
763
|
+
var _useFollowTarget = require("./ui/hooks/useFollowTarget.js");
|
|
764
|
+
var _followTargetStore = require("./ui/stores/followTargetStore.js");
|
|
720
765
|
var _OxyPayButton = _interopRequireDefault(require("./ui/components/OxyPayButton.js"));
|
|
721
766
|
var _LogoIcon = require("./ui/components/logo/LogoIcon.js");
|
|
722
767
|
var _LogoText = require("./ui/components/logo/LogoText.js");
|
|
@@ -804,7 +849,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
804
849
|
// SDK's user query cache under both keys it owns (by-id + viewer-scoped
|
|
805
850
|
// by-username). Consumers route ALL cache seeds (feed / list / search / profile
|
|
806
851
|
// hydration) through this so a sparse source can never strip a field an
|
|
807
|
-
// authoritative fetch already stored.
|
|
852
|
+
// authoritative fetch already stored. A write that DELIBERATELY empties a field
|
|
853
|
+
// ("remove my picture") says so with `{ cleared: [...] }` — the payload cannot
|
|
854
|
+
// express it, see the module docs.
|
|
808
855
|
|
|
809
856
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
810
857
|
|
|
@@ -852,6 +899,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
852
899
|
// Gates on `useOxy().canUsePrivateApi` / `isPrivateApiPending` — never flashes the
|
|
853
900
|
// wall before the device-first cold boot resolves. Opens the ONE account dialog.
|
|
854
901
|
|
|
902
|
+
// The follow graph (#809): follows anything registered, not just users.
|
|
903
|
+
|
|
855
904
|
// Sidebar account trigger. Pressing `ProfileButton` opens the unified
|
|
856
905
|
// `OxyAccountDialogScreen` (the single account switcher + sign-in surface) via
|
|
857
906
|
// `useOxy().openAccountDialog`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_reactNative","_OxyProvider","_interopRequireDefault","_OxyContext","_useAuth","_identityBinding","_authStore","_accountStore","_assetStore","_useAssets","_useFileDownloadUrl","_useFollow","_useStorage","_useAccountQueries","_useServicesQueries","_useSecurityQueries","_useAuthMethods","_usePaymentQueries","_useAccountMutations","_useServicesMutations","_mutationFactory","_mutationKeys","_queryKeys","_userCache","_useMutationStatus","_useOnlineStatus","_useOxyEvent","_errorHandlers","_useFileFiltering","_OxySignInButton","_oauthPopup","_OxyAuthPrompt","_OxyOAuthCallback","_OxyConsentScreen","_RequireOxyAuth","_FollowButton","_OxyPayButton","_LogoIcon","_LogoText","_ProfileButton","_OxyAuthChooser","_OxySignInRequestSurface","_useSwitchableAccounts","_ProfileScreen","_ManageAccountScreen","_NotificationsScreen","_PreferencesScreen","_ConnectedAppsScreen","_CreateAccountScreen","_AccountMembersScreen","_AccountSettingsScreen","_bottomSheetManager","_useSurfaceHeader","_SurfaceHeaderAction","_accountDialogManager","e","__esModule","default","setPlatformOS","Platform","OS"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_core","require","_reactNative","_OxyProvider","_interopRequireDefault","_OxyContext","_useAuth","_identityBinding","_authStore","_accountStore","_assetStore","_useAssets","_useFileDownloadUrl","_useFollow","_useStorage","_useAccountQueries","_useServicesQueries","_useSecurityQueries","_useAuthMethods","_usePaymentQueries","_useAccountMutations","_useServicesMutations","_mutationFactory","_mutationKeys","_queryKeys","_userCache","_useMutationStatus","_useOnlineStatus","_useOxyEvent","_errorHandlers","_useFileFiltering","_OxySignInButton","_oauthPopup","_OxyAuthPrompt","_OxyOAuthCallback","_OxyConsentScreen","_RequireOxyAuth","_FollowButton","_FollowTargetButton","_useFollowTarget","_followTargetStore","_OxyPayButton","_LogoIcon","_LogoText","_ProfileButton","_OxyAuthChooser","_OxySignInRequestSurface","_useSwitchableAccounts","_ProfileScreen","_ManageAccountScreen","_NotificationsScreen","_PreferencesScreen","_ConnectedAppsScreen","_CreateAccountScreen","_AccountMembersScreen","_AccountSettingsScreen","_bottomSheetManager","_useSurfaceHeader","_SurfaceHeaderAction","_accountDialogManager","e","__esModule","default","setPlatformOS","Platform","OS"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AA3W9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAIA,IAAAG,mBAAa,EAACC,qBAAQ,CAACC,EAAgB,CAAC;;AAExC;AACA;AACA;;AAMA;AACA;AACA;;AAGA;AACA;AACA;;AAgBA;AACA;AACA;;AAOA;AACA;AACA;;AAgCA;;AAeA;AACA;AACA;;AA2BA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;;AAcA;;AAMA;AACA;AACA;;AASA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAQA;AACA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;;AAMA;;AAeA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AAIA;;AAOA;;AAKA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.FollowButton = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
8
9
|
var _OxyContext = require("../context/OxyContext.js");
|
|
9
10
|
var _toast = require("@oxyhq/bloom/toast");
|
|
10
11
|
var _button = require("@oxyhq/bloom/button");
|
|
11
|
-
var _loading = require("@oxyhq/bloom/loading");
|
|
12
12
|
var _useFollow = require("../hooks/useFollow.js");
|
|
13
13
|
var _followStore = require("../stores/followStore.js");
|
|
14
14
|
var _theme = require("@oxyhq/bloom/theme");
|
|
@@ -89,8 +89,7 @@ const FollowButtonInner = /*#__PURE__*/(0, _react.memo)(function FollowButtonInn
|
|
|
89
89
|
disabled: disabled || isBusy,
|
|
90
90
|
style: style,
|
|
91
91
|
textStyle: textStyle,
|
|
92
|
-
icon: showSpinner ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
93
|
-
variant: "inline",
|
|
92
|
+
icon: showSpinner ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
94
93
|
size: "small",
|
|
95
94
|
color: showFollowing ? colors.text : colors.primaryForeground
|
|
96
95
|
}) : undefined,
|
|
@@ -200,8 +199,7 @@ const FollowButtonMultiInner = /*#__PURE__*/(0, _react.memo)(function FollowButt
|
|
|
200
199
|
disabled: disabled || isLoading,
|
|
201
200
|
style: style,
|
|
202
201
|
textStyle: textStyle,
|
|
203
|
-
icon: showSpinner ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
204
|
-
variant: "inline",
|
|
202
|
+
icon: showSpinner ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
205
203
|
size: "small",
|
|
206
204
|
color: allFollowing ? colors.text : colors.primaryForeground
|
|
207
205
|
}) : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_OxyContext","_toast","_button","
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_OxyContext","_toast","_button","_useFollow","_followStore","_theme","_shallow","_jsxRuntime","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","memo","userId","oxyServices","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","colors","useTheme","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","useFollowForButton","handlePress","useCallback","event","preventDefault","stopPropagation","err","error","Error","String","toast","message","useEffect","isBusy","showFollowing","showSpinner","jsx","Button","variant","onPress","icon","ActivityIndicator","color","text","primaryForeground","undefined","children","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","useFollow","followAllUsers","unfollowAllUsers","isAnyLoading","initialFollowStatuses","useFollowStore","useShallow","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","useState","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","FollowButton","canUsePrivateApi","user","currentUser","useOxy","currentUserId","id","trim","rawUserIds","multiUserIds","useMemo","seen","Set","cleaned","raw","has","add","push","targetUserId","exports","_default","default"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA,GAAAR,OAAA;AAAmD,IAAAS,WAAA,GAAAT,OAAA;AAEnD,MAAMU,wBAAwB,GAAG,YAAY;AAC7C,MAAMC,0BAA0B,GAAG,WAAW;;AAE9C;;AAYA;;AAOA;;AAWA;AACA;AACA;AACA;;AAGA,MAAMC,WAAW,GAAIC,KAAwB,IAC3C,SAAS,IAAIA,KAAK,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAACG,OAAO,CAAC;AAEpD,MAAMC,iBAAiB,gBAAG,IAAAC,WAAI,EAAC,SAASD,iBAAiBA,CAAC;EACxDE,MAAM;EACNC,WAAW;EACXC,kBAAkB;EAClBC,IAAI,GAAG,QAAQ;EACfC,cAAc;EACdC,KAAK;EACLC,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ACb;EAEA,IAAI5F,WAAW,CAACC,KAAK,CAAC,EAAE;IACtB,IAAImG,YAAY,CAACf,MAAM,KAAK,CAAC,EAAE;MAC7B,OAAO,IAAI;IACb;IACA,oBACE,IAAAxF,WAAA,CAAA2C,GAAA,EAACW,sBAAsB;MAAA,GACjBlD,KAAK;MACTG,OAAO,EAAEgG;IAAa,CACvB,CAAC;EAEN;EAEA,MAAMS,YAAY,GAAG5G,KAAK,CAACM,MAAM,GAAG0B,MAAM,CAAChC,KAAK,CAACM,MAAM,CAAC,CAAC2F,IAAI,CAAC,CAAC,GAAG,EAAE;EACpE,IAAI,CAACW,YAAY,IAAKb,aAAa,IAAIA,aAAa,KAAKa,YAAa,EAAE;IACtE,OAAO,IAAI;EACb;EAEA,oBACE,IAAAhH,WAAA,CAAA2C,GAAA,EAACnC,iBAAiB;IAAA,GACZJ,KAAK;IACTM,MAAM,EAAEsG,YAAa;IACrBrG,WAAW,EAAEA;EAAY,CAC1B,CAAC;AAEN,CAAC;AAACsG,OAAA,CAAAnB,YAAA,GAAAA,YAAA;AAAA,IAAAoB,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAGarB,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FollowTargetButton = void 0;
|
|
7
|
+
exports.buildFollowMenuItems = buildFollowMenuItems;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
|
+
var _button = require("@oxyhq/bloom/button");
|
|
11
|
+
var _icons = require("@oxyhq/bloom/icons");
|
|
12
|
+
var _menu = require("@oxyhq/bloom/menu");
|
|
13
|
+
var _toast = require("@oxyhq/bloom/toast");
|
|
14
|
+
var _useFollowTarget = require("../hooks/useFollowTarget.js");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
/**
|
|
17
|
+
* `FollowTargetButton` — one button for everything an Oxy user can follow.
|
|
18
|
+
*
|
|
19
|
+
* Follows a TARGET of any registered kind: a person, a topic, a channel, a
|
|
20
|
+
* store, an artist. Nothing in this file branches on what the target is, which
|
|
21
|
+
* is the property that lets an application this package has never heard of use
|
|
22
|
+
* it without a release.
|
|
23
|
+
*
|
|
24
|
+
* ## Two controls, not one
|
|
25
|
+
*
|
|
26
|
+
* The main press does the obvious thing. The chevron beside it opens the
|
|
27
|
+
* choices that a single press cannot express — follow for a while, stop showing
|
|
28
|
+
* this here without giving it up everywhere — and those belong behind a
|
|
29
|
+
* disclosure precisely because they are not what most people want most of the
|
|
30
|
+
* time. Bloom's `Menu` renders as a bottom sheet on native and a dropdown on
|
|
31
|
+
* web, so this is one component and not a platform fork.
|
|
32
|
+
*
|
|
33
|
+
* ## Verbs
|
|
34
|
+
*
|
|
35
|
+
* "Follow" is wrong for half the things in the ecosystem: you subscribe to a
|
|
36
|
+
* channel, you join a community, you watch a listing. The verb is a prop with a
|
|
37
|
+
* small vocabulary of defaults and a full override, rather than a lookup keyed
|
|
38
|
+
* on kind — a kind→verb table in this package would need a release every time
|
|
39
|
+
* an application invents a kind, which is exactly the coupling #809 removes.
|
|
40
|
+
*
|
|
41
|
+
* ## Relationship to the legacy `FollowButton`
|
|
42
|
+
*
|
|
43
|
+
* `FollowButton` follows a USER through the Mongo-backed social graph and
|
|
44
|
+
* remains the correct component for that until the user graph is migrated onto
|
|
45
|
+
* `/v2/follows`. When it is, that component is deleted and this one takes the
|
|
46
|
+
* name — not aliased, not deprecated in place.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The small vocabulary of verbs the ecosystem actually uses. An application
|
|
51
|
+
* whose verb is not here passes `labels` instead — the escape hatch exists so
|
|
52
|
+
* this union never has to grow to accommodate one product's wording.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
const VERB_LABELS = {
|
|
56
|
+
follow: {
|
|
57
|
+
idle: 'Follow',
|
|
58
|
+
active: 'Following',
|
|
59
|
+
pending: 'Requested',
|
|
60
|
+
disabled: 'Off here'
|
|
61
|
+
},
|
|
62
|
+
subscribe: {
|
|
63
|
+
idle: 'Subscribe',
|
|
64
|
+
active: 'Subscribed',
|
|
65
|
+
pending: 'Requested',
|
|
66
|
+
disabled: 'Off here'
|
|
67
|
+
},
|
|
68
|
+
join: {
|
|
69
|
+
idle: 'Join',
|
|
70
|
+
active: 'Joined',
|
|
71
|
+
pending: 'Requested',
|
|
72
|
+
disabled: 'Off here'
|
|
73
|
+
},
|
|
74
|
+
watch: {
|
|
75
|
+
idle: 'Watch',
|
|
76
|
+
active: 'Watching',
|
|
77
|
+
pending: 'Requested',
|
|
78
|
+
disabled: 'Off here'
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** A timed-follow choice offered in the menu. */
|
|
83
|
+
|
|
84
|
+
const HOUR = 60 * 60;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Defaults chosen for the cases a timed follow is actually for: a live event
|
|
88
|
+
* tonight, a story running this week. Not a general-purpose duration picker —
|
|
89
|
+
* an application that needs one passes its own.
|
|
90
|
+
*/
|
|
91
|
+
const DEFAULT_DURATIONS = [{
|
|
92
|
+
label: '24 hours',
|
|
93
|
+
seconds: 24 * HOUR
|
|
94
|
+
}, {
|
|
95
|
+
label: '72 hours',
|
|
96
|
+
seconds: 72 * HOUR
|
|
97
|
+
}, {
|
|
98
|
+
label: 'A week',
|
|
99
|
+
seconds: 7 * 24 * HOUR
|
|
100
|
+
}];
|
|
101
|
+
|
|
102
|
+
/** One line in the disclosure menu. */
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Which choices exist, given the state.
|
|
106
|
+
*
|
|
107
|
+
* Pure and exported because this is the product decision, not a rendering
|
|
108
|
+
* detail: a timed follow is only offered before following, turning it off here
|
|
109
|
+
* is only offered while following, and NEITHER is offered before the server has
|
|
110
|
+
* answered — every one of them addresses a relationship that does not exist
|
|
111
|
+
* yet, so offering them mid-write would mean sending a guessed id.
|
|
112
|
+
*/
|
|
113
|
+
function buildFollowMenuItems(input) {
|
|
114
|
+
const items = [];
|
|
115
|
+
if (!input.following) {
|
|
116
|
+
if (input.durations === false) return items;
|
|
117
|
+
for (const d of input.durations) {
|
|
118
|
+
items.push({
|
|
119
|
+
key: `for-${d.seconds}`,
|
|
120
|
+
label: `${input.idleVerb} for ${d.label.toLowerCase()}`,
|
|
121
|
+
action: {
|
|
122
|
+
type: 'follow-timed',
|
|
123
|
+
seconds: d.seconds,
|
|
124
|
+
durationLabel: d.label
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return items;
|
|
129
|
+
}
|
|
130
|
+
if (!input.hasRelationship || input.isPending) return items;
|
|
131
|
+
items.push(input.applicationMode === 'disabled' ? {
|
|
132
|
+
key: 'enable-here',
|
|
133
|
+
label: `Show in ${input.applicationName}`,
|
|
134
|
+
action: {
|
|
135
|
+
type: 'enable-here'
|
|
136
|
+
}
|
|
137
|
+
} : {
|
|
138
|
+
key: 'disable-here',
|
|
139
|
+
label: `Don’t show in ${input.applicationName}`,
|
|
140
|
+
action: {
|
|
141
|
+
type: 'disable-here'
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
items.push({
|
|
145
|
+
// Named for what it does. "Unfollow" beside "don't show here" would read as
|
|
146
|
+
// the same action twice, and the user would pick the wrong one.
|
|
147
|
+
key: 'unfollow-everywhere',
|
|
148
|
+
label: 'Unfollow everywhere',
|
|
149
|
+
action: {
|
|
150
|
+
type: 'unfollow'
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return items;
|
|
154
|
+
}
|
|
155
|
+
const FollowTargetButton = exports.FollowTargetButton = /*#__PURE__*/(0, _react.memo)(function FollowTargetButton({
|
|
156
|
+
targetId,
|
|
157
|
+
verb = 'follow',
|
|
158
|
+
labels,
|
|
159
|
+
size = 'medium',
|
|
160
|
+
style,
|
|
161
|
+
disabled = false,
|
|
162
|
+
showOptions = true,
|
|
163
|
+
durations = DEFAULT_DURATIONS,
|
|
164
|
+
applicationName,
|
|
165
|
+
onChange
|
|
166
|
+
}) {
|
|
167
|
+
const {
|
|
168
|
+
status,
|
|
169
|
+
isFollowing,
|
|
170
|
+
isUnknown,
|
|
171
|
+
isPending,
|
|
172
|
+
follow,
|
|
173
|
+
unfollow,
|
|
174
|
+
disableHere,
|
|
175
|
+
enableHere
|
|
176
|
+
} = (0, _useFollowTarget.useFollowTarget)(targetId);
|
|
177
|
+
const text = (0, _react.useMemo)(() => ({
|
|
178
|
+
...VERB_LABELS[verb],
|
|
179
|
+
...labels
|
|
180
|
+
}), [verb, labels]);
|
|
181
|
+
const label = (0, _react.useMemo)(() => {
|
|
182
|
+
if (status.globalState === 'requested') return text.pending;
|
|
183
|
+
if (!isFollowing) return text.idle;
|
|
184
|
+
// Followed globally but switched off here. `effectiveState` reports
|
|
185
|
+
// `not_following` for this, correctly — the question it answers is "does
|
|
186
|
+
// this act here" — so the label has to be derived from the other two.
|
|
187
|
+
return status.applicationMode === 'disabled' ? text.disabled : text.active;
|
|
188
|
+
}, [isFollowing, status.globalState, status.applicationMode, text]);
|
|
189
|
+
const handlePrimary = (0, _react.useCallback)(async () => {
|
|
190
|
+
if (isFollowing) {
|
|
191
|
+
await unfollow();
|
|
192
|
+
onChange?.(false);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
await follow();
|
|
196
|
+
onChange?.(true);
|
|
197
|
+
}, [isFollowing, follow, unfollow, onChange]);
|
|
198
|
+
const handleTimed = (0, _react.useCallback)(async (seconds, durationLabel) => {
|
|
199
|
+
await follow({
|
|
200
|
+
expiresIn: seconds
|
|
201
|
+
});
|
|
202
|
+
onChange?.(true);
|
|
203
|
+
// The confirmation is the point: a follow that ends on its own is a
|
|
204
|
+
// promise, and a user who does not see it made will not believe it.
|
|
205
|
+
_toast.toast.success(`Following for ${durationLabel.toLowerCase()}`);
|
|
206
|
+
}, [follow, onChange]);
|
|
207
|
+
const menuItems = (0, _react.useMemo)(() => buildFollowMenuItems({
|
|
208
|
+
following: isFollowing,
|
|
209
|
+
applicationMode: status.applicationMode,
|
|
210
|
+
hasRelationship: Boolean(status.relationshipId),
|
|
211
|
+
isPending,
|
|
212
|
+
durations,
|
|
213
|
+
idleVerb: text.idle,
|
|
214
|
+
applicationName: applicationName ?? 'this app'
|
|
215
|
+
}), [isFollowing, status.applicationMode, status.relationshipId, isPending, durations, text.idle, applicationName]);
|
|
216
|
+
const runItem = (0, _react.useCallback)(item => {
|
|
217
|
+
switch (item.action.type) {
|
|
218
|
+
case 'follow-timed':
|
|
219
|
+
void handleTimed(item.action.seconds, item.action.durationLabel);
|
|
220
|
+
return;
|
|
221
|
+
case 'enable-here':
|
|
222
|
+
void enableHere();
|
|
223
|
+
return;
|
|
224
|
+
case 'disable-here':
|
|
225
|
+
void disableHere();
|
|
226
|
+
return;
|
|
227
|
+
case 'unfollow':
|
|
228
|
+
void unfollow();
|
|
229
|
+
onChange?.(false);
|
|
230
|
+
}
|
|
231
|
+
}, [handleTimed, enableHere, disableHere, unfollow, onChange]);
|
|
232
|
+
const primary = /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
|
|
233
|
+
variant: isFollowing ? 'secondary' : 'primary',
|
|
234
|
+
size: size
|
|
235
|
+
// Unknown is not "not following": the button stays inert until the first
|
|
236
|
+
// read settles rather than inviting a follow that may already exist.
|
|
237
|
+
,
|
|
238
|
+
disabled: disabled || isUnknown,
|
|
239
|
+
loading: isPending,
|
|
240
|
+
onPress: () => void handlePrimary(),
|
|
241
|
+
accessibilityLabel: label,
|
|
242
|
+
children: label
|
|
243
|
+
});
|
|
244
|
+
if (!showOptions || menuItems.length === 0) {
|
|
245
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
246
|
+
style: style,
|
|
247
|
+
children: primary
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
251
|
+
style: [{
|
|
252
|
+
flexDirection: 'row',
|
|
253
|
+
alignItems: 'center',
|
|
254
|
+
gap: 4
|
|
255
|
+
}, style],
|
|
256
|
+
children: [primary, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_menu.Menu, {
|
|
257
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_menu.MenuTrigger, {
|
|
258
|
+
label: `${label} options`,
|
|
259
|
+
hint: "Opens follow options",
|
|
260
|
+
children: ({
|
|
261
|
+
props
|
|
262
|
+
}) =>
|
|
263
|
+
/*#__PURE__*/
|
|
264
|
+
// The trigger's props are mapped rather than spread: `MenuTrigger`
|
|
265
|
+
// hands back a DOM-ish bag (focus handlers, an accessibility role)
|
|
266
|
+
// and `Button` accepts a different set, so a spread would pass
|
|
267
|
+
// props it silently drops.
|
|
268
|
+
(0, _jsxRuntime.jsx)(_button.Button, {
|
|
269
|
+
variant: "secondary",
|
|
270
|
+
size: size === 'large' ? 'large' : 'small',
|
|
271
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChevronBottom_Stroke2_Corner0_Rounded, {
|
|
272
|
+
width: 16
|
|
273
|
+
}),
|
|
274
|
+
disabled: disabled || isUnknown,
|
|
275
|
+
onPress: props.onPress,
|
|
276
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
277
|
+
accessibilityHint: props.accessibilityHint
|
|
278
|
+
})
|
|
279
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_menu.MenuContent, {
|
|
280
|
+
showCancel: true,
|
|
281
|
+
children: menuItems.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)(_menu.MenuItem, {
|
|
282
|
+
label: item.label,
|
|
283
|
+
onPress: () => runItem(item),
|
|
284
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_menu.MenuItemText, {
|
|
285
|
+
children: item.label
|
|
286
|
+
})
|
|
287
|
+
}, item.key))
|
|
288
|
+
})]
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
//# sourceMappingURL=FollowTargetButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_button","_icons","_menu","_toast","_useFollowTarget","_jsxRuntime","VERB_LABELS","follow","idle","active","pending","disabled","subscribe","join","watch","HOUR","DEFAULT_DURATIONS","label","seconds","buildFollowMenuItems","input","items","following","durations","d","push","key","idleVerb","toLowerCase","action","type","durationLabel","hasRelationship","isPending","applicationMode","applicationName","FollowTargetButton","exports","memo","targetId","verb","labels","size","style","showOptions","onChange","status","isFollowing","isUnknown","unfollow","disableHere","enableHere","useFollowTarget","text","useMemo","globalState","handlePrimary","useCallback","handleTimed","expiresIn","toast","success","menuItems","Boolean","relationshipId","runItem","item","primary","jsx","Button","variant","loading","onPress","accessibilityLabel","children","length","View","jsxs","flexDirection","alignItems","gap","Menu","MenuTrigger","hint","props","icon","ChevronBottom_Stroke2_Corner0_Rounded","width","accessibilityHint","MenuContent","showCancel","map","MenuItem","MenuItemText"],"sourceRoot":"../../../../src","sources":["ui/components/FollowTargetButton.tsx"],"mappings":";;;;;;;AAiCA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,gBAAA,GAAAN,OAAA;AAA2D,IAAAO,WAAA,GAAAP,OAAA;AAzC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;;AAcA,MAAMQ,WAA6C,GAAG;E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UAAG,CAAE,CAAE;UACjC5E,QAAQ,EAAEA,QAAQ,IAAIqC,SAAU;UAChCwB,OAAO,EAAEY,KAAK,CAACZ,OAAQ;UACvBC,kBAAkB,EAAEW,KAAK,CAACX,kBAAmB;UAC7Ce,iBAAiB,EAAEJ,KAAK,CAACI;QAAkB,CAC5C;MACF,CACU,CAAC,eACd,IAAAnF,WAAA,CAAA+D,GAAA,EAAClE,KAAA,CAAAuF,WAAW;QAACC,UAAU;QAAAhB,QAAA,EACpBZ,SAAS,CAAC6B,GAAG,CAAEzB,IAAI,iBAClB,IAAA7D,WAAA,CAAA+D,GAAA,EAAClE,KAAA,CAAA0F,QAAQ;UAAgB3E,KAAK,EAAEiD,IAAI,CAACjD,KAAM;UAACuD,OAAO,EAAEA,CAAA,KAAMP,OAAO,CAACC,IAAI,CAAE;UAAAQ,QAAA,eACvE,IAAArE,WAAA,CAAA+D,GAAA,EAAClE,KAAA,CAAA2F,YAAY;YAAAnB,QAAA,EAAER,IAAI,CAACjD;UAAK,CAAe;QAAC,GAD5BiD,IAAI,CAACxC,GAEV,CACX;MAAC,CACS,CAAC;IAAA,CACV,CAAC;EAAA,CACH,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -8,7 +8,7 @@ var _reactNative = require("react-native");
|
|
|
8
8
|
var _MaterialCommunityIcons = _interopRequireDefault(require("@expo/vector-icons/MaterialCommunityIcons"));
|
|
9
9
|
var _reactNativeQrcodeSvg = _interopRequireDefault(require("react-native-qrcode-svg"));
|
|
10
10
|
var _button = require("@oxyhq/bloom/button");
|
|
11
|
-
var
|
|
11
|
+
var _theme = require("@oxyhq/bloom/theme");
|
|
12
12
|
var _typography = require("@oxyhq/bloom/typography");
|
|
13
13
|
var _styles = require("./styles.js");
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -34,11 +34,19 @@ const QR_SIZE = 196;
|
|
|
34
34
|
/** The leading route glyph, sized to sit where the QR plate otherwise would. */
|
|
35
35
|
const ROUTE_GLYPH_SIZE = 44;
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
/**
|
|
38
|
+
* The indeterminate leading visual: the request exists but has nothing to show yet.
|
|
39
|
+
* Uses RN's ActivityIndicator — `@oxyhq/bloom/loading` can tree-shake to `undefined`
|
|
40
|
+
* in rolldown-vite production bundles when co-imported with `@oxyhq/bloom/button`
|
|
41
|
+
* (auth.oxy.so/authorize blank screen, React #130).
|
|
42
|
+
*/
|
|
43
|
+
const PreparingSurface = () => {
|
|
44
|
+
const theme = (0, _theme.useTheme)();
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
46
|
+
size: "large",
|
|
47
|
+
color: theme.colors.primary
|
|
48
|
+
});
|
|
49
|
+
};
|
|
42
50
|
|
|
43
51
|
/** The leading glyph for a route whose surface is elsewhere (the phone, Commons). */
|
|
44
52
|
exports.PreparingSurface = PreparingSurface;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_MaterialCommunityIcons","_interopRequireDefault","_reactNativeQrcodeSvg","_button","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_MaterialCommunityIcons","_interopRequireDefault","_reactNativeQrcodeSvg","_button","_theme","_typography","_styles","_jsxRuntime","e","__esModule","default","QR_PLATE_BG","QR_FOREGROUND","QR_SIZE","ROUTE_GLYPH_SIZE","PreparingSurface","theme","useTheme","jsx","ActivityIndicator","size","color","colors","primary","exports","RouteGlyph","name","QrPlate","payload","t","jsxs","Fragment","children","Text","style","styles","qrHeadline","text","View","qrPlate","value","backgroundColor","GetCommonsPrompt","onGetCommons","mutedText","textSecondary","Button","variant","onPress","primaryButton","testID","RequestPrimarySurface","route","progress","qrPayload","success"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/requestSurfaces.tsx"],"mappings":";;;;;;AAeA,IAAAA,YAAA,GAAAC,OAAA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A,oBAAO,IAAAhB,WAAA,CAAAW,GAAA,EAACH,gBAAgB,IAAE,CAAC;AAC7B,CAAC;AAACS,OAAA,CAAA2B,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -12,6 +12,8 @@ var _OxyContext = require("../../context/OxyContext.js");
|
|
|
12
12
|
var _toast = require("@oxyhq/bloom/toast");
|
|
13
13
|
var _avatarUtils = require("../../utils/avatarUtils.js");
|
|
14
14
|
var _authStore = require("../../stores/authStore.js");
|
|
15
|
+
var _accountStore = require("../../stores/accountStore.js");
|
|
16
|
+
var _userCache = require("../queries/userCache.js");
|
|
15
17
|
/**
|
|
16
18
|
* Update user profile with optimistic updates and offline queue support
|
|
17
19
|
*/
|
|
@@ -96,10 +98,21 @@ const useUpdateProfile = () => {
|
|
|
96
98
|
|
|
97
99
|
// Update authStore so frontend components see the changes immediately
|
|
98
100
|
_authStore.useAuthStore.getState().setUser(data);
|
|
101
|
+
const cleared = (0, _userCache.clearedFieldsFromProfileUpdate)(updates);
|
|
102
|
+
(0, _userCache.upsertCachedUser)(queryClient, data, data.id, {
|
|
103
|
+
cleared: cleared.length > 0 ? cleared : undefined
|
|
104
|
+
});
|
|
99
105
|
|
|
100
|
-
//
|
|
101
|
-
if (updates.avatar
|
|
102
|
-
|
|
106
|
+
// Avatar add/remove: keep the account switcher in sync with profile writes
|
|
107
|
+
if (typeof updates.avatar === 'string' && activeSessionId) {
|
|
108
|
+
if (updates.avatar && oxyServices) {
|
|
109
|
+
(0, _avatarUtils.refreshAvatarInStore)(activeSessionId, updates.avatar, oxyServices);
|
|
110
|
+
} else {
|
|
111
|
+
_accountStore.useAccountStore.getState().updateAccount(activeSessionId, {
|
|
112
|
+
avatar: undefined,
|
|
113
|
+
avatarUrl: undefined
|
|
114
|
+
});
|
|
115
|
+
}
|
|
103
116
|
}
|
|
104
117
|
|
|
105
118
|
// Invalidate all related queries so every consumer (the account dialog,
|