@spare-technologies/spare-link 1.0.1 → 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.
Files changed (67) hide show
  1. package/README.md +34 -5
  2. package/lib/commonjs/core/services/hosted-flow-controller.js +5 -0
  3. package/lib/commonjs/core/services/hosted-flow-controller.js.map +1 -1
  4. package/lib/commonjs/internal/hosted/bridge-message.js +13 -0
  5. package/lib/commonjs/internal/hosted/bridge-message.js.map +1 -1
  6. package/lib/commonjs/internal/telemetry/native-telemetry-reply.js +59 -0
  7. package/lib/commonjs/internal/telemetry/native-telemetry-reply.js.map +1 -0
  8. package/lib/commonjs/internal/telemetry/risk-telemetry-collector.js +99 -0
  9. package/lib/commonjs/internal/telemetry/risk-telemetry-collector.js.map +1 -0
  10. package/lib/commonjs/internal/telemetry/risk-telemetry-probes.js +134 -0
  11. package/lib/commonjs/internal/telemetry/risk-telemetry-probes.js.map +1 -0
  12. package/lib/commonjs/ui/hosted/hosted-payment-page.js +8 -0
  13. package/lib/commonjs/ui/hosted/hosted-payment-page.js.map +1 -1
  14. package/lib/commonjs/ui/hosted/hosted-payment-webview.js +31 -2
  15. package/lib/commonjs/ui/hosted/hosted-payment-webview.js.map +1 -1
  16. package/lib/commonjs/version.js +1 -1
  17. package/lib/module/core/services/hosted-flow-controller.js +5 -0
  18. package/lib/module/core/services/hosted-flow-controller.js.map +1 -1
  19. package/lib/module/internal/hosted/bridge-message.js +13 -0
  20. package/lib/module/internal/hosted/bridge-message.js.map +1 -1
  21. package/lib/module/internal/telemetry/native-telemetry-reply.js +53 -0
  22. package/lib/module/internal/telemetry/native-telemetry-reply.js.map +1 -0
  23. package/lib/module/internal/telemetry/risk-telemetry-collector.js +94 -0
  24. package/lib/module/internal/telemetry/risk-telemetry-collector.js.map +1 -0
  25. package/lib/module/internal/telemetry/risk-telemetry-probes.js +129 -0
  26. package/lib/module/internal/telemetry/risk-telemetry-probes.js.map +1 -0
  27. package/lib/module/ui/hosted/hosted-payment-page.js +8 -0
  28. package/lib/module/ui/hosted/hosted-payment-page.js.map +1 -1
  29. package/lib/module/ui/hosted/hosted-payment-webview.js +32 -3
  30. package/lib/module/ui/hosted/hosted-payment-webview.js.map +1 -1
  31. package/lib/module/version.js +1 -1
  32. package/lib/typescript/commonjs/core/services/hosted-flow-controller.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts +12 -1
  34. package/lib/typescript/commonjs/internal/hosted/bridge-message.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/internal/telemetry/native-telemetry-reply.d.ts +33 -0
  36. package/lib/typescript/commonjs/internal/telemetry/native-telemetry-reply.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-collector.d.ts +47 -0
  38. package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-collector.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-probes.d.ts +19 -0
  40. package/lib/typescript/commonjs/internal/telemetry/risk-telemetry-probes.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/ui/hosted/hosted-payment-page.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts +9 -0
  43. package/lib/typescript/commonjs/ui/hosted/hosted-payment-webview.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/version.d.ts +1 -1
  45. package/lib/typescript/module/core/services/hosted-flow-controller.d.ts.map +1 -1
  46. package/lib/typescript/module/internal/hosted/bridge-message.d.ts +12 -1
  47. package/lib/typescript/module/internal/hosted/bridge-message.d.ts.map +1 -1
  48. package/lib/typescript/module/internal/telemetry/native-telemetry-reply.d.ts +33 -0
  49. package/lib/typescript/module/internal/telemetry/native-telemetry-reply.d.ts.map +1 -0
  50. package/lib/typescript/module/internal/telemetry/risk-telemetry-collector.d.ts +47 -0
  51. package/lib/typescript/module/internal/telemetry/risk-telemetry-collector.d.ts.map +1 -0
  52. package/lib/typescript/module/internal/telemetry/risk-telemetry-probes.d.ts +19 -0
  53. package/lib/typescript/module/internal/telemetry/risk-telemetry-probes.d.ts.map +1 -0
  54. package/lib/typescript/module/ui/hosted/hosted-payment-page.d.ts.map +1 -1
  55. package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts +9 -0
  56. package/lib/typescript/module/ui/hosted/hosted-payment-webview.d.ts.map +1 -1
  57. package/lib/typescript/module/version.d.ts +1 -1
  58. package/package.json +24 -4
  59. package/plugins/with-spare-link.js +78 -5
  60. package/src/core/services/hosted-flow-controller.ts +5 -0
  61. package/src/internal/hosted/bridge-message.ts +20 -1
  62. package/src/internal/telemetry/native-telemetry-reply.ts +59 -0
  63. package/src/internal/telemetry/risk-telemetry-collector.ts +128 -0
  64. package/src/internal/telemetry/risk-telemetry-probes.ts +159 -0
  65. package/src/ui/hosted/hosted-payment-page.tsx +8 -0
  66. package/src/ui/hosted/hosted-payment-webview.tsx +42 -4
  67. package/src/version.ts +1 -1
package/README.md CHANGED
@@ -100,7 +100,15 @@ The ranges are deliberately narrow. This release supports **Expo 52 only**, so a
100
100
 
101
101
  `expo-web-browser` opens the bank, `expo-secure-store` stores the pending payment for recovery, and the rest render the payment flow. `react-native-svg` is an optional peer, loaded only if present; without it the SDK shows a plain activity indicator.
102
102
 
103
- The SDK requires no runtime permissions.
103
+ Four further optional peers feed the payment's device risk signals — facts like device model, OS version and battery state that the payment page cannot see from inside a webview:
104
+
105
+ ```sh
106
+ npx expo install expo-device expo-battery expo-network expo-application
107
+ ```
108
+
109
+ Each is loaded only if present; an app that ships without one simply reports fewer facts, and payments are never delayed or failed by their absence.
110
+
111
+ The SDK itself requires no runtime permissions and shows no permission dialogs.
104
112
 
105
113
  ## Expo plugin
106
114
 
@@ -118,14 +126,35 @@ plugins: [
118
126
  ]
119
127
  ```
120
128
 
121
- The plugin registers only the deep link the payer returns through:
129
+ The plugin does two things:
122
130
 
123
- - **iOS**: a `CFBundleURLSchemes` entry for your app scheme.
124
- - **Android**: an intent-filter for `myapp://callback`.
131
+ - **Deep link** — registers the return URL scheme: a `CFBundleURLSchemes` entry on iOS, an intent-filter on Android.
132
+ - **iOS privacy manifest** — merges the device data the SDK collects into your app's `ios.privacyManifests` (written to `PrivacyInfo.xcprivacy` at prebuild), so App Store review has it. It declares Device ID (the vendor identifier the risk-telemetry probe reads) and coarse location (the fix the payment page may attach), both unlinked, not used for tracking, purpose App Functionality, and `NSPrivacyTracking: false`. The merge is additive and idempotent — a data type you already declare is left as you set it, and it never forces `NSPrivacyTracking` off if you set it on.
125
133
 
126
134
  Use the same scheme and host your backend sets in `successRedirectUrl` and `failureRedirectUrl`. Rebuild your dev client after adding the plugin, because it changes native configuration.
127
135
 
128
- Earlier versions injected `ACCESS_FINE_LOCATION` and an iOS location usage description for device telemetry. The SDK no longer collects it, and the plugin requests no permissions.
136
+ The plugin requests no runtime permissions; the location signal below is a separate, opt-in host-app permission.
137
+
138
+ ## Location signal (optional)
139
+
140
+ The payment page asks for a coarse location fix on its consent screen and attaches it to the payment as a fraud-prevention signal. This is opt-in per app: the SDK declares no location permission and shows no dialog of its own, and a payment completes normally when the signal is unavailable.
141
+
142
+ To enable it, declare the permission in your app and make sure it has been granted before checkout:
143
+
144
+ ```ts
145
+ // app.config.ts
146
+ ios: {
147
+ infoPlist: {
148
+ NSLocationWhenInUseUsageDescription:
149
+ 'Your approximate location is attached to the payment as a fraud-prevention signal.',
150
+ },
151
+ },
152
+ android: {
153
+ permissions: ['android.permission.ACCESS_COARSE_LOCATION'],
154
+ },
155
+ ```
156
+
157
+ On iOS the system prompts the payer per origin when the page first asks. On Android the reading is enabled for the payment webview as a whole; the SDK's navigation policy keeps any other origin from ever loading in that frame, and coordinates are coarsened to about a kilometre before they are stored.
129
158
 
130
159
  ## Environments
131
160
 
@@ -113,6 +113,11 @@ class HostedFlowController {
113
113
  attempt: this.currentState.attempt
114
114
  }));
115
115
  break;
116
+ case 'telemetryRequest':
117
+ // Answered by the webview layer, which owns the injection channel the
118
+ // reply travels back on. Reaching here means no telemetry handler was
119
+ // wired, and the page's own timeout settles the request.
120
+ break;
116
121
  }
117
122
  return true;
118
123
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_bankRedirect","require","_bridgeMessage","_logger","_paymentReturnParams","_hostedFlowState","log","createLogger","DEFAULT_READY_TIMEOUT_MS","exports","HostedFlowController","listeners","Set","constructor","options","reference","bankLauncher","url","defaultLaunchBankRedirect","authorizationUrl","readyTimeoutMs","currentState","HostedFlowStates","loading","reportPageMounted","phase","watchForReadiness","state","subscribe","listener","add","delete","handleBridgeMessage","raw","message","parseHostedBridgeMessage","info","isPagePresented","type","stopWatchingForReadiness","moveTo","hosted","attempt","openBank","cancelled","failed","errorCode","code","handleReturn","uri","outcome","report","readPaymentReturn","undefined","warning","succeeded","abandoned","failToLoad","severe","unreachable","retry","giveUp","abandon","dispose","clear","readyTimer","setTimeout","clearTimeout","isTerminalPhase","redirecting","awaitingCallback","next"],"sourceRoot":"../../../../src","sources":["core/services/hosted-flow-controller.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,MAAMK,GAAG,GAAG,IAAAC,oBAAY,EAAC,sBAAsB,CAAC;;AAEhD;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,MAAM;AAS9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,oBAAoB,CAAC;EAIfC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EAKlDC,WAAWA,CAACC,OAAoC,EAAE;IAChD,IAAI,CAACC,SAAS,GAAGD,OAAO,CAACC,SAAS;IAClC,IAAI,CAACC,YAAY,GACfF,OAAO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M;QACN;MAAA;IAEJ;EACF;AACF;AAACpB,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_bankRedirect","require","_bridgeMessage","_logger","_paymentReturnParams","_hostedFlowState","log","createLogger","DEFAULT_READY_TIMEOUT_MS","exports","HostedFlowController","listeners","Set","constructor","options","reference","bankLauncher","url","defaultLaunchBankRedirect","authorizationUrl","readyTimeoutMs","currentState","HostedFlowStates","loading","reportPageMounted","phase","watchForReadiness","state","subscribe","listener","add","delete","handleBridgeMessage","raw","message","parseHostedBridgeMessage","info","isPagePresented","type","stopWatchingForReadiness","moveTo","hosted","attempt","openBank","cancelled","failed","errorCode","code","handleReturn","uri","outcome","report","readPaymentReturn","undefined","warning","succeeded","abandoned","failToLoad","severe","unreachable","retry","giveUp","abandon","dispose","clear","readyTimer","setTimeout","clearTimeout","isTerminalPhase","redirecting","awaitingCallback","next"],"sourceRoot":"../../../../src","sources":["core/services/hosted-flow-controller.ts"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,oBAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,MAAMK,GAAG,GAAG,IAAAC,oBAAY,EAAC,sBAAsB,CAAC;;AAEhD;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,MAAM;AAS9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,oBAAoB,CAAC;EAIfC,SAAS,GAAG,IAAIC,GAAG,CAAa,CAAC;EAKlDC,WAAWA,CAACC,OAAoC,EAAE;IAChD,IAAI,CAACC,SAAS,GAAGD,OAAO,CAACC,SAAS;IAClC,IAAI,CAACC,YAAY,GACfF,OAAO,CAACE,YAAY,K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AC;MACZ,CAAC,CAAC,MAAM;QACN;MAAA;IAEJ;EACF;AACF;AAACpB,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -30,6 +30,15 @@ var _urlParts = require("../url-parts.js");
30
30
 
31
31
  /** The flow cannot continue. [code] is the key the page itself renders. */
32
32
 
33
+ /**
34
+ * The page is asking for this device's native risk facts.
35
+ *
36
+ * The one message that expects an answer — not over this channel, which cannot
37
+ * reply, but through the `window.__spareLinkNativeTelemetry` callback the page
38
+ * exposes and the shell invokes by injecting script. A shell that stays silent
39
+ * costs the page one bounded timeout and nothing else.
40
+ */
41
+
33
42
  /**
34
43
  * Parses a message posted by the hosted page.
35
44
  *
@@ -60,6 +69,10 @@ function parseHostedBridgeMessage(raw) {
60
69
  return {
61
70
  type: 'cancel'
62
71
  };
72
+ case 'spare.telemetry_request':
73
+ return {
74
+ type: 'telemetryRequest'
75
+ };
63
76
  case 'spare.error':
64
77
  {
65
78
  const code = message.code;
@@ -1 +1 @@
1
- {"version":3,"names":["_urlParts","require","parseHostedBridgeMessage","raw","message","asRecord","type","url","isHttpsUrl","code","trim","length","JSON","parse","Array","isArray","parts","parseUrlParts","scheme","host"],"sourceRoot":"../../../../src","sources":["internal/hosted/bridge-message.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;;AAKA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAACC,GAAY,EAA8B;EACjF,MAAMC,OAAO,GAAGC,QAAQ,CAACF,GAAG,CAAC;EAC7B,IAAI,CAACC,OAAO,EAAE,OAAO,IAAI;EAEzB,MAAME,IAAI,GAAGF,OAAO,CAACE,IAAI;EACzB,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE,OAAO,IAAI;EAEzC,QAAQA,IAAI;IACV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IF,KAAK,CAACG,IAAI,CAACR,MAAM,GAAG,CAAC;AAC5E","ignoreList":[]}
1
+ {"version":3,"names":["_urlParts","require","parseHostedBridgeMessage","raw","message","asRecord","type","url","isHttpsUrl","code","trim","length","JSON","parse","Array","isArray","parts","parseUrlParts","scheme","host"],"sourceRoot":"../../../../src","sources":["internal/hosted/bridge-message.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;;AAKA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CAACC,GAAY,EAA8B;EACjF,MAAMC,OAAO,GAAGC,QAAQ,CAACF,GAAG,CAAC;EAC7B,IAAI,CAACC,OAAO,EAAE,OAAO,IAAI;EAEzB,MAAME,IAAI,GAAGF,OAAO,CAACE,IAAI;EACzB,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE,OAAO,IAAI;EAEzC,QAAQA,IAAI;IACV,KAAK,aAAa;MAChB,OAAO;QAAEA,IAAI,EAAE;MAAQ,CAAC;IAC1B,KAAK,gBAAgB;MAAE;QACrB,MAAMC,GAAG,GAAGH,OAAO,CAACG,GAAG;QACvB,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACC,UAAU,CAACD,GAAG,CAAC,EAAE,OAAO,IAAI;QAC5D,OAAO;UAAED,IAAI,EAAE,SAAS;UAAEC;QAAI,CAAC;MACjC;IACA,KAAK,cAAc;MACjB,OAAO;QAAED,IAAI,EAAE;MAAS,CAAC;IAC3B,KAAK,yBAAyB;MAC5B,OAAO;QAAEA,IAAI,EAAE;MAAmB,CAAC;IACrC,KAAK,aAAa;MAAE;QAClB,MAAMG,IAAI,GAAGL,OAAO,CAACK,IAAI;QACzB,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAIA,IAAI,CAACC,IAAI,CAAC,CAAC,CAACC,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;QACrE,OAAO;UAAEL,IAAI,EAAE,OAAO;UAAEG;QAAK,CAAC;MAChC;IACA;MACE,OAAO,IAAI;EACf;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAASJ,QAAQA,CAACF,GAAY,EAAkC;EAC9D,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;IAC3B,IAAI;MACF,OAAOE,QAAQ,CAACO,IAAI,CAACC,KAAK,CAACV,GAAG,CAAY,CAAC;IAC7C,CAAC,CAAC,MAAM;MACN,OAAO,IAAI;IACb;EACF;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,KAAK,IAAI,IAAIW,KAAK,CAACC,OAAO,CAACZ,GAAG,CAAC,EAAE,OAAO,IAAI;EAC9E,OAAOA,GAAG;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,UAAUA,CAACD,GAAW,EAAW;EACxC,MAAMS,KAAK,GAAG,IAAAC,uBAAa,EAACV,GAAG,CAAC;EAChC,OAAOS,KAAK,KAAK,IAAI,IAAIA,KAAK,CAACE,MAAM,KAAK,OAAO,IAAIF,KAAK,CAACG,IAAI,CAACR,MAAM,GAAG,CAAC;AAC5E","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NATIVE_TELEMETRY_CALLBACK_NAME = void 0;
7
+ exports.buildNativeTelemetryReplyScript = buildNativeTelemetryReplyScript;
8
+ exports.createTelemetryRequestHandler = createTelemetryRequestHandler;
9
+ /**
10
+ * Delivers a telemetry reply into the hosted page.
11
+ *
12
+ * The WebView message channel is one-way, so the reply travels the other way:
13
+ * the page exposes `window.__spareLinkNativeTelemetry` before it asks, and the
14
+ * shell answers by injecting a call to it. A page without the callback — an
15
+ * older page, or one that already gave up waiting — receives nothing and the
16
+ * injected chunk evaluates to a harmless literal.
17
+ */
18
+
19
+ /** Page-exposed global the shell invokes with its telemetry reply. */
20
+ const NATIVE_TELEMETRY_CALLBACK_NAME = exports.NATIVE_TELEMETRY_CALLBACK_NAME = '__spareLinkNativeTelemetry';
21
+
22
+ /**
23
+ * Builds the script that hands [payload] to the page's telemetry callback.
24
+ *
25
+ * The payload is embedded as a JSON literal. U+2028 and U+2029 are legal inside
26
+ * a JSON string but terminate a statement when evaluated as script, so they are
27
+ * escaped; the result is a single expression that is inert on a page without
28
+ * the callback.
29
+ */
30
+ function buildNativeTelemetryReplyScript(payload) {
31
+ const literal = JSON.stringify(payload).replaceAll('\u2028', '\\u2028').replaceAll('\u2029', '\\u2029');
32
+ return `window.${NATIVE_TELEMETRY_CALLBACK_NAME} && ` + `window.${NATIVE_TELEMETRY_CALLBACK_NAME}(${literal}); true;`;
33
+ }
34
+
35
+ /**
36
+ * Builds the handler the webview runs when the page asks for telemetry.
37
+ *
38
+ * Collection and injection are injected so the handler is a pure seam: the
39
+ * component wires the real collector and the WebView reference into it. A
40
+ * collector that answers nothing, or throws, injects nothing — the page's own
41
+ * timeout settles the request.
42
+ */
43
+ function createTelemetryRequestHandler(deps) {
44
+ return async () => {
45
+ let payload;
46
+ try {
47
+ payload = await deps.collect();
48
+ } catch {
49
+ payload = null;
50
+ }
51
+ if (payload == null) return;
52
+ try {
53
+ deps.inject(buildNativeTelemetryReplyScript(payload));
54
+ } catch {
55
+ // A torn-down webview cannot be injected into; the page's timeout answers.
56
+ }
57
+ };
58
+ }
59
+ //# sourceMappingURL=native-telemetry-reply.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NATIVE_TELEMETRY_CALLBACK_NAME","exports","buildNativeTelemetryReplyScript","payload","literal","JSON","stringify","replaceAll","createTelemetryRequestHandler","deps","collect","inject"],"sourceRoot":"../../../../src","sources":["internal/telemetry/native-telemetry-reply.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GAAG,4BAA4B;;AAE1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,+BAA+BA,CAACC,OAAgC,EAAU;EACxF,MAAMC,OAAO,GAAGC,IAAI,CAACC,SAAS,CAACH,OAAO,CAAC,CACpCI,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,CAC/BA,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;EAClC,OACE,UAAUP,8BAA8B,MAAM,GAC9C,UAAUA,8BAA8B,IAAII,OAAO,UAAU;AAEjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,6BAA6BA,CAACC,IAG7C,EAAuB;EACtB,OAAO,YAAY;IACjB,IAAIN,OAAuC;IAC3C,IAAI;MACFA,OAAO,GAAG,MAAMM,IAAI,CAACC,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC,MAAM;MACNP,OAAO,GAAG,IAAI;IAChB;IACA,IAAIA,OAAO,IAAI,IAAI,EAAE;IAErB,IAAI;MACFM,IAAI,CAACE,MAAM,CAACT,+BAA+B,CAACC,OAAO,CAAC,CAAC;IACvD,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TELEMETRY_PROBE_BUDGET_MS = void 0;
7
+ exports.collectRiskTelemetry = collectRiskTelemetry;
8
+ /**
9
+ * Collects this device's native risk facts for the hosted payment page.
10
+ *
11
+ * Every probe is injected, so the collector runs under Jest with fakes and the
12
+ * module wiring lives in `risk-telemetry-probes`. Every probe is also allowed to
13
+ * fail or hang: a throwing or slow reading leaves its fact absent, because a risk
14
+ * reading must never delay or break a payment.
15
+ *
16
+ * The payload mirrors the page's own risk contract: camelCase keys under a
17
+ * `deviceInformation` block, facts only, nothing fabricated.
18
+ */
19
+
20
+ /** How long any single probe may take before its fact is given up on. */
21
+ const TELEMETRY_PROBE_BUDGET_MS = exports.TELEMETRY_PROBE_BUDGET_MS = 800;
22
+
23
+ /** Identity and build facts read from the platform. */
24
+
25
+ /** A battery reading, with the level as a 0 to 1 fraction. */
26
+
27
+ /** The network medium classes the risk payload distinguishes. */
28
+
29
+ /** The probes the collector runs. Each may answer null, throw, or hang. */
30
+
31
+ const CONNECTION_LABELS = {
32
+ wifi: 'WiFi',
33
+ cellular: 'Cellular',
34
+ other: 'Other'
35
+ };
36
+
37
+ /** Runs a probe under the budget, yielding null on failure or timeout. */
38
+ async function guarded(probe) {
39
+ try {
40
+ return await Promise.race([probe(), new Promise(resolve => setTimeout(() => resolve(null), TELEMETRY_PROBE_BUDGET_MS))]);
41
+ } catch {
42
+ return null;
43
+ }
44
+ }
45
+ function read(reader) {
46
+ try {
47
+ return reader();
48
+ } catch {
49
+ return null;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Collects whatever the device answered within the per-probe budget.
55
+ *
56
+ * Returns null when nothing answered, so a caller hands the page nothing rather
57
+ * than an empty block.
58
+ */
59
+ async function collectRiskTelemetry(probes) {
60
+ const [snapshot, battery, connection] = await Promise.all([guarded(probes.loadDeviceSnapshot), guarded(probes.loadBattery), guarded(probes.loadConnection)]);
61
+ const localeTag = read(probes.localeTag);
62
+ const localDateTime = read(probes.localDateTime);
63
+ const deviceInformation = {};
64
+ if (snapshot?.operatingSystem != null) {
65
+ deviceInformation.deviceOperatingSystem = snapshot.operatingSystem;
66
+ }
67
+ if (snapshot?.operatingSystemVersion != null) {
68
+ deviceInformation.deviceOperatingSystemVersion = snapshot.operatingSystemVersion;
69
+ }
70
+ const manufacturer = {};
71
+ if (snapshot?.model != null) manufacturer.model = snapshot.model;
72
+ if (snapshot?.manufacturer != null) manufacturer.manufacturer = snapshot.manufacturer;
73
+ if (Object.keys(manufacturer).length > 0) {
74
+ deviceInformation.deviceManufacturer = manufacturer;
75
+ }
76
+ if (snapshot?.vendorIdentifier != null) {
77
+ deviceInformation.alternativeDeviceId = snapshot.vendorIdentifier;
78
+ }
79
+ if (localeTag != null) deviceInformation.deviceLanguage = localeTag;
80
+ if (localDateTime != null) deviceInformation.deviceLocalDateTime = localDateTime;
81
+ if (connection != null) deviceInformation.connectionType = CONNECTION_LABELS[connection];
82
+ const batteryStatus = {};
83
+ const level = battery?.levelFraction;
84
+ if (level != null && level >= 0 && level <= 1) batteryStatus.level = level;
85
+ if (battery?.isCharging != null) batteryStatus.isCharging = battery.isCharging;
86
+ if (Object.keys(batteryStatus).length > 0) {
87
+ deviceInformation.batteryStatus = batteryStatus;
88
+ }
89
+ const environmentContext = [];
90
+ if (snapshot?.isPhysicalDevice === false) environmentContext.push('EmulatorDetected');
91
+ if (environmentContext.length > 0) {
92
+ deviceInformation.deviceEnvironmentContext = environmentContext;
93
+ }
94
+ if (Object.keys(deviceInformation).length === 0) return null;
95
+ return {
96
+ deviceInformation
97
+ };
98
+ }
99
+ //# sourceMappingURL=risk-telemetry-collector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TELEMETRY_PROBE_BUDGET_MS","exports","CONNECTION_LABELS","wifi","cellular","other","guarded","probe","Promise","race","resolve","setTimeout","read","reader","collectRiskTelemetry","probes","snapshot","battery","connection","all","loadDeviceSnapshot","loadBattery","loadConnection","localeTag","localDateTime","deviceInformation","operatingSystem","deviceOperatingSystem","operatingSystemVersion","deviceOperatingSystemVersion","manufacturer","model","Object","keys","length","deviceManufacturer","vendorIdentifier","alternativeDeviceId","deviceLanguage","deviceLocalDateTime","connectionType","batteryStatus","level","levelFraction","isCharging","environmentContext","isPhysicalDevice","push","deviceEnvironmentContext"],"sourceRoot":"../../../../src","sources":["internal/telemetry/risk-telemetry-collector.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACO,MAAMA,yBAAyB,GAAAC,OA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,aAAa;EACjD;EAEA,MAAMI,kBAA4B,GAAG,EAAE;EACvC,IAAI7B,QAAQ,EAAE8B,gBAAgB,KAAK,KAAK,EAAED,kBAAkB,CAACE,IAAI,CAAC,kBAAkB,CAAC;EACrF,IAAIF,kBAAkB,CAACX,MAAM,GAAG,CAAC,EAAE;IACjCT,iBAAiB,CAACuB,wBAAwB,GAAGH,kBAAkB;EACjE;EAEA,IAAIb,MAAM,CAACC,IAAI,CAACR,iBAAiB,CAAC,CAACS,MAAM,KAAK,CAAC,EAAE,OAAO,IAAI;EAC5D,OAAO;IAAET;EAAkB,CAAC;AAC9B","ignoreList":[]}
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createRiskTelemetryProbes = createRiskTelemetryProbes;
7
+ exports.formatLocalIsoWithOffset = formatLocalIsoWithOffset;
8
+ var _reactNative = require("react-native");
9
+ /**
10
+ * The real device probes behind `collectRiskTelemetry`.
11
+ *
12
+ * Every expo module here is an optional peer, loaded lazily inside a try/catch:
13
+ * a host app that ships without one simply reports that fact as absent, and no
14
+ * import of this file can throw for want of a native module. Structural `*Like`
15
+ * types keep this file honest about how little of each module it relies on.
16
+ */
17
+
18
+ function load(moduleName) {
19
+ try {
20
+ // Resolved at call time so a host app without the optional peer never pays
21
+ // for it — bundlers keep the require because the name is static.
22
+ switch (moduleName) {
23
+ case 'expo-device':
24
+ return require('expo-device');
25
+ case 'expo-battery':
26
+ return require('expo-battery');
27
+ case 'expo-network':
28
+ return require('expo-network');
29
+ case 'expo-application':
30
+ return require('expo-application');
31
+ default:
32
+ return null;
33
+ }
34
+ } catch {
35
+ return null;
36
+ }
37
+ }
38
+ async function loadDeviceSnapshot() {
39
+ const device = load('expo-device');
40
+ if (device == null) return null;
41
+
42
+ // The vendor identifier is iOS-only by design: Android offers no equivalent
43
+ // scoped identifier worth persisting against a payment.
44
+ let vendorIdentifier = null;
45
+ if (_reactNative.Platform.OS === 'ios') {
46
+ const application = load('expo-application');
47
+ if (application != null) {
48
+ try {
49
+ vendorIdentifier = await application.getIosIdForVendorAsync();
50
+ } catch {
51
+ vendorIdentifier = null;
52
+ }
53
+ }
54
+ }
55
+ return {
56
+ operatingSystem: _reactNative.Platform.OS === 'ios' ? 'iOS' : 'Android',
57
+ operatingSystemVersion: device.osVersion ?? null,
58
+ model: device.modelName ?? null,
59
+ manufacturer: device.manufacturer ?? null,
60
+ vendorIdentifier,
61
+ isPhysicalDevice: typeof device.isDevice === 'boolean' ? device.isDevice : null
62
+ };
63
+ }
64
+ async function loadBattery() {
65
+ const battery = load('expo-battery');
66
+ if (battery == null) return null;
67
+ const level = await battery.getBatteryLevelAsync();
68
+ const state = await battery.getBatteryStateAsync();
69
+ const charging = battery.BatteryState?.CHARGING;
70
+ const full = battery.BatteryState?.FULL;
71
+ return {
72
+ // The module reports -1 when the level cannot be read; the collector's 0..1
73
+ // bound would drop it anyway, made explicit here.
74
+ levelFraction: level >= 0 && level <= 1 ? level : null,
75
+ isCharging: charging != null ? state === charging || state === full : null
76
+ };
77
+ }
78
+ async function loadConnection() {
79
+ const network = load('expo-network');
80
+ if (network == null) return null;
81
+ const state = await network.getNetworkStateAsync();
82
+ const type = state.type?.toUpperCase() ?? null;
83
+ if (type == null || type === 'NONE' || type === 'UNKNOWN') return null;
84
+ if (type === 'WIFI') return 'wifi';
85
+ if (type === 'CELLULAR') return 'cellular';
86
+ return 'other';
87
+ }
88
+ function localeTag() {
89
+ try {
90
+ const tag = Intl.DateTimeFormat().resolvedOptions().locale;
91
+ return typeof tag === 'string' && tag.length > 0 ? tag : null;
92
+ } catch {
93
+ return null;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Formats a date as local-time ISO 8601 with a numeric UTC offset, e.g.
99
+ * `2026-08-25T10:45:46.319+05:30` — never the UTC `Z` form. This keeps the
100
+ * timestamp on the payer's own clock so it reads the same as the device shows,
101
+ * and matches the Flutter SDK's `deviceLocalDateTime`.
102
+ */
103
+ function formatLocalIsoWithOffset(date) {
104
+ const pad = (value, width = 2) => String(value).padStart(width, '0');
105
+
106
+ // getTimezoneOffset is minutes behind UTC, so east-of-UTC zones are negative;
107
+ // flip the sign to render the conventional offset.
108
+ const offsetMinutes = -date.getTimezoneOffset();
109
+ const sign = offsetMinutes >= 0 ? '+' : '-';
110
+ const absOffset = Math.abs(offsetMinutes);
111
+ const localDate = `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
112
+ const localTime = `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}.${pad(date.getMilliseconds(), 3)}`;
113
+ const offset = `${sign}${pad(Math.floor(absOffset / 60))}:${pad(absOffset % 60)}`;
114
+ return `${localDate}T${localTime}${offset}`;
115
+ }
116
+ function localDateTime() {
117
+ try {
118
+ return formatLocalIsoWithOffset(new Date());
119
+ } catch {
120
+ return null;
121
+ }
122
+ }
123
+
124
+ /** The production probe set, ready for `collectRiskTelemetry`. */
125
+ function createRiskTelemetryProbes() {
126
+ return {
127
+ loadDeviceSnapshot,
128
+ loadBattery,
129
+ loadConnection,
130
+ localeTag,
131
+ localDateTime
132
+ };
133
+ }
134
+ //# sourceMappingURL=risk-telemetry-probes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","load","moduleName","loadDeviceSnapshot","device","vendorIdentifier","Platform","OS","application","getIosIdForVendorAsync","operatingSystem","operatingSystemVersion","osVersion","model","modelName","manufacturer","isPhysicalDevice","isDevice","loadBattery","battery","level","getBatteryLevelAsync","state","getBatteryStateAsync","charging","BatteryState","CHARGING","full","FULL","levelFraction","isCharging","loadConnection","network","getNetworkStateAsync","type","toUpperCase","localeTag","tag","Intl","DateTimeFormat","resolvedOptions","locale","length","formatLocalIsoWithOffset","date","pad","value","width","String","padStart","offsetMinutes","getTimezoneOffset","sign","absOffset","Math","abs","localDate","getFullYear","getMonth","getDate","localTime","getHours","getMinutes","getSeconds","getMilliseconds","offset","floor","localDateTime","Date","createRiskTelemetryProbes"],"sourceRoot":"../../../../src","sources":["internal/telemetry/risk-telemetry-probes.ts"],"mappings":";;;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+BA,SAASC,IAAIA,CAAIC,UAAkB,EAAY;EAC7C,IAAI;IACF;IACA;IACA,QAAQA,UAAU;MAChB,KAAK,aAAa;QAChB,OAAOF,OAAO,CAAC,aAAa,CAAC;MAC/B,KAAK,cAAc;QACjB,OAAOA,OAAO,CAAC,cAAc,CAAC;MAChC,KAAK,cAAc;QACjB,OAAOA,OAAO,CAAC,cAAc,CAAC;MAChC,KAAK,kBAAkB;QACrB,OAAOA,OAAO,CAAC,kBAAkB,CAAC;MACpC;QACE,OAAO,IAAI;IACf;EACF,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEA,eAAeG,kBAAkBA,CAAA,EAAuC;EACtE,MAAMC,MAAM,GAAGH,IAAI,CAAmB,aAAa,CAAC;EACpD,IAAIG,MAAM,IAAI,IAAI,EAAE,OAAO,IAAI;;EAE/B;EACA;EACA,IAAIC,gBAA+B,GAAG,IAAI;EAC1C,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;IACzB,MAAMC,WAAW,GAAGP,IAAI,CAAwB,kBAAkB,CAAC;IACnE,IAAIO,WAAW,IAAI,IAAI,EAAE;MACvB,IAAI;QACFH,gBAAgB,GAAG,MAAMG,WAAW,CAACC,sBAAsB,CAAC,CAAC;MAC/D,CAAC,CAAC,MAAM;QACNJ,gBAAgB,GAAG,IAAI;MACzB;IACF;EACF;EAEA,OAAO;IACLK,eAAe,EAAEJ,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAG,KAAK,GAAG,SAAS;IAC1DI,sBAAsB,EAAEP,MAAM,CAACQ,SAAS,IAAI,IAAI;IAChDC,KAAK,EAAET,MAAM,CAACU,SAAS,IAAI,IAAI;IAC/BC,YAAY,EAAEX,M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jI,MAAMC,MAAM,GAAG,GAAGb,IAAI,GAAGP,GAAG,CAACS,IAAI,CAACY,KAAK,CAACb,SAAS,GAAG,EAAE,CAAC,CAAC,IAAIR,GAAG,CAACQ,SAAS,GAAG,EAAE,CAAC,EAAE;EAEjF,OAAO,GAAGG,SAAS,IAAII,SAAS,GAAGK,MAAM,EAAE;AAC7C;AAEA,SAASE,aAAaA,CAAA,EAAkB;EACtC,IAAI;IACF,OAAOxB,wBAAwB,CAAC,IAAIyB,IAAI,CAAC,CAAC,CAAC;EAC7C,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;;AAEA;AACO,SAASC,yBAAyBA,CAAA,EAAwB;EAC/D,OAAO;IAAElE,kBAAkB;IAAEe,WAAW;IAAEa,cAAc;IAAEK,SAAS;IAAE+B;EAAc,CAAC;AACtF","ignoreList":[]}
@@ -7,6 +7,8 @@ exports.HostedPaymentPage = HostedPaymentPage;
7
7
  var _react = require("react");
8
8
  var _reactNative = require("react-native");
9
9
  var _hostedFlowState = require("../../core/services/hosted-flow-state.js");
10
+ var _riskTelemetryCollector = require("../../internal/telemetry/risk-telemetry-collector.js");
11
+ var _riskTelemetryProbes = require("../../internal/telemetry/risk-telemetry-probes.js");
10
12
  var _useHostedFlowState = require("../hooks/use-hosted-flow-state.js");
11
13
  var _pageUnavailableScreen = require("../screens/page-unavailable-screen.js");
12
14
  var _redirectHandoffScreen = require("../screens/redirect-handoff-screen.js");
@@ -64,6 +66,11 @@ function HostedPaymentPage(props) {
64
66
  const handleBridgeMessage = (0, _react.useCallback)(message => {
65
67
  void controller.handleBridgeMessage(message);
66
68
  }, [controller]);
69
+
70
+ // One probe set for the page's lifetime; collection itself runs per request.
71
+ const handleTelemetryRequest = (0, _react.useCallback)(() => {
72
+ return (0, _riskTelemetryCollector.collectRiskTelemetry)((0, _riskTelemetryProbes.createRiskTelemetryProbes)());
73
+ }, []);
67
74
  const handleLoadFailure = (0, _react.useCallback)(() => {
68
75
  controller.failToLoad();
69
76
  }, [controller]);
@@ -95,6 +102,7 @@ function HostedPaymentPage(props) {
95
102
  baseUrl: baseUrl,
96
103
  reference: controller.reference,
97
104
  onBridgeMessage: handleBridgeMessage,
105
+ onTelemetryRequest: handleTelemetryRequest,
98
106
  onLoadFailure: handleLoadFailure,
99
107
  onMounted: handlePageMounted
100
108
  }, state.attempt)
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_reactNative","_hostedFlowState","_useHostedFlowState","_pageUnavailableScreen","_redirectHandoffScreen","_resultScreen","_resumeProcessingScreen","_index","_hostedPaymentWebview","_jsxRuntime","RESULT_DWELL_MS","HostedPaymentPage","props","controller","baseUrl","onResolved","state","useHostedFlowState","awaitingSinceMs","useRef","undefined","phase","current","Date","now","wasNeverReached","errorCode","resolved","isTerminalPhase","useEffect","timer","setTimeout","clearTimeout","handleBridgeMessage","useCallback","message","handleLoadFailure","failToLoad","handlePageMounted","reportPageMounted","handleRetry","retry","handleGiveUp","giveUp","jsxs","View","style","styles","fill","children","jsx","accessibilityElementsHidden","importantForAccessibility","HostedPaymentWebView","reference","onBridgeMessage","onLoadFailure","onMounted","attempt","loadingCover","testID","ActivityIndicator","size","color","Colors","spareBlue","Text","Typography","bodyMuted","loadingLabel","PageUnavailableScreen","onRetry","onCancel","RedirectHandoffScreen","ResumeProcessingScreen","awaitingCallbackStartedAtMs","abandon","ResultScreen","title","isSuccess","onDone","StyleSheet","create","flex","backgroundColor","surfacePage","absoluteFillObject","alignItems","justifyContent","gap","Spacing","lg","textAlign"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-page.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA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,CAACqB;EAC1B,CAAC;EACDhB,YAAY,EAAE;IAAEuB,SAAS,EAAE;EAAS;AACtC,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_reactNative","_hostedFlowState","_riskTelemetryCollector","_riskTelemetryProbes","_useHostedFlowState","_pageUnavailableScreen","_redirectHandoffScreen","_resultScreen","_resumeProcessingScreen","_index","_hostedPaymentWebview","_jsxRuntime","RESULT_DWELL_MS","HostedPaymentPage","props","controller","baseUrl","onResolved","state","useHostedFlowState","awaitingSinceMs","useRef","undefined","phase","current","Date","now","wasNeverReached","errorCode","resolved","isTerminalPhase","useEffect","timer","setTimeout","clearTimeout","handleBridgeMessage","useCallback","message","handleTelemetryRequest","collectRiskTelemetry","createRiskTelemetryProbes","handleLoadFailure","failToLoad","handlePageMounted","reportPageMounted","handleRetry","retry","handleGiveUp","giveUp","jsxs","View","style","styles","fill","children","jsx","accessibilityElementsHidden","importantForAccessibility","HostedPaymentWebView","reference","onBridgeMessage","onTelemetryRequest","onLoadFailure","onMounted","attempt","loadingCover","testID","ActivityIndicator","size","color","Colors","spareBlue","Text","Typography","bodyMuted","loadingLabel","PageUnavailableScreen","onRetry","onCancel","RedirectHandoffScreen","ResumeProcessingScreen","awaitingCallbackStartedAtMs","abandon","ResultScreen","title","isSuccess","onDone","StyleSheet","create","flex","backgroundColor","surfacePage","absoluteFillObject","alignItems","justifyContent","gap","Spacing","lg","textAlign"],"sourceRoot":"../../../../src","sources":["ui/hosted/hosted-payment-page.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AACA,IAAAO,sBAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAA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B;EAAY,CAAC;EACtD1B,YAAY,EAAE;IACZ,GAAGsB,uBAAU,CAACK,kBAAkB;IAChCC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,GAAG,EAAEC,cAAO,CAACC,EAAE;IACfP,eAAe,EAAEpB,aAAM,CAACqB;EAC1B,CAAC;EACDhB,YAAY,EAAE;IAAEuB,SAAS,EAAE;EAAS;AACtC,CAAC,CAAC","ignoreList":[]}
@@ -8,8 +8,10 @@ exports.shouldAllowHostedNavigation = shouldAllowHostedNavigation;
8
8
  var _react = require("react");
9
9
  var _reactNative = require("react-native");
10
10
  var _reactNativeWebview = require("react-native-webview");
11
+ var _bridgeMessage = require("../../internal/hosted/bridge-message.js");
11
12
  var _hostedUrl = require("../../internal/hosted/hosted-url.js");
12
13
  var _logger = require("../../internal/logger.js");
14
+ var _nativeTelemetryReply = require("../../internal/telemetry/native-telemetry-reply.js");
13
15
  var _urlParts = require("../../internal/url-parts.js");
14
16
  var _index = require("../theme/index.js");
15
17
  var _jsxRuntime = require("react/jsx-runtime");
@@ -52,6 +54,7 @@ function HostedPaymentWebView(props) {
52
54
  baseUrl,
53
55
  reference,
54
56
  onBridgeMessage,
57
+ onTelemetryRequest,
55
58
  onLoadFailure,
56
59
  onMounted
57
60
  } = props;
@@ -59,6 +62,7 @@ function HostedPaymentWebView(props) {
59
62
  baseUrl,
60
63
  reference
61
64
  });
65
+ const webViewRef = (0, _react.useRef)(null);
62
66
 
63
67
  // This reports that *this* webview exists, and a retry mounts a fresh instance
64
68
  // which reports itself anew. Re-running on a new callback identity would
@@ -68,8 +72,21 @@ function HostedPaymentWebView(props) {
68
72
  onMounted?.();
69
73
  }, []);
70
74
  const handleMessage = (0, _react.useCallback)(event => {
71
- onBridgeMessage(event.nativeEvent.data);
72
- }, [onBridgeMessage]);
75
+ const raw = event.nativeEvent.data;
76
+
77
+ // The telemetry request is answered here, where the webview reference
78
+ // lives, because the reply is delivered by injecting script — a channel
79
+ // only this component holds. Everything else stays the caller's.
80
+ if (onTelemetryRequest && (0, _bridgeMessage.parseHostedBridgeMessage)(raw)?.type === 'telemetryRequest') {
81
+ const respond = (0, _nativeTelemetryReply.createTelemetryRequestHandler)({
82
+ collect: onTelemetryRequest,
83
+ inject: script => webViewRef.current?.injectJavaScript(script)
84
+ });
85
+ void respond();
86
+ return;
87
+ }
88
+ onBridgeMessage(raw);
89
+ }, [onBridgeMessage, onTelemetryRequest]);
73
90
 
74
91
  // Every navigation is routed through here rather than through `originWhitelist`.
75
92
  // A URL that fails the whitelist is handed to `Linking.openURL` by
@@ -93,6 +110,7 @@ function HostedPaymentWebView(props) {
93
110
  style: styles.container,
94
111
  testID: "hosted-payment-webview",
95
112
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeWebview.WebView, {
113
+ ref: webViewRef,
96
114
  source: {
97
115
  uri
98
116
  },
@@ -138,6 +156,17 @@ function HostedPaymentWebView(props) {
138
156
  style: styles.webview,
139
157
  javaScriptEnabled: true,
140
158
  domStorageEnabled: true
159
+ // Lets the page's consent screen ask for a coarse location fix, which it
160
+ // attaches to the payment as a risk signal. Android only; iOS raises its
161
+ // own per-origin system prompt, gated by the host app's usage-description
162
+ // entry. This toggle is frame-wide — the platform offers no per-origin
163
+ // answer here — so the scope rests on `handleShouldStartLoad` above
164
+ // refusing every off-origin document in this frame. The toggle alone also
165
+ // reveals nothing: the host application must hold the user-facing location
166
+ // permission, and without it the page's request fails and the payment
167
+ // proceeds without the signal.
168
+ ,
169
+ geolocationEnabled: true
141
170
  // The page holds a payment in progress and nothing else should share its
142
171
  // storage, on this device or between payers on it.
143
172
  ,