@oxyhq/services 26.2.0 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/index.js +50 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +3 -5
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/FollowTargetButton.js +292 -0
- package/lib/commonjs/ui/components/FollowTargetButton.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +14 -6
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +16 -3
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +164 -10
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/useFollowTarget.js +140 -0
- package/lib/commonjs/ui/hooks/useFollowTarget.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +49 -6
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +6 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +73 -40
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/stores/followTargetStore.js +113 -0
- package/lib/commonjs/ui/stores/followTargetStore.js.map +1 -0
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js +2 -0
- package/lib/commonjs/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/commonjs/ui/utils/avatarUtils.js +5 -0
- package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
- package/lib/module/index.js +8 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +3 -5
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/FollowTargetButton.js +287 -0
- package/lib/module/ui/components/FollowTargetButton.js.map +1 -0
- package/lib/module/ui/components/authChooser/requestSurfaces.js +15 -7
- package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +16 -3
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +161 -10
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/module/ui/hooks/useFollowTarget.js +136 -0
- package/lib/module/ui/hooks/useFollowTarget.js.map +1 -0
- package/lib/module/ui/screens/AccountMembersScreen.js +49 -6
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +6 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +74 -41
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/stores/followTargetStore.js +107 -0
- package/lib/module/ui/stores/followTargetStore.js.map +1 -0
- package/lib/module/ui/stores/resetSessionScopedStores.js +2 -0
- package/lib/module/ui/stores/resetSessionScopedStores.js.map +1 -1
- package/lib/module/ui/utils/avatarUtils.js +5 -0
- package/lib/module/ui/utils/avatarUtils.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +7 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts +119 -0
- package/lib/typescript/commonjs/ui/components/FollowTargetButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +6 -1
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +79 -2
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useFollowTarget.d.ts +41 -0
- package/lib/typescript/commonjs/ui/hooks/useFollowTarget.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts +70 -0
- package/lib/typescript/commonjs/ui/stores/followTargetStore.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +7 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FollowTargetButton.d.ts +119 -0
- package/lib/typescript/module/ui/components/FollowTargetButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +6 -1
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +79 -2
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useFollowTarget.d.ts +41 -0
- package/lib/typescript/module/ui/hooks/useFollowTarget.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/AccountMembersScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts +70 -0
- package/lib/typescript/module/ui/stores/followTargetStore.d.ts.map +1 -0
- package/lib/typescript/module/ui/stores/resetSessionScopedStores.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +26 -3
- package/src/ui/components/FollowButton.tsx +3 -5
- package/src/ui/components/FollowTargetButton.tsx +326 -0
- package/src/ui/components/__tests__/followTargetButton.test.ts +132 -0
- package/src/ui/components/authChooser/requestSurfaces.tsx +12 -4
- package/src/ui/hooks/mutations/useAccountMutations.ts +20 -3
- package/src/ui/hooks/queries/__tests__/userCacheClear.test.ts +301 -0
- package/src/ui/hooks/queries/userCache.ts +211 -10
- package/src/ui/hooks/useFollowTarget.ts +194 -0
- package/src/ui/screens/AccountMembersScreen.tsx +62 -6
- package/src/ui/screens/AccountSettingsScreen.tsx +9 -1
- package/src/ui/screens/CreateAccountScreen.tsx +66 -36
- package/src/ui/stores/__tests__/resetSessionScopedStores.test.ts +23 -0
- package/src/ui/stores/followTargetStore.ts +119 -0
- package/src/ui/stores/resetSessionScopedStores.ts +2 -0
- package/src/ui/utils/avatarUtils.ts +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_zustand","require","UNKNOWN_FOLLOW_STATUS","exports","globalState","applicationMode","effectiveState","useFollowTargetStore","create","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":";;;;;;;;;AAwBA,IAAAA,QAAA,GAAAC,OAAA;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AEC,MAAM,EAAE,CAAC;EAAE,CAAC;AAC5D,CAAC,CAAC,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,kBAAkBA,CAACR,MAAoB,EAAW;EAChE,OAAOA,MAAM,CAACX,WAAW,KAAK,QAAQ,IAAIW,MAAM,CAACX,WAAW,KAAK,WAAW;AAC9E;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASoB,mBAAmBA,CACjCT,MAAoB,EACpBU,IAA2B,EACb;EACd,OAAO;IACL,GAAGV,MAAM;IACTV,eAAe,EAAEoB,IAAI;IACrBnB,cAAc,EACZmB,IAAI,KAAK,UAAU,GACf,eAAe,GACfV,MAAM,CAACX,WAAW,KAAK,QAAQ,GAC7B,WAAW,GACXW,MAAM,CAACX,WAAW,KAAK,WAAW,GAChC,WAAW,GACX;EACZ,CAAC;AACH","ignoreList":[]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.resetSessionScopedStores = resetSessionScopedStores;
|
|
7
7
|
var _followStore = require("./followStore.js");
|
|
8
|
+
var _followTargetStore = require("./followTargetStore.js");
|
|
8
9
|
/**
|
|
9
10
|
* Drop session-scoped Zustand slices so the next user/account never inherits
|
|
10
11
|
* stale UI state.
|
|
@@ -15,5 +16,6 @@ var _followStore = require("./followStore.js");
|
|
|
15
16
|
*/
|
|
16
17
|
function resetSessionScopedStores() {
|
|
17
18
|
_followStore.useFollowStore.getState().resetFollowState();
|
|
19
|
+
_followTargetStore.useFollowTargetStore.getState().reset();
|
|
18
20
|
}
|
|
19
21
|
//# sourceMappingURL=resetSessionScopedStores.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_followStore","require","resetSessionScopedStores","useFollowStore","getState","resetFollowState"],"sourceRoot":"../../../../src","sources":["ui/stores/resetSessionScopedStores.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,
|
|
1
|
+
{"version":3,"names":["_followStore","require","_followTargetStore","resetSessionScopedStores","useFollowStore","getState","resetFollowState","useFollowTargetStore","reset"],"sourceRoot":"../../../../src","sources":["ui/stores/resetSessionScopedStores.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,wBAAwBA,CAAA,EAAS;EAC/CC,2BAAc,CAACC,QAAQ,CAAC,CAAC,CAACC,gBAAgB,CAAC,CAAC;EAC5CC,uCAAoB,CAACF,QAAQ,CAAC,CAAC,CAACG,KAAK,CAAC,CAAC;AACzC","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ var _core = require("@oxyhq/core");
|
|
|
9
9
|
var _accountStore = require("../stores/accountStore.js");
|
|
10
10
|
var _authStore = require("../stores/authStore.js");
|
|
11
11
|
var _queryKeys = require("../hooks/queries/queryKeys.js");
|
|
12
|
+
var _userCache = require("../hooks/queries/userCache.js");
|
|
12
13
|
/**
|
|
13
14
|
* Refreshes avatar in accountStore with cache-busted URL to force image reload.
|
|
14
15
|
*
|
|
@@ -49,6 +50,10 @@ async function updateProfileWithAvatar(updates, oxyServices, activeSessionId, qu
|
|
|
49
50
|
|
|
50
51
|
// Update authStore so frontend components see the changes immediately
|
|
51
52
|
_authStore.useAuthStore.getState().setUser(data);
|
|
53
|
+
const cleared = (0, _userCache.clearedFieldsFromProfileUpdate)(updates);
|
|
54
|
+
(0, _userCache.upsertCachedUser)(queryClient, data, data.id, {
|
|
55
|
+
cleared: cleared.length > 0 ? cleared : undefined
|
|
56
|
+
});
|
|
52
57
|
|
|
53
58
|
// If avatar was updated, refresh accountStore with a cache-busted URL. An
|
|
54
59
|
// EMPTY avatar is a removal: clear both fields so the switcher falls back to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_core","require","_accountStore","_authStore","_queryKeys","refreshAvatarInStore","sessionId","avatarFileId","oxyServices","updateAccount","useAccountStore","getState","cacheBustedUrl","getFileDownloadUrl","Date","now","avatar","avatarUrl","updateProfileWithAvatar","updates","activeSessionId","queryClient","syncSession","data","authenticatedApiCall","updateProfile","setQueryData","queryKeys","accounts","current","users","profile","useAuthStore","setUser","undefined","invalidateUserQueries","invalidateAccountQueries"],"sourceRoot":"../../../../src","sources":["ui/utils/avatarUtils.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;
|
|
1
|
+
{"version":3,"names":["_core","require","_accountStore","_authStore","_queryKeys","_userCache","refreshAvatarInStore","sessionId","avatarFileId","oxyServices","updateAccount","useAccountStore","getState","cacheBustedUrl","getFileDownloadUrl","Date","now","avatar","avatarUrl","updateProfileWithAvatar","updates","activeSessionId","queryClient","syncSession","data","authenticatedApiCall","updateProfile","setQueryData","queryKeys","accounts","current","users","profile","useAuthStore","setUser","cleared","clearedFieldsFromProfileUpdate","upsertCachedUser","id","length","undefined","invalidateUserQueries","invalidateAccountQueries"],"sourceRoot":"../../../../src","sources":["ui/utils/avatarUtils.ts"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,oBAAoBA,CAClCC,SAAiB,EACjBC,YAAoB,EACpBC,WAAwB,EAClB;EACN,MAAM;IAAEC;EAAc,CAAC,GAAGC,6BAAe,CAACC,QAAQ,CAAC,CAAC;EACpD,MAAMC,cAAc,GAAG,GAAGJ,WAAW,CAACK,kBAAkB,CAACN,YAAY,EA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ACC,QAAQ,CAAC,CAAC,CAACF,aAAa,CAACW,eAAe,EAAE;QACxDJ,MAAM,EAAEuB,SAAS;QACjBtB,SAAS,EAAEsB;MACb,CAAC,CAAC;IACJ;EACF;;EAEA;EACA,IAAAC,gCAAqB,EAACnB,WAAW,CAAC;EAClC,IAAAoB,mCAAwB,EAACpB,WAAW,CAAC;EAErC,OAAOE,IAAI;AACb","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -87,8 +87,10 @@ export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateS
|
|
|
87
87
|
// SDK's user query cache under both keys it owns (by-id + viewer-scoped
|
|
88
88
|
// by-username). Consumers route ALL cache seeds (feed / list / search / profile
|
|
89
89
|
// hydration) through this so a sparse source can never strip a field an
|
|
90
|
-
// authoritative fetch already stored.
|
|
91
|
-
|
|
90
|
+
// authoritative fetch already stored. A write that DELIBERATELY empties a field
|
|
91
|
+
// ("remove my picture") says so with `{ cleared: [...] }` — the payload cannot
|
|
92
|
+
// express it, see the module docs.
|
|
93
|
+
export { upsertCachedUser, upsertCachedUsers, CLEARABLE_USER_FIELDS, clearedFieldsFromProfileUpdate, clearedFieldsFromAccountUpdate } from "./ui/hooks/queries/userCache.js";
|
|
92
94
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
93
95
|
export { useMutationStatus } from "./ui/hooks/useMutationStatus.js";
|
|
94
96
|
export { useOnlineStatus } from "./ui/hooks/useOnlineStatus.js";
|
|
@@ -143,6 +145,10 @@ export { OxyConsentScreen } from "./ui/components/OxyConsentScreen.js";
|
|
|
143
145
|
// wall before the device-first cold boot resolves. Opens the ONE account dialog.
|
|
144
146
|
export { RequireOxyAuth } from "./ui/components/RequireOxyAuth.js";
|
|
145
147
|
export { default as FollowButton } from "./ui/components/FollowButton.js";
|
|
148
|
+
// The follow graph (#809): follows anything registered, not just users.
|
|
149
|
+
export { FollowTargetButton } from "./ui/components/FollowTargetButton.js";
|
|
150
|
+
export { useFollowTarget } from "./ui/hooks/useFollowTarget.js";
|
|
151
|
+
export { useFollowTargetStore, UNKNOWN_FOLLOW_STATUS } from "./ui/stores/followTargetStore.js";
|
|
146
152
|
export { default as OxyPayButton } from "./ui/components/OxyPayButton.js";
|
|
147
153
|
export { LogoIcon } from "./ui/components/logo/LogoIcon.js";
|
|
148
154
|
export { LogoText } from "./ui/components/logo/LogoText.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setPlatformOS","Platform","OS","default","OxyProvider","useOxy","useAuth","IdentityBoundSessionError","useAuthStore","useAccountStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","setOxyAssetInstance","useFileDownloadUrl","useFollow","useFollowerCounts","useSeedFollowStatuses","useStorage","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useConnectedApps","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useAccountStorageUsage","useSecurityActivity","useRecentSecurityActivity","useInfiniteSecurityActivity","useAuthMethods","useUserSubscription","useUserPayments","useUserWallet","useUserWalletTransactions","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUpdateNotificationPreferences","useUpdateUserPreferences","useRevokeConnectedApp","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","mutationKeys","queryKeys","invalidateAccountQueries","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries","invalidateAuthMethodsQueries","upsertCachedUser","upsertCachedUsers","useMutationStatus","useOnlineStatus","useOxyEvent","handleAuthError","isInvalidSessionError","isTimeoutOrNetworkError","extractErrorMessage","useFileFiltering","OXY_OAUTH_STATE_STORAGE_KEY","OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY","OxySignInButton","openOAuthPopup","OxyAuthPrompt","OxyOAuthCallback","OxyConsentScreen","RequireOxyAuth","FollowButton","OxyPayButton","LogoIcon","LogoText","ProfileButton","OxyAuthChooser","OxySignInRequestSurface","useSwitchableAccounts","ProfileScreen","ManageAccountScreen","NotificationsScreen","PreferencesScreen","ConnectedAppsScreen","CreateAccountScreen","AccountMembersScreen","AccountSettingsScreen","showBottomSheet","closeBottomSheet","useSurfaceHeader","SurfaceHeaderAction","openAccountDialog","closeAccountDialog","subscribeToAccountDialog"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAASA,aAAa,QAAyB,aAAa;AAC5D,SAASC,QAAQ,QAAQ,cAAc;AACvCD,aAAa,CAACC,QAAQ,CAACC,EAAgB,CAAC;;AAExC;AACA;AACA;AACA,SAASC,OAAO,IAAIC,WAAW,QAAQ,gCAA6B;AACpE,SAASC,MAAM,QAAQ,4BAAyB;AAEhD,SAASC,OAAO,QAAQ,uBAAoB;AAE5C;AACA;AACA;AACA,SAASC,yBAAyB,QAAQ,iCAA8B;;AAExE;AACA;AACA;AACA,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SACIC,aAAa,EACbC,SAAS,IAAIC,cAAc,EAC3BC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,QACb,2BAAwB;;AAE/B;AACA;AACA;AACA,SAAST,SAAS,EAAEU,mBAAmB,QAAQ,yBAAsB;AACrE,SAASC,kBAAkB,QAAQ,kCAA+B;AAClE,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,qBAAqB,QAAQ,yBAAsB;AAC1F,SAASC,UAAU,QAAQ,0BAAuB;AAGlD;AACA;AACA;AACA,SACIC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,QACb,yCAAsC;AAC7C,SACIC,WAAW,EACXC,UAAU,EACVC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,sBAAsB,QACnB,0CAAuC;AAC9C,SACIC,mBAAmB,EACnBC,yBAAyB,EACzBC,2BAA2B,QACxB,0CAAuC;AAC9C,SAASC,cAAc,QAAQ,sCAAmC;AAClE,SACIC,mBAAmB,EACnBC,eAAe,EACfC,aAAa,EACbC,yBAAyB,QACtB,yCAAsC;;AAE7C;;AAeA;AACA;AACA;AACA,SACIC,gBAAgB,EAChBC,eAAe,EACfC,wBAAwB,EACxBC,wBAAwB,EACxBC,gCAAgC,EAChCC,wBAAwB,EACxBC,qBAAqB,EACrBC,aAAa,QACV,6CAA0C;AACjD,SACIC,gBAAgB,EAChBC,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBC,eAAe,QACZ,8CAA2C;AAClD,SACIC,qBAAqB,EACrBC,qBAAqB,QAClB,yCAAsC;AAM7C;AACA,SAASC,YAAY,QAAQ,sCAAmC;;AAEhE;AACA;AACA;AACA;AACA;AACA;AACA,SACIC,SAAS,EACTC,wBAAwB,EACxBC,qBAAqB,EACrBC,wBAAwB,EACxBC,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,EACzBC,wBAAwB,EACxBC,yBAAyB,EACzBC,8BAA8B,EAC9BC,4BAA4B,QACzB,iCAA8B;;AAErC;AACA;AACA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"names":["setPlatformOS","Platform","OS","default","OxyProvider","useOxy","useAuth","IdentityBoundSessionError","useAuthStore","useAccountStore","useAssetStore","useAssets","useAssetsStore","useAsset","useUploadProgress","useAssetLoading","useAssetErrors","useAssetsByApp","useAssetsByEntity","useAssetUsageCount","useIsAssetLinked","setOxyAssetInstance","useFileDownloadUrl","useFollow","useFollowerCounts","useSeedFollowStatuses","useStorage","useUserProfile","useUserProfiles","useCurrentUser","useUserById","useUserByUsername","useUsersBySessions","usePrivacySettings","useConnectedApps","useSessions","useSession","useDeviceSessions","useUserDevices","useSecurityInfo","useAccountStorageUsage","useSecurityActivity","useRecentSecurityActivity","useInfiniteSecurityActivity","useAuthMethods","useUserSubscription","useUserPayments","useUserWallet","useUserWalletTransactions","useUpdateProfile","useUploadAvatar","useUpdateAccountSettings","useUpdatePrivacySettings","useUpdateNotificationPreferences","useUpdateUserPreferences","useRevokeConnectedApp","useUploadFile","useSwitchSession","useLogoutSession","useLogoutAll","useUpdateDeviceName","useRemoveDevice","createProfileMutation","createGenericMutation","mutationKeys","queryKeys","invalidateAccountQueries","invalidateUserQueries","invalidateSessionQueries","invalidateDeviceQueries","invalidatePrivacyQueries","invalidateSecurityQueries","invalidateStorageQueries","invalidatePaymentsQueries","invalidateConnectedAppsQueries","invalidateAuthMethodsQueries","upsertCachedUser","upsertCachedUsers","CLEARABLE_USER_FIELDS","clearedFieldsFromProfileUpdate","clearedFieldsFromAccountUpdate","useMutationStatus","useOnlineStatus","useOxyEvent","handleAuthError","isInvalidSessionError","isTimeoutOrNetworkError","extractErrorMessage","useFileFiltering","OXY_OAUTH_STATE_STORAGE_KEY","OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY","OxySignInButton","openOAuthPopup","OxyAuthPrompt","OxyOAuthCallback","OxyConsentScreen","RequireOxyAuth","FollowButton","FollowTargetButton","useFollowTarget","useFollowTargetStore","UNKNOWN_FOLLOW_STATUS","OxyPayButton","LogoIcon","LogoText","ProfileButton","OxyAuthChooser","OxySignInRequestSurface","useSwitchableAccounts","ProfileScreen","ManageAccountScreen","NotificationsScreen","PreferencesScreen","ConnectedAppsScreen","CreateAccountScreen","AccountMembersScreen","AccountSettingsScreen","showBottomSheet","closeBottomSheet","useSurfaceHeader","SurfaceHeaderAction","openAccountDialog","closeAccountDialog","subscribeToAccountDialog"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,SAASA,aAAa,QAAyB,aAAa;AAC5D,SAASC,QAAQ,QAAQ,cAAc;AACvCD,aAAa,CAACC,QAAQ,CAACC,EAAgB,CAAC;;AAExC;AACA;AACA;AACA,SAASC,OAAO,IAAIC,WAAW,QAAQ,gCAA6B;AACpE,SAASC,MAAM,QAAQ,4BAAyB;AAEhD,SAASC,OAAO,QAAQ,uBAAoB;AAE5C;AACA;AACA;AACA,SAASC,yBAAyB,QAAQ,iCAA8B;;AAExE;AACA;AACA;AACA,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,eAAe,QAAQ,6BAA0B;AAC1D,SACIC,aAAa,EACbC,SAAS,IAAIC,cAAc,EAC3BC,QAAQ,EACRC,iBAAiB,EACjBC,eAAe,EACfC,cAAc,EACdC,cAAc,EACdC,iBAAiB,EACjBC,kBAAkB,EAClBC,gBAAgB,QACb,2BAAwB;;AAE/B;AACA;AACA;AACA,SAAST,SAAS,EAAEU,mBAAmB,QAAQ,yBAAsB;AACrE,SAASC,kBAAkB,QAAQ,kCAA+B;AAClE,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,qBAAqB,QAAQ,yBAAsB;AAC1F,SAASC,UAAU,QAAQ,0BAAuB;AAGlD;AACA;AACA;AACA,SACIC,cAAc,EACdC,eAAe,EACfC,cAAc,EACdC,WAAW,EACXC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,QACb,yCAAsC;AAC7C,SACIC,WAAW,EACXC,UAAU,EACVC,iBAAiB,EACjBC,cAAc,EACdC,eAAe,EACfC,sBAAsB,QACnB,0CAAuC;AAC9C,SACIC,mBAAmB,EACnB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S/G,OAAO,IAAIgH,oBAAoB,QAAQ,sCAAmC;AACnF,SAAShH,OAAO,IAAIiH,qBAAqB,QAAQ,uCAAoC;;AAErF;AACA;AACA;AACA,SAASC,eAAe,EAAEC,gBAAgB,QAAQ,uCAAoC;AAGtF;AACA;AACA;AACA,SAASC,gBAAgB,QAAmC,gCAA6B;AACzF,SAASC,mBAAmB,QAAuC,wCAAqC;;AAExG;AACA;AACA;AACA;AACA,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,wBAAwB,QACnB,yCAAsC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useEffect, useCallback, useMemo, useState, memo } from 'react';
|
|
4
|
+
import { ActivityIndicator } from 'react-native';
|
|
4
5
|
import { useOxy } from "../context/OxyContext.js";
|
|
5
6
|
import { toast } from '@oxyhq/bloom/toast';
|
|
6
7
|
import { Button } from '@oxyhq/bloom/button';
|
|
7
|
-
import { Loading } from '@oxyhq/bloom/loading';
|
|
8
8
|
import { useFollow, useFollowForButton } from "../hooks/useFollow.js";
|
|
9
9
|
import { useFollowStore } from "../stores/followStore.js";
|
|
10
10
|
import { useTheme } from '@oxyhq/bloom/theme';
|
|
@@ -85,8 +85,7 @@ const FollowButtonInner = /*#__PURE__*/memo(function FollowButtonInner({
|
|
|
85
85
|
disabled: disabled || isBusy,
|
|
86
86
|
style: style,
|
|
87
87
|
textStyle: textStyle,
|
|
88
|
-
icon: showSpinner ? /*#__PURE__*/_jsx(
|
|
89
|
-
variant: "inline",
|
|
88
|
+
icon: showSpinner ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
90
89
|
size: "small",
|
|
91
90
|
color: showFollowing ? colors.text : colors.primaryForeground
|
|
92
91
|
}) : undefined,
|
|
@@ -196,8 +195,7 @@ const FollowButtonMultiInner = /*#__PURE__*/memo(function FollowButtonMultiInner
|
|
|
196
195
|
disabled: disabled || isLoading,
|
|
197
196
|
style: style,
|
|
198
197
|
textStyle: textStyle,
|
|
199
|
-
icon: showSpinner ? /*#__PURE__*/_jsx(
|
|
200
|
-
variant: "inline",
|
|
198
|
+
icon: showSpinner ? /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
201
199
|
size: "small",
|
|
202
200
|
color: allFollowing ? colors.text : colors.primaryForeground
|
|
203
201
|
}) : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useCallback","useMemo","useState","memo","useOxy","toast","Button","
|
|
1
|
+
{"version":3,"names":["useEffect","useCallback","useMemo","useState","memo","ActivityIndicator","useOxy","toast","Button","useFollow","useFollowForButton","useFollowStore","useTheme","useShallow","jsx","_jsx","DEFAULT_FOLLOW_ALL_LABEL","DEFAULT_FOLLOWED_ALL_LABEL","isMultiMode","props","Array","isArray","userIds","FollowButtonInner","userId","oxyServices","initiallyFollowing","size","onFollowChange","style","textStyle","disabled","showLoadingState","preventParentActions","colors","isFollowing","isKnown","isLoading","toggleFollow","resolveStatus","handlePress","event","preventDefault","stopPropagation","err","error","Error","String","message","isBusy","showFollowing","showSpinner","variant","onPress","icon","color","text","primaryForeground","undefined","children","FollowButtonMultiInner","initiallyAllFollowing","followAllLabel","followedAllLabel","onBulkFollow","onBulkUnfollow","follow","followAllUsers","unfollowAllUsers","isAnyLoading","initialFollowStatuses","state","statuses","uid","Object","prototype","hasOwnProperty","call","followingUsers","hasKnownNotFollowing","some","storeAllFollowing","allFollowing","fetchAllStatuses","isSubmitting","setIsSubmitting","result","allAlreadyFollowing","followedCount","results","length","every","entry","alreadyFollowing","anyFollowed","success","FollowButton","canUsePrivateApi","user","currentUser","currentUserId","id","trim","rawUserIds","multiUserIds","seen","Set","cleaned","raw","has","add","push","targetUserId"],"sourceRoot":"../../../../src","sources":["ui/components/FollowButton.tsx"],"mappings":";;AACA,SAASA,SAAS,EAAEC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AAMvE,SAASC,iBAAiB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B,KAAK,MAAMC,GAAG,IAAIL,UAAU,EAAE;MAC5B,MAAMF,EAAE,GAAGO,GAAG,GAAG7D,MAAM,CAAC6D,GAAG,CAAC,CAACN,IAAI,CAAC,CAAC,GAAG,EAAE;MACxC,IAAI,CAACD,EAAE,IAAIA,EAAE,KAAKD,aAAa,IAAIK,IAAI,CAACI,GAAG,CAACR,EAAE,CAAC,EAAE;MACjDI,IAAI,CAACK,GAAG,CAACT,EAAE,CAAC;MACZM,OAAO,CAACI,IAAI,CAACV,EAAE,CAAC;IAClB;IACA,OAAOM,OAAO;EAChB,CAAC,EAAE,CAACJ,UAAU,EAAEH,aAAa,CAAC,CAAC;EAE/B,IAAI,CAACH,gBAAgB,EAAE;IACrB,OAAO,IAAI;EACb;EAEA,IAAI/E,WAAW,CAACC,KAAK,CAAC,EAAE;IACtB,IAAIqF,YAAY,CAACd,MAAM,KAAK,CAAC,EAAE;MAC7B,OAAO,IAAI;IACb;IACA,oBACE3E,IAAA,CAAC6C,sBAAsB;MAAA,GACjBzC,KAAK;MACTG,OAAO,EAAEkF;IAAa,CACvB,CAAC;EAEN;EAEA,MAAMQ,YAAY,GAAG7F,KAAK,CAACK,MAAM,GAAGuB,MAAM,CAAC5B,KAAK,CAACK,MAAM,CAAC,CAAC8E,IAAI,CAAC,CAAC,GAAG,EAAE;EACpE,IAAI,CAACU,YAAY,IAAKZ,aAAa,IAAIA,aAAa,KAAKY,YAAa,EAAE;IACtE,OAAO,IAAI;EACb;EAEA,oBACEjG,IAAA,CAACQ,iBAAiB;IAAA,GACZJ,KAAK;IACTK,MAAM,EAAEwF,YAAa;IACrBvF,WAAW,EAAEA;EAAY,CAC1B,CAAC;AAEN,CAAC;AAED,SAASuE,YAAY;AACrB,eAAeA,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `FollowTargetButton` — one button for everything an Oxy user can follow.
|
|
5
|
+
*
|
|
6
|
+
* Follows a TARGET of any registered kind: a person, a topic, a channel, a
|
|
7
|
+
* store, an artist. Nothing in this file branches on what the target is, which
|
|
8
|
+
* is the property that lets an application this package has never heard of use
|
|
9
|
+
* it without a release.
|
|
10
|
+
*
|
|
11
|
+
* ## Two controls, not one
|
|
12
|
+
*
|
|
13
|
+
* The main press does the obvious thing. The chevron beside it opens the
|
|
14
|
+
* choices that a single press cannot express — follow for a while, stop showing
|
|
15
|
+
* this here without giving it up everywhere — and those belong behind a
|
|
16
|
+
* disclosure precisely because they are not what most people want most of the
|
|
17
|
+
* time. Bloom's `Menu` renders as a bottom sheet on native and a dropdown on
|
|
18
|
+
* web, so this is one component and not a platform fork.
|
|
19
|
+
*
|
|
20
|
+
* ## Verbs
|
|
21
|
+
*
|
|
22
|
+
* "Follow" is wrong for half the things in the ecosystem: you subscribe to a
|
|
23
|
+
* channel, you join a community, you watch a listing. The verb is a prop with a
|
|
24
|
+
* small vocabulary of defaults and a full override, rather than a lookup keyed
|
|
25
|
+
* on kind — a kind→verb table in this package would need a release every time
|
|
26
|
+
* an application invents a kind, which is exactly the coupling #809 removes.
|
|
27
|
+
*
|
|
28
|
+
* ## Relationship to the legacy `FollowButton`
|
|
29
|
+
*
|
|
30
|
+
* `FollowButton` follows a USER through the Mongo-backed social graph and
|
|
31
|
+
* remains the correct component for that until the user graph is migrated onto
|
|
32
|
+
* `/v2/follows`. When it is, that component is deleted and this one takes the
|
|
33
|
+
* name — not aliased, not deprecated in place.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
37
|
+
import { View } from 'react-native';
|
|
38
|
+
import { Button } from '@oxyhq/bloom/button';
|
|
39
|
+
import { ChevronBottom_Stroke2_Corner0_Rounded as ChevronDown } from '@oxyhq/bloom/icons';
|
|
40
|
+
import { Menu, MenuContent, MenuItem, MenuItemText, MenuTrigger } from '@oxyhq/bloom/menu';
|
|
41
|
+
import { toast } from '@oxyhq/bloom/toast';
|
|
42
|
+
import { useFollowTarget } from "../hooks/useFollowTarget.js";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The small vocabulary of verbs the ecosystem actually uses. An application
|
|
46
|
+
* whose verb is not here passes `labels` instead — the escape hatch exists so
|
|
47
|
+
* this union never has to grow to accommodate one product's wording.
|
|
48
|
+
*/
|
|
49
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
50
|
+
const VERB_LABELS = {
|
|
51
|
+
follow: {
|
|
52
|
+
idle: 'Follow',
|
|
53
|
+
active: 'Following',
|
|
54
|
+
pending: 'Requested',
|
|
55
|
+
disabled: 'Off here'
|
|
56
|
+
},
|
|
57
|
+
subscribe: {
|
|
58
|
+
idle: 'Subscribe',
|
|
59
|
+
active: 'Subscribed',
|
|
60
|
+
pending: 'Requested',
|
|
61
|
+
disabled: 'Off here'
|
|
62
|
+
},
|
|
63
|
+
join: {
|
|
64
|
+
idle: 'Join',
|
|
65
|
+
active: 'Joined',
|
|
66
|
+
pending: 'Requested',
|
|
67
|
+
disabled: 'Off here'
|
|
68
|
+
},
|
|
69
|
+
watch: {
|
|
70
|
+
idle: 'Watch',
|
|
71
|
+
active: 'Watching',
|
|
72
|
+
pending: 'Requested',
|
|
73
|
+
disabled: 'Off here'
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** A timed-follow choice offered in the menu. */
|
|
78
|
+
|
|
79
|
+
const HOUR = 60 * 60;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Defaults chosen for the cases a timed follow is actually for: a live event
|
|
83
|
+
* tonight, a story running this week. Not a general-purpose duration picker —
|
|
84
|
+
* an application that needs one passes its own.
|
|
85
|
+
*/
|
|
86
|
+
const DEFAULT_DURATIONS = [{
|
|
87
|
+
label: '24 hours',
|
|
88
|
+
seconds: 24 * HOUR
|
|
89
|
+
}, {
|
|
90
|
+
label: '72 hours',
|
|
91
|
+
seconds: 72 * HOUR
|
|
92
|
+
}, {
|
|
93
|
+
label: 'A week',
|
|
94
|
+
seconds: 7 * 24 * HOUR
|
|
95
|
+
}];
|
|
96
|
+
|
|
97
|
+
/** One line in the disclosure menu. */
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Which choices exist, given the state.
|
|
101
|
+
*
|
|
102
|
+
* Pure and exported because this is the product decision, not a rendering
|
|
103
|
+
* detail: a timed follow is only offered before following, turning it off here
|
|
104
|
+
* is only offered while following, and NEITHER is offered before the server has
|
|
105
|
+
* answered — every one of them addresses a relationship that does not exist
|
|
106
|
+
* yet, so offering them mid-write would mean sending a guessed id.
|
|
107
|
+
*/
|
|
108
|
+
export function buildFollowMenuItems(input) {
|
|
109
|
+
const items = [];
|
|
110
|
+
if (!input.following) {
|
|
111
|
+
if (input.durations === false) return items;
|
|
112
|
+
for (const d of input.durations) {
|
|
113
|
+
items.push({
|
|
114
|
+
key: `for-${d.seconds}`,
|
|
115
|
+
label: `${input.idleVerb} for ${d.label.toLowerCase()}`,
|
|
116
|
+
action: {
|
|
117
|
+
type: 'follow-timed',
|
|
118
|
+
seconds: d.seconds,
|
|
119
|
+
durationLabel: d.label
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return items;
|
|
124
|
+
}
|
|
125
|
+
if (!input.hasRelationship || input.isPending) return items;
|
|
126
|
+
items.push(input.applicationMode === 'disabled' ? {
|
|
127
|
+
key: 'enable-here',
|
|
128
|
+
label: `Show in ${input.applicationName}`,
|
|
129
|
+
action: {
|
|
130
|
+
type: 'enable-here'
|
|
131
|
+
}
|
|
132
|
+
} : {
|
|
133
|
+
key: 'disable-here',
|
|
134
|
+
label: `Don’t show in ${input.applicationName}`,
|
|
135
|
+
action: {
|
|
136
|
+
type: 'disable-here'
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
items.push({
|
|
140
|
+
// Named for what it does. "Unfollow" beside "don't show here" would read as
|
|
141
|
+
// the same action twice, and the user would pick the wrong one.
|
|
142
|
+
key: 'unfollow-everywhere',
|
|
143
|
+
label: 'Unfollow everywhere',
|
|
144
|
+
action: {
|
|
145
|
+
type: 'unfollow'
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return items;
|
|
149
|
+
}
|
|
150
|
+
export const FollowTargetButton = /*#__PURE__*/memo(function FollowTargetButton({
|
|
151
|
+
targetId,
|
|
152
|
+
verb = 'follow',
|
|
153
|
+
labels,
|
|
154
|
+
size = 'medium',
|
|
155
|
+
style,
|
|
156
|
+
disabled = false,
|
|
157
|
+
showOptions = true,
|
|
158
|
+
durations = DEFAULT_DURATIONS,
|
|
159
|
+
applicationName,
|
|
160
|
+
onChange
|
|
161
|
+
}) {
|
|
162
|
+
const {
|
|
163
|
+
status,
|
|
164
|
+
isFollowing,
|
|
165
|
+
isUnknown,
|
|
166
|
+
isPending,
|
|
167
|
+
follow,
|
|
168
|
+
unfollow,
|
|
169
|
+
disableHere,
|
|
170
|
+
enableHere
|
|
171
|
+
} = useFollowTarget(targetId);
|
|
172
|
+
const text = useMemo(() => ({
|
|
173
|
+
...VERB_LABELS[verb],
|
|
174
|
+
...labels
|
|
175
|
+
}), [verb, labels]);
|
|
176
|
+
const label = useMemo(() => {
|
|
177
|
+
if (status.globalState === 'requested') return text.pending;
|
|
178
|
+
if (!isFollowing) return text.idle;
|
|
179
|
+
// Followed globally but switched off here. `effectiveState` reports
|
|
180
|
+
// `not_following` for this, correctly — the question it answers is "does
|
|
181
|
+
// this act here" — so the label has to be derived from the other two.
|
|
182
|
+
return status.applicationMode === 'disabled' ? text.disabled : text.active;
|
|
183
|
+
}, [isFollowing, status.globalState, status.applicationMode, text]);
|
|
184
|
+
const handlePrimary = useCallback(async () => {
|
|
185
|
+
if (isFollowing) {
|
|
186
|
+
await unfollow();
|
|
187
|
+
onChange?.(false);
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
await follow();
|
|
191
|
+
onChange?.(true);
|
|
192
|
+
}, [isFollowing, follow, unfollow, onChange]);
|
|
193
|
+
const handleTimed = useCallback(async (seconds, durationLabel) => {
|
|
194
|
+
await follow({
|
|
195
|
+
expiresIn: seconds
|
|
196
|
+
});
|
|
197
|
+
onChange?.(true);
|
|
198
|
+
// The confirmation is the point: a follow that ends on its own is a
|
|
199
|
+
// promise, and a user who does not see it made will not believe it.
|
|
200
|
+
toast.success(`Following for ${durationLabel.toLowerCase()}`);
|
|
201
|
+
}, [follow, onChange]);
|
|
202
|
+
const menuItems = useMemo(() => buildFollowMenuItems({
|
|
203
|
+
following: isFollowing,
|
|
204
|
+
applicationMode: status.applicationMode,
|
|
205
|
+
hasRelationship: Boolean(status.relationshipId),
|
|
206
|
+
isPending,
|
|
207
|
+
durations,
|
|
208
|
+
idleVerb: text.idle,
|
|
209
|
+
applicationName: applicationName ?? 'this app'
|
|
210
|
+
}), [isFollowing, status.applicationMode, status.relationshipId, isPending, durations, text.idle, applicationName]);
|
|
211
|
+
const runItem = useCallback(item => {
|
|
212
|
+
switch (item.action.type) {
|
|
213
|
+
case 'follow-timed':
|
|
214
|
+
void handleTimed(item.action.seconds, item.action.durationLabel);
|
|
215
|
+
return;
|
|
216
|
+
case 'enable-here':
|
|
217
|
+
void enableHere();
|
|
218
|
+
return;
|
|
219
|
+
case 'disable-here':
|
|
220
|
+
void disableHere();
|
|
221
|
+
return;
|
|
222
|
+
case 'unfollow':
|
|
223
|
+
void unfollow();
|
|
224
|
+
onChange?.(false);
|
|
225
|
+
}
|
|
226
|
+
}, [handleTimed, enableHere, disableHere, unfollow, onChange]);
|
|
227
|
+
const primary = /*#__PURE__*/_jsx(Button, {
|
|
228
|
+
variant: isFollowing ? 'secondary' : 'primary',
|
|
229
|
+
size: size
|
|
230
|
+
// Unknown is not "not following": the button stays inert until the first
|
|
231
|
+
// read settles rather than inviting a follow that may already exist.
|
|
232
|
+
,
|
|
233
|
+
disabled: disabled || isUnknown,
|
|
234
|
+
loading: isPending,
|
|
235
|
+
onPress: () => void handlePrimary(),
|
|
236
|
+
accessibilityLabel: label,
|
|
237
|
+
children: label
|
|
238
|
+
});
|
|
239
|
+
if (!showOptions || menuItems.length === 0) {
|
|
240
|
+
return /*#__PURE__*/_jsx(View, {
|
|
241
|
+
style: style,
|
|
242
|
+
children: primary
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
246
|
+
style: [{
|
|
247
|
+
flexDirection: 'row',
|
|
248
|
+
alignItems: 'center',
|
|
249
|
+
gap: 4
|
|
250
|
+
}, style],
|
|
251
|
+
children: [primary, /*#__PURE__*/_jsxs(Menu, {
|
|
252
|
+
children: [/*#__PURE__*/_jsx(MenuTrigger, {
|
|
253
|
+
label: `${label} options`,
|
|
254
|
+
hint: "Opens follow options",
|
|
255
|
+
children: ({
|
|
256
|
+
props
|
|
257
|
+
}) =>
|
|
258
|
+
/*#__PURE__*/
|
|
259
|
+
// The trigger's props are mapped rather than spread: `MenuTrigger`
|
|
260
|
+
// hands back a DOM-ish bag (focus handlers, an accessibility role)
|
|
261
|
+
// and `Button` accepts a different set, so a spread would pass
|
|
262
|
+
// props it silently drops.
|
|
263
|
+
_jsx(Button, {
|
|
264
|
+
variant: "secondary",
|
|
265
|
+
size: size === 'large' ? 'large' : 'small',
|
|
266
|
+
icon: /*#__PURE__*/_jsx(ChevronDown, {
|
|
267
|
+
width: 16
|
|
268
|
+
}),
|
|
269
|
+
disabled: disabled || isUnknown,
|
|
270
|
+
onPress: props.onPress,
|
|
271
|
+
accessibilityLabel: props.accessibilityLabel,
|
|
272
|
+
accessibilityHint: props.accessibilityHint
|
|
273
|
+
})
|
|
274
|
+
}), /*#__PURE__*/_jsx(MenuContent, {
|
|
275
|
+
showCancel: true,
|
|
276
|
+
children: menuItems.map(item => /*#__PURE__*/_jsx(MenuItem, {
|
|
277
|
+
label: item.label,
|
|
278
|
+
onPress: () => runItem(item),
|
|
279
|
+
children: /*#__PURE__*/_jsx(MenuItemText, {
|
|
280
|
+
children: item.label
|
|
281
|
+
})
|
|
282
|
+
}, item.key))
|
|
283
|
+
})]
|
|
284
|
+
})]
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
//# sourceMappingURL=FollowTargetButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["memo","useCallback","useMemo","View","Button","ChevronBottom_Stroke2_Corner0_Rounded","ChevronDown","Menu","MenuContent","MenuItem","MenuItemText","MenuTrigger","toast","useFollowTarget","jsx","_jsx","jsxs","_jsxs","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","targetId","verb","labels","size","style","showOptions","onChange","status","isFollowing","isUnknown","unfollow","disableHere","enableHere","text","globalState","handlePrimary","handleTimed","expiresIn","success","menuItems","Boolean","relationshipId","runItem","item","primary","variant","loading","onPress","accessibilityLabel","children","length","flexDirection","alignItems","gap","hint","props","icon","width","accessibilityHint","showCancel","map"],"sourceRoot":"../../../../src","sources":["ui/components/FollowTargetButton.tsx"],"mappings":";;AAAA;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;;AAEA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AAGlD,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,qCAAqC,IAAIC,WAAW,QAAQ,oBAAoB;AACzF,SAASC,IAAI,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,WAAW,QAAQ,mBAAmB;AAC1F,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,eAAe,QAAQ,6BAA0B;;AAE1D;AACA;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AC,eACdxE,IAAA,CAACP,WAAW;QAACgF,UAAU;QAAAV,QAAA,EACpBV,SAAS,CAACqB,GAAG,CAAEjB,IAAI,iBAClBzD,IAAA,CAACN,QAAQ;UAAgBoB,KAAK,EAAE2C,IAAI,CAAC3C,KAAM;UAAC+C,OAAO,EAAEA,CAAA,KAAML,OAAO,CAACC,IAAI,CAAE;UAAAM,QAAA,eACvE/D,IAAA,CAACL,YAAY;YAAAoE,QAAA,EAAEN,IAAI,CAAC3C;UAAK,CAAe;QAAC,GAD5B2C,IAAI,CAAClC,GAEV,CACX;MAAC,CACS,CAAC;IAAA,CACV,CAAC;EAAA,CACH,CAAC;AAEX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* server-side by the approver (Commons), never read out of the payload here.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { View } from 'react-native';
|
|
17
|
+
import { ActivityIndicator, View } from 'react-native';
|
|
18
18
|
import MaterialCommunityIcons from '@expo/vector-icons/MaterialCommunityIcons';
|
|
19
19
|
import QRCode from 'react-native-qrcode-svg';
|
|
20
20
|
import { Button } from '@oxyhq/bloom/button';
|
|
21
|
-
import {
|
|
21
|
+
import { useTheme } from '@oxyhq/bloom/theme';
|
|
22
22
|
import { Text } from '@oxyhq/bloom/typography';
|
|
23
23
|
import { authChooserStyles as styles } from "./styles.js";
|
|
24
24
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -29,11 +29,19 @@ const QR_SIZE = 196;
|
|
|
29
29
|
/** The leading route glyph, sized to sit where the QR plate otherwise would. */
|
|
30
30
|
const ROUTE_GLYPH_SIZE = 44;
|
|
31
31
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
/**
|
|
33
|
+
* The indeterminate leading visual: the request exists but has nothing to show yet.
|
|
34
|
+
* Uses RN's ActivityIndicator — `@oxyhq/bloom/loading` can tree-shake to `undefined`
|
|
35
|
+
* in rolldown-vite production bundles when co-imported with `@oxyhq/bloom/button`
|
|
36
|
+
* (auth.oxy.so/authorize blank screen, React #130).
|
|
37
|
+
*/
|
|
38
|
+
export const PreparingSurface = () => {
|
|
39
|
+
const theme = useTheme();
|
|
40
|
+
return /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
41
|
+
size: "large",
|
|
42
|
+
color: theme.colors.primary
|
|
43
|
+
});
|
|
44
|
+
};
|
|
37
45
|
|
|
38
46
|
/** The leading glyph for a route whose surface is elsewhere (the phone, Commons). */
|
|
39
47
|
export const RouteGlyph = ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["View","MaterialCommunityIcons","QRCode","Button","
|
|
1
|
+
{"version":3,"names":["ActivityIndicator","View","MaterialCommunityIcons","QRCode","Button","useTheme","Text","authChooserStyles","styles","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","QR_PLATE_BG","QR_FOREGROUND","QR_SIZE","ROUTE_GLYPH_SIZE","PreparingSurface","theme","size","color","colors","primary","RouteGlyph","name","QrPlate","payload","t","children","style","qrHeadline","text","qrPlate","value","backgroundColor","GetCommonsPrompt","onGetCommons","mutedText","textSecondary","variant","onPress","primaryButton","testID","RequestPrimarySurface","route","progress","qrPayload","success"],"sourceRoot":"../../../../../src","sources":["ui/components/authChooser/requestSurfaces.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,iBAAiB,EAAEC,IAAI,QAAQ,cAAc;AACtD,OAAOC,sBAAsB,MAAM,2CAA2C;AAC9E,OAAOC,MAAM,MAAM,yBAAyB;AAC5C,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,IAAI,QAAQ,yBAAyB;AAE9C,SAASC,iBAAiB,IAAIC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAA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IiB,KAAK,KAAK,YAAY,EAAE;IAC1B,oBAAOpC,IAAA,CAACe,UAAU;MAACC,IAAI,EAAC,mBAAmB;MAACJ,KAAK,EAAEF,KAAK,CAACG,MAAM,CAACC;IAAQ,CAAE,CAAC;EAC7E;EACA,IAAIsB,KAAK,KAAK,cAAc,EAAE;IAC5B,oBAAOpC,IAAA,CAACe,UAAU;MAACC,IAAI,EAAC,aAAa;MAACJ,KAAK,EAAEF,KAAK,CAACG,MAAM,CAACC;IAAQ,CAAE,CAAC;EACvE;EACA;EACA;EACA,oBAAOd,IAAA,CAACS,gBAAgB,IAAE,CAAC;AAC7B,CAAC","ignoreList":[]}
|
|
@@ -8,6 +8,8 @@ import { useOxy } from "../../context/OxyContext.js";
|
|
|
8
8
|
import { toast } from '@oxyhq/bloom/toast';
|
|
9
9
|
import { refreshAvatarInStore } from "../../utils/avatarUtils.js";
|
|
10
10
|
import { useAuthStore } from "../../stores/authStore.js";
|
|
11
|
+
import { useAccountStore } from "../../stores/accountStore.js";
|
|
12
|
+
import { clearedFieldsFromProfileUpdate, upsertCachedUser } from "../queries/userCache.js";
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Update user profile with optimistic updates and offline queue support
|
|
@@ -93,10 +95,21 @@ export const useUpdateProfile = () => {
|
|
|
93
95
|
|
|
94
96
|
// Update authStore so frontend components see the changes immediately
|
|
95
97
|
useAuthStore.getState().setUser(data);
|
|
98
|
+
const cleared = clearedFieldsFromProfileUpdate(updates);
|
|
99
|
+
upsertCachedUser(queryClient, data, data.id, {
|
|
100
|
+
cleared: cleared.length > 0 ? cleared : undefined
|
|
101
|
+
});
|
|
96
102
|
|
|
97
|
-
//
|
|
98
|
-
if (updates.avatar
|
|
99
|
-
|
|
103
|
+
// Avatar add/remove: keep the account switcher in sync with profile writes
|
|
104
|
+
if (typeof updates.avatar === 'string' && activeSessionId) {
|
|
105
|
+
if (updates.avatar && oxyServices) {
|
|
106
|
+
refreshAvatarInStore(activeSessionId, updates.avatar, oxyServices);
|
|
107
|
+
} else {
|
|
108
|
+
useAccountStore.getState().updateAccount(activeSessionId, {
|
|
109
|
+
avatar: undefined,
|
|
110
|
+
avatarUrl: undefined
|
|
111
|
+
});
|
|
112
|
+
}
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
// Invalidate all related queries so every consumer (the account dialog,
|