@outerjoyn/react-native 1.6.0 → 1.6.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 +2 -2
- package/src/__contracts__/pay-breakdown.contract.ts +7 -8
- package/src/core/api-client.ts +1 -1
- package/src/core/portabilityHandoff.ts +1 -1
- package/src/core/tender.ts +5 -8
- package/src/core/types.ts +3 -3
- package/src/core/version.ts +1 -1
- package/src/html.ts +1 -0
- package/src/screens/ConnectScreen.tsx +6 -6
- package/src/screens/RedeemScreen.tsx +3 -3
- package/src/types.ts +2 -2
package/package.json
CHANGED
|
@@ -641,8 +641,8 @@ export function OuterJoynProvider({
|
|
|
641
641
|
// the sheet. Awaiting is important: if the sheet closes before
|
|
642
642
|
// the refresh lands, `CheckoutPointsApply` and other consumers
|
|
643
643
|
// re-render with stale `linkedPrograms` and the user sees their
|
|
644
|
-
// old balances for one frame
|
|
645
|
-
//
|
|
644
|
+
// old balances for one frame (a race between handleSheetSuccess and
|
|
645
|
+
// refreshBalances).
|
|
646
646
|
try {
|
|
647
647
|
await refreshBalances();
|
|
648
648
|
} catch (err) {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* → widgetOptions widgets.tsx (mirror 4)
|
|
14
14
|
* → hosted oj.pay.open() → frame INIT → checkout POST
|
|
15
15
|
*
|
|
16
|
-
* This exact mirror shape has
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* This exact mirror shape has broken before on the web SDK's `PayOpenOptions`:
|
|
17
|
+
* one change dropped `merchandiseSubtotalCents` (discount-mode checkouts could
|
|
18
|
+
* never reserve) and another dropped `applicationMode`. A dropped
|
|
19
19
|
* field does not fail loudly — it produces a 422 at reserve time, or worse, a
|
|
20
20
|
* silently capped redemption. Types alone never caught it because each mirror
|
|
21
21
|
* is independently well-formed.
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
* WHAT THIS CANNOT PIN
|
|
32
32
|
*
|
|
33
33
|
* That `widgets.tsx` actually FORWARDS each field into `widgetOptions` — a
|
|
34
|
-
* mirror can carry a key while the plumbing drops it
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* asserts the values reach the iframe INIT payload.
|
|
34
|
+
* mirror can carry a key while the plumbing drops it. The forwarding is
|
|
35
|
+
* guarded on the hosted side by a contract test whose runtime layer asserts the
|
|
36
|
+
* values reach the iframe INIT payload.
|
|
38
37
|
*
|
|
39
38
|
* `absent` IS NOT `0`
|
|
40
39
|
*
|
|
@@ -91,7 +90,7 @@ const _minorUnits: OpenPayBreakdown = {
|
|
|
91
90
|
// --- `currencyCode` rides the same mirrors ----------------------------------
|
|
92
91
|
// It travels the identical four-mirror path and has ALREADY been a dead path
|
|
93
92
|
// once: the provider read `sheetProps.currencyCode` while `openPay`'s options
|
|
94
|
-
// never declared it, so no caller could set it (fixed
|
|
93
|
+
// never declared it, so no caller could set it (since fixed). Dropping it
|
|
95
94
|
// again does not 422 — the gateway defaults nothing, but the SDK sends 'USD',
|
|
96
95
|
// so a non-USD order silently records a same-currency session with NO FX
|
|
97
96
|
// conversion and values points at parity. That is a mispricing, not an error,
|
package/src/core/api-client.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* API Client for React Native SDK
|
|
3
3
|
*
|
|
4
|
-
* Ported from
|
|
4
|
+
* Ported from the web SDK's API client with RN-specific adaptations:
|
|
5
5
|
* - Uses plain fetch() (available in Hermes)
|
|
6
6
|
* - AbortController for timeouts (available in Hermes)
|
|
7
7
|
* - No browser-specific APIs (credentials, mode, DOMException)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Portability consent hand-off (
|
|
2
|
+
* Portability consent hand-off (the Plaid model).
|
|
3
3
|
*
|
|
4
4
|
* A brand app can NOT grant "carry my linked programs across brands" — the
|
|
5
5
|
* member grants it only on the OuterJoyn-hosted, OTP-verified consent page. The
|
package/src/core/tender.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// duplicated with the same contract. Keep the two in sync; the web copy's
|
|
5
|
-
// doc comment is the canonical rationale. A shared test in the main repo
|
|
6
|
-
// (src/sdk/core/__tests__/rnTenderParity.test.ts) asserts the twins agree.
|
|
1
|
+
// RN twin of the web SDK's planRedeemTender — the same ~30 lines with the same
|
|
2
|
+
// contract, kept in sync with the web copy (a parity test asserts the two
|
|
3
|
+
// agree).
|
|
7
4
|
//
|
|
8
|
-
// Contract: the Go redeem handler debits
|
|
9
|
-
// payment.method='points' and ONE MemberCurrency row (by currency id) for
|
|
5
|
+
// Contract: the Go redeem handler debits the member's main-currency
|
|
6
|
+
// MemberCurrency row for payment.method='points' and ONE MemberCurrency row (by currency id) for
|
|
10
7
|
// 'partner_currency'. Scalar covers → points (pre-existing behavior kept);
|
|
11
8
|
// else the largest single covering payable row pays as partner_currency;
|
|
12
9
|
// else null (can't afford — no tender exists). Snowflake ids stay STRINGS.
|
package/src/core/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core types for @outerjoyn/react-native SDK
|
|
3
3
|
*
|
|
4
|
-
* Derived from API response schemas
|
|
4
|
+
* Derived from the API response schemas.
|
|
5
5
|
* These are the source of truth for the RN SDK's state model.
|
|
6
6
|
*/
|
|
7
7
|
|
|
@@ -39,7 +39,7 @@ export interface PayableBalance {
|
|
|
39
39
|
// Snowflake IDs (memberCurrencyId/currencyId/partnershipId) ride as JSON
|
|
40
40
|
// strings on the wire post-audit-D2; kept `number | string` to also accept
|
|
41
41
|
// the legacy numeric shape. Amounts/balances stay numeric.
|
|
42
|
-
//
|
|
42
|
+
// Some routes return camelCase
|
|
43
43
|
memberCurrencyId?: number | string;
|
|
44
44
|
currencyId?: number | string;
|
|
45
45
|
currencyName?: string;
|
|
@@ -51,7 +51,7 @@ export interface PayableBalance {
|
|
|
51
51
|
pointValueAmount?: number;
|
|
52
52
|
valueAmount?: number;
|
|
53
53
|
partnershipId?: number | string;
|
|
54
|
-
//
|
|
54
|
+
// Others return snake_case
|
|
55
55
|
member_currency_id?: number | string;
|
|
56
56
|
currency_id?: number | string;
|
|
57
57
|
currency_name?: string;
|
package/src/core/version.ts
CHANGED
package/src/html.ts
CHANGED
|
@@ -62,6 +62,7 @@ export function generateWidgetHTML(
|
|
|
62
62
|
|
|
63
63
|
mod.open(Object.assign({
|
|
64
64
|
container: document.getElementById('widget-container'),
|
|
65
|
+
${module === 'connect' ? "presentation: 'sheet'," : ''}
|
|
65
66
|
onSuccess: function(result) { sendToNative({ type: 'sdk_success', result: result }); },
|
|
66
67
|
onError: function(err) { sendToNative({ type: 'sdk_error', error: err }); },
|
|
67
68
|
onClose: function() { sendToNative({ type: 'sdk_close' }); },
|
|
@@ -382,7 +382,7 @@ export const ConnectScreen: React.FC<ConnectScreenProps> = ({
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
// For real (non-demo) mode, skip the SDK consent step —
|
|
385
|
-
// the
|
|
385
|
+
// the hosted consent page handles auth + consent in one flow.
|
|
386
386
|
if (!isDemoMode) {
|
|
387
387
|
setStep('processing');
|
|
388
388
|
initiateConnectForInstitution(institution);
|
|
@@ -688,7 +688,7 @@ export const ConnectScreen: React.FC<ConnectScreenProps> = ({
|
|
|
688
688
|
</View>
|
|
689
689
|
|
|
690
690
|
{/* Portability banner — shown when the consumer has an identity but no
|
|
691
|
-
portability grant covering this app.
|
|
691
|
+
portability grant covering this app. The Plaid model: the
|
|
692
692
|
app can NOT grant it; tapping opens the OuterJoyn-hosted, OTP-verified
|
|
693
693
|
consent page in the system browser and reads back only the outcome. */}
|
|
694
694
|
{consentRequired && !consentGranting && (
|
|
@@ -1127,8 +1127,8 @@ const s = StyleSheet.create({
|
|
|
1127
1127
|
paddingHorizontal: 14,
|
|
1128
1128
|
height: 48,
|
|
1129
1129
|
backgroundColor: '#F1F5F9',
|
|
1130
|
-
// Pill search — Plaid-style picker (parity with the web SDK
|
|
1131
|
-
//
|
|
1130
|
+
// Pill search — Plaid-style picker (parity with the web SDK's connect
|
|
1131
|
+
// picker).
|
|
1132
1132
|
borderRadius: 999,
|
|
1133
1133
|
borderWidth: 1,
|
|
1134
1134
|
borderColor: C.border,
|
|
@@ -1152,8 +1152,8 @@ const s = StyleSheet.create({
|
|
|
1152
1152
|
paddingBottom: 24,
|
|
1153
1153
|
},
|
|
1154
1154
|
// Plaid-style 2-column brand grid — the default (no-search) picker view;
|
|
1155
|
-
// typing a query switches to the detailed rows. Parity with the web SDK
|
|
1156
|
-
//
|
|
1155
|
+
// typing a query switches to the detailed rows. Parity with the web SDK's
|
|
1156
|
+
// connect picker.
|
|
1157
1157
|
gridColumnWrapper: {
|
|
1158
1158
|
gap: 10,
|
|
1159
1159
|
},
|
|
@@ -273,7 +273,7 @@ export function RedeemScreen({
|
|
|
273
273
|
setStep('detail');
|
|
274
274
|
}, []);
|
|
275
275
|
|
|
276
|
-
// Tender planning
|
|
276
|
+
// Tender planning: the server debits Member.points_balance
|
|
277
277
|
// for points tender and ONE MemberCurrency row for partner_currency. The
|
|
278
278
|
// old gate compared cost against effectiveBalance = max(scalar,
|
|
279
279
|
// cross-program TOTAL) — a sum no single tender can spend, so it enabled
|
|
@@ -329,7 +329,7 @@ export function RedeemScreen({
|
|
|
329
329
|
// payment is REQUIRED by the Go handler (a body without it 400s
|
|
330
330
|
// MISSING_PAYMENT_METHOD — this POST shipped without one). Pay from
|
|
331
331
|
// the store that can cover it: scalar via points, else the covering
|
|
332
|
-
// MemberCurrency row via partner_currency
|
|
332
|
+
// MemberCurrency row via partner_currency.
|
|
333
333
|
//
|
|
334
334
|
// NO `?? {method:'points'}` FALLBACK. A null plan means no single
|
|
335
335
|
// tender covers this item, and defaulting to points there submits the
|
|
@@ -550,7 +550,7 @@ export function RedeemScreen({
|
|
|
550
550
|
// Gate on the tender PLAN, not the cross-program sum: effectiveBalance
|
|
551
551
|
// is max(scalar, TOTAL across programs) — a number no single tender can
|
|
552
552
|
// spend, so the old check enabled a button whose press could only
|
|
553
|
-
// produce an "insufficient" alert
|
|
553
|
+
// produce an "insufficient" alert. The meter/shortfall use
|
|
554
554
|
// the best SINGLE tender for the same reason.
|
|
555
555
|
const detailPlan = planRedeemTender(balance, tenderRows, selectedItem.points_cost);
|
|
556
556
|
const bestTender = maxTenderableBalance(balance, tenderRows);
|
package/src/types.ts
CHANGED
|
@@ -122,8 +122,8 @@ export interface PayResult {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
export interface ConnectResult {
|
|
125
|
-
// Snowflake ID: emitted as a JSON string on the wire
|
|
126
|
-
//
|
|
125
|
+
// Snowflake ID: emitted as a JSON string on the wire. Widened to accept the
|
|
126
|
+
// legacy numeric shape too, from older servers.
|
|
127
127
|
linkedProgramId: number | string;
|
|
128
128
|
programName: string;
|
|
129
129
|
}
|