@bsv/expo-wallet-toolbox 0.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/LICENSE.txt +28 -0
- package/README.md +512 -0
- package/assets/sounds/payment-receive.wav +0 -0
- package/assets/sounds/payment-send.wav +0 -0
- package/assets/sounds/vault-close.wav +0 -0
- package/assets/sounds/vault-open.wav +0 -0
- package/core/amountFormatHelpers.ts +330 -0
- package/core/backup/RemoteSyncReader.ts +94 -0
- package/core/backup/client.ts +111 -0
- package/core/backup/codec.ts +218 -0
- package/core/backup/constants.ts +88 -0
- package/core/backup/cursor.ts +138 -0
- package/core/backup/derive.ts +46 -0
- package/core/backup/deviceId.ts +33 -0
- package/core/backup/erase.ts +67 -0
- package/core/backup/preference.ts +33 -0
- package/core/backup/push.ts +295 -0
- package/core/backup/restore.ts +152 -0
- package/core/backup/restoreOnImport.ts +119 -0
- package/core/backup/status.ts +46 -0
- package/core/config.tsx +47 -0
- package/core/constants.ts +35 -0
- package/core/context/ExchangeRateContext.tsx +69 -0
- package/core/context/LocalStorageProvider.tsx +225 -0
- package/core/context/UserContext.tsx +129 -0
- package/core/context/VaultContext.tsx +79 -0
- package/core/context/WalletConnectionContext.tsx +454 -0
- package/core/context/WalletContext.tsx +2938 -0
- package/core/context/buildGeneration.ts +37 -0
- package/core/deviceTier.ts +89 -0
- package/core/diskSpace.ts +62 -0
- package/core/displayCurrencies.ts +56 -0
- package/core/headers/OfflineFirstChaintracks.ts +176 -0
- package/core/headers/checkpoints.ts +39 -0
- package/core/headers/fs.ts +119 -0
- package/core/headers/headerStore.ts +333 -0
- package/core/headers/prewarm.ts +36 -0
- package/core/headers/syncHeaders.ts +73 -0
- package/core/hooks/useConfirmationSound.ts +135 -0
- package/core/hooks/useHaptics.ts +51 -0
- package/core/hooks/usePermissionQueue.ts +69 -0
- package/core/i18n/translations.tsx +6692 -0
- package/core/index.ts +295 -0
- package/core/localpay/blePermissions.ts +32 -0
- package/core/localpay/build.ts +392 -0
- package/core/localpay/codec.ts +338 -0
- package/core/localpay/deviceCaps.ts +175 -0
- package/core/localpay/nearbyAdvisory.ts +32 -0
- package/core/localpay/nearbyPermissions.ts +34 -0
- package/core/localpay/pending.ts +385 -0
- package/core/localpay/pendingAborts.ts +67 -0
- package/core/localpay/qr.ts +16 -0
- package/core/localpay/session.ts +277 -0
- package/core/localpay/sessionPolicy.ts +5 -0
- package/core/localpay/transport/awdl.ts +11 -0
- package/core/localpay/transport/ble.ts +159 -0
- package/core/localpay/transport/nearby.ts +12 -0
- package/core/localpay/transport/race.ts +110 -0
- package/core/localpay/transport/select.ts +128 -0
- package/core/localpay/transport/socket.ts +244 -0
- package/core/localpay/types.ts +82 -0
- package/core/localpay/verify.ts +204 -0
- package/core/logging.config.ts +10 -0
- package/core/logging.ts +77 -0
- package/core/mnemonicWallet.ts +180 -0
- package/core/monitor/TaskBackupPush.ts +168 -0
- package/core/monitor/TaskCreditInbox.ts +116 -0
- package/core/monitor/TaskDrainOutbox.ts +122 -0
- package/core/monitor/TaskSendOffline.ts +123 -0
- package/core/monitor/unfailRetry.ts +116 -0
- package/core/net/chainMatch.ts +34 -0
- package/core/net/online.ts +34 -0
- package/core/offline/cancelParked.ts +56 -0
- package/core/offline/hold.ts +127 -0
- package/core/offline/order.ts +109 -0
- package/core/offline/payerHold.ts +144 -0
- package/core/offline/plan.ts +264 -0
- package/core/offline/queueGrace.ts +52 -0
- package/core/parsePeerPayURI.ts +119 -0
- package/core/pay/beefRepair.ts +106 -0
- package/core/pay/creditErrors.ts +46 -0
- package/core/pay/creditInbox.ts +202 -0
- package/core/pay/damagedInbox.ts +64 -0
- package/core/pay/proofNudge.ts +23 -0
- package/core/pay/provenTxFromBump.ts +31 -0
- package/core/pay/rails/address.ts +329 -0
- package/core/pay/rails/handle.ts +617 -0
- package/core/pay/rails/index.ts +197 -0
- package/core/pay/rails/nearby.ts +79 -0
- package/core/pay/receiveFocus.ts +13 -0
- package/core/pay/recordProof.ts +91 -0
- package/core/pay/refreshProofGuard.ts +34 -0
- package/core/pay/sweeper.ts +75 -0
- package/core/pay/tokenAmount.ts +18 -0
- package/core/pay/userError.ts +18 -0
- package/core/pay/watchlist.ts +126 -0
- package/core/peerpay/control.ts +122 -0
- package/core/peerpay/handleResendRequests.ts +475 -0
- package/core/peerpay/inboxAttempts.ts +33 -0
- package/core/peerpay/metadataDecryptor.ts +42 -0
- package/core/peerpay/offlineNacks.ts +96 -0
- package/core/peerpay/outbox.ts +209 -0
- package/core/peerpay/rebuildToken.ts +76 -0
- package/core/peerpay/resendBeef.ts +115 -0
- package/core/services/arcadeBroadcastProvider.ts +214 -0
- package/core/services/capWalletArgs.ts +99 -0
- package/core/services/exchangeRate.ts +63 -0
- package/core/services/secrets/envelope.ts +102 -0
- package/core/services/secrets/hkdf.ts +37 -0
- package/core/services/secrets/index.ts +63 -0
- package/core/services/secrets/kek.ts +274 -0
- package/core/services/secrets/migration.ts +188 -0
- package/core/services/secrets/policy.ts +120 -0
- package/core/services/secrets/storage.ts +54 -0
- package/core/services/secrets/store.ts +125 -0
- package/core/services/secrets/types.ts +85 -0
- package/core/services/usdFxRates.ts +101 -0
- package/core/services/vault/VaultKeyService.ts +312 -0
- package/core/services/vault/backupAttestation.ts +136 -0
- package/core/services/vault/ceremony.ts +972 -0
- package/core/services/vault/ceremonyHost.ts +46 -0
- package/core/services/vault/devMock.ts +22 -0
- package/core/services/vault/driver.ts +197 -0
- package/core/services/vault/guard.ts +90 -0
- package/core/services/vault/k1.ts +75 -0
- package/core/services/vault/mockYubiKey.ts +217 -0
- package/core/services/vault/random.ts +20 -0
- package/core/services/vault/sealing.ts +84 -0
- package/core/services/vault/session.ts +59 -0
- package/core/services/vault/transfers.ts +1151 -0
- package/core/services/vault/types.ts +109 -0
- package/core/services/vault/vaultDerivation.ts +152 -0
- package/core/services/vault/vaultPassphrase.ts +287 -0
- package/core/services/vault/vaultStore.ts +104 -0
- package/core/services/walletArgLimits.ts +234 -0
- package/core/services/walletServiceConfig.ts +170 -0
- package/core/storage/LocalStorageAdapter.ts +58 -0
- package/core/storage/README.md +391 -0
- package/core/storage/StorageExpoSQLite.ts +2008 -0
- package/core/storage/errors.ts +73 -0
- package/core/storage/index.ts +3 -0
- package/core/storage/methods/findSql.ts +286 -0
- package/core/storage/methods/historyNotes.ts +61 -0
- package/core/storage/methods/listActionsSql.ts +212 -0
- package/core/storage/methods/listOutputsSql.ts +211 -0
- package/core/storage/methods/offlineActions.ts +156 -0
- package/core/storage/methods/processOfflineActions.ts +503 -0
- package/core/storage/methods/reclaim.ts +135 -0
- package/core/storage/methods/reviewStatusSql.ts +167 -0
- package/core/storage/methods/unprovenWithoutReqSql.ts +26 -0
- package/core/storage/methods/walletBalanceSql.ts +55 -0
- package/core/storage/schema/createTables.ts +385 -0
- package/core/storage/skipQueuedAncestors.ts +29 -0
- package/core/storage/sqlUpdateValue.ts +12 -0
- package/core/stores/ConnectionStore.ts +71 -0
- package/core/theme/ThemeContext.tsx +182 -0
- package/core/theme/assertThemeContrast.ts +109 -0
- package/core/theme/motion.ts +50 -0
- package/core/theme/tokens.ts +232 -0
- package/core/theme/useThemeStyles.tsx +156 -0
- package/core/walletDbRegistry.ts +110 -0
- package/core/walletMonitor.ts +149 -0
- package/core/walletRepair/runWalletCheck.ts +195 -0
- package/core/walletRepair/shouldReleaseUtxo.ts +18 -0
- package/package.json +86 -0
- package/ui/backupShares.ts +367 -0
- package/ui/components/QRScanner.tsx +353 -0
- package/ui/components/pay/AddressReceive.tsx +507 -0
- package/ui/components/pay/AvailableBalance.tsx +61 -0
- package/ui/components/pay/HandleReceive.tsx +896 -0
- package/ui/components/pay/MessageBoxConfig.tsx +256 -0
- package/ui/components/pay/NearbyAdvisoryModal.tsx +111 -0
- package/ui/components/pay/NearbyFlow.tsx +2542 -0
- package/ui/components/pay/OfflineNotice.tsx +337 -0
- package/ui/components/pay/PayCellRow.tsx +101 -0
- package/ui/components/pay/PayForm.tsx +223 -0
- package/ui/components/pay/PaymentQrDisplay.tsx +105 -0
- package/ui/components/pay/PaymentSuccessOverlay.tsx +266 -0
- package/ui/components/pay/RecipientField.tsx +308 -0
- package/ui/components/pay/RequestHub.tsx +75 -0
- package/ui/components/pay/ResultBanner.tsx +69 -0
- package/ui/components/pay/UniversalSend.tsx +687 -0
- package/ui/components/pay/useRecipientInput.ts +270 -0
- package/ui/components/security/WalletLockNotice.tsx +138 -0
- package/ui/components/ui/AlertCard.tsx +223 -0
- package/ui/components/ui/AppLogo.tsx +166 -0
- package/ui/components/ui/BlurChrome.tsx +72 -0
- package/ui/components/ui/Celebration.tsx +84 -0
- package/ui/components/ui/ChoiceSheet.ts +69 -0
- package/ui/components/ui/CustomSafeArea.tsx +74 -0
- package/ui/components/ui/ErrorBoundary.tsx +154 -0
- package/ui/components/ui/GroupedList.tsx +125 -0
- package/ui/components/ui/IconButton.tsx +105 -0
- package/ui/components/ui/ListRow.tsx +197 -0
- package/ui/components/ui/PermissionSheet.tsx +920 -0
- package/ui/components/ui/PresenceRow.tsx +215 -0
- package/ui/components/ui/PressableScale.tsx +105 -0
- package/ui/components/ui/ScreenGradient.tsx +47 -0
- package/ui/components/ui/ScrollFade.tsx +76 -0
- package/ui/components/ui/Sheet.tsx +342 -0
- package/ui/components/ui/Toast.tsx +142 -0
- package/ui/components/ui/index.ts +8 -0
- package/ui/components/vault/EnrollWizard.tsx +627 -0
- package/ui/components/vault/PassphraseField.tsx +306 -0
- package/ui/components/vault/PhraseBackupSheet.tsx +227 -0
- package/ui/components/vault/VaultBackdrop.tsx +354 -0
- package/ui/components/vault/VaultCeremonySheet.tsx +327 -0
- package/ui/components/wallet/ActivityRow.tsx +408 -0
- package/ui/components/wallet/AmountDisplay.tsx +48 -0
- package/ui/components/wallet/AmountInput.tsx +256 -0
- package/ui/components/wallet/BackupReminderSheet.tsx +168 -0
- package/ui/components/wallet/Balance.tsx +144 -0
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +133 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +93 -0
- package/ui/exportDatabases.ts +122 -0
- package/ui/exportTransactions.ts +129 -0
- package/ui/hooks/useOfflineNoticeActions.ts +136 -0
- package/ui/hooks/useOnline.ts +70 -0
- package/ui/hooks/useSpendableBalance.ts +58 -0
- package/ui/hooks/useVaultBalance.ts +50 -0
- package/ui/importDatabases.ts +170 -0
- package/ui/index.ts +136 -0
- package/ui/isImageUrl.ts +10 -0
- package/ui/printRecoveryShares.ts +93 -0
- package/ui/resolveIdentity.ts +125 -0
- package/ui/screens/ConnectionsScreen.tsx +438 -0
- package/ui/screens/LogsScreen.tsx +432 -0
- package/ui/screens/PairScreen.tsx +288 -0
- package/ui/screens/PayScreen.tsx +479 -0
- package/ui/screens/SettingsScreen.tsx +180 -0
- package/ui/screens/TrustScreen.tsx +831 -0
- package/ui/screens/VaultRecoverScreen.tsx +226 -0
- package/ui/screens/VaultScreen.tsx +423 -0
- package/ui/screens/VaultTransferScreen.tsx +293 -0
- package/ui/screens/WalletCheckScreen.tsx +539 -0
- package/ui/screens/WalletConfigScreen.tsx +1095 -0
- package/ui/screens/WalletHomeScreen.tsx +1597 -0
- package/ui/screens/homeBadges.ts +18 -0
- package/ui/txStatus.ts +79 -0
- package/ui/validateTrust.ts +44 -0
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three things the user must be told, in one place.
|
|
3
|
+
*
|
|
4
|
+
* While offline: which rails still work and how many payments are waiting to be
|
|
5
|
+
* broadcast. While ONLINE with a queue that has not drained: that those payments
|
|
6
|
+
* still have not reached the network. After a rejection: which payment the
|
|
7
|
+
* network refused and who handed it over — that identity key is the only
|
|
8
|
+
* recourse the user has, so the row persists rather than toasting away.
|
|
9
|
+
*
|
|
10
|
+
* The online-with-a-queue case is not cosmetic. `processOfflineActions` can stall
|
|
11
|
+
* permanently — behind a foreign ancestor no service will accept, or on a row
|
|
12
|
+
* whose request has gone — and it reports that only as `stalledOn`, whose one
|
|
13
|
+
* consumer writes it into the monitor's log string
|
|
14
|
+
* (`utils/monitor/TaskSendOffline.ts`). Nothing else in the system records it. If
|
|
15
|
+
* this component went blank the moment signal returned, a user would watch a
|
|
16
|
+
* stuck payment behave exactly like a settled one.
|
|
17
|
+
*
|
|
18
|
+
* A rejection can also be the user's OWN outbound payment — a held send can be
|
|
19
|
+
* poisoned same as a held receive (see app/pay.tsx's role split). That gets a
|
|
20
|
+
* separate, unattributed notice: there is no counterparty to name for a
|
|
21
|
+
* transaction the user sent themselves, and folding it into the "who handed
|
|
22
|
+
* you this" copy would misreport the user's own failure as someone else's
|
|
23
|
+
* fraud against them.
|
|
24
|
+
*
|
|
25
|
+
* It never claims settlement. A payment nobody has broadcast can still be
|
|
26
|
+
* double-spent by the payer once they reconnect; no header check closes that,
|
|
27
|
+
* so the copy says "not yet broadcast", never "received". Nor does it ever
|
|
28
|
+
* claim delivery for a payment the user sent — only that the network refused
|
|
29
|
+
* it.
|
|
30
|
+
*/
|
|
31
|
+
import React from 'react'
|
|
32
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
33
|
+
import { useTranslation } from 'react-i18next'
|
|
34
|
+
import { useTheme, radii, spacing, typography, hitTargets, type OfflineActionRow } from '@bsv/expo-wallet-toolbox'
|
|
35
|
+
import PressableScale from '../ui/PressableScale'
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
39
|
+
* etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
|
|
40
|
+
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
41
|
+
* Ionicons is loaded lazily, only when actually rendering, same pattern as
|
|
42
|
+
* this package's other native-module-boundary fixes (expo-router, expo-blur).
|
|
43
|
+
*/
|
|
44
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
45
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
46
|
+
function loadIonicons(): IoniconsComponent {
|
|
47
|
+
if (!ioniconsComponent) {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
49
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
50
|
+
}
|
|
51
|
+
return ioniconsComponent
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function offlineActionDetails(row: OfflineActionRow): string {
|
|
55
|
+
const lines = [`txid: ${row.txid}`]
|
|
56
|
+
if (row.senderIdentityKey) lines.push(`sender: ${row.senderIdentityKey}`)
|
|
57
|
+
if (row.receivedVia) lines.push(`via: ${row.receivedVia}`)
|
|
58
|
+
if (row.rejectedReason) lines.push(`reason: ${row.rejectedReason}`)
|
|
59
|
+
if (row.created_at) lines.push(`when: ${row.created_at}`)
|
|
60
|
+
return lines.join('\n')
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface OfflineNoticeProps {
|
|
64
|
+
online: boolean
|
|
65
|
+
queued: number
|
|
66
|
+
rejected: OfflineActionRow[]
|
|
67
|
+
/**
|
|
68
|
+
* A payer's own held payment can be rejected too (the same release plan
|
|
69
|
+
* poisons rows regardless of role — see app/pay.tsx's queue effect), but it
|
|
70
|
+
* carries no sender to name: there is no counterparty to blame for a
|
|
71
|
+
* transaction the user sent themselves. Rendered as its own, unattributed
|
|
72
|
+
* notice rather than folded into `rejected`'s "who handed you this" copy.
|
|
73
|
+
*/
|
|
74
|
+
sentRejected?: OfflineActionRow[]
|
|
75
|
+
/** Fires TaskSendOffline.requestNow via the caller. Rendered only when online with a queue. */
|
|
76
|
+
onSendNow?: () => void
|
|
77
|
+
/** TaskSendOffline.lastStall — set when retrying alone will not drain the queue. */
|
|
78
|
+
stalled?: string
|
|
79
|
+
/** Queued/posting rows the user sent. Rows with a framePayload get a re-show affordance. */
|
|
80
|
+
queuedSent?: OfflineActionRow[]
|
|
81
|
+
onShowCode?: (row: OfflineActionRow) => void
|
|
82
|
+
/** Re-send `resend_request` for a rejected received payment. */
|
|
83
|
+
onRequestAgain?: (row: OfflineActionRow) => void
|
|
84
|
+
/** Prefill `/pay` with the rejected sent amount. */
|
|
85
|
+
onSendAgain?: (row: OfflineActionRow) => void
|
|
86
|
+
onCopyDetails?: (row: OfflineActionRow) => void
|
|
87
|
+
/** Archive a rejected row as `acknowledged`. Not destructive. */
|
|
88
|
+
onDismiss?: (row: OfflineActionRow) => void
|
|
89
|
+
/** Tighter padding when mounted above the home activity list. */
|
|
90
|
+
compact?: boolean
|
|
91
|
+
/** Unprocessed `localpay_pending` KV entries waiting to internalize. */
|
|
92
|
+
pendingCount?: number
|
|
93
|
+
/** Nearby payments this device tried and gave up on. */
|
|
94
|
+
pendingStuck?: number
|
|
95
|
+
/** Corrupt `localpay_pending` blob was quarantined, not treated as empty. */
|
|
96
|
+
pendingCorrupt?: boolean
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default function OfflineNotice({
|
|
100
|
+
online,
|
|
101
|
+
queued,
|
|
102
|
+
rejected,
|
|
103
|
+
sentRejected = [],
|
|
104
|
+
onSendNow,
|
|
105
|
+
stalled,
|
|
106
|
+
queuedSent,
|
|
107
|
+
onShowCode,
|
|
108
|
+
onRequestAgain,
|
|
109
|
+
onSendAgain,
|
|
110
|
+
onCopyDetails,
|
|
111
|
+
onDismiss,
|
|
112
|
+
compact = false,
|
|
113
|
+
pendingCount = 0,
|
|
114
|
+
pendingStuck = 0,
|
|
115
|
+
pendingCorrupt = false
|
|
116
|
+
}: OfflineNoticeProps) {
|
|
117
|
+
const { t } = useTranslation()
|
|
118
|
+
const { colors } = useTheme()
|
|
119
|
+
const Ionicons = loadIonicons()
|
|
120
|
+
if (
|
|
121
|
+
online &&
|
|
122
|
+
queued === 0 &&
|
|
123
|
+
rejected.length === 0 &&
|
|
124
|
+
sentRejected.length === 0 &&
|
|
125
|
+
(queuedSent ?? []).length === 0 &&
|
|
126
|
+
pendingCount === 0 &&
|
|
127
|
+
pendingStuck === 0 &&
|
|
128
|
+
!pendingCorrupt
|
|
129
|
+
)
|
|
130
|
+
return null
|
|
131
|
+
|
|
132
|
+
const stallDetail = stalled
|
|
133
|
+
? stalled
|
|
134
|
+
.split(';')
|
|
135
|
+
.map(part => part.trim())
|
|
136
|
+
.filter(Boolean)
|
|
137
|
+
.map(part =>
|
|
138
|
+
part === 'offline_stall_no_request' ||
|
|
139
|
+
part === 'offline_stall_bad_beef' ||
|
|
140
|
+
part === 'offline_stall_foreign_ancestor'
|
|
141
|
+
? t(part)
|
|
142
|
+
: part
|
|
143
|
+
)
|
|
144
|
+
.join('; ')
|
|
145
|
+
: ''
|
|
146
|
+
|
|
147
|
+
const actionBtn = (label: string, onPress?: () => void) => (
|
|
148
|
+
<PressableScale
|
|
149
|
+
onPress={onPress}
|
|
150
|
+
haptic="tap"
|
|
151
|
+
accessibilityRole="button"
|
|
152
|
+
accessibilityLabel={label}
|
|
153
|
+
style={styles.actionBtn}
|
|
154
|
+
>
|
|
155
|
+
<Text style={[styles.actionBtnLabel, { color: colors.info }]}>{label}</Text>
|
|
156
|
+
</PressableScale>
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<View style={[styles.wrap, compact && styles.wrapCompact]}>
|
|
161
|
+
{!online && (
|
|
162
|
+
<View style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
163
|
+
<Ionicons name="cloud-offline-outline" size={18} color={colors.textSecondary} />
|
|
164
|
+
<View style={styles.text}>
|
|
165
|
+
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('pay_offline_title')}</Text>
|
|
166
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
167
|
+
{queued > 0 ? t('pay_offline_queued', { count: queued }) : t('pay_offline_body')}
|
|
168
|
+
</Text>
|
|
169
|
+
{pendingCount > 0 && (
|
|
170
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
171
|
+
{t('pay_offline_kv_pending', { count: pendingCount })}
|
|
172
|
+
</Text>
|
|
173
|
+
)}
|
|
174
|
+
</View>
|
|
175
|
+
</View>
|
|
176
|
+
)}
|
|
177
|
+
{/* Online and still queued. The offline card above already carries the
|
|
178
|
+
count, so this is the case it cannot cover: signal is back and the
|
|
179
|
+
queue has not drained, which is either a run that has not happened yet
|
|
180
|
+
or one that never will. Same honesty rule as everywhere else in this
|
|
181
|
+
feature — waiting to be broadcast, never settled. */}
|
|
182
|
+
{online && queued > 0 && (
|
|
183
|
+
<View style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
184
|
+
<Ionicons name="time-outline" size={18} color={colors.textSecondary} />
|
|
185
|
+
<View style={styles.text}>
|
|
186
|
+
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('pay_offline_pending_title')}</Text>
|
|
187
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
188
|
+
{t('pay_offline_pending_body', { count: queued })}
|
|
189
|
+
</Text>
|
|
190
|
+
{pendingCount > 0 && (
|
|
191
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
192
|
+
{t('pay_offline_kv_pending', { count: pendingCount })}
|
|
193
|
+
</Text>
|
|
194
|
+
)}
|
|
195
|
+
{!!stallDetail && (
|
|
196
|
+
<Text style={[styles.body, { color: colors.warning }]}>
|
|
197
|
+
{t('pay_offline_stalled_body', { detail: stallDetail })}
|
|
198
|
+
</Text>
|
|
199
|
+
)}
|
|
200
|
+
{onSendNow && (
|
|
201
|
+
<Text accessibilityRole="button" onPress={onSendNow} style={[styles.action, { color: colors.info }]}>
|
|
202
|
+
{t('pay_offline_send_now')}
|
|
203
|
+
</Text>
|
|
204
|
+
)}
|
|
205
|
+
</View>
|
|
206
|
+
</View>
|
|
207
|
+
)}
|
|
208
|
+
{online && pendingCount > 0 && queued === 0 && (
|
|
209
|
+
<View style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
210
|
+
<Ionicons name="time-outline" size={18} color={colors.textSecondary} />
|
|
211
|
+
<View style={styles.text}>
|
|
212
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
213
|
+
{t('pay_offline_kv_pending', { count: pendingCount })}
|
|
214
|
+
</Text>
|
|
215
|
+
</View>
|
|
216
|
+
</View>
|
|
217
|
+
)}
|
|
218
|
+
{/* Given up on, so it is not "waiting" and must not be counted as such —
|
|
219
|
+
but it is still money this device holds a copy of and could not
|
|
220
|
+
credit, which the user has to be told rather than left to infer from
|
|
221
|
+
a number that quietly went down. */}
|
|
222
|
+
{pendingStuck > 0 && (
|
|
223
|
+
<View style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
224
|
+
<Ionicons name="alert-circle-outline" size={18} color={colors.warning} />
|
|
225
|
+
<View style={styles.text}>
|
|
226
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
227
|
+
{t('pay_offline_kv_stuck', { count: pendingStuck })}
|
|
228
|
+
</Text>
|
|
229
|
+
</View>
|
|
230
|
+
</View>
|
|
231
|
+
)}
|
|
232
|
+
{pendingCorrupt && (
|
|
233
|
+
<View style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
234
|
+
<Ionicons name="alert-circle-outline" size={18} color={colors.warning} />
|
|
235
|
+
<View style={styles.text}>
|
|
236
|
+
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('pay_offline_kv_corrupt')}</Text>
|
|
237
|
+
</View>
|
|
238
|
+
</View>
|
|
239
|
+
)}
|
|
240
|
+
{rejected.map(r => (
|
|
241
|
+
<View
|
|
242
|
+
key={r.txid}
|
|
243
|
+
style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
244
|
+
>
|
|
245
|
+
<Ionicons name="alert-circle-outline" size={18} color={colors.textSecondary} />
|
|
246
|
+
<View style={styles.text}>
|
|
247
|
+
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('pay_offline_rejected_title')}</Text>
|
|
248
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
249
|
+
{t('pay_offline_rejected_body', {
|
|
250
|
+
sender: r.senderIdentityKey ? `${r.senderIdentityKey.slice(0, 8)}…` : t('pay_offline_unknown_sender'),
|
|
251
|
+
via: r.receivedVia ?? t('pay_offline_unknown_via'),
|
|
252
|
+
when: r.created_at.slice(0, 10)
|
|
253
|
+
})}
|
|
254
|
+
</Text>
|
|
255
|
+
<View style={styles.actions}>
|
|
256
|
+
{!!r.senderIdentityKey && actionBtn(t('request_again'), () => onRequestAgain?.(r))}
|
|
257
|
+
{actionBtn(t('copy_details'), () => onCopyDetails?.(r))}
|
|
258
|
+
{actionBtn(t('cancel'), () => onDismiss?.(r))}
|
|
259
|
+
</View>
|
|
260
|
+
</View>
|
|
261
|
+
</View>
|
|
262
|
+
))}
|
|
263
|
+
{sentRejected.map(r => (
|
|
264
|
+
<View
|
|
265
|
+
key={r.txid}
|
|
266
|
+
style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
267
|
+
>
|
|
268
|
+
<Ionicons name="alert-circle-outline" size={18} color={colors.textSecondary} />
|
|
269
|
+
<View style={styles.text}>
|
|
270
|
+
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('pay_offline_sent_rejected_title')}</Text>
|
|
271
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>
|
|
272
|
+
{t('pay_offline_sent_rejected_body', { when: r.created_at.slice(0, 10) })}
|
|
273
|
+
</Text>
|
|
274
|
+
<View style={styles.actions}>
|
|
275
|
+
{actionBtn(t('send_again'), () => onSendAgain?.(r))}
|
|
276
|
+
{actionBtn(t('copy_details'), () => onCopyDetails?.(r))}
|
|
277
|
+
{actionBtn(t('cancel'), () => onDismiss?.(r))}
|
|
278
|
+
</View>
|
|
279
|
+
</View>
|
|
280
|
+
</View>
|
|
281
|
+
))}
|
|
282
|
+
{(queuedSent ?? [])
|
|
283
|
+
.filter(r => r.framePayload)
|
|
284
|
+
.map(r => (
|
|
285
|
+
<View
|
|
286
|
+
key={`code-${r.txid}`}
|
|
287
|
+
style={[styles.card, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}
|
|
288
|
+
>
|
|
289
|
+
<Ionicons name="qr-code-outline" size={18} color={colors.textSecondary} />
|
|
290
|
+
<View style={styles.text}>
|
|
291
|
+
<Text style={[styles.body, { color: colors.textSecondary }]}>{r.created_at.slice(0, 10)}</Text>
|
|
292
|
+
<Text
|
|
293
|
+
accessibilityRole="button"
|
|
294
|
+
onPress={() => onShowCode?.(r)}
|
|
295
|
+
style={[styles.action, { color: colors.info }]}
|
|
296
|
+
>
|
|
297
|
+
{t('pay_offline_show_code')}
|
|
298
|
+
</Text>
|
|
299
|
+
</View>
|
|
300
|
+
</View>
|
|
301
|
+
))}
|
|
302
|
+
</View>
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const styles = StyleSheet.create({
|
|
307
|
+
// No horizontal padding: this mounts inside the grid, which already supplies
|
|
308
|
+
// spacing.lg on both sides. Adding it here would double-indent the cards
|
|
309
|
+
// relative to the cell rows below them.
|
|
310
|
+
wrap: { paddingBottom: spacing.md, gap: spacing.sm },
|
|
311
|
+
wrapCompact: {
|
|
312
|
+
paddingHorizontal: spacing.xl,
|
|
313
|
+
paddingTop: spacing.lg,
|
|
314
|
+
paddingBottom: spacing.sm,
|
|
315
|
+
gap: spacing.xs
|
|
316
|
+
},
|
|
317
|
+
card: {
|
|
318
|
+
flexDirection: 'row',
|
|
319
|
+
alignItems: 'flex-start',
|
|
320
|
+
gap: spacing.sm,
|
|
321
|
+
padding: spacing.md,
|
|
322
|
+
borderRadius: radii.lg,
|
|
323
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
324
|
+
},
|
|
325
|
+
text: { flex: 1, gap: 2 },
|
|
326
|
+
title: { ...typography.subhead, fontWeight: '600' },
|
|
327
|
+
body: { ...typography.footnote },
|
|
328
|
+
action: { ...typography.subhead, fontWeight: '600', marginTop: 4 },
|
|
329
|
+
actions: { flexDirection: 'row', flexWrap: 'wrap', marginTop: spacing.xs },
|
|
330
|
+
actionBtn: {
|
|
331
|
+
minHeight: hitTargets.minimum,
|
|
332
|
+
minWidth: hitTargets.minimum,
|
|
333
|
+
justifyContent: 'center',
|
|
334
|
+
paddingRight: spacing.md
|
|
335
|
+
},
|
|
336
|
+
actionBtnLabel: { ...typography.subhead, fontWeight: '600' }
|
|
337
|
+
})
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One row of the counterparty picker. A row, not a grid tile: six tiles on one
|
|
3
|
+
* screen is a worse maze than three menu rows, and the row form keeps one
|
|
4
|
+
* focal element per line — the title — with the transport hint demoted to a
|
|
5
|
+
* subtitle where transport names are allowed to live.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react'
|
|
8
|
+
import { StyleSheet, Text, View } from 'react-native'
|
|
9
|
+
import { useTheme, radii, spacing, typography } from '@bsv/expo-wallet-toolbox'
|
|
10
|
+
import PressableScale from '../ui/PressableScale'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
14
|
+
* etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
|
|
15
|
+
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
16
|
+
* Ionicons is loaded lazily, only when actually rendering, same pattern as
|
|
17
|
+
* this package's other native-module-boundary fixes (expo-router, expo-blur).
|
|
18
|
+
*/
|
|
19
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
20
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
21
|
+
function loadIonicons(): IoniconsComponent {
|
|
22
|
+
if (!ioniconsComponent) {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
25
|
+
}
|
|
26
|
+
return ioniconsComponent
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface PayCellRowProps {
|
|
30
|
+
title: string
|
|
31
|
+
subtitle: string
|
|
32
|
+
icon: keyof IoniconsComponent['glyphMap']
|
|
33
|
+
onPress: () => void
|
|
34
|
+
/** Dimmed and unpressable — used for rails that need internet. */
|
|
35
|
+
disabled?: boolean
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default function PayCellRow({ title, subtitle, icon, onPress, disabled = false }: PayCellRowProps) {
|
|
39
|
+
const { colors } = useTheme()
|
|
40
|
+
const Ionicons = loadIonicons()
|
|
41
|
+
return (
|
|
42
|
+
<PressableScale
|
|
43
|
+
onPress={disabled ? () => {} : onPress}
|
|
44
|
+
haptic={disabled ? undefined : 'tap'}
|
|
45
|
+
scaleTo={disabled ? 1 : 0.98}
|
|
46
|
+
disabled={disabled}
|
|
47
|
+
style={[
|
|
48
|
+
styles.row,
|
|
49
|
+
{ backgroundColor: colors.backgroundElevated, borderColor: colors.separator },
|
|
50
|
+
disabled && styles.disabled
|
|
51
|
+
]}
|
|
52
|
+
accessibilityRole="button"
|
|
53
|
+
accessibilityState={{ disabled }}
|
|
54
|
+
accessibilityLabel={`${title}. ${subtitle}`}
|
|
55
|
+
>
|
|
56
|
+
<View
|
|
57
|
+
style={[
|
|
58
|
+
styles.iconWrap,
|
|
59
|
+
{ backgroundColor: colors.surfaceSunken, borderColor: colors.surfaceSunkenBorder }
|
|
60
|
+
]}
|
|
61
|
+
>
|
|
62
|
+
<Ionicons name={icon} size={20} color={colors.textSecondary} />
|
|
63
|
+
</View>
|
|
64
|
+
<View style={styles.text}>
|
|
65
|
+
<Text style={[styles.title, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
66
|
+
{title}
|
|
67
|
+
</Text>
|
|
68
|
+
<Text style={[styles.subtitle, { color: colors.textSecondary }]} numberOfLines={2}>
|
|
69
|
+
{subtitle}
|
|
70
|
+
</Text>
|
|
71
|
+
</View>
|
|
72
|
+
<Ionicons name="chevron-forward" size={18} color={colors.textQuaternary} />
|
|
73
|
+
</PressableScale>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const styles = StyleSheet.create({
|
|
78
|
+
row: {
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
alignItems: 'center',
|
|
81
|
+
gap: spacing.md,
|
|
82
|
+
paddingVertical: spacing.md,
|
|
83
|
+
paddingHorizontal: spacing.md,
|
|
84
|
+
borderRadius: radii.lg,
|
|
85
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
86
|
+
},
|
|
87
|
+
// Rounded square, not a circle: every glyph well in this system is a squircle
|
|
88
|
+
// of the same family, and a lone circle here reads as a different component.
|
|
89
|
+
iconWrap: {
|
|
90
|
+
width: 40,
|
|
91
|
+
height: 40,
|
|
92
|
+
borderRadius: 12,
|
|
93
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'center'
|
|
96
|
+
},
|
|
97
|
+
disabled: { opacity: 0.4 },
|
|
98
|
+
text: { flex: 1 },
|
|
99
|
+
title: { ...typography.headline, fontWeight: '600' },
|
|
100
|
+
subtitle: { ...typography.footnote }
|
|
101
|
+
})
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared pay-form vocabulary.
|
|
3
|
+
*
|
|
4
|
+
* The three rails grew up separately, and it showed: each hand-rolled its own
|
|
5
|
+
* field labels, amount prompt, warning note and submit button, so the same
|
|
6
|
+
* question read differently depending on how the counterparty was identified.
|
|
7
|
+
* These components are the fix — a rail composes them and inherits the one
|
|
8
|
+
* agreed rendering of each question. If a screen needs to ask for an amount,
|
|
9
|
+
* it uses PayAmountField; there is no second way to ask.
|
|
10
|
+
*
|
|
11
|
+
* Everything here is presentational. Validation, sending and money movement
|
|
12
|
+
* stay in the rails — proven logic this refactor deliberately does not touch.
|
|
13
|
+
*/
|
|
14
|
+
import React from 'react'
|
|
15
|
+
import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'
|
|
16
|
+
import { useTranslation } from 'react-i18next'
|
|
17
|
+
|
|
18
|
+
import AvailableBalance from './AvailableBalance'
|
|
19
|
+
import { useTheme, radii, spacing, typography } from '@bsv/expo-wallet-toolbox'
|
|
20
|
+
import { AmountInput } from '../wallet/AmountInput'
|
|
21
|
+
import PressableScale from '../ui/PressableScale'
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @expo/vector-icons' index barrel re-exports every icon set (AntDesign,
|
|
25
|
+
* etc.), one of which reaches expo-font -> expo-asset -- untransformed ESM
|
|
26
|
+
* that Jest cannot parse when eagerly pulled in via the `ui` package barrel.
|
|
27
|
+
* Ionicons is loaded lazily, only when actually rendering, same pattern as
|
|
28
|
+
* this package's other native-module-boundary fixes (expo-router, expo-blur).
|
|
29
|
+
*/
|
|
30
|
+
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
31
|
+
let ioniconsComponent: IoniconsComponent | undefined
|
|
32
|
+
function loadIonicons(): IoniconsComponent {
|
|
33
|
+
if (!ioniconsComponent) {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
35
|
+
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
36
|
+
}
|
|
37
|
+
return ioniconsComponent
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** One field section: the uppercase caption, then whatever asks the question. */
|
|
41
|
+
export function PayField({ labelKey, children }: { labelKey: string; children: React.ReactNode }) {
|
|
42
|
+
const { t } = useTranslation()
|
|
43
|
+
const { colors } = useTheme()
|
|
44
|
+
return (
|
|
45
|
+
<View style={styles.fieldGroup}>
|
|
46
|
+
<Text style={[styles.fieldLabel, { color: colors.textTertiary }]}>{t(labelKey)}</Text>
|
|
47
|
+
{children}
|
|
48
|
+
</View>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* THE amount question. Same label, same input, same balance line beneath it on every
|
|
54
|
+
* screen that asks it. `showBalance` is false only when the person typing is
|
|
55
|
+
* not the one paying (a payee naming a request) — their balance is meaningless
|
|
56
|
+
* to the payer and showing it would imply otherwise.
|
|
57
|
+
*/
|
|
58
|
+
export function PayAmountField({
|
|
59
|
+
value,
|
|
60
|
+
onChangeText,
|
|
61
|
+
showMax = true,
|
|
62
|
+
showBalance = true
|
|
63
|
+
}: {
|
|
64
|
+
value: string
|
|
65
|
+
onChangeText: (text: string) => void
|
|
66
|
+
showMax?: boolean
|
|
67
|
+
showBalance?: boolean
|
|
68
|
+
}) {
|
|
69
|
+
return (
|
|
70
|
+
<PayField labelKey="amount">
|
|
71
|
+
<AmountInput value={value} onChangeText={onChangeText} showMax={showMax} />
|
|
72
|
+
{showBalance && <AvailableBalance />}
|
|
73
|
+
</PayField>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The consequence, before the button — not after. Boxed so it reads as fact,
|
|
78
|
+
* not fine print. */
|
|
79
|
+
export function ConsequenceNote({ textKey }: { textKey: string }) {
|
|
80
|
+
const { t } = useTranslation()
|
|
81
|
+
const { colors } = useTheme()
|
|
82
|
+
const Ionicons = loadIonicons()
|
|
83
|
+
return (
|
|
84
|
+
<View style={[styles.consequence, { backgroundColor: colors.fillTertiary, borderColor: colors.separator }]}>
|
|
85
|
+
<Ionicons name="information-circle-outline" size={16} color={colors.textSecondary} />
|
|
86
|
+
<Text style={[styles.consequenceText, { color: colors.textSecondary }]}>{t(textKey)}</Text>
|
|
87
|
+
</View>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The submit button every rail sends with. */
|
|
92
|
+
export function PayCta({
|
|
93
|
+
onPress,
|
|
94
|
+
disabled,
|
|
95
|
+
busy,
|
|
96
|
+
labelKey = 'pay',
|
|
97
|
+
icon = 'arrow-up'
|
|
98
|
+
}: {
|
|
99
|
+
onPress: () => void
|
|
100
|
+
disabled: boolean
|
|
101
|
+
busy: boolean
|
|
102
|
+
labelKey?: string
|
|
103
|
+
icon?: keyof IoniconsComponent['glyphMap']
|
|
104
|
+
}) {
|
|
105
|
+
const { t } = useTranslation()
|
|
106
|
+
const { colors } = useTheme()
|
|
107
|
+
const Ionicons = loadIonicons()
|
|
108
|
+
const enabled = !disabled
|
|
109
|
+
return (
|
|
110
|
+
<PressableScale
|
|
111
|
+
onPress={onPress}
|
|
112
|
+
disabled={disabled}
|
|
113
|
+
haptic="confirm"
|
|
114
|
+
style={[styles.cta, { backgroundColor: enabled ? colors.accent : colors.fill }]}
|
|
115
|
+
accessibilityRole="button"
|
|
116
|
+
accessibilityLabel={t(labelKey)}
|
|
117
|
+
accessibilityState={{ disabled }}
|
|
118
|
+
>
|
|
119
|
+
{busy ? (
|
|
120
|
+
<ActivityIndicator size="small" color={enabled ? colors.background : colors.textTertiary} />
|
|
121
|
+
) : (
|
|
122
|
+
<>
|
|
123
|
+
<Ionicons name={icon} size={20} color={enabled ? colors.textOnAccent : colors.textTertiary} />
|
|
124
|
+
<Text style={[styles.ctaText, { color: enabled ? colors.textOnAccent : colors.textTertiary }]}>
|
|
125
|
+
{t(labelKey)}
|
|
126
|
+
</Text>
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</PressableScale>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* The resolved counterparty, shown the same way on every rail: avatar, the
|
|
135
|
+
* RECIPIENT caption, the name, and (when the name is not itself the key) the
|
|
136
|
+
* abbreviated key or address underneath.
|
|
137
|
+
*/
|
|
138
|
+
export function RecipientSummary({
|
|
139
|
+
name,
|
|
140
|
+
detail,
|
|
141
|
+
icon = 'person'
|
|
142
|
+
}: {
|
|
143
|
+
name: string
|
|
144
|
+
detail?: string
|
|
145
|
+
icon?: keyof IoniconsComponent['glyphMap']
|
|
146
|
+
}) {
|
|
147
|
+
const { t } = useTranslation()
|
|
148
|
+
const { colors } = useTheme()
|
|
149
|
+
const Ionicons = loadIonicons()
|
|
150
|
+
return (
|
|
151
|
+
<View style={[styles.idCard, { backgroundColor: colors.backgroundElevated, borderColor: colors.separator }]}>
|
|
152
|
+
<View style={[styles.avatar, { backgroundColor: colors.fillTertiary }]}>
|
|
153
|
+
<Ionicons name={icon} size={20} color={colors.textSecondary} />
|
|
154
|
+
</View>
|
|
155
|
+
<View style={styles.idText}>
|
|
156
|
+
<Text style={[styles.idLabel, { color: colors.textTertiary }]}>{t('recipient')}</Text>
|
|
157
|
+
<Text style={[styles.idName, { color: colors.textPrimary }]} numberOfLines={1}>
|
|
158
|
+
{name}
|
|
159
|
+
</Text>
|
|
160
|
+
{!!detail && (
|
|
161
|
+
<Text style={[styles.idKey, { color: colors.textTertiary }]} numberOfLines={1} ellipsizeMode="middle">
|
|
162
|
+
{detail}
|
|
163
|
+
</Text>
|
|
164
|
+
)}
|
|
165
|
+
</View>
|
|
166
|
+
</View>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const styles = StyleSheet.create({
|
|
171
|
+
fieldGroup: { marginBottom: spacing.xl },
|
|
172
|
+
fieldLabel: {
|
|
173
|
+
...typography.caption2,
|
|
174
|
+
fontWeight: '600',
|
|
175
|
+
letterSpacing: 0.8,
|
|
176
|
+
textTransform: 'uppercase',
|
|
177
|
+
marginBottom: spacing.sm
|
|
178
|
+
},
|
|
179
|
+
consequence: {
|
|
180
|
+
flexDirection: 'row',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
gap: spacing.sm,
|
|
183
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
184
|
+
borderRadius: radii.md,
|
|
185
|
+
paddingVertical: spacing.sm + 2,
|
|
186
|
+
paddingHorizontal: spacing.md,
|
|
187
|
+
marginBottom: spacing.lg
|
|
188
|
+
},
|
|
189
|
+
consequenceText: { ...typography.footnote, flex: 1 },
|
|
190
|
+
cta: {
|
|
191
|
+
flexDirection: 'row',
|
|
192
|
+
alignItems: 'center',
|
|
193
|
+
justifyContent: 'center',
|
|
194
|
+
gap: spacing.sm,
|
|
195
|
+
paddingVertical: spacing.md + 2,
|
|
196
|
+
borderRadius: radii.md
|
|
197
|
+
},
|
|
198
|
+
ctaText: { ...typography.subhead, fontWeight: '600' },
|
|
199
|
+
idCard: {
|
|
200
|
+
flexDirection: 'row',
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
gap: spacing.md,
|
|
203
|
+
borderWidth: StyleSheet.hairlineWidth,
|
|
204
|
+
borderRadius: radii.md,
|
|
205
|
+
padding: spacing.md
|
|
206
|
+
},
|
|
207
|
+
avatar: {
|
|
208
|
+
width: 40,
|
|
209
|
+
height: 40,
|
|
210
|
+
borderRadius: 20,
|
|
211
|
+
alignItems: 'center',
|
|
212
|
+
justifyContent: 'center'
|
|
213
|
+
},
|
|
214
|
+
idText: { flex: 1, gap: 2 },
|
|
215
|
+
idLabel: {
|
|
216
|
+
...typography.caption2,
|
|
217
|
+
fontWeight: '600',
|
|
218
|
+
letterSpacing: 0.8,
|
|
219
|
+
textTransform: 'uppercase'
|
|
220
|
+
},
|
|
221
|
+
idName: { ...typography.body, fontWeight: '600' },
|
|
222
|
+
idKey: { ...typography.caption1 }
|
|
223
|
+
})
|