@spare-technologies/spare-link 1.0.0 → 1.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/README.md +34 -5
- package/lib/commonjs/core/services/hosted-flow-controller.js +5 -0
- package/lib/commonjs/core/services/hosted-flow-controller.js.map +1 -1
- package/lib/commonjs/internal/bank-redirect.js +20 -9
- package/lib/commonjs/internal/bank-redirect.js.map +1 -1
- package/lib/commonjs/internal/hosted/bridge-message.js +13 -0
- package/lib/commonjs/internal/hosted/bridge-message.js.map +1 -1
- package/lib/commonjs/internal/telemetry/native-telemetry-reply.js +59 -0
- package/lib/commonjs/internal/telemetry/native-telemetry-reply.js.map +1 -0
- package/lib/commonjs/internal/telemetry/risk-telemetry-collector.js +99 -0
- package/lib/commonjs/internal/telemetry/risk-telemetry-collector.js.map +1 -0
- package/lib/commonjs/internal/telemetry/risk-telemetry-probes.js +134 -0
- package/lib/commonjs/internal/telemetry/risk-telemetry-probes.js.map +1 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js +8 -0
- package/lib/commonjs/ui/hosted/hosted-payment-page.js.map +1 -1
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js +31 -2
- package/lib/commonjs/ui/hosted/hosted-payment-webview.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/core/services/hosted-flow-controller.js +5 -0
- package/lib/module/core/services/hosted-flow-controller.js.map +1 -1
- package/lib/module/internal/bank-redirect.js +20 -9
- package/lib/module/internal/bank-redirect.js.map +1 -1
- package/lib/module/internal/hosted/bridge-message.js +13 -0
- package/lib/module/internal/hosted/bridge-message.js.map +1 -1
- package/lib/module/internal/telemetry/native-telemetry-reply.js +53 -0
- package/lib/module/internal/telemetry/native-telemetry-reply.js.map +1 -0
- package/lib/module/internal/telemetry/risk-telemetry-collector.js +94 -0
- package/lib/module/internal/telemetry/risk-telemetry-collector.js.map +1 -0
- package/lib/module/internal/telemetry/risk-telemetry-probes.js +129 -0
- package/lib/module/internal/telemetry/risk-telemetry-probes.js.map +1 -0
- package/lib/module/ui/hosted/hosted-payment-page.js +8 -0
- package/lib/module/ui/hosted/hosted-payment-page.js.map +1 -1
- package/lib/module/ui/hosted/hosted-payment-webview.js +32 -3
- package/lib/module/ui/hosted/hosted-payment-webview.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/bank-redirect.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts +12 -1
- package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts.map +1 -1
- package/lib/typescript/commonjs/internal/telemetry/native-telemetry-reply.d.ts +33 -0
- package/lib/typescript/commonjs/internal/telemetry/native-telemetry-reply.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-collector.d.ts +47 -0
- package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-collector.d.ts.map +1 -0
- package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-probes.d.ts +19 -0
- package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-probes.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts +9 -0
- package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts.map +1 -1
- package/lib/typescript/commonjs/version.d.ts +1 -1
- package/lib/typescript/module/core/services/hosted-flow-controller.d.ts.map +1 -1
- package/lib/typescript/module/internal/bank-redirect.d.ts.map +1 -1
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts +12 -1
- package/lib/typescript/module/internal/hosted/bridge-message.d.ts.map +1 -1
- package/lib/typescript/module/internal/telemetry/native-telemetry-reply.d.ts +33 -0
- package/lib/typescript/module/internal/telemetry/native-telemetry-reply.d.ts.map +1 -0
- package/lib/typescript/module/internal/telemetry/risk-telemetry-collector.d.ts +47 -0
- package/lib/typescript/module/internal/telemetry/risk-telemetry-collector.d.ts.map +1 -0
- package/lib/typescript/module/internal/telemetry/risk-telemetry-probes.d.ts +19 -0
- package/lib/typescript/module/internal/telemetry/risk-telemetry-probes.d.ts.map +1 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts.map +1 -1
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts +9 -0
- package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts.map +1 -1
- package/lib/typescript/module/version.d.ts +1 -1
- package/package.json +24 -4
- package/plugins/with-spare-link.js +78 -5
- package/src/core/services/hosted-flow-controller.ts +5 -0
- package/src/internal/bank-redirect.ts +23 -9
- package/src/internal/hosted/bridge-message.ts +20 -1
- package/src/internal/telemetry/native-telemetry-reply.ts +59 -0
- package/src/internal/telemetry/risk-telemetry-collector.ts +128 -0
- package/src/internal/telemetry/risk-telemetry-probes.ts +159 -0
- package/src/ui/hosted/hosted-payment-page.tsx +8 -0
- package/src/ui/hosted/hosted-payment-webview.tsx +42 -4
- package/src/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useRef","ActivityIndicator","StyleSheet","Text","View","isTerminalPhase","useHostedFlowState","PageUnavailableScreen","RedirectHandoffScreen","ResultScreen","ResumeProcessingScreen","Colors","Spacing","Typography","HostedPaymentWebView","jsx","_jsx","jsxs","_jsxs","RESULT_DWELL_MS","HostedPaymentPage","props","controller","baseUrl","onResolved","state","awaitingSinceMs","undefined","phase","current","Date","now","wasNeverReached","errorCode","resolved","timer","setTimeout","clearTimeout","handleBridgeMessage","message","handleLoadFailure","failToLoad","handlePageMounted","reportPageMounted","handleRetry","retry","handleGiveUp","giveUp","style","styles","fill","children","accessibilityElementsHidden","importantForAccessibility","reference","onBridgeMessage","onLoadFailure","onMounted","attempt","loadingCover","testID","size","color","spareBlue","bodyMuted","loadingLabel","onRetry","onCancel","awaitingCallbackStartedAtMs","abandon","title","isSuccess","onDone","create","flex","backgroundColor","surfacePage","absoluteFillObject","alignItems","justifyContent","gap","lg","textAlign"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-page.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,iBAAiB,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAExE,SAASC,eAAe,QAAQ,0CAAuC;AACvE,SAASC,kBAAkB,QAAQ,mCAAgC;AACnE,SAASC,qBAAqB,QAAQ,uCAAoC;AAC1E,SAASC,qBAAqB,QAAQ,uCAAoC;AAC1E,SAASC,YAAY,QAAQ,6BAA0B;AACvD,SAASC,sBAAsB,QAAQ,wCAAqC;AAC5E,SAASC,MAAM,EAAEC,OAAO,EAAEC,UAAU,QAAQ,mBAAU;AACtD,SAASC,oBAAoB,QAAQ,6BAA0B;;AAE/D;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,eAAe,GAAG,IAAI;AAU5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAA6B,EAAe;EAC5E,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAGH,KAAK;EACjD,MAAMI,KAAK,GAAGnB,kBAAkB,CAACgB,UAAU,CAAC;;EAE5C;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMI,eAAe,
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","ActivityIndicator","StyleSheet","Text","View","isTerminalPhase","collectRiskTelemetry","createRiskTelemetryProbes","useHostedFlowState","PageUnavailableScreen","RedirectHandoffScreen","ResultScreen","ResumeProcessingScreen","Colors","Spacing","Typography","HostedPaymentWebView","jsx","_jsx","jsxs","_jsxs","RESULT_DWELL_MS","HostedPaymentPage","props","controller","baseUrl","onResolved","state","awaitingSinceMs","undefined","phase","current","Date","now","wasNeverReached","errorCode","resolved","timer","setTimeout","clearTimeout","handleBridgeMessage","message","handleTelemetryRequest","handleLoadFailure","failToLoad","handlePageMounted","reportPageMounted","handleRetry","retry","handleGiveUp","giveUp","style","styles","fill","children","accessibilityElementsHidden","importantForAccessibility","reference","onBridgeMessage","onTelemetryRequest","onLoadFailure","onMounted","attempt","loadingCover","testID","size","color","spareBlue","bodyMuted","loadingLabel","onRetry","onCancel","awaitingCallbackStartedAtMs","abandon","title","isSuccess","onDone","create","flex","backgroundColor","surfacePage","absoluteFillObject","alignItems","justifyContent","gap","lg","textAlign"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-page.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,iBAAiB,EAAEC,UAAU,EAAEC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAExE,SAASC,eAAe,QAAQ,0CAAuC;AACvE,SAASC,oBAAoB,QAAQ,sDAAmD;AACxF,SAASC,yBAAyB,QAAQ,mDAAgD;AAC1F,SAASC,kBAAkB,QAAQ,mCAAgC;AACnE,SAASC,qBAAqB,QAAQ,uCAAoC;AAC1E,SAASC,qBAAqB,QAAQ,uCAAoC;AAC1E,SAASC,YAAY,QAAQ,6BAA0B;AACvD,SAASC,sBAAsB,QAAQ,wCAAqC;AAC5E,SAASC,MAAM,EAAEC,OAAO,EAAEC,UAAU,QAAQ,mBAAU;AACtD,SAASC,oBAAoB,QAAQ,6BAA0B;;AAE/D;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,eAAe,GAAG,IAAI;AAU5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,KAA6B,EAAe;EAC5E,MAAM;IAAEC,UAAU;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAGH,KAAK;EACjD,MAAMI,KAAK,GAAGnB,kBAAkB,CAACgB,UA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CAAE,CAAC;IACzF,KAAK,WAAW;MACd,oBAAOR,IAAA,CAACP,YAAY;QAAC+D,KAAK,EAAC,uBAAuB;QAACC,SAAS,EAAE,KAAM;QAACC,MAAM,EAAElD;MAAW,CAAE,CAAC;EAC/F;AACF;AAEA,MAAM0B,MAAM,GAAGlD,UAAU,CAAC2E,MAAM,CAAC;EAC/BxB,IAAI,EAAE;IAAEyB,IAAI,EAAE,CAAC;IAAEC,eAAe,EAAElE,MAAM,CAACmE;EAAY,CAAC;EACtDjB,YAAY,EAAE;IACZ,GAAG7D,UAAU,CAAC+E,kBAAkB;IAChCC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,GAAG,EAAEtE,OAAO,CAACuE,EAAE;IACfN,eAAe,EAAElE,MAAM,CAACmE;EAC1B,CAAC;EACDX,YAAY,EAAE;IAAEiB,SAAS,EAAE;EAAS;AACtC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
4
4
|
import { StyleSheet, View } from 'react-native';
|
|
5
5
|
import { WebView } from 'react-native-webview';
|
|
6
|
+
import { parseHostedBridgeMessage } from "../../internal/hosted/bridge-message.js";
|
|
6
7
|
import { buildHostedPaymentUrl, isHostedOriginUrl } from "../../internal/hosted/hosted-url.js";
|
|
7
8
|
import { createLogger } from "../../internal/logger.js";
|
|
9
|
+
import { createTelemetryRequestHandler } from "../../internal/telemetry/native-telemetry-reply.js";
|
|
8
10
|
import { parseUrlParts } from "../../internal/url-parts.js";
|
|
9
11
|
import { Colors } from "../theme/index.js";
|
|
10
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -47,6 +49,7 @@ export function HostedPaymentWebView(props) {
|
|
|
47
49
|
baseUrl,
|
|
48
50
|
reference,
|
|
49
51
|
onBridgeMessage,
|
|
52
|
+
onTelemetryRequest,
|
|
50
53
|
onLoadFailure,
|
|
51
54
|
onMounted
|
|
52
55
|
} = props;
|
|
@@ -54,6 +57,7 @@ export function HostedPaymentWebView(props) {
|
|
|
54
57
|
baseUrl,
|
|
55
58
|
reference
|
|
56
59
|
});
|
|
60
|
+
const webViewRef = useRef(null);
|
|
57
61
|
|
|
58
62
|
// This reports that *this* webview exists, and a retry mounts a fresh instance
|
|
59
63
|
// which reports itself anew. Re-running on a new callback identity would
|
|
@@ -63,8 +67,21 @@ export function HostedPaymentWebView(props) {
|
|
|
63
67
|
onMounted?.();
|
|
64
68
|
}, []);
|
|
65
69
|
const handleMessage = useCallback(event => {
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
const raw = event.nativeEvent.data;
|
|
71
|
+
|
|
72
|
+
// The telemetry request is answered here, where the webview reference
|
|
73
|
+
// lives, because the reply is delivered by injecting script — a channel
|
|
74
|
+
// only this component holds. Everything else stays the caller's.
|
|
75
|
+
if (onTelemetryRequest && parseHostedBridgeMessage(raw)?.type === 'telemetryRequest') {
|
|
76
|
+
const respond = createTelemetryRequestHandler({
|
|
77
|
+
collect: onTelemetryRequest,
|
|
78
|
+
inject: script => webViewRef.current?.injectJavaScript(script)
|
|
79
|
+
});
|
|
80
|
+
void respond();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
onBridgeMessage(raw);
|
|
84
|
+
}, [onBridgeMessage, onTelemetryRequest]);
|
|
68
85
|
|
|
69
86
|
// Every navigation is routed through here rather than through `originWhitelist`.
|
|
70
87
|
// A URL that fails the whitelist is handed to `Linking.openURL` by
|
|
@@ -88,6 +105,7 @@ export function HostedPaymentWebView(props) {
|
|
|
88
105
|
style: styles.container,
|
|
89
106
|
testID: "hosted-payment-webview",
|
|
90
107
|
children: /*#__PURE__*/_jsx(WebView, {
|
|
108
|
+
ref: webViewRef,
|
|
91
109
|
source: {
|
|
92
110
|
uri
|
|
93
111
|
},
|
|
@@ -133,6 +151,17 @@ export function HostedPaymentWebView(props) {
|
|
|
133
151
|
style: styles.webview,
|
|
134
152
|
javaScriptEnabled: true,
|
|
135
153
|
domStorageEnabled: true
|
|
154
|
+
// Lets the page's consent screen ask for a coarse location fix, which it
|
|
155
|
+
// attaches to the payment as a risk signal. Android only; iOS raises its
|
|
156
|
+
// own per-origin system prompt, gated by the host app's usage-description
|
|
157
|
+
// entry. This toggle is frame-wide — the platform offers no per-origin
|
|
158
|
+
// answer here — so the scope rests on `handleShouldStartLoad` above
|
|
159
|
+
// refusing every off-origin document in this frame. The toggle alone also
|
|
160
|
+
// reveals nothing: the host application must hold the user-facing location
|
|
161
|
+
// permission, and without it the page's request fails and the payment
|
|
162
|
+
// proceeds without the signal.
|
|
163
|
+
,
|
|
164
|
+
geolocationEnabled: true
|
|
136
165
|
// The page holds a payment in progress and nothing else should share its
|
|
137
166
|
// storage, on this device or between payers on it.
|
|
138
167
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","StyleSheet","View","WebView","buildHostedPaymentUrl","isHostedOriginUrl","createLogger","parseUrlParts","Colors","jsx","_jsx","log","safeOrigin","url","parts","scheme","host","shouldAllowHostedNavigation","args","HostedPaymentWebView","props","baseUrl","reference","onBridgeMessage","onLoadFailure","onMounted","uri","handleMessage","event","nativeEvent","data","handleShouldStartLoad","style","styles","container","testID","children","source","onMessage","originWhitelist","ALLOW_ALL_ORIGINS","onShouldStartLoadWithRequest","onError","severe","description","code","onHttpError","statusCode","onContentProcessDidTerminate","onRenderProcessGone","didCrash","webview","javaScriptEnabled","domStorageEnabled","incognito","setSupportMultipleWindows","allowFileAccess","allowUniversalAccessFromFileURLs","allowFileAccessFromFileURLs","create","flex","backgroundColor","surfacePage"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-webview.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useRef","StyleSheet","View","WebView","parseHostedBridgeMessage","buildHostedPaymentUrl","isHostedOriginUrl","createLogger","createTelemetryRequestHandler","parseUrlParts","Colors","jsx","_jsx","log","safeOrigin","url","parts","scheme","host","shouldAllowHostedNavigation","args","HostedPaymentWebView","props","baseUrl","reference","onBridgeMessage","onTelemetryRequest","onLoadFailure","onMounted","uri","webViewRef","handleMessage","event","raw","nativeEvent","data","type","respond","collect","inject","script","current","injectJavaScript","handleShouldStartLoad","style","styles","container","testID","children","ref","source","onMessage","originWhitelist","ALLOW_ALL_ORIGINS","onShouldStartLoadWithRequest","onError","severe","description","code","onHttpError","statusCode","onContentProcessDidTerminate","onRenderProcessGone","didCrash","webview","javaScriptEnabled","domStorageEnabled","geolocationEnabled","incognito","setSupportMultipleWindows","allowFileAccess","allowUniversalAccessFromFileURLs","allowFileAccessFromFileURLs","create","flex","backgroundColor","surfacePage"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-webview.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACtD,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,OAAO,QAAkC,sBAAsB;AACxE,SAASC,wBAAwB,QAAQ,yCAAsC;AAC/E,SAASC,qBAAqB,EAAEC,iBAAiB,QAAQ,qCAAkC;AAC3F,SAASC,YAAY,QAAQ,0BAAuB;AACpD,SAASC,6BAA6B,QAAQ,oDAAiD;AAC/F,SAASC,aAAa,QAAQ,6BAA0B;AACxD,SAASC,MAAM,QAAQ,mBAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElC,MAAMC,GAAG,GAAGN,YAAY,CAAC,sBAAsB,CAAC;;AAEhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASO,UAAUA,CAACC,GAAW,EAAU;EACvC,MAAMC,KAAK,GAAGP,aAAa,CAACM,GAAG,CAAC;EAChC,OAAOC,KAAK,GAAG,GAAGA,KAAK,CAACC,MAAM,MAAMD,KAAK,CA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,EAAEC,MAAM,CAACmB,OAAQ;QACtBC,iBAAiB;QACjBC,iBAAiB;QACjB;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QAAA;QACAC,kBAAkB;QAClB;QACA;QAAA;QACAC,SAAS;QACT;QACA;QAAA;QACAC,yBAAyB,EAAE,KAAM;QACjCC,eAAe,EAAE,KAAM;QACvBC,gCAAgC,EAAE,KAAM;QACxCC,2BAA2B,EAAE,KAAM;QACnCzB,MAAM,EAAC;MAAiC,CACzC;IAAC,CACE;EAAC;AAEX;AAEA,MAAMM,iBAAiB,GAAG,CAAC,GAAG,CAAC;AAE/B,MAAMR,MAAM,GAAG5C,UAAU,CAACwE,MAAM,CAAC;EAC/B3B,SAAS,EAAE;IAAE4B,IAAI,EAAE,CAAC;IAAEC,eAAe,EAAEjE,MAAM,CAACkE;EAAY,CAAC;EAC3DZ,OAAO,EAAE;IAAEU,IAAI,EAAE,CAAC;IAAEC,eAAe,EAAEjE,MAAM,CAACkE;EAAY;AAC1D,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-flow-controller.d.ts","sourceRoot":"","sources":["../../../../../src/core/services/hosted-flow-controller.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAqC,MAAM,qBAAqB,CAAC;AAI9F,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;IAC/B,QAAQ,CAAC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OAAO,CAAC,UAAU,CAA4C;gBAElD,OAAO,EAAE,2BAA2B;IAQhD;;;;;OAKG;IACH,iBAAiB,IAAI,IAAI;IAKzB,IAAI,KAAK,IAAI,eAAe,CAE3B;IAED,mEAAmE;IACnE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C;;;;;;OAMG;IACG,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiDzD;;;;;OAKG;IACH,+EAA+E;IAC/E,OAAO,CAAC,eAAe;IAKvB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IA4CrC;;;;;;;;;;;;;OAaG;IACH,UAAU,IAAI,IAAI;IA2BlB;;;;;OAKG;IACH,KAAK,IAAI,IAAI;IAWb;;;;;OAKG;IACH,MAAM,IAAI,IAAI;IAed;;;;;;OAMG;IACH,OAAO,IAAI,IAAI;IAmBf,OAAO,IAAI,IAAI;IAKf,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,wBAAwB;IAMhC;;;;;;;OAOG;YACW,QAAQ;IAiCtB,OAAO,CAAC,MAAM;CAcf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank-redirect.d.ts","sourceRoot":"","sources":["../../../../src/internal/bank-redirect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bank-redirect.d.ts","sourceRoot":"","sources":["../../../../src/internal/bank-redirect.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC9E"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The page posts to `window.ReactNativeWebView.postMessage` as a JSON string,
|
|
9
9
|
* which arrives here as `event.nativeEvent.data`.
|
|
10
10
|
*/
|
|
11
|
-
export type HostedBridgeMessage = HostedReady | HostedOpenUrl | HostedCancel | HostedError;
|
|
11
|
+
export type HostedBridgeMessage = HostedReady | HostedOpenUrl | HostedCancel | HostedError | HostedTelemetryRequest;
|
|
12
12
|
/** The payable page is interactive. */
|
|
13
13
|
export interface HostedReady {
|
|
14
14
|
readonly type: 'ready';
|
|
@@ -33,6 +33,17 @@ export interface HostedError {
|
|
|
33
33
|
readonly type: 'error';
|
|
34
34
|
readonly code: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The page is asking for this device's native risk facts.
|
|
38
|
+
*
|
|
39
|
+
* The one message that expects an answer — not over this channel, which cannot
|
|
40
|
+
* reply, but through the `window.__spareLinkNativeTelemetry` callback the page
|
|
41
|
+
* exposes and the shell invokes by injecting script. A shell that stays silent
|
|
42
|
+
* costs the page one bounded timeout and nothing else.
|
|
43
|
+
*/
|
|
44
|
+
export interface HostedTelemetryRequest {
|
|
45
|
+
readonly type: 'telemetryRequest';
|
|
46
|
+
}
|
|
36
47
|
/**
|
|
37
48
|
* Parses a message posted by the hosted page.
|
|
38
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-message.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hosted/bridge-message.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"bridge-message.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hosted/bridge-message.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,aAAa,GACb,YAAY,GACZ,WAAW,GACX,sBAAsB,CAAC;AAE3B,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CA2BjF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivers a telemetry reply into the hosted page.
|
|
3
|
+
*
|
|
4
|
+
* The WebView message channel is one-way, so the reply travels the other way:
|
|
5
|
+
* the page exposes `window.__spareLinkNativeTelemetry` before it asks, and the
|
|
6
|
+
* shell answers by injecting a call to it. A page without the callback — an
|
|
7
|
+
* older page, or one that already gave up waiting — receives nothing and the
|
|
8
|
+
* injected chunk evaluates to a harmless literal.
|
|
9
|
+
*/
|
|
10
|
+
/** Page-exposed global the shell invokes with its telemetry reply. */
|
|
11
|
+
export declare const NATIVE_TELEMETRY_CALLBACK_NAME = "__spareLinkNativeTelemetry";
|
|
12
|
+
/**
|
|
13
|
+
* Builds the script that hands [payload] to the page's telemetry callback.
|
|
14
|
+
*
|
|
15
|
+
* The payload is embedded as a JSON literal. U+2028 and U+2029 are legal inside
|
|
16
|
+
* a JSON string but terminate a statement when evaluated as script, so they are
|
|
17
|
+
* escaped; the result is a single expression that is inert on a page without
|
|
18
|
+
* the callback.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildNativeTelemetryReplyScript(payload: Record<string, unknown>): string;
|
|
21
|
+
/**
|
|
22
|
+
* Builds the handler the webview runs when the page asks for telemetry.
|
|
23
|
+
*
|
|
24
|
+
* Collection and injection are injected so the handler is a pure seam: the
|
|
25
|
+
* component wires the real collector and the WebView reference into it. A
|
|
26
|
+
* collector that answers nothing, or throws, injects nothing — the page's own
|
|
27
|
+
* timeout settles the request.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createTelemetryRequestHandler(deps: {
|
|
30
|
+
collect: () => Promise<Record<string, unknown> | null>;
|
|
31
|
+
inject: (script: string) => void;
|
|
32
|
+
}): () => Promise<void>;
|
|
33
|
+
//# sourceMappingURL=native-telemetry-reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-telemetry-reply.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/native-telemetry-reply.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,sEAAsE;AACtE,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQxF;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACvD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAgBtB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects this device's native risk facts for the hosted payment page.
|
|
3
|
+
*
|
|
4
|
+
* Every probe is injected, so the collector runs under Jest with fakes and the
|
|
5
|
+
* module wiring lives in `risk-telemetry-probes`. Every probe is also allowed to
|
|
6
|
+
* fail or hang: a throwing or slow reading leaves its fact absent, because a risk
|
|
7
|
+
* reading must never delay or break a payment.
|
|
8
|
+
*
|
|
9
|
+
* The payload mirrors the page's own risk contract: camelCase keys under a
|
|
10
|
+
* `deviceInformation` block, facts only, nothing fabricated.
|
|
11
|
+
*/
|
|
12
|
+
/** How long any single probe may take before its fact is given up on. */
|
|
13
|
+
export declare const TELEMETRY_PROBE_BUDGET_MS = 800;
|
|
14
|
+
/** Identity and build facts read from the platform. */
|
|
15
|
+
export interface RiskDeviceSnapshot {
|
|
16
|
+
readonly operatingSystem: string | null;
|
|
17
|
+
readonly operatingSystemVersion: string | null;
|
|
18
|
+
readonly model: string | null;
|
|
19
|
+
readonly manufacturer: string | null;
|
|
20
|
+
/** A per-vendor install-stable identifier, when the platform offers one. */
|
|
21
|
+
readonly vendorIdentifier: string | null;
|
|
22
|
+
/** False on simulators and emulators. */
|
|
23
|
+
readonly isPhysicalDevice: boolean | null;
|
|
24
|
+
}
|
|
25
|
+
/** A battery reading, with the level as a 0 to 1 fraction. */
|
|
26
|
+
export interface RiskBatteryReading {
|
|
27
|
+
readonly levelFraction: number | null;
|
|
28
|
+
readonly isCharging: boolean | null;
|
|
29
|
+
}
|
|
30
|
+
/** The network medium classes the risk payload distinguishes. */
|
|
31
|
+
export type RiskConnectionKind = 'wifi' | 'cellular' | 'other';
|
|
32
|
+
/** The probes the collector runs. Each may answer null, throw, or hang. */
|
|
33
|
+
export interface RiskTelemetryProbes {
|
|
34
|
+
loadDeviceSnapshot(): Promise<RiskDeviceSnapshot | null>;
|
|
35
|
+
loadBattery(): Promise<RiskBatteryReading | null>;
|
|
36
|
+
loadConnection(): Promise<RiskConnectionKind | null>;
|
|
37
|
+
localeTag(): string | null;
|
|
38
|
+
localDateTime(): string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Collects whatever the device answered within the per-probe budget.
|
|
42
|
+
*
|
|
43
|
+
* Returns null when nothing answered, so a caller hands the page nothing rather
|
|
44
|
+
* than an empty block.
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectRiskTelemetry(probes: RiskTelemetryProbes): Promise<Record<string, unknown> | null>;
|
|
47
|
+
//# sourceMappingURL=risk-telemetry-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-telemetry-collector.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/risk-telemetry-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,yCAAyC;IACzC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3C;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACzD,WAAW,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAClD,cAAc,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACrD,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;CAChC;AA4BD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAgDzC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real device probes behind `collectRiskTelemetry`.
|
|
3
|
+
*
|
|
4
|
+
* Every expo module here is an optional peer, loaded lazily inside a try/catch:
|
|
5
|
+
* a host app that ships without one simply reports that fact as absent, and no
|
|
6
|
+
* import of this file can throw for want of a native module. Structural `*Like`
|
|
7
|
+
* types keep this file honest about how little of each module it relies on.
|
|
8
|
+
*/
|
|
9
|
+
import type { RiskTelemetryProbes } from './risk-telemetry-collector';
|
|
10
|
+
/**
|
|
11
|
+
* Formats a date as local-time ISO 8601 with a numeric UTC offset, e.g.
|
|
12
|
+
* `2026-08-25T10:45:46.319+05:30` — never the UTC `Z` form. This keeps the
|
|
13
|
+
* timestamp on the payer's own clock so it reads the same as the device shows,
|
|
14
|
+
* and matches the Flutter SDK's `deviceLocalDateTime`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatLocalIsoWithOffset(date: Date): string;
|
|
17
|
+
/** The production probe set, ready for `collectRiskTelemetry`. */
|
|
18
|
+
export declare function createRiskTelemetryProbes(): RiskTelemetryProbes;
|
|
19
|
+
//# sourceMappingURL=risk-telemetry-probes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-telemetry-probes.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/risk-telemetry-probes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAIV,mBAAmB,EACpB,MAAM,4BAA4B,CAAC;AA8GpC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAc3D;AAUD,kEAAkE;AAClE,wBAAgB,yBAAyB,IAAI,mBAAmB,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-payment-page.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-payment-page.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAevF,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,oBAAoB,CAAC;IACjC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CA6I5E"}
|
|
@@ -22,6 +22,15 @@ export interface HostedPaymentWebViewProps {
|
|
|
22
22
|
* this component stays a transport.
|
|
23
23
|
*/
|
|
24
24
|
onBridgeMessage: (message: unknown) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Answers the page's telemetry request with this device's native risk facts.
|
|
27
|
+
*
|
|
28
|
+
* The reply travels back by injected script rather than a return value, so it
|
|
29
|
+
* is handled here where the webview reference lives, and the message never
|
|
30
|
+
* reaches [onBridgeMessage]. Absent, or answering null, means the page
|
|
31
|
+
* proceeds with what the browser alone can see.
|
|
32
|
+
*/
|
|
33
|
+
onTelemetryRequest?: () => Promise<Record<string, unknown> | null>;
|
|
25
34
|
/** Called when the page itself could not be loaded. */
|
|
26
35
|
onLoadFailure?: () => void;
|
|
27
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-payment-webview.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-webview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hosted-payment-webview.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-webview.tsx"],"names":[],"mappings":"AAwBA;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE3F;AAED,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACnE,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,GAAG,CAAC,OAAO,CAuHlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-flow-controller.d.ts","sourceRoot":"","sources":["../../../../../src/core/services/hosted-flow-controller.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,eAAe,EAAqC,MAAM,wBAAqB,CAAC;AAI9F,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1D;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,MAAM,WAAW,2BAA2B;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E,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyB;IACnD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,UAAU,CAA4C;gBAElD,OAAO,EAAE,2BAA2B;IAQhD;;;;;OAKG;IACH,iBAAiB,IAAI,IAAI;IAKzB,IAAI,KAAK,IAAI,eAAe,CAE3B;IAED,mEAAmE;IACnE,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAO3C;;;;;;OAMG;IACG,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAiDzD;;;;;OAKG;IACH,+EAA+E;IAC/E,OAAO,CAAC,eAAe;IAKvB,YAAY,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;IA4CrC;;;;;;;;;;;;;OAaG;IACH,UAAU,IAAI,IAAI;IA2BlB;;;;;OAKG;IACH,KAAK,IAAI,IAAI;IAWb;;;;;OAKG;IACH,MAAM,IAAI,IAAI;IAed;;;;;;OAMG;IACH,OAAO,IAAI,IAAI;IAmBf,OAAO,IAAI,IAAI;IAKf,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,wBAAwB;IAMhC;;;;;;;OAOG;YACW,QAAQ;IAiCtB,OAAO,CAAC,MAAM;CAcf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bank-redirect.d.ts","sourceRoot":"","sources":["../../../../src/internal/bank-redirect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bank-redirect.d.ts","sourceRoot":"","sources":["../../../../src/internal/bank-redirect.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC9E"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* The page posts to `window.ReactNativeWebView.postMessage` as a JSON string,
|
|
9
9
|
* which arrives here as `event.nativeEvent.data`.
|
|
10
10
|
*/
|
|
11
|
-
export type HostedBridgeMessage = HostedReady | HostedOpenUrl | HostedCancel | HostedError;
|
|
11
|
+
export type HostedBridgeMessage = HostedReady | HostedOpenUrl | HostedCancel | HostedError | HostedTelemetryRequest;
|
|
12
12
|
/** The payable page is interactive. */
|
|
13
13
|
export interface HostedReady {
|
|
14
14
|
readonly type: 'ready';
|
|
@@ -33,6 +33,17 @@ export interface HostedError {
|
|
|
33
33
|
readonly type: 'error';
|
|
34
34
|
readonly code: string;
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* The page is asking for this device's native risk facts.
|
|
38
|
+
*
|
|
39
|
+
* The one message that expects an answer — not over this channel, which cannot
|
|
40
|
+
* reply, but through the `window.__spareLinkNativeTelemetry` callback the page
|
|
41
|
+
* exposes and the shell invokes by injecting script. A shell that stays silent
|
|
42
|
+
* costs the page one bounded timeout and nothing else.
|
|
43
|
+
*/
|
|
44
|
+
export interface HostedTelemetryRequest {
|
|
45
|
+
readonly type: 'telemetryRequest';
|
|
46
|
+
}
|
|
36
47
|
/**
|
|
37
48
|
* Parses a message posted by the hosted page.
|
|
38
49
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-message.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hosted/bridge-message.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"bridge-message.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hosted/bridge-message.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAC3B,WAAW,GACX,aAAa,GACb,YAAY,GACZ,WAAW,GACX,sBAAsB,CAAC;AAE3B,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CA2BjF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delivers a telemetry reply into the hosted page.
|
|
3
|
+
*
|
|
4
|
+
* The WebView message channel is one-way, so the reply travels the other way:
|
|
5
|
+
* the page exposes `window.__spareLinkNativeTelemetry` before it asks, and the
|
|
6
|
+
* shell answers by injecting a call to it. A page without the callback — an
|
|
7
|
+
* older page, or one that already gave up waiting — receives nothing and the
|
|
8
|
+
* injected chunk evaluates to a harmless literal.
|
|
9
|
+
*/
|
|
10
|
+
/** Page-exposed global the shell invokes with its telemetry reply. */
|
|
11
|
+
export declare const NATIVE_TELEMETRY_CALLBACK_NAME = "__spareLinkNativeTelemetry";
|
|
12
|
+
/**
|
|
13
|
+
* Builds the script that hands [payload] to the page's telemetry callback.
|
|
14
|
+
*
|
|
15
|
+
* The payload is embedded as a JSON literal. U+2028 and U+2029 are legal inside
|
|
16
|
+
* a JSON string but terminate a statement when evaluated as script, so they are
|
|
17
|
+
* escaped; the result is a single expression that is inert on a page without
|
|
18
|
+
* the callback.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildNativeTelemetryReplyScript(payload: Record<string, unknown>): string;
|
|
21
|
+
/**
|
|
22
|
+
* Builds the handler the webview runs when the page asks for telemetry.
|
|
23
|
+
*
|
|
24
|
+
* Collection and injection are injected so the handler is a pure seam: the
|
|
25
|
+
* component wires the real collector and the WebView reference into it. A
|
|
26
|
+
* collector that answers nothing, or throws, injects nothing — the page's own
|
|
27
|
+
* timeout settles the request.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createTelemetryRequestHandler(deps: {
|
|
30
|
+
collect: () => Promise<Record<string, unknown> | null>;
|
|
31
|
+
inject: (script: string) => void;
|
|
32
|
+
}): () => Promise<void>;
|
|
33
|
+
//# sourceMappingURL=native-telemetry-reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-telemetry-reply.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/native-telemetry-reply.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,sEAAsE;AACtE,eAAO,MAAM,8BAA8B,+BAA+B,CAAC;AAE3E;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAQxF;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACvD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAgBtB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects this device's native risk facts for the hosted payment page.
|
|
3
|
+
*
|
|
4
|
+
* Every probe is injected, so the collector runs under Jest with fakes and the
|
|
5
|
+
* module wiring lives in `risk-telemetry-probes`. Every probe is also allowed to
|
|
6
|
+
* fail or hang: a throwing or slow reading leaves its fact absent, because a risk
|
|
7
|
+
* reading must never delay or break a payment.
|
|
8
|
+
*
|
|
9
|
+
* The payload mirrors the page's own risk contract: camelCase keys under a
|
|
10
|
+
* `deviceInformation` block, facts only, nothing fabricated.
|
|
11
|
+
*/
|
|
12
|
+
/** How long any single probe may take before its fact is given up on. */
|
|
13
|
+
export declare const TELEMETRY_PROBE_BUDGET_MS = 800;
|
|
14
|
+
/** Identity and build facts read from the platform. */
|
|
15
|
+
export interface RiskDeviceSnapshot {
|
|
16
|
+
readonly operatingSystem: string | null;
|
|
17
|
+
readonly operatingSystemVersion: string | null;
|
|
18
|
+
readonly model: string | null;
|
|
19
|
+
readonly manufacturer: string | null;
|
|
20
|
+
/** A per-vendor install-stable identifier, when the platform offers one. */
|
|
21
|
+
readonly vendorIdentifier: string | null;
|
|
22
|
+
/** False on simulators and emulators. */
|
|
23
|
+
readonly isPhysicalDevice: boolean | null;
|
|
24
|
+
}
|
|
25
|
+
/** A battery reading, with the level as a 0 to 1 fraction. */
|
|
26
|
+
export interface RiskBatteryReading {
|
|
27
|
+
readonly levelFraction: number | null;
|
|
28
|
+
readonly isCharging: boolean | null;
|
|
29
|
+
}
|
|
30
|
+
/** The network medium classes the risk payload distinguishes. */
|
|
31
|
+
export type RiskConnectionKind = 'wifi' | 'cellular' | 'other';
|
|
32
|
+
/** The probes the collector runs. Each may answer null, throw, or hang. */
|
|
33
|
+
export interface RiskTelemetryProbes {
|
|
34
|
+
loadDeviceSnapshot(): Promise<RiskDeviceSnapshot | null>;
|
|
35
|
+
loadBattery(): Promise<RiskBatteryReading | null>;
|
|
36
|
+
loadConnection(): Promise<RiskConnectionKind | null>;
|
|
37
|
+
localeTag(): string | null;
|
|
38
|
+
localDateTime(): string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Collects whatever the device answered within the per-probe budget.
|
|
42
|
+
*
|
|
43
|
+
* Returns null when nothing answered, so a caller hands the page nothing rather
|
|
44
|
+
* than an empty block.
|
|
45
|
+
*/
|
|
46
|
+
export declare function collectRiskTelemetry(probes: RiskTelemetryProbes): Promise<Record<string, unknown> | null>;
|
|
47
|
+
//# sourceMappingURL=risk-telemetry-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-telemetry-collector.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/risk-telemetry-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,uDAAuD;AACvD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,yCAAyC;IACzC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3C;AAED,8DAA8D;AAC9D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;CACrC;AAED,iEAAiE;AACjE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;AAE/D,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACzD,WAAW,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IAClD,cAAc,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC;IACrD,SAAS,IAAI,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;CAChC;AA4BD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAgDzC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real device probes behind `collectRiskTelemetry`.
|
|
3
|
+
*
|
|
4
|
+
* Every expo module here is an optional peer, loaded lazily inside a try/catch:
|
|
5
|
+
* a host app that ships without one simply reports that fact as absent, and no
|
|
6
|
+
* import of this file can throw for want of a native module. Structural `*Like`
|
|
7
|
+
* types keep this file honest about how little of each module it relies on.
|
|
8
|
+
*/
|
|
9
|
+
import type { RiskTelemetryProbes } from './risk-telemetry-collector.js';
|
|
10
|
+
/**
|
|
11
|
+
* Formats a date as local-time ISO 8601 with a numeric UTC offset, e.g.
|
|
12
|
+
* `2026-08-25T10:45:46.319+05:30` — never the UTC `Z` form. This keeps the
|
|
13
|
+
* timestamp on the payer's own clock so it reads the same as the device shows,
|
|
14
|
+
* and matches the Flutter SDK's `deviceLocalDateTime`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatLocalIsoWithOffset(date: Date): string;
|
|
17
|
+
/** The production probe set, ready for `collectRiskTelemetry`. */
|
|
18
|
+
export declare function createRiskTelemetryProbes(): RiskTelemetryProbes;
|
|
19
|
+
//# sourceMappingURL=risk-telemetry-probes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"risk-telemetry-probes.d.ts","sourceRoot":"","sources":["../../../../../src/internal/telemetry/risk-telemetry-probes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAIV,mBAAmB,EACpB,MAAM,+BAA4B,CAAC;AA8GpC;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAc3D;AAUD,kEAAkE;AAClE,wBAAgB,yBAAyB,IAAI,mBAAmB,CAE/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-payment-page.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA4C,CAAC;
|
|
1
|
+
{"version":3,"file":"hosted-payment-page.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA4C,CAAC;AAevF,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,oBAAoB,CAAC;IACjC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,GAAG,CAAC,OAAO,CA6I5E"}
|
|
@@ -22,6 +22,15 @@ export interface HostedPaymentWebViewProps {
|
|
|
22
22
|
* this component stays a transport.
|
|
23
23
|
*/
|
|
24
24
|
onBridgeMessage: (message: unknown) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Answers the page's telemetry request with this device's native risk facts.
|
|
27
|
+
*
|
|
28
|
+
* The reply travels back by injected script rather than a return value, so it
|
|
29
|
+
* is handled here where the webview reference lives, and the message never
|
|
30
|
+
* reaches [onBridgeMessage]. Absent, or answering null, means the page
|
|
31
|
+
* proceeds with what the browser alone can see.
|
|
32
|
+
*/
|
|
33
|
+
onTelemetryRequest?: () => Promise<Record<string, unknown> | null>;
|
|
25
34
|
/** Called when the page itself could not be loaded. */
|
|
26
35
|
onLoadFailure?: () => void;
|
|
27
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hosted-payment-webview.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-webview.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hosted-payment-webview.d.ts","sourceRoot":"","sources":["../../../../../src/ui/hosted/hosted-payment-webview.tsx"],"names":[],"mappings":"AAwBA;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAE3F;AAED,MAAM,WAAW,yBAAyB;IACxC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IACnE,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,GAAG,CAAC,OAAO,CAuHlF"}
|