@outerjoyn/react-native 1.3.0 → 1.4.1
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/package.json +1 -1
- package/src/OuterJoynProvider.tsx +1 -1
- package/src/core/types.ts +16 -11
- package/src/screens/AccountScreen.tsx +3 -1
- package/src/screens/RedeemScreen.tsx +263 -82
- package/src/types.ts +7 -4
package/package.json
CHANGED
|
@@ -592,7 +592,7 @@ export function OuterJoynProvider({
|
|
|
592
592
|
);
|
|
593
593
|
|
|
594
594
|
const openExchange = useCallback(
|
|
595
|
-
(opts?: { sourceCurrencyId?: number }) => {
|
|
595
|
+
(opts?: { sourceCurrencyId?: number | string }) => {
|
|
596
596
|
analyticsRef.current?.trackOpen('exchange');
|
|
597
597
|
openSheet('exchange', opts ?? {});
|
|
598
598
|
},
|
package/src/core/types.ts
CHANGED
|
@@ -14,7 +14,9 @@ export interface CreateSessionResponse {
|
|
|
14
14
|
status: 'ready' | 'link_required';
|
|
15
15
|
expires_at: string;
|
|
16
16
|
member_context?: {
|
|
17
|
-
|
|
17
|
+
// Snowflake IDs ride as JSON strings on the wire post-audit-D2b; the
|
|
18
|
+
// legacy numeric shape is still accepted from pre-D2b servers.
|
|
19
|
+
member_id: number | string;
|
|
18
20
|
display_name?: string;
|
|
19
21
|
linked_programs?: Array<{ program_name: string; currency_name: string }>;
|
|
20
22
|
};
|
|
@@ -23,9 +25,9 @@ export interface CreateSessionResponse {
|
|
|
23
25
|
|
|
24
26
|
export interface SessionContextResponse {
|
|
25
27
|
status: string;
|
|
26
|
-
member_id: number | null;
|
|
28
|
+
member_id: number | string | null;
|
|
27
29
|
display_name?: string;
|
|
28
|
-
business_unit_id: number;
|
|
30
|
+
business_unit_id: number | string;
|
|
29
31
|
scopes: string[];
|
|
30
32
|
expires_at: string;
|
|
31
33
|
payable_balances?: PayableBalance[];
|
|
@@ -34,9 +36,12 @@ export interface SessionContextResponse {
|
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
export interface PayableBalance {
|
|
39
|
+
// Snowflake IDs (memberCurrencyId/currencyId/partnershipId) ride as JSON
|
|
40
|
+
// strings on the wire post-audit-D2; kept `number | string` to also accept
|
|
41
|
+
// the legacy numeric shape. Amounts/balances stay numeric.
|
|
37
42
|
// Go gateway returns camelCase
|
|
38
|
-
memberCurrencyId?: number;
|
|
39
|
-
currencyId?: number;
|
|
43
|
+
memberCurrencyId?: number | string;
|
|
44
|
+
currencyId?: number | string;
|
|
40
45
|
currencyName?: string;
|
|
41
46
|
currencyCode?: string;
|
|
42
47
|
brandName?: string;
|
|
@@ -45,10 +50,10 @@ export interface PayableBalance {
|
|
|
45
50
|
balance?: number;
|
|
46
51
|
pointValueAmount?: number;
|
|
47
52
|
valueAmount?: number;
|
|
48
|
-
partnershipId?: number;
|
|
53
|
+
partnershipId?: number | string;
|
|
49
54
|
// Express returns snake_case
|
|
50
|
-
member_currency_id?: number;
|
|
51
|
-
currency_id?: number;
|
|
55
|
+
member_currency_id?: number | string;
|
|
56
|
+
currency_id?: number | string;
|
|
52
57
|
currency_name?: string;
|
|
53
58
|
currency_code?: string;
|
|
54
59
|
brand_name?: string;
|
|
@@ -56,7 +61,7 @@ export interface PayableBalance {
|
|
|
56
61
|
brand_color?: string | null;
|
|
57
62
|
point_value_amount?: number;
|
|
58
63
|
value_amount?: number;
|
|
59
|
-
partnership_id?: number;
|
|
64
|
+
partnership_id?: number | string;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
67
|
export interface BrandConfig {
|
|
@@ -87,7 +92,7 @@ export interface LinkedProgram {
|
|
|
87
92
|
brandLogoUrl: string | null;
|
|
88
93
|
brandColor: string | null;
|
|
89
94
|
/** Partnership ID — used for disconnect. May be undefined for demo programs. */
|
|
90
|
-
partnershipId?: number;
|
|
95
|
+
partnershipId?: number | string;
|
|
91
96
|
}
|
|
92
97
|
|
|
93
98
|
// =============================================================================
|
|
@@ -183,7 +188,7 @@ export interface OuterJoynContextValue {
|
|
|
183
188
|
// Actions
|
|
184
189
|
refreshBalances: () => Promise<void>;
|
|
185
190
|
openConnect: (opts?: { institutionId?: string }) => void;
|
|
186
|
-
openExchange: (opts?: { sourceCurrencyId?: number }) => void;
|
|
191
|
+
openExchange: (opts?: { sourceCurrencyId?: number | string }) => void;
|
|
187
192
|
openRedeem: (opts?: { category?: string }) => void;
|
|
188
193
|
openPay: (opts: { orderTotalCents: number; merchantOrderId?: string }) => void;
|
|
189
194
|
openAccount: () => void;
|
|
@@ -67,7 +67,9 @@ interface ConnectedBrand {
|
|
|
67
67
|
total_redeemed: number;
|
|
68
68
|
scopes: string[];
|
|
69
69
|
linked_at: string;
|
|
70
|
-
|
|
70
|
+
// Snowflake ID: JSON string on the wire post-audit-D2; sourced from the
|
|
71
|
+
// widened LinkedProgram.partnershipId. Legacy numeric shape still accepted.
|
|
72
|
+
partnership_id?: number | string;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
interface ActivityItem {
|
|
@@ -63,7 +63,8 @@ interface RedemptionResult {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
interface CatalogItem {
|
|
66
|
-
|
|
66
|
+
// Snowflake catalog ID: JSON string on the wire post-audit-D2; legacy numeric accepted.
|
|
67
|
+
product_id: number | string;
|
|
67
68
|
name: string;
|
|
68
69
|
description: string;
|
|
69
70
|
short_description?: string;
|
|
@@ -85,14 +86,23 @@ type Step = 'catalog' | 'detail' | 'confirm' | 'processing' | 'success' | 'error
|
|
|
85
86
|
// Demo data
|
|
86
87
|
// =============================================================================
|
|
87
88
|
|
|
88
|
-
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Category visuals for image-less rewards (2026-07-21 Plaid-grade redesign,
|
|
91
|
+
* built against the approved HTML rendering): a soft pastel tile background
|
|
92
|
+
* plus an emoji monogram in a floating white square — replaces the old flat
|
|
93
|
+
* saturated color block with the category name shouting in white caps.
|
|
94
|
+
*/
|
|
95
|
+
const CATEGORY_VISUALS: Record<string, { bg: string; emoji: string }> = {
|
|
96
|
+
'Gift Cards': { bg: '#EEF4FF', emoji: '🎁' },
|
|
97
|
+
'Electronics': { bg: '#EDF7FE', emoji: '🎧' },
|
|
98
|
+
'Experiences': { bg: '#EEF4FF', emoji: '🌴' },
|
|
99
|
+
'Merchandise': { bg: '#F5F0FE', emoji: '👕' },
|
|
100
|
+
'Wellness': { bg: '#EFFDF4', emoji: '🧘' },
|
|
101
|
+
'Skincare': { bg: '#FDF2F8', emoji: '✨' },
|
|
102
|
+
'Rewards': { bg: '#F6F9FC', emoji: '⭐' },
|
|
95
103
|
};
|
|
104
|
+
const categoryVisual = (category: string) =>
|
|
105
|
+
CATEGORY_VISUALS[category] ?? { bg: '#F6F9FC', emoji: '⭐' };
|
|
96
106
|
|
|
97
107
|
const DEMO_CATALOG: CatalogItem[] = [
|
|
98
108
|
{ product_id: 1, name: '$10 Coffee Gift Card', description: 'Redeemable at any Urban Coffee Co location.', category: 'Gift Cards', points_cost: 2000, cash_price: 1000, image_url: 'https://images.unsplash.com/photo-1509042239860-f550ce710b93?w=400&h=400&fit=crop' },
|
|
@@ -145,6 +155,18 @@ export function RedeemScreen({
|
|
|
145
155
|
const [walletState, setWalletState] = useState<'idle' | 'adding' | 'added' | 'unavailable'>('idle');
|
|
146
156
|
// Start at 0 for real sessions; demo mode explicitly sets DEMO_BALANCE below.
|
|
147
157
|
const [balance, setBalance] = useState(0);
|
|
158
|
+
// Category chip filter ('' = All) — Plaid-grade redesign 2026-07-21.
|
|
159
|
+
const [categoryFilter, setCategoryFilter] = useState('');
|
|
160
|
+
|
|
161
|
+
// "Available to spend": /api/sdk/balance only reads the single brand
|
|
162
|
+
// Member.points_balance, which is 0 for cross-program demo members even
|
|
163
|
+
// when the provider holds six-figure payable balances — the infamous
|
|
164
|
+
// "Total Available Value: 0 pts" header. Prefer the provider's
|
|
165
|
+
// cross-program total (same source as LoyaltyBanner/BalanceSummary) and
|
|
166
|
+
// fall back to the endpoint value.
|
|
167
|
+
const effectiveBalance = Math.max(balance, ctx.totalAvailablePoints ?? 0);
|
|
168
|
+
const effectiveValueCents = ctx.totalAvailableValue ?? 0;
|
|
169
|
+
const programCount = ctx.linkedPrograms?.length ?? 0;
|
|
148
170
|
const [reloadKey, setReloadKey] = useState(0);
|
|
149
171
|
const searchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
150
172
|
|
|
@@ -217,16 +239,27 @@ export function RedeemScreen({
|
|
|
217
239
|
}
|
|
218
240
|
}, [visible]);
|
|
219
241
|
|
|
220
|
-
//
|
|
242
|
+
// Category chips (derived from the loaded catalog, insertion-ordered).
|
|
243
|
+
const categories = useMemo(() => {
|
|
244
|
+
const seen: string[] = [];
|
|
245
|
+
for (const item of catalog) {
|
|
246
|
+
if (item.category && !seen.includes(item.category)) seen.push(item.category);
|
|
247
|
+
}
|
|
248
|
+
return seen;
|
|
249
|
+
}, [catalog]);
|
|
250
|
+
|
|
251
|
+
// Debounced search filter + category chip filter
|
|
221
252
|
const filteredCatalog = useMemo(() => {
|
|
222
|
-
|
|
253
|
+
let items = catalog;
|
|
254
|
+
if (categoryFilter) items = items.filter((i) => i.category === categoryFilter);
|
|
255
|
+
if (!search.trim()) return items;
|
|
223
256
|
const q = search.toLowerCase();
|
|
224
|
-
return
|
|
257
|
+
return items.filter(
|
|
225
258
|
(item) =>
|
|
226
259
|
item.name.toLowerCase().includes(q) ||
|
|
227
260
|
item.category.toLowerCase().includes(q),
|
|
228
261
|
);
|
|
229
|
-
}, [catalog, search]);
|
|
262
|
+
}, [catalog, search, categoryFilter]);
|
|
230
263
|
|
|
231
264
|
const handleSearchChange = useCallback((text: string) => {
|
|
232
265
|
setSearch(text);
|
|
@@ -239,12 +272,12 @@ export function RedeemScreen({
|
|
|
239
272
|
|
|
240
273
|
const handleRedeem = useCallback(() => {
|
|
241
274
|
if (!selectedItem) return;
|
|
242
|
-
if (selectedItem.points_cost >
|
|
275
|
+
if (selectedItem.points_cost > effectiveBalance) {
|
|
243
276
|
Alert.alert(t('redeem.insufficient'), t('redeem.points', { cost: String(selectedItem.points_cost) }));
|
|
244
277
|
return;
|
|
245
278
|
}
|
|
246
279
|
setStep('confirm');
|
|
247
|
-
}, [selectedItem,
|
|
280
|
+
}, [selectedItem, effectiveBalance]);
|
|
248
281
|
|
|
249
282
|
const handleConfirmRedeem = useCallback(async () => {
|
|
250
283
|
if (!selectedItem) return;
|
|
@@ -346,32 +379,62 @@ export function RedeemScreen({
|
|
|
346
379
|
// Render steps
|
|
347
380
|
// =========================================================================
|
|
348
381
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
382
|
+
// Plaid-grade card (2026-07-21, built against the approved rendering):
|
|
383
|
+
// rounded tile, image or pastel monogram fallback, points pill overlay,
|
|
384
|
+
// name + category eyebrow + points/value row.
|
|
385
|
+
const renderCatalogItem = ({ item }: { item: CatalogItem }) => {
|
|
386
|
+
const visual = categoryVisual(item.category);
|
|
387
|
+
return (
|
|
388
|
+
<Pressable style={styles.catalogCard} onPress={() => handleSelectItem(item)}>
|
|
389
|
+
<View style={[styles.catalogThumb, !item.image_url && { backgroundColor: visual.bg }]}>
|
|
390
|
+
{item.image_url ? (
|
|
391
|
+
<Image source={{ uri: item.image_url }} style={styles.catalogImage} resizeMode="cover" />
|
|
392
|
+
) : (
|
|
393
|
+
<View style={styles.monogram}>
|
|
394
|
+
<Text style={styles.monogramEmoji}>{visual.emoji}</Text>
|
|
395
|
+
</View>
|
|
396
|
+
)}
|
|
397
|
+
<View style={styles.pointsPill}>
|
|
398
|
+
<Text style={styles.pointsPillText}>{fmt(item.points_cost)} pts</Text>
|
|
399
|
+
</View>
|
|
400
|
+
</View>
|
|
401
|
+
<View style={styles.catalogBody}>
|
|
402
|
+
<Text style={styles.catalogName} numberOfLines={2}>{item.name}</Text>
|
|
403
|
+
<Text style={styles.catalogCategory}>{item.category}</Text>
|
|
404
|
+
<View style={styles.catalogPriceRow}>
|
|
405
|
+
<Text style={styles.catalogPoints}>{fmt(item.points_cost)} pts</Text>
|
|
406
|
+
{item.cash_price != null && (
|
|
407
|
+
<Text style={styles.catalogCash}>${(item.cash_price / 100).toFixed(0)} value</Text>
|
|
408
|
+
)}
|
|
409
|
+
</View>
|
|
410
|
+
</View>
|
|
411
|
+
</Pressable>
|
|
412
|
+
);
|
|
413
|
+
};
|
|
365
414
|
|
|
366
415
|
const renderCatalog = () => (
|
|
367
416
|
<View style={styles.content}>
|
|
368
|
-
{/*
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
417
|
+
{/* Available-to-spend chip — cross-program totals from the provider
|
|
418
|
+
(the old header read /api/sdk/balance = single-brand
|
|
419
|
+
Member.points_balance, which rendered "0 pts" for cross-program
|
|
420
|
+
demo members). */}
|
|
421
|
+
<View style={styles.balanceChip}>
|
|
422
|
+
<View style={styles.balanceChipLeft}>
|
|
423
|
+
<Text style={styles.balanceChipLabel}>AVAILABLE TO SPEND</Text>
|
|
424
|
+
<Text style={styles.balanceChipPts}>{fmt(effectiveBalance)} pts</Text>
|
|
425
|
+
{effectiveValueCents > 0 && (
|
|
426
|
+
<Text style={styles.balanceChipUsd}>
|
|
427
|
+
{'≈'} ${(effectiveValueCents / 100).toFixed(2)}
|
|
428
|
+
{programCount > 1 ? ` across ${programCount} programs` : ''}
|
|
429
|
+
</Text>
|
|
430
|
+
)}
|
|
431
|
+
</View>
|
|
432
|
+
<View style={styles.balanceChipSpark}>
|
|
433
|
+
<Text style={styles.balanceChipSparkText}>{'✦'}</Text>
|
|
434
|
+
</View>
|
|
372
435
|
</View>
|
|
373
436
|
|
|
374
|
-
{/* Search */}
|
|
437
|
+
{/* Search (pill, parity with the Connect picker) */}
|
|
375
438
|
<View style={styles.searchContainer}>
|
|
376
439
|
<TextInput
|
|
377
440
|
style={styles.searchInput}
|
|
@@ -383,6 +446,32 @@ export function RedeemScreen({
|
|
|
383
446
|
/>
|
|
384
447
|
</View>
|
|
385
448
|
|
|
449
|
+
{/* Category chips */}
|
|
450
|
+
{categories.length > 1 && (
|
|
451
|
+
<View>
|
|
452
|
+
<FlatList
|
|
453
|
+
horizontal
|
|
454
|
+
showsHorizontalScrollIndicator={false}
|
|
455
|
+
data={['', ...categories]}
|
|
456
|
+
keyExtractor={(c: string) => c || '__all__'}
|
|
457
|
+
contentContainerStyle={styles.chipsRow}
|
|
458
|
+
renderItem={({ item: cat }: { item: string }) => {
|
|
459
|
+
const on = categoryFilter === cat;
|
|
460
|
+
return (
|
|
461
|
+
<Pressable
|
|
462
|
+
style={[styles.chip, on && styles.chipOn]}
|
|
463
|
+
onPress={() => setCategoryFilter(cat)}
|
|
464
|
+
>
|
|
465
|
+
<Text style={[styles.chipText, on && styles.chipTextOn]}>
|
|
466
|
+
{cat === '' ? 'All' : cat}
|
|
467
|
+
</Text>
|
|
468
|
+
</Pressable>
|
|
469
|
+
);
|
|
470
|
+
}}
|
|
471
|
+
/>
|
|
472
|
+
</View>
|
|
473
|
+
)}
|
|
474
|
+
|
|
386
475
|
{loading ? (
|
|
387
476
|
<View style={styles.loadingContainer}>
|
|
388
477
|
<ActivityIndicator size="large" color={COLORS.primary} />
|
|
@@ -391,7 +480,7 @@ export function RedeemScreen({
|
|
|
391
480
|
<FlatList
|
|
392
481
|
data={filteredCatalog}
|
|
393
482
|
renderItem={renderCatalogItem}
|
|
394
|
-
keyExtractor={(item) => String(item.product_id)}
|
|
483
|
+
keyExtractor={(item: CatalogItem) => String(item.product_id)}
|
|
395
484
|
numColumns={2}
|
|
396
485
|
columnWrapperStyle={styles.catalogRow}
|
|
397
486
|
contentContainerStyle={styles.catalogList}
|
|
@@ -406,41 +495,72 @@ export function RedeemScreen({
|
|
|
406
495
|
|
|
407
496
|
const renderDetail = () => {
|
|
408
497
|
if (!selectedItem) return null;
|
|
409
|
-
const affordable = selectedItem.points_cost <=
|
|
498
|
+
const affordable = selectedItem.points_cost <= effectiveBalance;
|
|
499
|
+
const shortfall = Math.max(0, selectedItem.points_cost - effectiveBalance);
|
|
500
|
+
const progress = selectedItem.points_cost > 0
|
|
501
|
+
? Math.max(0.03, Math.min(1, effectiveBalance / selectedItem.points_cost))
|
|
502
|
+
: 1;
|
|
503
|
+
const visual = categoryVisual(selectedItem.category);
|
|
410
504
|
return (
|
|
411
505
|
<View style={styles.content}>
|
|
412
506
|
<Pressable onPress={() => setStep('catalog')} style={styles.backButton}>
|
|
413
|
-
<Text style={styles.backText}>{'\
|
|
507
|
+
<Text style={styles.backText}>{'\u2039'} All rewards</Text>
|
|
414
508
|
</Pressable>
|
|
415
509
|
|
|
416
|
-
<View style={[styles.
|
|
510
|
+
<View style={[styles.detailHero, !selectedItem.image_url && { backgroundColor: visual.bg }]}>
|
|
417
511
|
{selectedItem.image_url ? (
|
|
418
512
|
<Image source={{ uri: selectedItem.image_url }} style={styles.detailImage} resizeMode="cover" />
|
|
419
513
|
) : (
|
|
420
|
-
<
|
|
514
|
+
<View style={[styles.monogram, styles.detailMonogram]}>
|
|
515
|
+
<Text style={styles.detailMonogramEmoji}>{visual.emoji}</Text>
|
|
516
|
+
</View>
|
|
421
517
|
)}
|
|
518
|
+
<View style={[styles.pointsPill, styles.detailPointsPill]}>
|
|
519
|
+
<Text style={styles.pointsPillText}>{fmt(selectedItem.points_cost)} pts</Text>
|
|
520
|
+
</View>
|
|
422
521
|
</View>
|
|
423
522
|
|
|
523
|
+
<Text style={styles.detailEyebrow}>{selectedItem.category}</Text>
|
|
424
524
|
<Text style={styles.detailName}>{selectedItem.name}</Text>
|
|
425
|
-
<Text style={styles.detailCategory}>{selectedItem.category}</Text>
|
|
426
525
|
<Text style={styles.detailDescription}>{selectedItem.description}</Text>
|
|
427
526
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
527
|
+
{/* Affordability card: points + retail value + progress toward the
|
|
528
|
+
cost, with an honest shortfall line instead of a pale disabled
|
|
529
|
+
button labelled "Not enough points". */}
|
|
530
|
+
<View style={styles.priceCard}>
|
|
531
|
+
<View style={styles.priceCardRow}>
|
|
532
|
+
<Text style={styles.detailPoints}>{fmt(selectedItem.points_cost)} pts</Text>
|
|
533
|
+
{selectedItem.cash_price != null && (
|
|
534
|
+
<Text style={styles.detailCash}>${(selectedItem.cash_price / 100).toFixed(2)} retail value</Text>
|
|
535
|
+
)}
|
|
536
|
+
</View>
|
|
537
|
+
<View style={styles.meterTrack}>
|
|
538
|
+
<View style={[styles.meterFill, { width: `${Math.round(progress * 100)}%` }]} />
|
|
539
|
+
</View>
|
|
540
|
+
<Text style={styles.meterHint}>
|
|
541
|
+
You have <Text style={styles.meterHintStrong}>{fmt(effectiveBalance)} pts</Text>
|
|
542
|
+
{affordable
|
|
543
|
+
? ' \u2014 plenty to redeem this'
|
|
544
|
+
: <Text> \u2014 <Text style={styles.meterHintAccent}>{fmt(shortfall)} more</Text> to unlock this</Text>}
|
|
545
|
+
</Text>
|
|
433
546
|
</View>
|
|
434
547
|
|
|
435
548
|
<Pressable
|
|
436
|
-
style={[styles.primaryButton, !affordable && styles.
|
|
549
|
+
style={[styles.primaryButton, !affordable && styles.insufficientButton]}
|
|
437
550
|
disabled={!affordable}
|
|
438
551
|
onPress={handleRedeem}
|
|
439
552
|
>
|
|
440
|
-
<Text style={styles.primaryButtonText}>
|
|
441
|
-
{affordable
|
|
553
|
+
<Text style={[styles.primaryButtonText, !affordable && styles.insufficientButtonText]}>
|
|
554
|
+
{affordable
|
|
555
|
+
? `Redeem for ${fmt(selectedItem.points_cost)} pts`
|
|
556
|
+
: `${fmt(shortfall)} more points needed`}
|
|
442
557
|
</Text>
|
|
443
558
|
</Pressable>
|
|
559
|
+
<Text style={styles.ctaHint}>
|
|
560
|
+
{affordable
|
|
561
|
+
? 'Points are deducted after you confirm on the next step'
|
|
562
|
+
: 'Keep earning, or exchange points from another program'}
|
|
563
|
+
</Text>
|
|
444
564
|
</View>
|
|
445
565
|
);
|
|
446
566
|
};
|
|
@@ -453,7 +573,7 @@ export function RedeemScreen({
|
|
|
453
573
|
<Text style={styles.confirmLabel}>{fmt(selectedItem?.points_cost ?? 0)} points</Text>
|
|
454
574
|
</View>
|
|
455
575
|
<Text style={styles.confirmBalance}>
|
|
456
|
-
Remaining balance: {fmt(
|
|
576
|
+
Remaining balance: {fmt(effectiveBalance - (selectedItem?.points_cost ?? 0))} pts
|
|
457
577
|
</Text>
|
|
458
578
|
<Pressable style={styles.primaryButton} onPress={handleConfirmRedeem}>
|
|
459
579
|
<Text style={styles.primaryButtonText}>{t('exchange.confirm')}</Text>
|
|
@@ -623,76 +743,138 @@ const styles = StyleSheet.create({
|
|
|
623
743
|
poweredByText: { fontSize: 11, color: '#9CA3AF' },
|
|
624
744
|
poweredByLogo: { width: 80, height: 16 },
|
|
625
745
|
|
|
626
|
-
//
|
|
627
|
-
|
|
746
|
+
// Available-to-spend chip (Plaid-grade redesign, 2026-07-21 — built
|
|
747
|
+
// against the approved HTML rendering; solid navy in lieu of a gradient
|
|
748
|
+
// to avoid an expo-linear-gradient peer dep)
|
|
749
|
+
balanceChip: {
|
|
628
750
|
flexDirection: 'row',
|
|
629
751
|
justifyContent: 'space-between',
|
|
630
752
|
alignItems: 'center',
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
753
|
+
paddingVertical: 16,
|
|
754
|
+
paddingHorizontal: 18,
|
|
755
|
+
borderRadius: 18,
|
|
756
|
+
backgroundColor: COLORS.navy,
|
|
757
|
+
marginBottom: 14,
|
|
758
|
+
},
|
|
759
|
+
balanceChipLeft: { flex: 1 },
|
|
760
|
+
balanceChipLabel: {
|
|
761
|
+
fontSize: 11, fontWeight: '600', letterSpacing: 0.5,
|
|
762
|
+
color: 'rgba(255,255,255,0.72)', marginBottom: 3,
|
|
763
|
+
},
|
|
764
|
+
balanceChipPts: { fontSize: 22, fontWeight: '800', color: '#FFFFFF', letterSpacing: -0.4 },
|
|
765
|
+
balanceChipUsd: { fontSize: 12.5, fontWeight: '500', color: 'rgba(255,255,255,0.78)', marginTop: 2 },
|
|
766
|
+
balanceChipSpark: {
|
|
767
|
+
width: 44, height: 44, borderRadius: 22,
|
|
768
|
+
backgroundColor: 'rgba(255,255,255,0.14)',
|
|
769
|
+
alignItems: 'center', justifyContent: 'center',
|
|
635
770
|
},
|
|
636
|
-
|
|
637
|
-
balanceValue: { fontSize: 18, fontWeight: '700', color: COLORS.primary },
|
|
771
|
+
balanceChipSparkText: { fontSize: 20, color: '#FFFFFF' },
|
|
638
772
|
|
|
639
|
-
// Search
|
|
773
|
+
// Search (pill — parity with the Connect picker)
|
|
640
774
|
searchContainer: { marginBottom: 12 },
|
|
641
775
|
searchInput: {
|
|
642
776
|
borderWidth: 1,
|
|
643
777
|
borderColor: COLORS.border,
|
|
644
|
-
borderRadius:
|
|
645
|
-
|
|
778
|
+
borderRadius: 999,
|
|
779
|
+
paddingVertical: 12,
|
|
780
|
+
paddingHorizontal: 18,
|
|
646
781
|
fontSize: 15,
|
|
647
782
|
color: COLORS.text,
|
|
648
783
|
backgroundColor: COLORS.surface,
|
|
649
784
|
},
|
|
650
785
|
|
|
786
|
+
// Category chips
|
|
787
|
+
chipsRow: { gap: 8, paddingBottom: 14 },
|
|
788
|
+
chip: {
|
|
789
|
+
paddingVertical: 7, paddingHorizontal: 14, borderRadius: 999,
|
|
790
|
+
borderWidth: 1, borderColor: COLORS.border, backgroundColor: COLORS.bg,
|
|
791
|
+
},
|
|
792
|
+
chipOn: { backgroundColor: COLORS.navy, borderColor: COLORS.navy },
|
|
793
|
+
chipText: { fontSize: 12.5, fontWeight: '600', color: '#5B6472' },
|
|
794
|
+
chipTextOn: { color: '#FFFFFF' },
|
|
795
|
+
|
|
651
796
|
// Catalog grid
|
|
652
797
|
catalogList: { paddingBottom: 16 },
|
|
653
798
|
catalogRow: { justifyContent: 'space-between' },
|
|
654
799
|
catalogCard: {
|
|
655
800
|
width: '48%',
|
|
656
801
|
borderWidth: 1,
|
|
657
|
-
borderColor:
|
|
658
|
-
borderRadius:
|
|
802
|
+
borderColor: '#EDF0F4',
|
|
803
|
+
borderRadius: 18,
|
|
659
804
|
backgroundColor: COLORS.bg,
|
|
660
805
|
marginBottom: 12,
|
|
661
806
|
overflow: 'hidden',
|
|
807
|
+
shadowColor: COLORS.navy,
|
|
808
|
+
shadowOpacity: 0.05,
|
|
809
|
+
shadowRadius: 10,
|
|
810
|
+
shadowOffset: { width: 0, height: 2 },
|
|
811
|
+
elevation: 2,
|
|
662
812
|
},
|
|
663
|
-
|
|
664
|
-
height:
|
|
813
|
+
catalogThumb: {
|
|
814
|
+
height: 112,
|
|
665
815
|
backgroundColor: COLORS.surface,
|
|
666
816
|
justifyContent: 'center',
|
|
667
817
|
alignItems: 'center',
|
|
668
818
|
},
|
|
669
819
|
catalogImage: { width: '100%', height: '100%' },
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
820
|
+
monogram: {
|
|
821
|
+
width: 44, height: 44, borderRadius: 14,
|
|
822
|
+
backgroundColor: 'rgba(255,255,255,0.9)',
|
|
823
|
+
alignItems: 'center', justifyContent: 'center',
|
|
824
|
+
shadowColor: COLORS.navy, shadowOpacity: 0.1, shadowRadius: 8,
|
|
825
|
+
shadowOffset: { width: 0, height: 2 }, elevation: 2,
|
|
826
|
+
},
|
|
827
|
+
monogramEmoji: { fontSize: 20 },
|
|
828
|
+
pointsPill: {
|
|
829
|
+
position: 'absolute', bottom: 8, left: 8,
|
|
830
|
+
backgroundColor: 'rgba(16,24,74,0.82)',
|
|
831
|
+
paddingVertical: 4, paddingHorizontal: 9, borderRadius: 999,
|
|
832
|
+
},
|
|
833
|
+
pointsPillText: { fontSize: 11, fontWeight: '700', color: '#FFFFFF' },
|
|
834
|
+
catalogBody: { paddingHorizontal: 12, paddingTop: 10, paddingBottom: 12 },
|
|
835
|
+
catalogName: { fontSize: 13.5, fontWeight: '700', color: COLORS.text, lineHeight: 17, letterSpacing: -0.1, marginBottom: 3 },
|
|
836
|
+
catalogCategory: { fontSize: 10.5, fontWeight: '600', letterSpacing: 0.5, textTransform: 'uppercase', color: COLORS.muted, marginBottom: 8 },
|
|
837
|
+
catalogPriceRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
|
|
838
|
+
catalogPoints: { fontSize: 13, fontWeight: '800', color: COLORS.accent },
|
|
839
|
+
catalogCash: { fontSize: 11, fontWeight: '600', color: COLORS.muted },
|
|
674
840
|
loadingContainer: { flex: 1, justifyContent: 'center', alignItems: 'center' },
|
|
675
841
|
emptyText: { textAlign: 'center', color: COLORS.muted, marginTop: 40, fontSize: 15 },
|
|
676
842
|
|
|
677
843
|
// Detail
|
|
678
844
|
backButton: { marginBottom: 12 },
|
|
679
|
-
backText: { fontSize: 15, color: COLORS.
|
|
680
|
-
|
|
681
|
-
height:
|
|
682
|
-
borderRadius:
|
|
845
|
+
backText: { fontSize: 15, color: COLORS.accent, fontWeight: '700' },
|
|
846
|
+
detailHero: {
|
|
847
|
+
height: 200,
|
|
848
|
+
borderRadius: 20,
|
|
683
849
|
backgroundColor: COLORS.surface,
|
|
684
850
|
justifyContent: 'center',
|
|
685
851
|
alignItems: 'center',
|
|
686
852
|
marginBottom: 16,
|
|
853
|
+
overflow: 'hidden',
|
|
854
|
+
},
|
|
855
|
+
detailImage: { width: '100%', height: '100%' },
|
|
856
|
+
detailMonogram: { width: 64, height: 64, borderRadius: 20 },
|
|
857
|
+
detailMonogramEmoji: { fontSize: 30 },
|
|
858
|
+
detailPointsPill: { bottom: 12, left: 12, paddingVertical: 6, paddingHorizontal: 12 },
|
|
859
|
+
detailEyebrow: { fontSize: 11, fontWeight: '700', letterSpacing: 0.8, textTransform: 'uppercase', color: COLORS.accent, marginBottom: 6 },
|
|
860
|
+
detailName: { fontSize: 23, fontWeight: '800', color: COLORS.text, letterSpacing: -0.4, marginBottom: 8 },
|
|
861
|
+
detailDescription: { fontSize: 14.5, color: '#5B6472', lineHeight: 22, marginBottom: 18 },
|
|
862
|
+
priceCard: {
|
|
863
|
+
borderWidth: 1, borderColor: '#EDF0F4', borderRadius: 16,
|
|
864
|
+
paddingVertical: 14, paddingHorizontal: 16, marginBottom: 4,
|
|
865
|
+
backgroundColor: '#FAFBFD',
|
|
687
866
|
},
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
867
|
+
priceCardRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'baseline', marginBottom: 10 },
|
|
868
|
+
detailPoints: { fontSize: 19, fontWeight: '800', color: COLORS.text },
|
|
869
|
+
detailCash: { fontSize: 12.5, fontWeight: '600', color: COLORS.muted },
|
|
870
|
+
meterTrack: { height: 6, borderRadius: 3, backgroundColor: '#E9EEF5', overflow: 'hidden', marginBottom: 8 },
|
|
871
|
+
meterFill: { height: '100%', borderRadius: 3, backgroundColor: COLORS.accent },
|
|
872
|
+
meterHint: { fontSize: 12, fontWeight: '500', color: '#5B6472' },
|
|
873
|
+
meterHintStrong: { fontWeight: '700', color: COLORS.text },
|
|
874
|
+
meterHintAccent: { fontWeight: '700', color: COLORS.accent },
|
|
875
|
+
ctaHint: { textAlign: 'center', fontSize: 12, fontWeight: '500', color: COLORS.muted, marginTop: 8 },
|
|
876
|
+
insufficientButton: { backgroundColor: '#F1F4F8' },
|
|
877
|
+
insufficientButtonText: { color: COLORS.muted },
|
|
696
878
|
|
|
697
879
|
// Buttons
|
|
698
880
|
primaryButton: {
|
|
@@ -715,7 +897,6 @@ const styles = StyleSheet.create({
|
|
|
715
897
|
},
|
|
716
898
|
walletButtonDisabled: { opacity: 0.7 },
|
|
717
899
|
walletButtonText: { fontSize: 16, fontWeight: '700', color: '#FFFFFF' },
|
|
718
|
-
disabledButton: { opacity: 0.4 },
|
|
719
900
|
secondaryButton: { marginTop: 12, paddingVertical: 14, alignItems: 'center' },
|
|
720
901
|
secondaryButtonText: { fontSize: 15, fontWeight: '600', color: COLORS.muted },
|
|
721
902
|
|
package/src/types.ts
CHANGED
|
@@ -99,26 +99,29 @@ export interface PromotionsViewProps extends OuterJoynConfig {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
export interface PayResult {
|
|
102
|
-
|
|
102
|
+
// Snowflake ID: JSON string on the wire post-audit-D2b; legacy numeric accepted.
|
|
103
|
+
reservationId: number | string;
|
|
103
104
|
status: string;
|
|
104
105
|
pointsUsed: number;
|
|
105
106
|
valueAmount: number;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
export interface ConnectResult {
|
|
109
|
-
|
|
110
|
+
// Snowflake ID: emitted as a JSON string on the wire (see audit D2). Widened
|
|
111
|
+
// to accept the legacy numeric shape too for pre-D2 servers.
|
|
112
|
+
linkedProgramId: number | string;
|
|
110
113
|
programName: string;
|
|
111
114
|
}
|
|
112
115
|
|
|
113
116
|
export interface ExchangeResult {
|
|
114
|
-
transactionId: number;
|
|
117
|
+
transactionId: number | string;
|
|
115
118
|
sourceAmount: number;
|
|
116
119
|
targetAmount: number;
|
|
117
120
|
rate: number;
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
export interface RedeemResult {
|
|
121
|
-
redemptionId: number;
|
|
124
|
+
redemptionId: number | string;
|
|
122
125
|
status: string;
|
|
123
126
|
}
|
|
124
127
|
|