@oxyhq/services 22.4.1 → 22.5.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/LICENSE +661 -21
- package/README.md +1 -1
- package/lib/commonjs/index.js +19 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +2 -2
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/queryKeys.js +9 -0
- package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +19 -3
- package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +262 -0
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -0
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +5 -5
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +1 -1
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +2 -2
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/module/ui/hooks/queries/queryKeys.js +9 -0
- package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
- package/lib/module/ui/hooks/queries/useAccountQueries.js +19 -3
- package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +258 -0
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -0
- package/lib/module/ui/screens/ConnectedAppsScreen.js +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +5 -5
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts +14 -1
- package/lib/typescript/commonjs/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +93 -0
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -0
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts +9 -0
- package/lib/typescript/module/ui/hooks/queries/queryKeys.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts +14 -1
- package/lib/typescript/module/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +93 -0
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/ConnectedAppsScreen.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +8 -0
- package/src/ui/components/ProfileButton.tsx +1 -2
- package/src/ui/components/payment/PaymentDetailsStep.tsx +2 -2
- package/src/ui/hooks/queries/__tests__/userCache.test.ts +332 -0
- package/src/ui/hooks/queries/queryKeys.ts +17 -0
- package/src/ui/hooks/queries/useAccountQueries.ts +19 -3
- package/src/ui/hooks/queries/userCache.ts +285 -0
- package/src/ui/screens/ConnectedAppsScreen.tsx +0 -1
- package/src/ui/screens/CreateAccountScreen.tsx +5 -5
|
@@ -46,6 +46,8 @@ export { createProfileMutation, createGenericMutation, } from './ui/hooks/mutati
|
|
|
46
46
|
export type { ProfileMutationConfig, GenericMutationConfig, } from './ui/hooks/mutations/mutationFactory';
|
|
47
47
|
export { mutationKeys } from './ui/hooks/mutations/mutationKeys';
|
|
48
48
|
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, invalidateAuthMethodsQueries, } from './ui/hooks/queries/queryKeys';
|
|
49
|
+
export { upsertCachedUser, upsertCachedUsers } from './ui/hooks/queries/userCache';
|
|
50
|
+
export type { CacheableUser } from './ui/hooks/queries/userCache';
|
|
49
51
|
export { useMutationStatus } from './ui/hooks/useMutationStatus';
|
|
50
52
|
export type { MutationStatus } from './ui/hooks/useMutationStatus';
|
|
51
53
|
export { useOnlineStatus } from './ui/hooks/useOnlineStatus';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKhF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,4BAA4B,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IAC9D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ProfileButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ProfileButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAKH,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAuCtB,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwP/C,CAAC;AAqDF,eAAe,aAAa,CAAC"}
|
|
@@ -23,6 +23,15 @@ export declare const queryKeys: {
|
|
|
23
23
|
readonly list: (userIds: string[]) => readonly ["users", "list", string[]];
|
|
24
24
|
readonly details: () => readonly ["users", "detail"];
|
|
25
25
|
readonly detail: (userId: string) => readonly ["users", "detail", string];
|
|
26
|
+
/** Viewer-scoped single-profile fetch by user id (`relationship` is viewer-relative). */
|
|
27
|
+
readonly detailForViewer: (userId: string, viewerId: string) => readonly ["users", "detail", string, "viewer", string];
|
|
28
|
+
/**
|
|
29
|
+
* Viewer-scoped single-profile fetch by username (`relationship` is
|
|
30
|
+
* viewer-relative). Username is normalized to `trim().toLowerCase()` here
|
|
31
|
+
* so the hook key and any external seeder (e.g. Mention's precache) agree
|
|
32
|
+
* by construction — normalize once, never at call sites.
|
|
33
|
+
*/
|
|
34
|
+
readonly byUsername: (username: string, viewerId: string) => readonly ["users", "detail", "username", string, "viewer", string];
|
|
26
35
|
readonly profile: (sessionId: string) => readonly ["users", "detail", string, "profile"];
|
|
27
36
|
};
|
|
28
37
|
readonly sessions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;;kCAEP,MAAM;
|
|
1
|
+
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;;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urrentUser: (options?: {
|
|
|
28
28
|
enabled?: boolean;
|
|
29
29
|
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<User>, Error>;
|
|
30
30
|
/**
|
|
31
|
-
* Get user by ID
|
|
31
|
+
* Get user by ID (identity-by-id).
|
|
32
|
+
*
|
|
33
|
+
* Keyed on the viewer-INDEPENDENT `queryKeys.users.detail(id)`: this hook is
|
|
34
|
+
* the card-identity workhorse (name, avatar, username, verified) and does NOT
|
|
35
|
+
* read the viewer-relative `relationship` field. Keeping the key
|
|
36
|
+
* viewer-independent lets external by-id identity seeders / precache layers
|
|
37
|
+
* (e.g. Mention's card enrichment) that all write `queryKeys.users.detail(id)`
|
|
38
|
+
* share a single cache entry — a viewer-scoped key would dead-end every seed
|
|
39
|
+
* and cause avatar/name flashes plus N+1 fetches.
|
|
40
|
+
*
|
|
41
|
+
* A viewer-scoped, relationship-aware by-id PROFILE fetch is intentionally NOT
|
|
42
|
+
* this hook — it would be a separate future `useUserProfileById` keyed on
|
|
43
|
+
* `queryKeys.users.detailForViewer(id, viewerId)`. No current consumer reads
|
|
44
|
+
* `relationship` from a by-id fetch (only the username path does).
|
|
32
45
|
*/
|
|
33
46
|
export declare const useUserById: (userId: string | null, options?: {
|
|
34
47
|
enabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useAccountQueries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAMtD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,yEAevF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,EAAE,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,yE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AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,0GAwBlF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical user-cache UPSERT for the Oxy React Query cache.
|
|
3
|
+
*
|
|
4
|
+
* The problem this solves: many places across an app write a user object into
|
|
5
|
+
* the React Query cache and REPLACE the existing entry — profile fetch, feed /
|
|
6
|
+
* post hydration, search, notifications, lists. Each of those sources carries a
|
|
7
|
+
* DIFFERENT (often sparse) slice of the user: a feed author has no viewer
|
|
8
|
+
* `relationship`, a search hit has no `createdAt`, a notification actor has no
|
|
9
|
+
* `_count`. A plain `setQueryData(key, sparseUser)` therefore STRIPS whatever
|
|
10
|
+
* fields the authoritative single-profile fetch had already stored — the
|
|
11
|
+
* "Follows you tag vanishes when the feed loads" / "counts flash to zero" class
|
|
12
|
+
* of bug.
|
|
13
|
+
*
|
|
14
|
+
* The fix (owned here, in the SDK): ONE canonical upsert that MERGES. It writes
|
|
15
|
+
* under BOTH keys the SDK's user hooks read from:
|
|
16
|
+
* - by-id: `queryKeys.users.detail(id)` (read by `useUserById`)
|
|
17
|
+
* - by-username: `queryKeys.users.byUsername(username, viewerId)` (viewer-scoped;
|
|
18
|
+
* read by `useUserByUsername`, carries the viewer `relationship`)
|
|
19
|
+
*
|
|
20
|
+
* Merge semantics (per key):
|
|
21
|
+
* - No existing entry -> seed the (normalized) incoming object and mark it
|
|
22
|
+
* STALE (`updatedAt: 0`) so react-query refetches the full authoritative
|
|
23
|
+
* profile (viewer-relative `relationship`, counts, `createdAt`, …). Instant
|
|
24
|
+
* first paint, then the real fetch.
|
|
25
|
+
* - Existing entry -> `{ ...existing, ...pickMeaningful(incoming) }`: only
|
|
26
|
+
* the DEFINED, non-empty fields of `incoming` win; every other field is kept
|
|
27
|
+
* from `existing`. A sparse source can never NULL-out or STRIP a field the
|
|
28
|
+
* authoritative fetch set. The entry's freshness is left untouched (never
|
|
29
|
+
* marked stale — it is already managed).
|
|
30
|
+
* - Nested objects (`name`, `_count`, `relationship`) merge field-by-field, so
|
|
31
|
+
* a partial `name`/`_count`/`relationship` never replaces a fuller one.
|
|
32
|
+
* - Anti-degradation: a good `username` / `name.displayName` / `avatar` is
|
|
33
|
+
* never overwritten by a degraded/empty one (empty username, the
|
|
34
|
+
* `'Unknown user'` ghost-author sentinel, `null` avatar).
|
|
35
|
+
*
|
|
36
|
+
* It is a cache write only — zero network, one `setQueryData` per key.
|
|
37
|
+
*/
|
|
38
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
39
|
+
import type { UserNameResponse } from '@oxyhq/contracts';
|
|
40
|
+
/**
|
|
41
|
+
* A user-shaped object that can be upserted into the cache. Intentionally
|
|
42
|
+
* permissive: it covers the SDK `User` PLUS the looser actor objects embedded on
|
|
43
|
+
* posts / notifications / lists, where `name` may be a plain string and the id
|
|
44
|
+
* may arrive as Mongo `_id`. Every field is optional — a sparse feed author is a
|
|
45
|
+
* valid `CacheableUser`. The index signature lets any additional `User` field
|
|
46
|
+
* pass through untouched (so the upsert never has to know the full DTO shape).
|
|
47
|
+
*/
|
|
48
|
+
export interface CacheableUser {
|
|
49
|
+
id?: string;
|
|
50
|
+
/** Some sources (post/notification actors) carry the id as Mongo `_id`. */
|
|
51
|
+
_id?: string;
|
|
52
|
+
username?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Canonical structured name (`UserNameResponse`) OR a plain display string on
|
|
55
|
+
* the looser actor objects. Normalized to the object shape on write.
|
|
56
|
+
*/
|
|
57
|
+
name?: string | UserNameResponse;
|
|
58
|
+
/** Avatar file id. `null`/`''` are treated as "no avatar" (never degrade). */
|
|
59
|
+
avatar?: string | null;
|
|
60
|
+
/** Social counts. A partial `_count` never replaces a fuller one. */
|
|
61
|
+
_count?: {
|
|
62
|
+
followers?: number;
|
|
63
|
+
following?: number;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* Viewer-relative follow relationship. Present ONLY on an authenticated
|
|
67
|
+
* single-profile fetch; `null`/absent for anon/self/bulk/feed. Never stripped
|
|
68
|
+
* from an existing entry by a source that lacks it.
|
|
69
|
+
*/
|
|
70
|
+
relationship?: {
|
|
71
|
+
isFollowing?: boolean;
|
|
72
|
+
followsYou?: boolean;
|
|
73
|
+
} | null;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Merge-upsert a (possibly partial) user into the SDK's user query cache under
|
|
78
|
+
* both the by-id key and, when a username is present, the viewer-scoped
|
|
79
|
+
* by-username key.
|
|
80
|
+
*
|
|
81
|
+
* @param queryClient The app's React Query client.
|
|
82
|
+
* @param user A `User`-shaped object (may be sparse).
|
|
83
|
+
* @param viewerId The active viewer id for the by-username key. Defaults to
|
|
84
|
+
* the current auth-store user id.
|
|
85
|
+
*/
|
|
86
|
+
export declare function upsertCachedUser(queryClient: QueryClient, user: CacheableUser, viewerId?: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Batch merge-upsert many users at once (for a feed / list / search response).
|
|
89
|
+
* Resolves the viewer id once and upserts each user cumulatively — a user that
|
|
90
|
+
* appears twice merges both slices into the single cache entry.
|
|
91
|
+
*/
|
|
92
|
+
export declare function upsertCachedUsers(queryClient: QueryClient, users: readonly CacheableUser[] | null | undefined, viewerId?: string): void;
|
|
93
|
+
//# sourceMappingURL=userCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/userCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACjC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,qEAAqE;IACrE,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D;;;;OAIG;IACH,YAAY,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAqKD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,aAAa,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,EAClD,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAMN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedAppsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/ConnectedAppsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;;
|
|
1
|
+
{"version":3,"file":"ConnectedAppsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/ConnectedAppsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;;AAkM3D,wBAA+C"}
|
|
@@ -46,6 +46,8 @@ export { createProfileMutation, createGenericMutation, } from './ui/hooks/mutati
|
|
|
46
46
|
export type { ProfileMutationConfig, GenericMutationConfig, } from './ui/hooks/mutations/mutationFactory.js';
|
|
47
47
|
export { mutationKeys } from './ui/hooks/mutations/mutationKeys.js';
|
|
48
48
|
export { queryKeys, invalidateAccountQueries, invalidateUserQueries, invalidateSessionQueries, invalidateDeviceQueries, invalidatePrivacyQueries, invalidateSecurityQueries, invalidateStorageQueries, invalidatePaymentsQueries, invalidateConnectedAppsQueries, invalidateAuthMethodsQueries, } from './ui/hooks/queries/queryKeys.js';
|
|
49
|
+
export { upsertCachedUser, upsertCachedUsers } from './ui/hooks/queries/userCache.js';
|
|
50
|
+
export type { CacheableUser } from './ui/hooks/queries/userCache.js';
|
|
49
51
|
export { useMutationStatus } from './ui/hooks/useMutationStatus.js';
|
|
50
52
|
export type { MutationStatus } from './ui/hooks/useMutationStatus.js';
|
|
51
53
|
export { useOnlineStatus } from './ui/hooks/useOnlineStatus.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAYH,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,gCAA6B,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAAyB,CAAC;AACjD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAoB,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAoB,CAAC;AAKhF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+BAA4B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;IAC9D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ProfileButton.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/ProfileButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAKH,KAAK,SAAS,EACd,KAAK,SAAS,EACjB,MAAM,cAAc,CAAC;AAuCtB,MAAM,WAAW,kBAAkB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B;;;;OAIG;IACH,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;IACnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwP/C,CAAC;AAqDF,eAAe,aAAa,CAAC"}
|
|
@@ -23,6 +23,15 @@ export declare const queryKeys: {
|
|
|
23
23
|
readonly list: (userIds: string[]) => readonly ["users", "list", string[]];
|
|
24
24
|
readonly details: () => readonly ["users", "detail"];
|
|
25
25
|
readonly detail: (userId: string) => readonly ["users", "detail", string];
|
|
26
|
+
/** Viewer-scoped single-profile fetch by user id (`relationship` is viewer-relative). */
|
|
27
|
+
readonly detailForViewer: (userId: string, viewerId: string) => readonly ["users", "detail", string, "viewer", string];
|
|
28
|
+
/**
|
|
29
|
+
* Viewer-scoped single-profile fetch by username (`relationship` is
|
|
30
|
+
* viewer-relative). Username is normalized to `trim().toLowerCase()` here
|
|
31
|
+
* so the hook key and any external seeder (e.g. Mention's precache) agree
|
|
32
|
+
* by construction — normalize once, never at call sites.
|
|
33
|
+
*/
|
|
34
|
+
readonly byUsername: (username: string, viewerId: string) => readonly ["users", "detail", "username", string, "viewer", string];
|
|
26
35
|
readonly profile: (sessionId: string) => readonly ["users", "detail", string, "profile"];
|
|
27
36
|
};
|
|
28
37
|
readonly sessions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;;kCAEP,MAAM;
|
|
1
|
+
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/queryKeys.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,eAAO,MAAM,SAAS;;;;oCAKC,MAAM,EAAE;;qCAEP,MAAM;uCACJ,MAAM,GAAG,IAAI;;;;;;iCAWnB,MAAM,EAAE;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CurrentUser: (options?: {
|
|
|
28
28
|
enabled?: boolean;
|
|
29
29
|
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<User>, Error>;
|
|
30
30
|
/**
|
|
31
|
-
* Get user by ID
|
|
31
|
+
* Get user by ID (identity-by-id).
|
|
32
|
+
*
|
|
33
|
+
* Keyed on the viewer-INDEPENDENT `queryKeys.users.detail(id)`: this hook is
|
|
34
|
+
* the card-identity workhorse (name, avatar, username, verified) and does NOT
|
|
35
|
+
* read the viewer-relative `relationship` field. Keeping the key
|
|
36
|
+
* viewer-independent lets external by-id identity seeders / precache layers
|
|
37
|
+
* (e.g. Mention's card enrichment) that all write `queryKeys.users.detail(id)`
|
|
38
|
+
* share a single cache entry — a viewer-scoped key would dead-end every seed
|
|
39
|
+
* and cause avatar/name flashes plus N+1 fetches.
|
|
40
|
+
*
|
|
41
|
+
* A viewer-scoped, relationship-aware by-id PROFILE fetch is intentionally NOT
|
|
42
|
+
* this hook — it would be a separate future `useUserProfileById` keyed on
|
|
43
|
+
* `queryKeys.users.detailForViewer(id, viewerId)`. No current consumer reads
|
|
44
|
+
* `relationship` from a by-id fetch (only the username path does).
|
|
32
45
|
*/
|
|
33
46
|
export declare const useUserById: (userId: string | null, options?: {
|
|
34
47
|
enabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAccountQueries.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/useAccountQueries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAMtD;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,GAAG,IAAI,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,yEAevF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,EAAE,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,y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;AACH,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,EAAE,UAAU;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,0GAwBlF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical user-cache UPSERT for the Oxy React Query cache.
|
|
3
|
+
*
|
|
4
|
+
* The problem this solves: many places across an app write a user object into
|
|
5
|
+
* the React Query cache and REPLACE the existing entry — profile fetch, feed /
|
|
6
|
+
* post hydration, search, notifications, lists. Each of those sources carries a
|
|
7
|
+
* DIFFERENT (often sparse) slice of the user: a feed author has no viewer
|
|
8
|
+
* `relationship`, a search hit has no `createdAt`, a notification actor has no
|
|
9
|
+
* `_count`. A plain `setQueryData(key, sparseUser)` therefore STRIPS whatever
|
|
10
|
+
* fields the authoritative single-profile fetch had already stored — the
|
|
11
|
+
* "Follows you tag vanishes when the feed loads" / "counts flash to zero" class
|
|
12
|
+
* of bug.
|
|
13
|
+
*
|
|
14
|
+
* The fix (owned here, in the SDK): ONE canonical upsert that MERGES. It writes
|
|
15
|
+
* under BOTH keys the SDK's user hooks read from:
|
|
16
|
+
* - by-id: `queryKeys.users.detail(id)` (read by `useUserById`)
|
|
17
|
+
* - by-username: `queryKeys.users.byUsername(username, viewerId)` (viewer-scoped;
|
|
18
|
+
* read by `useUserByUsername`, carries the viewer `relationship`)
|
|
19
|
+
*
|
|
20
|
+
* Merge semantics (per key):
|
|
21
|
+
* - No existing entry -> seed the (normalized) incoming object and mark it
|
|
22
|
+
* STALE (`updatedAt: 0`) so react-query refetches the full authoritative
|
|
23
|
+
* profile (viewer-relative `relationship`, counts, `createdAt`, …). Instant
|
|
24
|
+
* first paint, then the real fetch.
|
|
25
|
+
* - Existing entry -> `{ ...existing, ...pickMeaningful(incoming) }`: only
|
|
26
|
+
* the DEFINED, non-empty fields of `incoming` win; every other field is kept
|
|
27
|
+
* from `existing`. A sparse source can never NULL-out or STRIP a field the
|
|
28
|
+
* authoritative fetch set. The entry's freshness is left untouched (never
|
|
29
|
+
* marked stale — it is already managed).
|
|
30
|
+
* - Nested objects (`name`, `_count`, `relationship`) merge field-by-field, so
|
|
31
|
+
* a partial `name`/`_count`/`relationship` never replaces a fuller one.
|
|
32
|
+
* - Anti-degradation: a good `username` / `name.displayName` / `avatar` is
|
|
33
|
+
* never overwritten by a degraded/empty one (empty username, the
|
|
34
|
+
* `'Unknown user'` ghost-author sentinel, `null` avatar).
|
|
35
|
+
*
|
|
36
|
+
* It is a cache write only — zero network, one `setQueryData` per key.
|
|
37
|
+
*/
|
|
38
|
+
import type { QueryClient } from '@tanstack/react-query';
|
|
39
|
+
import type { UserNameResponse } from '@oxyhq/contracts';
|
|
40
|
+
/**
|
|
41
|
+
* A user-shaped object that can be upserted into the cache. Intentionally
|
|
42
|
+
* permissive: it covers the SDK `User` PLUS the looser actor objects embedded on
|
|
43
|
+
* posts / notifications / lists, where `name` may be a plain string and the id
|
|
44
|
+
* may arrive as Mongo `_id`. Every field is optional — a sparse feed author is a
|
|
45
|
+
* valid `CacheableUser`. The index signature lets any additional `User` field
|
|
46
|
+
* pass through untouched (so the upsert never has to know the full DTO shape).
|
|
47
|
+
*/
|
|
48
|
+
export interface CacheableUser {
|
|
49
|
+
id?: string;
|
|
50
|
+
/** Some sources (post/notification actors) carry the id as Mongo `_id`. */
|
|
51
|
+
_id?: string;
|
|
52
|
+
username?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Canonical structured name (`UserNameResponse`) OR a plain display string on
|
|
55
|
+
* the looser actor objects. Normalized to the object shape on write.
|
|
56
|
+
*/
|
|
57
|
+
name?: string | UserNameResponse;
|
|
58
|
+
/** Avatar file id. `null`/`''` are treated as "no avatar" (never degrade). */
|
|
59
|
+
avatar?: string | null;
|
|
60
|
+
/** Social counts. A partial `_count` never replaces a fuller one. */
|
|
61
|
+
_count?: {
|
|
62
|
+
followers?: number;
|
|
63
|
+
following?: number;
|
|
64
|
+
} | null;
|
|
65
|
+
/**
|
|
66
|
+
* Viewer-relative follow relationship. Present ONLY on an authenticated
|
|
67
|
+
* single-profile fetch; `null`/absent for anon/self/bulk/feed. Never stripped
|
|
68
|
+
* from an existing entry by a source that lacks it.
|
|
69
|
+
*/
|
|
70
|
+
relationship?: {
|
|
71
|
+
isFollowing?: boolean;
|
|
72
|
+
followsYou?: boolean;
|
|
73
|
+
} | null;
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Merge-upsert a (possibly partial) user into the SDK's user query cache under
|
|
78
|
+
* both the by-id key and, when a username is present, the viewer-scoped
|
|
79
|
+
* by-username key.
|
|
80
|
+
*
|
|
81
|
+
* @param queryClient The app's React Query client.
|
|
82
|
+
* @param user A `User`-shaped object (may be sparse).
|
|
83
|
+
* @param viewerId The active viewer id for the by-username key. Defaults to
|
|
84
|
+
* the current auth-store user id.
|
|
85
|
+
*/
|
|
86
|
+
export declare function upsertCachedUser(queryClient: QueryClient, user: CacheableUser, viewerId?: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Batch merge-upsert many users at once (for a feed / list / search response).
|
|
89
|
+
* Resolves the viewer id once and upserts each user cumulatively — a user that
|
|
90
|
+
* appears twice merges both slices into the single cache entry.
|
|
91
|
+
*/
|
|
92
|
+
export declare function upsertCachedUsers(queryClient: QueryClient, users: readonly CacheableUser[] | null | undefined, viewerId?: string): void;
|
|
93
|
+
//# sourceMappingURL=userCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userCache.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/hooks/queries/userCache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAIzD;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACjC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,qEAAqE;IACrE,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAC3D;;;;OAIG;IACH,YAAY,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAqKD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE,aAAa,EACnB,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAgBN;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,GAAG,SAAS,EAClD,QAAQ,CAAC,EAAE,MAAM,GAChB,IAAI,CAMN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedAppsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/ConnectedAppsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;;
|
|
1
|
+
{"version":3,"file":"ConnectedAppsScreen.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/ConnectedAppsScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAqB,CAAC;;AAkM3D,wBAA+C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.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",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"directory": "packages/services"
|
|
92
92
|
},
|
|
93
93
|
"author": "OxyHQ",
|
|
94
|
-
"license": "
|
|
94
|
+
"license": "AGPL-3.0-only",
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=18.0.0"
|
|
97
97
|
},
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"@biomejs/biome": "^1.9.4",
|
|
136
136
|
"@commitlint/cli": "^17.6.5",
|
|
137
137
|
"@commitlint/config-conventional": "^17.6.5",
|
|
138
|
-
"@oxyhq/core": "12.5.
|
|
138
|
+
"@oxyhq/core": "12.5.4",
|
|
139
139
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
140
140
|
"@react-native-community/netinfo": "^11.4.1",
|
|
141
141
|
"@react-native/babel-preset": "^0.86.0",
|
package/src/index.ts
CHANGED
|
@@ -170,6 +170,14 @@ export {
|
|
|
170
170
|
invalidateAuthMethodsQueries,
|
|
171
171
|
} from './ui/hooks/queries/queryKeys';
|
|
172
172
|
|
|
173
|
+
// Canonical user-cache upsert. MERGE-upserts a (possibly partial) user into the
|
|
174
|
+
// SDK's user query cache under both keys it owns (by-id + viewer-scoped
|
|
175
|
+
// by-username). Consumers route ALL cache seeds (feed / list / search / profile
|
|
176
|
+
// hydration) through this so a sparse source can never strip a field an
|
|
177
|
+
// authoritative fetch already stored.
|
|
178
|
+
export { upsertCachedUser, upsertCachedUsers } from './ui/hooks/queries/userCache';
|
|
179
|
+
export type { CacheableUser } from './ui/hooks/queries/userCache';
|
|
180
|
+
|
|
173
181
|
// Mutation status aggregator (for "Syncing..." indicators)
|
|
174
182
|
export { useMutationStatus } from './ui/hooks/useMutationStatus';
|
|
175
183
|
export type { MutationStatus } from './ui/hooks/useMutationStatus';
|
|
@@ -211,8 +211,7 @@ const ProfileButton: React.FC<ProfileButtonProps> = ({
|
|
|
211
211
|
// `state.hovered || state.focused`. Only web ever sets these, so on native
|
|
212
212
|
// the row renders statically.
|
|
213
213
|
const active = hovered || focused;
|
|
214
|
-
const accountLabel = t('accountSwitcher.switchWhileSignedInAs', { name: displayName })
|
|
215
|
-
|| `Switch account, signed in as ${displayName}`;
|
|
214
|
+
const accountLabel = t('accountSwitcher.switchWhileSignedInAs', { name: displayName });
|
|
216
215
|
|
|
217
216
|
// Web-only pointer/focus handlers. RN-Web forwards `onHoverIn`/`onHoverOut`
|
|
218
217
|
// to the underlying element; native Pressable ignores them harmlessly, but
|
|
@@ -90,7 +90,7 @@ const PaymentDetailsStep: React.FC<PaymentDetailsStepProps> = ({
|
|
|
90
90
|
<TextField>
|
|
91
91
|
<TextFieldInput
|
|
92
92
|
floatingLabel
|
|
93
|
-
label={t('payment.details.cardNumber')
|
|
93
|
+
label={t('payment.details.cardNumber')}
|
|
94
94
|
value={cardDetails.number}
|
|
95
95
|
onChangeText={text => {
|
|
96
96
|
const formatted = text.replace(/\s/g, '').replace(/(\d{4})/g, '$1 ').trim();
|
|
@@ -108,7 +108,7 @@ const PaymentDetailsStep: React.FC<PaymentDetailsStepProps> = ({
|
|
|
108
108
|
<TextField>
|
|
109
109
|
<TextFieldInput
|
|
110
110
|
floatingLabel
|
|
111
|
-
label={t('payment.details.expiry')
|
|
111
|
+
label={t('payment.details.expiry')}
|
|
112
112
|
value={cardDetails.expiry}
|
|
113
113
|
onChangeText={text => {
|
|
114
114
|
const formatted = text.replace(/\D/g, '').replace(/(\d{2})(\d)/, '$1/$2');
|