@tapayadot/accept-react-native 1.16.0 → 1.19.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/CHANGELOG.md +58 -0
- package/README.md +11 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +5 -0
- package/android/src/main/java/com/tapaya/acceptsdkreactnative/Parsing.kt +25 -1
- package/build/Accept.d.ts +3 -1
- package/build/Accept.d.ts.map +1 -1
- package/build/Accept.js +7 -4
- package/build/Accept.js.map +1 -1
- package/build/Accept.types.d.ts +26 -0
- package/build/Accept.types.d.ts.map +1 -1
- package/build/Accept.types.js.map +1 -1
- package/build/withoutUndefined.d.ts +9 -0
- package/build/withoutUndefined.d.ts.map +1 -0
- package/build/withoutUndefined.js +17 -0
- package/build/withoutUndefined.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,64 @@ Each release must have a `## [x.y.z]` section that matches the `version` in
|
|
|
9
9
|
`package.json`. The publish workflow refuses to release a version whose section
|
|
10
10
|
is missing or empty.
|
|
11
11
|
|
|
12
|
+
## [1.19.0] - 2026-10-19
|
|
13
|
+
|
|
14
|
+
Carries Accept SDK for Android 1.19.0 to Expo apps. Both `com.tapaya:accept` and the optional
|
|
15
|
+
`com.tapaya:accept-installer` move to 1.19.0. No API changes.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- **`authenticate()` uses the device id owned by the companion app when it reports one.** Every
|
|
20
|
+
host app on a device, and a host app reinstalled after an uninstall, is now the same device on
|
|
21
|
+
the backend. The stored id, then a new random one, are used only while no companion can answer.
|
|
22
|
+
A companion build that predates this reports no id, and the SDK behaves as before.
|
|
23
|
+
|
|
24
|
+
- **`'merchantMismatch'` status and the `PluginMerchantMismatch` error now also cover a device
|
|
25
|
+
mismatch.** They are reported when the companion is activated for a different device, not only
|
|
26
|
+
a different merchant. The remedy is the same: `logout()`, then activate again. Devices are
|
|
27
|
+
compared only once the SDK has authenticated.
|
|
28
|
+
|
|
29
|
+
## [1.18.0] - 2026-10-15
|
|
30
|
+
|
|
31
|
+
Carries Accept SDK for Android 1.17.0 and 1.18.0 to Expo apps. Both `com.tapaya:accept` and
|
|
32
|
+
the optional `com.tapaya:accept-installer` move to 1.18.0.
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- **`customerFacingFlip` on `setOptions()` and `pay()`.** It controls whether the payment UI
|
|
37
|
+
rotates 180° when the merchant turns the device toward the customer. `'disabled'` is for
|
|
38
|
+
hardware that is already customer-facing — a fixed POS, a dual-sided panel, a device in a stand
|
|
39
|
+
— where that turn never happens and the motion sensors only produce accidental flips. Defaults
|
|
40
|
+
to `'automatic'`, the existing behavior. A companion build that predates the option ignores it.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
Accept.payments.setOptions({ customerFacingFlip: 'disabled' });
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- **An `indicator` on the `externalReader` NFC position.** For kiosks and docks where the reader
|
|
47
|
+
sits outside the screen, it names the edge the reader is beyond (`'top'`, `'right'`,
|
|
48
|
+
`'bottom'`, `'left'`, in the device's natural orientation) and where along it
|
|
49
|
+
(`offsetFraction`, 0 to 1, default 0.5). The tap screen then shows animated chevrons pointing at
|
|
50
|
+
the reader. Omitting it keeps today's behavior, and a companion build that predates the option
|
|
51
|
+
ignores it.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
nfcPosition: { type: 'externalReader', indicator: { edge: 'bottom', offsetFraction: 0.5 } }
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- **`activateTerminal()` rejects with `PluginUnavailable`, as documented,** when the plugin is not
|
|
60
|
+
installed or cannot handle activation. It resolved `{ type: 'failed', reason: 'UNKNOWN' }`
|
|
61
|
+
instead, after needlessly generating a handover code. Code that treated that result as "plugin
|
|
62
|
+
missing" should catch the `AcceptError` instead.
|
|
63
|
+
|
|
64
|
+
- **An optional key set to `undefined` no longer fails the call.** `setOptions()`, `pay()`,
|
|
65
|
+
`payAsync()` and `setTheme()` threw `ERR_UNEXPECTED` ("Value is undefined, expected an
|
|
66
|
+
Object") when an object carried an optional key whose value was `undefined` — for example
|
|
67
|
+
`{ type: 'externalReader', message: undefined }` — because the Expo bridge does not treat an
|
|
68
|
+
explicit `undefined` as absent. Those keys are now dropped before the call crosses the bridge.
|
|
69
|
+
|
|
12
70
|
## [1.16.0] - 2026-10-02
|
|
13
71
|
|
|
14
72
|
### Added
|
package/README.md
CHANGED
|
@@ -185,6 +185,7 @@ Accept.payments.setOptions({
|
|
|
185
185
|
},
|
|
186
186
|
nfcPosition: { type: 'onDevice', surface: 'back', xFraction: 0.5, yFraction: 0.25 },
|
|
187
187
|
transactionTimeoutMs: 60_000, // 0…120000
|
|
188
|
+
customerFacingFlip: 'disabled', // fixed POS / stand: never rotate the UI 180°
|
|
188
189
|
});
|
|
189
190
|
|
|
190
191
|
await Accept.payments.payAsync({
|
|
@@ -197,6 +198,16 @@ await Accept.payments.payAsync({
|
|
|
197
198
|
|
|
198
199
|
Only the keys you pass are changed, so one default can be set without disturbing the others.
|
|
199
200
|
|
|
201
|
+
For a reader outside the screen (a kiosk or dock reader), point the tap screen at it with
|
|
202
|
+
animated chevrons:
|
|
203
|
+
|
|
204
|
+
```ts
|
|
205
|
+
nfcPosition: {
|
|
206
|
+
type: 'externalReader',
|
|
207
|
+
indicator: { edge: 'bottom', offsetFraction: 0.5 }, // 0…1 along the edge
|
|
208
|
+
},
|
|
209
|
+
```
|
|
210
|
+
|
|
200
211
|
### Dual-screen terminals
|
|
201
212
|
|
|
202
213
|
On dual-sided hardware, run the payment UI on the customer-facing panel while your app keeps
|
package/android/build.gradle
CHANGED
|
@@ -62,12 +62,12 @@ def selfInstall = Boolean.parseBoolean(
|
|
|
62
62
|
|
|
63
63
|
dependencies {
|
|
64
64
|
// Published to Maven Central; no additional repository declaration is needed.
|
|
65
|
-
implementation 'com.tapaya:accept:1.
|
|
65
|
+
implementation 'com.tapaya:accept:1.19.0'
|
|
66
66
|
|
|
67
67
|
// Optional, and version-locked to the line above: the installer calls into `:accept` internals
|
|
68
68
|
// that are not part of the public surface, so a skew between the two is a runtime failure
|
|
69
69
|
// rather than a resolution error.
|
|
70
70
|
if (selfInstall) {
|
|
71
|
-
implementation 'com.tapaya:accept-installer:1.
|
|
71
|
+
implementation 'com.tapaya:accept-installer:1.19.0'
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -133,6 +133,7 @@ class AcceptSdkReactNativeModule : Module() {
|
|
|
133
133
|
options.receiptConfig()?.let { Accept.payments.setOptions(receiptConfig = it) }
|
|
134
134
|
options.nfcPosition()?.let { Accept.payments.setOptions(nfcPosition = it) }
|
|
135
135
|
options.display()?.let { Accept.payments.setOptions(display = it) }
|
|
136
|
+
options.customerFacingFlip()?.let { Accept.payments.setOptions(customerFacingFlip = it) }
|
|
136
137
|
if (options.containsKey("transactionTimeoutMs")) {
|
|
137
138
|
Accept.payments.setOptions(transactionTimeout = options.transactionTimeout())
|
|
138
139
|
}
|
|
@@ -155,6 +156,7 @@ class AcceptSdkReactNativeModule : Module() {
|
|
|
155
156
|
tip = request.tip(),
|
|
156
157
|
transactionTimeout = request.transactionTimeout(),
|
|
157
158
|
display = request.display(),
|
|
159
|
+
customerFacingFlip = request.customerFacingFlip(),
|
|
158
160
|
).collect { event ->
|
|
159
161
|
sendEvent(EVENT_PAYMENT, mapOf("requestId" to requestId, "event" to event.serialize()))
|
|
160
162
|
}
|
|
@@ -258,5 +260,8 @@ private fun Map<String, Any?>.nfcPosition() =
|
|
|
258
260
|
private fun Map<String, Any?>.display() =
|
|
259
261
|
(this["display"] as? Map<String, Any?>)?.let(::parsePaymentDisplay)
|
|
260
262
|
|
|
263
|
+
private fun Map<String, Any?>.customerFacingFlip() =
|
|
264
|
+
(this["customerFacingFlip"] as? String)?.let(::parseCustomerFacingFlip)
|
|
265
|
+
|
|
261
266
|
@Suppress("UNCHECKED_CAST")
|
|
262
267
|
private fun Map<String, Any?>.metadata() = this["metadata"] as? Map<String, Any?>
|
|
@@ -5,11 +5,14 @@ import com.tapaya.accept.domain.data.AcceptTheme
|
|
|
5
5
|
import com.tapaya.accept.domain.data.AcceptThemeColors
|
|
6
6
|
import com.tapaya.accept.domain.data.AcceptThemeImages
|
|
7
7
|
import com.tapaya.accept.domain.data.AcceptThemeVariant
|
|
8
|
+
import com.tapaya.accept.domain.data.CustomerFacingFlipConfig
|
|
8
9
|
import com.tapaya.accept.domain.data.DismissBehavior
|
|
9
10
|
import com.tapaya.accept.domain.data.NfcPositionConfig
|
|
10
11
|
import com.tapaya.accept.domain.data.OnDeviceSurface
|
|
11
12
|
import com.tapaya.accept.domain.data.PaymentDisplay
|
|
12
13
|
import com.tapaya.accept.domain.data.PaymentReceiptConfig
|
|
14
|
+
import com.tapaya.accept.domain.data.ReaderEdge
|
|
15
|
+
import com.tapaya.accept.domain.data.ReaderIndicator
|
|
13
16
|
import com.tapaya.accept.domain.data.ReceiptPrintBehavior
|
|
14
17
|
import com.tapaya.accept.domain.data.RefundReason
|
|
15
18
|
import expo.modules.kotlin.exception.CodedException
|
|
@@ -70,7 +73,11 @@ internal fun parseNfcPosition(config: Map<String, Any?>): NfcPositionConfig =
|
|
|
70
73
|
when (val type = config.string("type")) {
|
|
71
74
|
"unspecified" -> NfcPositionConfig.Unspecified
|
|
72
75
|
"externalAbove" -> NfcPositionConfig.ExternalAbove
|
|
73
|
-
"externalReader" -> NfcPositionConfig.ExternalReader(
|
|
76
|
+
"externalReader" -> NfcPositionConfig.ExternalReader(
|
|
77
|
+
message = config.string("message"),
|
|
78
|
+
indicator = config.map("indicator")?.let(::parseReaderIndicator),
|
|
79
|
+
)
|
|
80
|
+
|
|
74
81
|
"onDevice" -> NfcPositionConfig.OnDevice(
|
|
75
82
|
surface = when (val surface = config.string("surface")) {
|
|
76
83
|
"back" -> OnDeviceSurface.BACK
|
|
@@ -84,6 +91,23 @@ internal fun parseNfcPosition(config: Map<String, Any?>): NfcPositionConfig =
|
|
|
84
91
|
else -> invalid("NFC position", type)
|
|
85
92
|
}
|
|
86
93
|
|
|
94
|
+
private fun parseReaderIndicator(indicator: Map<String, Any?>): ReaderIndicator = ReaderIndicator(
|
|
95
|
+
edge = when (val edge = indicator.string("edge")) {
|
|
96
|
+
"top" -> ReaderEdge.TOP
|
|
97
|
+
"right" -> ReaderEdge.RIGHT
|
|
98
|
+
"bottom" -> ReaderEdge.BOTTOM
|
|
99
|
+
"left" -> ReaderEdge.LEFT
|
|
100
|
+
else -> invalid("reader edge", edge)
|
|
101
|
+
},
|
|
102
|
+
offsetFraction = indicator.float("offsetFraction") ?: 0.5f,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
internal fun parseCustomerFacingFlip(config: String): CustomerFacingFlipConfig = when (config) {
|
|
106
|
+
"automatic" -> CustomerFacingFlipConfig.Automatic
|
|
107
|
+
"disabled" -> CustomerFacingFlipConfig.Disabled
|
|
108
|
+
else -> invalid("customer-facing flip", config)
|
|
109
|
+
}
|
|
110
|
+
|
|
87
111
|
internal fun parseReceiptConfig(config: Map<String, Any?>): PaymentReceiptConfig =
|
|
88
112
|
when (val type = config.string("type")) {
|
|
89
113
|
"dismissImmediately" -> PaymentReceiptConfig.DismissImmediately
|
package/build/Accept.d.ts
CHANGED
|
@@ -36,7 +36,9 @@ export declare const Accept: {
|
|
|
36
36
|
readonly isProduction: boolean;
|
|
37
37
|
/**
|
|
38
38
|
* This device's stable identifier, assigned on the first successful
|
|
39
|
-
* {@link auth.authenticate}
|
|
39
|
+
* {@link auth.authenticate}. When the companion app reports one, its id is used, so the id is
|
|
40
|
+
* shared by every host app on the device and survives a reinstall of this app; otherwise it is
|
|
41
|
+
* retained until the app is uninstalled.
|
|
40
42
|
*
|
|
41
43
|
* @returns the device id, or `null` before the first authentication.
|
|
42
44
|
* @throws AcceptError `NotInitialized`, `Unknown`.
|
package/build/Accept.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accept.d.ts","sourceRoot":"","sources":["../src/Accept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACT,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"Accept.d.ts","sourceRoot":"","sources":["../src/Accept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACT,MAAM,gBAAgB,CAAC;AA4UxB;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM;;QAxUjB;;;;;WAKG;oCACyB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;;;QASlD,iGAAiG;0BAClF,MAAM;QAIrB;;;;WAIG;+BACiB,OAAO;QAI3B;;;;;;;;WAQG;oBACS,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;QAIlC;;;;WAIG;0BACe,OAAO,CAAC,aAAa,EAAE,CAAC;;;QAS1C;;;;WAIG;gBACK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAI3C;;;;WAIG;kB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xC;;;OAGG;wBACiB,CAAC,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI;IAMnE;;;;;;OAMG;oBACa,WAAW,GAAG,IAAI,GAAG,IAAI;IAIzC;;;OAGG;gBACS,WAAW,GAAG,IAAI;IAI9B;;;;;;;;;;;OAWG;qCAEO,MAAM,kBACC,MAAM,GACpB,MAAM;CAKV,CAAC"}
|
package/build/Accept.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mapErrors, mapErrorsSync, toAcceptError } from "./AcceptError";
|
|
2
2
|
import Native from "./AcceptSdkReactNativeModule";
|
|
3
|
+
import { withoutUndefined } from "./withoutUndefined";
|
|
3
4
|
/**
|
|
4
5
|
* Correlates a `pay()` call with its events. Monotonic within a JavaScript context, which is all
|
|
5
6
|
* that is needed: the native side only ever routes an event back to the caller that started it.
|
|
@@ -40,7 +41,9 @@ const sdk = {
|
|
|
40
41
|
},
|
|
41
42
|
/**
|
|
42
43
|
* This device's stable identifier, assigned on the first successful
|
|
43
|
-
* {@link auth.authenticate}
|
|
44
|
+
* {@link auth.authenticate}. When the companion app reports one, its id is used, so the id is
|
|
45
|
+
* shared by every host app on the device and survives a reinstall of this app; otherwise it is
|
|
46
|
+
* retained until the app is uninstalled.
|
|
44
47
|
*
|
|
45
48
|
* @returns the device id, or `null` before the first authentication.
|
|
46
49
|
* @throws AcceptError `NotInitialized`, `Unknown`.
|
|
@@ -106,7 +109,7 @@ const payments = {
|
|
|
106
109
|
* before authenticating to keep the warm-up off the merchant's screen.
|
|
107
110
|
*/
|
|
108
111
|
setOptions(options) {
|
|
109
|
-
Native.setPaymentOptions(options);
|
|
112
|
+
Native.setPaymentOptions(withoutUndefined(options));
|
|
110
113
|
},
|
|
111
114
|
/**
|
|
112
115
|
* Launches the plugin's payment flow and streams its lifecycle to `listener`.
|
|
@@ -142,7 +145,7 @@ const payments = {
|
|
|
142
145
|
subscription.remove();
|
|
143
146
|
Native.stopPaymentEvents(requestId);
|
|
144
147
|
};
|
|
145
|
-
Native.startPayment(requestId, request);
|
|
148
|
+
Native.startPayment(requestId, withoutUndefined(request));
|
|
146
149
|
return { remove };
|
|
147
150
|
},
|
|
148
151
|
/**
|
|
@@ -378,7 +381,7 @@ export const Accept = {
|
|
|
378
381
|
* that it was applied — the plugin may not be installed or running yet.
|
|
379
382
|
*/
|
|
380
383
|
setTheme(theme) {
|
|
381
|
-
Native.setTheme(theme);
|
|
384
|
+
Native.setTheme(withoutUndefined(theme));
|
|
382
385
|
},
|
|
383
386
|
/**
|
|
384
387
|
* The theme currently set via {@link setTheme}, or `null`. Reflects local SDK state only, not
|
package/build/Accept.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accept.js","sourceRoot":"","sources":["../src/Accept.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAElD;;;GAGG;AACH,IAAI,aAAa,GAAG,CAAC,CAAC;AACtB,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,UAAU,GAAG,CAAC,KAAmB,EAAE,EAAE,CACzC,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,CAAC;AAE7D;;GAEG;AACH,MAAM,IAAI,GAAG;IACX;;;;;OAKG;IACH,YAAY,CAAC,aAAqB;QAChC,OAAO,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,GAAG,GAAG;IACV,iGAAiG;IACjG,IAAI,OAAO;QACT,OAAO,MAAM,CAAC,aAAa,EAAE,CAAC;IAChC,CAAC;IAED;;;;OAI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IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAyB;QAChC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,wBAAwB,CACtB,MAAc,EACd,gBAAwB,KAAK;QAE7B,OAAO,aAAa,CAAC,GAAG,EAAE,CACxB,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,aAAa,CAAC,CACvD,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import type {\n AcceptDisplay,\n AcceptLogEntry,\n AcceptLogLevel,\n AcceptSubscription,\n AcceptTheme,\n ActivateTerminalResult,\n InitializeOptions,\n MerchantConfig,\n MerchantInformation,\n MinimumAmount,\n OnboardingStatus,\n PayResult,\n PaymentEvent,\n PaymentOptions,\n PaymentRequest,\n PaymentState,\n PaymentStatus,\n PaymentSubscription,\n PluginStatus,\n PluginUpdateInfo,\n RefundReason,\n SdkState,\n} from \"./Accept.types\";\nimport { mapErrors, mapErrorsSync, toAcceptError } from \"./AcceptError\";\nimport Native from \"./AcceptSdkReactNativeModule\";\n\n/**\n * Correlates a `pay()` call with its events. Monotonic within a JavaScript context, which is all\n * that is needed: the native side only ever routes an event back to the caller that started it.\n */\nlet nextRequestId = 0;\nconst newRequestId = () => `pay-${++nextRequestId}`;\n\n/** A payment event that ends the stream. */\nconst isTerminal = (event: PaymentEvent) =>\n event.type === \"result\" || event.type === \"creationFailed\";\n\n/**\n * Authentication surface. Mirrors `Accept.auth`.\n */\nconst auth = {\n /**\n * Authenticates the SDK for the merchant identified by `merchantToken`. Must succeed before\n * {@link merchant} or {@link payments} can be used.\n *\n * @throws AcceptError `NotInitialized`, `NoInternetConnection`, `Unknown`.\n */\n authenticate(merchantToken: string): Promise<void> {\n return mapErrors(() => Native.authenticate(merchantToken));\n },\n};\n\n/**\n * SDK-level configuration and diagnostics. Mirrors `Accept.sdk`.\n */\nconst sdk = {\n /** The version of the Accept SDK for Android bundled in this build. Safe before `initialize`. */\n get version(): string {\n return Native.getSdkVersion();\n },\n\n /**\n * Whether the SDK was initialized against production.\n *\n * @throws AcceptError `NotInitialized`.\n */\n get isProduction(): boolean {\n return mapErrorsSync(() => Native.isProduction());\n },\n\n /**\n * This device's stable identifier, assigned on the first successful\n * {@link auth.authenticate} and retained until the app is uninstalled.\n *\n * @returns the device id, or `null` before the first authentication.\n * @throws AcceptError `NotInitialized`, `Unknown`.\n */\n deviceId(): Promise<string | null> {\n return mapErrors(() => Native.getDeviceId());\n },\n\n /**\n * The minimum payable amount per supported currency.\n *\n * @throws AcceptError `NotInitialized`, `NoInternetConnection`, `Unknown`.\n */\n minimumAmounts(): Promise<MinimumAmount[]> {\n return mapErrors(() => Native.getMinimumAmounts());\n },\n};\n\n/**\n * Merchant profile and onboarding. Mirrors `Accept.merchant`. Requires {@link auth.authenticate}.\n */\nconst merchant = {\n /**\n * The merchant's business profile, or `null` if onboarding hasn't been submitted yet.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n info(): Promise<MerchantInformation | null> {\n return mapErrors(() => Native.getMerchantInfo());\n },\n\n /**\n * The merchant's payment configuration.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n config(): Promise<MerchantConfig> {\n return mapErrors(() => Native.getMerchantConfig());\n },\n\n /**\n * Whether the merchant is ready to accept payments, or what is blocking it.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n onboardingStatus(): Promise<OnboardingStatus> {\n return mapErrors(() => Native.getOnboardingStatus());\n },\n\n /**\n * The currency codes the merchant accepts. Shorthand for `config().availableCurrencies`.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n availableCurrencies(): Promise<string[]> {\n return mapErrors(() => Native.getAvailableCurrencies());\n },\n};\n\n/**\n * Payments. Mirrors `Accept.payments`. Requires {@link auth.authenticate}.\n */\nconst payments = {\n /**\n * Sets the defaults applied to payments that don't override them on {@link pay}.\n *\n * Only the keys present are changed, so one option can be set without disturbing the others.\n * `display` is also what the terminal warm-up fired by {@link auth.authenticate} follows — set it\n * before authenticating to keep the warm-up off the merchant's screen.\n */\n setOptions(options: PaymentOptions): void {\n Native.setPaymentOptions(options);\n },\n\n /**\n * Launches the plugin's payment flow and streams its lifecycle to `listener`.\n *\n * Never throws: a failure to create the payment arrives as a `creationFailed` event carrying an\n * {@link AcceptError}. The stream ends after `result` or `creationFailed`, at which point the\n * subscription removes itself.\n *\n * ```ts\n * Accept.payments.pay({ amount: 1000, currency: 'USD' }, (event) => {\n * if (event.type === 'result' && event.payResult.type === 'success') {\n * console.log(event.payResult.paymentToken);\n * }\n * });\n * ```\n *\n * @returns a handle that stops delivering events; see {@link PaymentSubscription.remove}.\n */\n pay(\n request: PaymentRequest,\n listener: (event: PaymentEvent) => void,\n ): PaymentSubscription {\n const requestId = newRequestId();\n let removed = false;\n\n const subscription = Native.addListener(\"onPaymentEvent\", (payload) => {\n if (payload.requestId !== requestId) return;\n if (isTerminal(payload.event)) remove();\n listener(payload.event);\n });\n\n const remove = () => {\n if (removed) return;\n removed = true;\n subscription.remove();\n Native.stopPaymentEvents(requestId);\n };\n\n Native.startPayment(requestId, request);\n return { remove };\n },\n\n /**\n * {@link pay} reduced to its outcome, for callers that don't render the intermediate states.\n *\n * @returns the terminal {@link PayResult}.\n * @throws AcceptError whatever the payment would have reported as `creationFailed` — including\n * `PaymentInProgress`, `NotAuthenticated`, `PluginNotReadyForPayments`, `AmountBelowMinimum`,\n * and `LocationPermissionRequired`.\n */\n payAsync(request: PaymentRequest): Promise<PayResult> {\n return new Promise<PayResult>((resolve, reject) => {\n payments.pay(request, (event) => {\n if (event.type === \"result\") resolve(event.payResult);\n else if (event.type === \"creationFailed\")\n reject(toAcceptError(event.error));\n });\n });\n },\n\n /**\n * The current status of the payment identified by `paymentToken`.\n *\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n status(paymentToken: string): Promise<PaymentStatus> {\n return mapErrors(() => Native.getPaymentStatus(paymentToken));\n },\n\n /**\n * Cancels the payment identified by `paymentToken`.\n *\n * @returns the resulting {@link PaymentState}.\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n cancel(paymentToken: string): Promise<PaymentState> {\n return mapErrors(() => Native.cancelPayment(paymentToken));\n },\n\n /**\n * Refunds the payment identified by `paymentToken`.\n *\n * @returns the resulting {@link PaymentState}.\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n refund(paymentToken: string, reason: RefundReason): Promise<PaymentState> {\n return mapErrors(() => Native.refundPayment(paymentToken, reason));\n },\n};\n\n/**\n * The Accept plugin app — the companion that drives the physical terminal. Mirrors `Accept.plugin`.\n */\nconst plugin = {\n /**\n * Whether the plugin app is installed on this device.\n *\n * @throws AcceptError `NotInitialized`, `Unknown`.\n */\n isInstalled(): boolean {\n return mapErrorsSync(() => Native.isPluginInstalled());\n },\n\n /**\n * Installs the plugin app.\n *\n * On a device with an app store this opens the plugin's listing — branded when the authenticated\n * organization configured one — and needs no session to do it.\n *\n * On a device with no store the SDK downloads the APK and installs it through the system\n * installer. That path is opt-in: pass `{ selfInstall: true }` to this package's config plugin,\n * or it fails with `PluginSelfInstallUnavailable`. It also needs an authenticated merchant\n * (`PluginInstallAuthRequired`) and the user's \"Install unknown apps\" grant for the host app\n * (`PluginInstallPermissionRequired` — send them to Android's\n * `android.settings.MANAGE_UNKNOWN_APP_SOURCES` screen and call this again).\n *\n * `PluginDownloadNotPermitted` is an entitlement decision rather than anything retryable: the\n * merchant is not enabled for the non-store distribution channel. Point them at their account\n * manager or developers@tapaya.com.\n *\n * @throws AcceptError `NotInitialized`, `PluginStoreUnavailable`, `PluginSelfInstallUnavailable`,\n * `PluginInstallAuthRequired`, `PluginInstallPermissionRequired`, `PluginDownloadNotPermitted`,\n * `NoInternetConnection`, `Unknown`.\n */\n install(): Promise<void> {\n return mapErrors(() => Native.installPlugin());\n },\n\n /**\n * Runs the plugin's terminal activation flow and resolves when it finishes. Activation is\n * required before the device can take card payments.\n *\n * @throws AcceptError `ActivationInProgress`, `NotAuthenticated`, `PluginUnavailable`,\n * `NoInternetConnection`, `NoTidsAvailableForMerchant`, `MerchantOnboardingIncomplete`,\n * `Unknown`.\n */\n activateTerminal(): Promise<ActivateTerminalResult> {\n return mapErrors(() => Native.activateTerminal());\n },\n\n /**\n * The plugin's current installed/authenticated/ready state.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n status(): Promise<PluginStatus> {\n return mapErrors(() => Native.getPluginStatus());\n },\n\n /**\n * Whether a newer plugin build is available. Call {@link install} on `updateAvailable`.\n *\n * Answered from the backend's release metadata against the installed package, unauthenticated,\n * so it works during device setup, with no store, and with the plugin absent. A Play-installed\n * plugin is still measured against Play, since a release reaches the backend while the same\n * build can sit in review; the plugin's own check is the fallback.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n updateInfo(): Promise<PluginUpdateInfo> {\n return mapErrors(() => Native.getPluginUpdateInfo());\n },\n\n /**\n * Logs the merchant out of the plugin app.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n logout(): Promise<void> {\n return mapErrors(() => Native.logoutPlugin());\n },\n};\n\n/**\n * Screen topology, for dual-sided POS hardware. Mirrors `Accept.displays`.\n *\n * Every member reads the platform live, so a display hot-plugged or powered off between calls is\n * reflected immediately. None of them throw.\n */\nconst displays = {\n /** Every display the device currently reports, primary first. */\n all(): AcceptDisplay[] {\n return Native.getDisplays();\n },\n\n /**\n * The customer-facing panel of a dual-sided device, or `null` on single-screen devices. This is\n * what `{ type: 'customerFacing' }` targets.\n */\n customerFacing(): AcceptDisplay | null {\n return Native.getCustomerFacingDisplay();\n },\n\n /** Whether a customer-facing display is available right now. */\n get isDualScreen(): boolean {\n return Native.isDualScreen();\n },\n};\n\n/** The listener currently receiving forwarded SDK logs, if any. */\nlet logSubscription: AcceptSubscription | null = null;\n\n/**\n * Entry point to the Accept SDK. Mirrors the `Accept` object in the Accept SDK for Android, so the\n * Android reference documentation applies unchanged.\n *\n * ```ts\n * import Accept from '@tapayadot/accept-react-native';\n *\n * Accept.initialize({ isProduction: false });\n * await Accept.auth.authenticate(merchantToken);\n *\n * if (!Accept.plugin.isInstalled()) await Accept.plugin.install();\n * await Accept.plugin.activateTerminal();\n *\n * const result = await Accept.payments.payAsync({ amount: 1000, currency: 'USD' });\n * ```\n */\nexport const Accept = {\n auth,\n sdk,\n merchant,\n payments,\n plugin,\n displays,\n\n /**\n * Initializes the SDK against sandbox or production. Must be called before any other surface is\n * used — typically once, at app startup.\n *\n * Safe to call more than once; each call resets which environment subsequent requests target.\n */\n initialize(options: InitializeOptions = {}): void {\n Native.initialize(options.isProduction ?? false);\n },\n\n /** The SDK's current lifecycle state. */\n get state(): SdkState {\n return Native.getState();\n },\n\n /**\n * Subscribes to {@link state} transitions. The listener fires with the current state on\n * subscription, then on every change.\n */\n addStateListener(listener: (state: SdkState) => void): AcceptSubscription {\n return Native.addListener(\"onStateChange\", ({ state }) => listener(state));\n },\n\n /**\n * Clears all locally persisted SDK state — auth token, device id, cached config, and theme — and\n * resets {@link state} to `idle`. Call this on merchant logout.\n *\n * @throws AcceptError `Unknown`.\n */\n clear(): Promise<void> {\n return mapErrors(() => Native.clear());\n },\n\n /**\n * Enables or disables diagnostic logging. Shorthand for {@link setLogLevel}: `true` maps to\n * `'DEBUG'`, `false` to `'NONE'`.\n */\n setDebugLoggingEnabled(enabled: boolean): void {\n Native.setDebugLoggingEnabled(enabled);\n },\n\n /**\n * Sets the verbosity of diagnostic logging. Defaults to `'DEBUG'` against sandbox and `'NONE'`\n * against production; call after {@link initialize} to override.\n */\n setLogLevel(level: AcceptLogLevel): void {\n Native.setLogLevel(level);\n },\n\n /**\n * Routes SDK logs into `listener` instead of Logcat, for forwarding into your own logging stack.\n * Pass `null` to restore the default Logcat sink.\n */\n setLogger(listener: ((entry: AcceptLogEntry) => void) | null): void {\n logSubscription?.remove();\n logSubscription = listener ? Native.addListener(\"onLog\", listener) : null;\n Native.setLogForwardingEnabled(listener !== null);\n },\n\n /**\n * Sets the branding applied to the plugin's activation, status, and payment screens.\n *\n * Session-wide, not per payment: it persists until changed or cleared with `null`. Pushed to the\n * plugin opportunistically the next time it is bound or launched, so there is no confirmation\n * that it was applied — the plugin may not be installed or running yet.\n */\n setTheme(theme: AcceptTheme | null): void {\n Native.setTheme(theme);\n },\n\n /**\n * The theme currently set via {@link setTheme}, or `null`. Reflects local SDK state only, not\n * whether the plugin applied it.\n */\n getTheme(): AcceptTheme | null {\n return Native.getTheme();\n },\n\n /**\n * Stores `base64` image data in SDK-private storage and returns a `content://` URL the plugin can\n * read — for a logo the host app holds locally rather than at a stable URL. Use the result\n * anywhere an {@link AcceptTheme} image field takes a URL.\n *\n * `assetToBase64` from `@tapayadot/accept-react-native/utils` turns a `require('./logo.png')`\n * into the expected string.\n *\n * @param fileExtension the extension to store the data under, without a leading dot. Tells the\n * plugin how to decode it; defaults to `'png'`.\n * @throws AcceptError `NotInitialized`.\n */\n createLocalThemeImageUri(\n base64: string,\n fileExtension: string = \"png\",\n ): string {\n return mapErrorsSync(() =>\n Native.createLocalThemeImageUri(base64, fileExtension),\n );\n },\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Accept.js","sourceRoot":"","sources":["../src/Accept.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAClD,OAAO,EAAE,g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AAK,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,OAAO,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,sBAAsB,CAAC,OAAgB;QACrC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,WAAW,CAAC,KAAqB;QAC/B,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,QAAkD;QAC1D,eAAe,EAAE,MAAM,EAAE,CAAC;QAC1B,eAAe,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1E,MAAM,CAAC,uBAAuB,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,KAAyB;QAChC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,QAAQ;QACN,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;OAWG;IACH,wBAAwB,CACtB,MAAc,EACd,gBAAwB,KAAK;QAE7B,OAAO,aAAa,CAAC,GAAG,EAAE,CACxB,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,aAAa,CAAC,CACvD,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import type {\n AcceptDisplay,\n AcceptLogEntry,\n AcceptLogLevel,\n AcceptSubscription,\n AcceptTheme,\n ActivateTerminalResult,\n InitializeOptions,\n MerchantConfig,\n MerchantInformation,\n MinimumAmount,\n OnboardingStatus,\n PayResult,\n PaymentEvent,\n PaymentOptions,\n PaymentRequest,\n PaymentState,\n PaymentStatus,\n PaymentSubscription,\n PluginStatus,\n PluginUpdateInfo,\n RefundReason,\n SdkState,\n} from \"./Accept.types\";\nimport { mapErrors, mapErrorsSync, toAcceptError } from \"./AcceptError\";\nimport Native from \"./AcceptSdkReactNativeModule\";\nimport { withoutUndefined } from \"./withoutUndefined\";\n\n/**\n * Correlates a `pay()` call with its events. Monotonic within a JavaScript context, which is all\n * that is needed: the native side only ever routes an event back to the caller that started it.\n */\nlet nextRequestId = 0;\nconst newRequestId = () => `pay-${++nextRequestId}`;\n\n/** A payment event that ends the stream. */\nconst isTerminal = (event: PaymentEvent) =>\n event.type === \"result\" || event.type === \"creationFailed\";\n\n/**\n * Authentication surface. Mirrors `Accept.auth`.\n */\nconst auth = {\n /**\n * Authenticates the SDK for the merchant identified by `merchantToken`. Must succeed before\n * {@link merchant} or {@link payments} can be used.\n *\n * @throws AcceptError `NotInitialized`, `NoInternetConnection`, `Unknown`.\n */\n authenticate(merchantToken: string): Promise<void> {\n return mapErrors(() => Native.authenticate(merchantToken));\n },\n};\n\n/**\n * SDK-level configuration and diagnostics. Mirrors `Accept.sdk`.\n */\nconst sdk = {\n /** The version of the Accept SDK for Android bundled in this build. Safe before `initialize`. */\n get version(): string {\n return Native.getSdkVersion();\n },\n\n /**\n * Whether the SDK was initialized against production.\n *\n * @throws AcceptError `NotInitialized`.\n */\n get isProduction(): boolean {\n return mapErrorsSync(() => Native.isProduction());\n },\n\n /**\n * This device's stable identifier, assigned on the first successful\n * {@link auth.authenticate}. When the companion app reports one, its id is used, so the id is\n * shared by every host app on the device and survives a reinstall of this app; otherwise it is\n * retained until the app is uninstalled.\n *\n * @returns the device id, or `null` before the first authentication.\n * @throws AcceptError `NotInitialized`, `Unknown`.\n */\n deviceId(): Promise<string | null> {\n return mapErrors(() => Native.getDeviceId());\n },\n\n /**\n * The minimum payable amount per supported currency.\n *\n * @throws AcceptError `NotInitialized`, `NoInternetConnection`, `Unknown`.\n */\n minimumAmounts(): Promise<MinimumAmount[]> {\n return mapErrors(() => Native.getMinimumAmounts());\n },\n};\n\n/**\n * Merchant profile and onboarding. Mirrors `Accept.merchant`. Requires {@link auth.authenticate}.\n */\nconst merchant = {\n /**\n * The merchant's business profile, or `null` if onboarding hasn't been submitted yet.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n info(): Promise<MerchantInformation | null> {\n return mapErrors(() => Native.getMerchantInfo());\n },\n\n /**\n * The merchant's payment configuration.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n config(): Promise<MerchantConfig> {\n return mapErrors(() => Native.getMerchantConfig());\n },\n\n /**\n * Whether the merchant is ready to accept payments, or what is blocking it.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n onboardingStatus(): Promise<OnboardingStatus> {\n return mapErrors(() => Native.getOnboardingStatus());\n },\n\n /**\n * The currency codes the merchant accepts. Shorthand for `config().availableCurrencies`.\n *\n * @throws AcceptError `NotAuthenticated`, `NoInternetConnection`, `Unknown`.\n */\n availableCurrencies(): Promise<string[]> {\n return mapErrors(() => Native.getAvailableCurrencies());\n },\n};\n\n/**\n * Payments. Mirrors `Accept.payments`. Requires {@link auth.authenticate}.\n */\nconst payments = {\n /**\n * Sets the defaults applied to payments that don't override them on {@link pay}.\n *\n * Only the keys present are changed, so one option can be set without disturbing the others.\n * `display` is also what the terminal warm-up fired by {@link auth.authenticate} follows — set it\n * before authenticating to keep the warm-up off the merchant's screen.\n */\n setOptions(options: PaymentOptions): void {\n Native.setPaymentOptions(withoutUndefined(options));\n },\n\n /**\n * Launches the plugin's payment flow and streams its lifecycle to `listener`.\n *\n * Never throws: a failure to create the payment arrives as a `creationFailed` event carrying an\n * {@link AcceptError}. The stream ends after `result` or `creationFailed`, at which point the\n * subscription removes itself.\n *\n * ```ts\n * Accept.payments.pay({ amount: 1000, currency: 'USD' }, (event) => {\n * if (event.type === 'result' && event.payResult.type === 'success') {\n * console.log(event.payResult.paymentToken);\n * }\n * });\n * ```\n *\n * @returns a handle that stops delivering events; see {@link PaymentSubscription.remove}.\n */\n pay(\n request: PaymentRequest,\n listener: (event: PaymentEvent) => void,\n ): PaymentSubscription {\n const requestId = newRequestId();\n let removed = false;\n\n const subscription = Native.addListener(\"onPaymentEvent\", (payload) => {\n if (payload.requestId !== requestId) return;\n if (isTerminal(payload.event)) remove();\n listener(payload.event);\n });\n\n const remove = () => {\n if (removed) return;\n removed = true;\n subscription.remove();\n Native.stopPaymentEvents(requestId);\n };\n\n Native.startPayment(requestId, withoutUndefined(request));\n return { remove };\n },\n\n /**\n * {@link pay} reduced to its outcome, for callers that don't render the intermediate states.\n *\n * @returns the terminal {@link PayResult}.\n * @throws AcceptError whatever the payment would have reported as `creationFailed` — including\n * `PaymentInProgress`, `NotAuthenticated`, `PluginNotReadyForPayments`, `AmountBelowMinimum`,\n * and `LocationPermissionRequired`.\n */\n payAsync(request: PaymentRequest): Promise<PayResult> {\n return new Promise<PayResult>((resolve, reject) => {\n payments.pay(request, (event) => {\n if (event.type === \"result\") resolve(event.payResult);\n else if (event.type === \"creationFailed\")\n reject(toAcceptError(event.error));\n });\n });\n },\n\n /**\n * The current status of the payment identified by `paymentToken`.\n *\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n status(paymentToken: string): Promise<PaymentStatus> {\n return mapErrors(() => Native.getPaymentStatus(paymentToken));\n },\n\n /**\n * Cancels the payment identified by `paymentToken`.\n *\n * @returns the resulting {@link PaymentState}.\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n cancel(paymentToken: string): Promise<PaymentState> {\n return mapErrors(() => Native.cancelPayment(paymentToken));\n },\n\n /**\n * Refunds the payment identified by `paymentToken`.\n *\n * @returns the resulting {@link PaymentState}.\n * @throws AcceptError `NotAuthenticated`, `SessionExpired`, `PaymentNotFound`,\n * `NoInternetConnection`, `Unknown`.\n */\n refund(paymentToken: string, reason: RefundReason): Promise<PaymentState> {\n return mapErrors(() => Native.refundPayment(paymentToken, reason));\n },\n};\n\n/**\n * The Accept plugin app — the companion that drives the physical terminal. Mirrors `Accept.plugin`.\n */\nconst plugin = {\n /**\n * Whether the plugin app is installed on this device.\n *\n * @throws AcceptError `NotInitialized`, `Unknown`.\n */\n isInstalled(): boolean {\n return mapErrorsSync(() => Native.isPluginInstalled());\n },\n\n /**\n * Installs the plugin app.\n *\n * On a device with an app store this opens the plugin's listing — branded when the authenticated\n * organization configured one — and needs no session to do it.\n *\n * On a device with no store the SDK downloads the APK and installs it through the system\n * installer. That path is opt-in: pass `{ selfInstall: true }` to this package's config plugin,\n * or it fails with `PluginSelfInstallUnavailable`. It also needs an authenticated merchant\n * (`PluginInstallAuthRequired`) and the user's \"Install unknown apps\" grant for the host app\n * (`PluginInstallPermissionRequired` — send them to Android's\n * `android.settings.MANAGE_UNKNOWN_APP_SOURCES` screen and call this again).\n *\n * `PluginDownloadNotPermitted` is an entitlement decision rather than anything retryable: the\n * merchant is not enabled for the non-store distribution channel. Point them at their account\n * manager or developers@tapaya.com.\n *\n * @throws AcceptError `NotInitialized`, `PluginStoreUnavailable`, `PluginSelfInstallUnavailable`,\n * `PluginInstallAuthRequired`, `PluginInstallPermissionRequired`, `PluginDownloadNotPermitted`,\n * `NoInternetConnection`, `Unknown`.\n */\n install(): Promise<void> {\n return mapErrors(() => Native.installPlugin());\n },\n\n /**\n * Runs the plugin's terminal activation flow and resolves when it finishes. Activation is\n * required before the device can take card payments.\n *\n * @throws AcceptError `ActivationInProgress`, `NotAuthenticated`, `PluginUnavailable`,\n * `NoInternetConnection`, `NoTidsAvailableForMerchant`, `MerchantOnboardingIncomplete`,\n * `Unknown`.\n */\n activateTerminal(): Promise<ActivateTerminalResult> {\n return mapErrors(() => Native.activateTerminal());\n },\n\n /**\n * The plugin's current installed/authenticated/ready state.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n status(): Promise<PluginStatus> {\n return mapErrors(() => Native.getPluginStatus());\n },\n\n /**\n * Whether a newer plugin build is available. Call {@link install} on `updateAvailable`.\n *\n * Answered from the backend's release metadata against the installed package, unauthenticated,\n * so it works during device setup, with no store, and with the plugin absent. A Play-installed\n * plugin is still measured against Play, since a release reaches the backend while the same\n * build can sit in review; the plugin's own check is the fallback.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n updateInfo(): Promise<PluginUpdateInfo> {\n return mapErrors(() => Native.getPluginUpdateInfo());\n },\n\n /**\n * Logs the merchant out of the plugin app.\n *\n * @throws AcceptError `NotInitialized`, `PluginUnavailable`, `PluginTimeout`, `Unknown`.\n */\n logout(): Promise<void> {\n return mapErrors(() => Native.logoutPlugin());\n },\n};\n\n/**\n * Screen topology, for dual-sided POS hardware. Mirrors `Accept.displays`.\n *\n * Every member reads the platform live, so a display hot-plugged or powered off between calls is\n * reflected immediately. None of them throw.\n */\nconst displays = {\n /** Every display the device currently reports, primary first. */\n all(): AcceptDisplay[] {\n return Native.getDisplays();\n },\n\n /**\n * The customer-facing panel of a dual-sided device, or `null` on single-screen devices. This is\n * what `{ type: 'customerFacing' }` targets.\n */\n customerFacing(): AcceptDisplay | null {\n return Native.getCustomerFacingDisplay();\n },\n\n /** Whether a customer-facing display is available right now. */\n get isDualScreen(): boolean {\n return Native.isDualScreen();\n },\n};\n\n/** The listener currently receiving forwarded SDK logs, if any. */\nlet logSubscription: AcceptSubscription | null = null;\n\n/**\n * Entry point to the Accept SDK. Mirrors the `Accept` object in the Accept SDK for Android, so the\n * Android reference documentation applies unchanged.\n *\n * ```ts\n * import Accept from '@tapayadot/accept-react-native';\n *\n * Accept.initialize({ isProduction: false });\n * await Accept.auth.authenticate(merchantToken);\n *\n * if (!Accept.plugin.isInstalled()) await Accept.plugin.install();\n * await Accept.plugin.activateTerminal();\n *\n * const result = await Accept.payments.payAsync({ amount: 1000, currency: 'USD' });\n * ```\n */\nexport const Accept = {\n auth,\n sdk,\n merchant,\n payments,\n plugin,\n displays,\n\n /**\n * Initializes the SDK against sandbox or production. Must be called before any other surface is\n * used — typically once, at app startup.\n *\n * Safe to call more than once; each call resets which environment subsequent requests target.\n */\n initialize(options: InitializeOptions = {}): void {\n Native.initialize(options.isProduction ?? false);\n },\n\n /** The SDK's current lifecycle state. */\n get state(): SdkState {\n return Native.getState();\n },\n\n /**\n * Subscribes to {@link state} transitions. The listener fires with the current state on\n * subscription, then on every change.\n */\n addStateListener(listener: (state: SdkState) => void): AcceptSubscription {\n return Native.addListener(\"onStateChange\", ({ state }) => listener(state));\n },\n\n /**\n * Clears all locally persisted SDK state — auth token, device id, cached config, and theme — and\n * resets {@link state} to `idle`. Call this on merchant logout.\n *\n * @throws AcceptError `Unknown`.\n */\n clear(): Promise<void> {\n return mapErrors(() => Native.clear());\n },\n\n /**\n * Enables or disables diagnostic logging. Shorthand for {@link setLogLevel}: `true` maps to\n * `'DEBUG'`, `false` to `'NONE'`.\n */\n setDebugLoggingEnabled(enabled: boolean): void {\n Native.setDebugLoggingEnabled(enabled);\n },\n\n /**\n * Sets the verbosity of diagnostic logging. Defaults to `'DEBUG'` against sandbox and `'NONE'`\n * against production; call after {@link initialize} to override.\n */\n setLogLevel(level: AcceptLogLevel): void {\n Native.setLogLevel(level);\n },\n\n /**\n * Routes SDK logs into `listener` instead of Logcat, for forwarding into your own logging stack.\n * Pass `null` to restore the default Logcat sink.\n */\n setLogger(listener: ((entry: AcceptLogEntry) => void) | null): void {\n logSubscription?.remove();\n logSubscription = listener ? Native.addListener(\"onLog\", listener) : null;\n Native.setLogForwardingEnabled(listener !== null);\n },\n\n /**\n * Sets the branding applied to the plugin's activation, status, and payment screens.\n *\n * Session-wide, not per payment: it persists until changed or cleared with `null`. Pushed to the\n * plugin opportunistically the next time it is bound or launched, so there is no confirmation\n * that it was applied — the plugin may not be installed or running yet.\n */\n setTheme(theme: AcceptTheme | null): void {\n Native.setTheme(withoutUndefined(theme));\n },\n\n /**\n * The theme currently set via {@link setTheme}, or `null`. Reflects local SDK state only, not\n * whether the plugin applied it.\n */\n getTheme(): AcceptTheme | null {\n return Native.getTheme();\n },\n\n /**\n * Stores `base64` image data in SDK-private storage and returns a `content://` URL the plugin can\n * read — for a logo the host app holds locally rather than at a stable URL. Use the result\n * anywhere an {@link AcceptTheme} image field takes a URL.\n *\n * `assetToBase64` from `@tapayadot/accept-react-native/utils` turns a `require('./logo.png')`\n * into the expected string.\n *\n * @param fileExtension the extension to store the data under, without a leading dot. Tells the\n * plugin how to decode it; defaults to `'png'`.\n * @throws AcceptError `NotInitialized`.\n */\n createLocalThemeImageUri(\n base64: string,\n fileExtension: string = \"png\",\n ): string {\n return mapErrorsSync(() =>\n Native.createLocalThemeImageUri(base64, fileExtension),\n );\n },\n};\n"]}
|
package/build/Accept.types.d.ts
CHANGED
|
@@ -204,7 +204,10 @@ export type NfcPositionConfig = {
|
|
|
204
204
|
type: "externalAbove";
|
|
205
205
|
} | {
|
|
206
206
|
type: "externalReader";
|
|
207
|
+
/** Replaces the companion's own prompt; you own its localization. Blank keeps the default. */
|
|
207
208
|
message?: string;
|
|
209
|
+
/** Which screen edge the reader sits beyond. Omit to show no chevrons. */
|
|
210
|
+
indicator?: ReaderIndicator;
|
|
208
211
|
} | {
|
|
209
212
|
type: "onDevice";
|
|
210
213
|
surface: OnDeviceSurface;
|
|
@@ -213,6 +216,25 @@ export type NfcPositionConfig = {
|
|
|
213
216
|
/** Vertical position of the antenna, 0..1 down the surface. */
|
|
214
217
|
yFraction: number;
|
|
215
218
|
};
|
|
219
|
+
/** Screen edge an external reader sits beyond, in the device's natural orientation. Mirrors `ReaderEdge`. */
|
|
220
|
+
export type ReaderEdge = "top" | "right" | "bottom" | "left";
|
|
221
|
+
/** Where an external reader sits relative to the screen. Mirrors `ReaderIndicator`. */
|
|
222
|
+
export type ReaderIndicator = {
|
|
223
|
+
edge: ReaderEdge;
|
|
224
|
+
/**
|
|
225
|
+
* Position along {@link edge}, 0..1: left to right along `top`/`bottom`, top to bottom along
|
|
226
|
+
* `left`/`right`. Defaults to 0.5.
|
|
227
|
+
*/
|
|
228
|
+
offsetFraction?: number;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Whether the payment UI may rotate 180° when the merchant turns the device toward the customer.
|
|
232
|
+
* Mirrors `CustomerFacingFlipConfig`. `'disabled'` is for hardware that is already
|
|
233
|
+
* customer-facing — a fixed POS, a dual-sided panel, a device in a stand — where the turn never
|
|
234
|
+
* happens and the sensors only produce accidental flips. A companion build that predates the
|
|
235
|
+
* option ignores it.
|
|
236
|
+
*/
|
|
237
|
+
export type CustomerFacingFlipConfig = "automatic" | "disabled";
|
|
216
238
|
/** Which screen the plugin's payment UI runs on. Mirrors `PaymentDisplay`. */
|
|
217
239
|
export type PaymentDisplay = {
|
|
218
240
|
type: "default";
|
|
@@ -232,6 +254,8 @@ export type PaymentOptions = {
|
|
|
232
254
|
*/
|
|
233
255
|
transactionTimeoutMs?: number | null;
|
|
234
256
|
display?: PaymentDisplay;
|
|
257
|
+
/** Defaults to `'automatic'`. */
|
|
258
|
+
customerFacingFlip?: CustomerFacingFlipConfig;
|
|
235
259
|
};
|
|
236
260
|
/** A payment to run. Mirrors the parameters of `AcceptPayments.pay`. */
|
|
237
261
|
export type PaymentRequest = {
|
|
@@ -253,6 +277,8 @@ export type PaymentRequest = {
|
|
|
253
277
|
transactionTimeoutMs?: number;
|
|
254
278
|
/** Overrides the session default for this payment only. */
|
|
255
279
|
display?: PaymentDisplay;
|
|
280
|
+
/** Overrides the session default for this payment only. */
|
|
281
|
+
customerFacingFlip?: CustomerFacingFlipConfig;
|
|
256
282
|
};
|
|
257
283
|
/** Handle returned by {@link AcceptPayments.pay}. */
|
|
258
284
|
export type PaymentSubscription = {
|
|
@@ -1 +1 @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,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF,oCAAoC;AACpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,uGAAuG;AACvG,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,IAAI,CAAC,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AAIF,kFAAkF;AAClF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accept.types.js","sourceRoot":"","sources":["../src/Accept.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Types mirroring the Accept SDK for Android.\n *\n * Every name here corresponds 1:1 to a type in `com.tapaya.accept`, so the Android reference\n * documentation applies unchanged. Kotlin sealed interfaces become tagged unions discriminated on\n * `type`; Kotlin enums become string-literal unions.\n */\n\n// ── Lifecycle ─────────────────────────────────────────────────────────────────\n\n/**\n * Lifecycle state of the SDK. Mirrors `SdkState`.\n *\n * - `idle` — {@link Accept.initialize} has not been called yet.\n * - `initialized` — ready for {@link AcceptAuth.authenticate}.\n * - `authenticated` — the merchant and payments surfaces are usable.\n */\nexport type SdkState = \"idle\" | \"initialized\" | \"authenticated\";\n\n/** Options for {@link Accept.initialize}. */\nexport type InitializeOptions = {\n /** `true` to target production, `false` (the default) to target sandbox. */\n isProduction?: boolean;\n};\n\n// ── Diagnostics ───────────────────────────────────────────────────────────────\n\n/** Verbosity threshold for the SDK's diagnostic logging, least to most verbose. */\nexport type AcceptLogLevel =\n \"NONE\" | \"ERROR\" | \"WARN\" | \"INFO\" | \"DEBUG\" | \"VERBOSE\";\n\n/** A single diagnostic log line, delivered to the listener passed to {@link Accept.setLogger}. */\nexport type AcceptLogEntry = {\n level: AcceptLogLevel;\n /** Stable Logcat-style tag identifying the SDK. */\n tag: string;\n /** Human-readable, already redacted message. */\n message: string;\n /** Message of the cause associated with this line, when there is one. */\n throwable: string | null;\n};\n\n// ── Errors ────────────────────────────────────────────────────────────────────\n\n/** Discriminator on {@link AcceptError}; mirrors the `AcceptException` subclass names. */\nexport type AcceptErrorCode =\n | \"NotInitialized\"\n | \"NotAuthenticated\"\n | \"PluginUnavailable\"\n | \"PaymentInProgress\"\n | \"ActivationInProgress\"\n | \"PluginAlreadyAuthenticated\"\n | \"PluginMerchantMismatch\"\n | \"NoTidsAvailableForMerchant\"\n | \"MerchantOnboardingIncomplete\"\n | \"UnsupportedCurrency\"\n | \"CurrencyNotAvailableForMerchant\"\n | \"AmountBelowMinimum\"\n | \"TransactionTimeoutOutOfRange\"\n | \"PluginNotReadyForPayments\"\n | \"PaymentCreationFailed\"\n | \"LocationPermissionRequired\"\n | \"LocationUnavailable\"\n | \"LocationTimeout\"\n | \"NoInternetConnection\"\n | \"SessionExpired\"\n | \"PaymentNotFound\"\n | \"PluginStoreUnavailable\"\n | \"PluginSelfInstallUnavailable\"\n | \"PluginInstallPermissionRequired\"\n | \"PluginInstallAuthRequired\"\n | \"PluginDownloadNotPermitted\"\n | \"PluginTimeout\"\n | \"UnknownEnvironment\"\n | \"Unknown\";\n\n/** The payload fields carried by the error codes that have any. */\nexport type AcceptErrorDetails = {\n /** `MerchantOnboardingIncomplete`: the merchant's current onboarding state. */\n state?: OnboardingState;\n /** `UnsupportedCurrency`, `CurrencyNotAvailableForMerchant`, `AmountBelowMinimum`. */\n currency?: string;\n /** `AmountBelowMinimum`: the minimum required amount, in minor units. */\n minimum?: number;\n /** `TransactionTimeoutOutOfRange`: the out-of-range value that was passed, in milliseconds. */\n transactionTimeoutMs?: number;\n /** `PluginNotReadyForPayments`: the plugin's status at the time of the call. */\n status?: PluginStatus;\n /** `UnknownEnvironment`: the environment key that was not recognized. */\n environment?: string;\n /** `PaymentCreationFailed`, `Unknown`: the underlying error's message. Not for end-user display. */\n cause?: string;\n};\n\n// ── SDK configuration ─────────────────────────────────────────────────────────\n\n/** The minimum payable amount for one currency. Mirrors `MinimumAmount`. */\nexport type MinimumAmount = {\n /** ISO 4217 currency code. */\n currency: string;\n /** The minimum amount, in the currency's minor unit. */\n amount: number;\n};\n\n// ── Merchant ──────────────────────────────────────────────────────────────────\n\n/** Mirrors `BusinessType`. */\nexport type BusinessType =\n | \"INDIVIDUAL\"\n | \"COMPANY\"\n | \"NONPROFIT_ORGANIZATION\"\n | \"GOVERNMENT_ENTITY\"\n | \"PARTNERSHIP\";\n\n/** The merchant's payment configuration. Mirrors `MerchantConfig`. */\nexport type MerchantConfig = {\n /** ISO 4217 codes the merchant is configured to accept. */\n availableCurrencies: string[];\n /** The merchant's default currency, when one is set. */\n currency: string | null;\n};\n\n/** The merchant's business profile. Mirrors `MerchantInformation`. */\nexport type MerchantInformation = {\n merchantId: string;\n email: string;\n businessType: BusinessType;\n legalName: string;\n registrationNumber: string;\n mcc: string;\n addressLine1: string;\n city: string;\n country: string;\n vatNumber: string | null;\n incorporationDate: string | null;\n addressLine2: string | null;\n postalCode: string | null;\n state: string | null;\n phone: string | null;\n averageItemValue: number | null;\n expectedMonthlyTurnover: number | null;\n businessModelDescription: string | null;\n numberOfEmployees: number | null;\n annualTurnover: number | null;\n balanceSheetTotal: number | null;\n statementDescriptor: string | null;\n termsVersion: string | null;\n};\n\n/** Mirrors `OnboardingState`. */\nexport type OnboardingState =\n | \"NOT_STARTED\"\n | \"PENDING\"\n | \"ACTIVE\"\n | \"ATTENTION_NEEDED\"\n | \"ACTION_REQUIRED\"\n | \"BLOCKED\"\n | \"WAITING_FOR_KYB\"\n | \"WAITING_FOR_STAKEHOLDERS\"\n | \"PENDING_ACQUIRER_APPROVAL\";\n\n/** Whether the merchant can accept payments, or what is blocking it. Mirrors `OnboardingStatus`. */\nexport type OnboardingStatus =\n | { type: \"readyForPayments\" }\n | { type: \"requiresAction\"; state: OnboardingState };\n\n// ── Payments ──────────────────────────────────────────────────────────────────\n\n/** Lifecycle state of a payment on the backend. Mirrors `PaymentState`. */\nexport type PaymentState =\n \"PENDING\" | \"SUCCESS\" | \"CANCELLED\" | \"REFUNDED\" | \"FAILED\" | \"ACTION_NEEDED\";\n\n/** Mirrors `PaymentStatus`. Amounts are decimal strings as returned by the backend. */\nexport type PaymentStatus = {\n state: PaymentState;\n paymentToken: string;\n requestedAmount: string;\n requestedCurrency: string;\n settlementAmount: string;\n settlementCurrency: string;\n createdAt: string;\n receiptUrl: string;\n processedAt: string | null;\n};\n\n/** Mirrors `RefundReason`. */\nexport type RefundReason =\n \"CUSTOMER_REQUEST\" | \"DUPLICATE\" | \"FRAUDULENT\" | \"EXPIRED_CHARGE\";\n\n/** Card-scheme detail for the completed transaction. Mirrors `ReceiptDetails`. */\nexport type ReceiptDetails = {\n merchantId: string | null;\n terminalId: string | null;\n cardBrand: string | null;\n appLabel: string | null;\n aid: string | null;\n maskedPan: string | null;\n responseCode: string | null;\n transactionTimestamp: string | null;\n};\n\n/** Why the plugin reported a `failed` {@link PayResult}. Mirrors `PayFailureReason`. */\nexport type PayFailureReason =\n | \"INVALID_INTENT\"\n | \"NOT_ACTIVATED\"\n | \"TERMINAL_INIT_FAILED\"\n | \"PAYMENT_SETUP_FAILED\"\n | \"PLUGIN_UNAVAILABLE\"\n | \"UNKNOWN\";\n\n/** Terminal outcome of a payment run by the plugin. Mirrors `PayResult`. */\nexport type PayResult =\n | {\n type: \"success\";\n paymentToken: string;\n metadata: Record<string, string> | null;\n authCode: string | null;\n receiptDetails: ReceiptDetails | null;\n receiptUrl: string | null;\n }\n | {\n type: \"declined\";\n metadata: Record<string, string> | null;\n receiptDetails: ReceiptDetails | null;\n receiptUrl: string | null;\n }\n | { type: \"canceled\"; metadata: Record<string, string> | null }\n | {\n type: \"failed\";\n reason: PayFailureReason;\n metadata: Record<string, string> | null;\n };\n\n/**\n * Lifecycle of a payment request, delivered to the listener passed to {@link AcceptPayments.pay}.\n * Mirrors `PaymentEvent`.\n *\n * Exactly one of `result` or `creationFailed` ends the stream.\n */\nexport type PaymentEvent =\n | { type: \"creating\" }\n | { type: \"created\"; paymentToken: string; receiptUrl: string | null }\n | { type: \"launched\" }\n | { type: \"result\"; payResult: PayResult }\n | {\n type: \"creationFailed\";\n error: { code: AcceptErrorCode; message: string } & AcceptErrorDetails;\n };\n\n/** How the plugin dismisses its receipt screen. Mirrors `DismissBehavior`. */\nexport type DismissBehavior =\n { type: \"manual\" } | { type: \"delayed\"; delayMs: number };\n\n/** Whether the plugin prints a paper receipt. Mirrors `ReceiptPrintBehavior`. */\nexport type ReceiptPrintBehavior = \"automatic\" | \"onDemand\" | \"disabled\";\n\n/** What the plugin shows after a payment completes. Mirrors `PaymentReceiptConfig`. */\nexport type PaymentReceiptConfig =\n | { type: \"dismissImmediately\" }\n | {\n type: \"show\";\n /** Defaults to `true`. */\n showQrCodeReceipt?: boolean;\n /** Defaults to `{ type: 'manual' }`. */\n dismissBehavior?: DismissBehavior;\n /** Defaults to `'onDemand'`. */\n printBehavior?: ReceiptPrintBehavior;\n };\n\n/** Which face of the device carries the NFC antenna. Mirrors `OnDeviceSurface`. */\nexport type OnDeviceSurface = \"back\" | \"frontScreen\";\n\n/** Where the merchant should tap the card. Mirrors `NfcPositionConfig`. */\nexport type NfcPositionConfig =\n | { type: \"unspecified\" }\n | { type: \"externalAbove\" }\n | { type: \"externalReader\"; message?: string }\n | {\n type: \"onDevice\";\n surface: OnDeviceSurface;\n /** Horizontal position of the antenna, 0..1 across the surface. */\n xFraction: number;\n /** Vertical position of the antenna, 0..1 down the surface. */\n yFraction: number;\n };\n\n/** Which screen the plugin's payment UI runs on. Mirrors `PaymentDisplay`. */\nexport type PaymentDisplay =\n | { type: \"default\" }\n | { type: \"customerFacing\" }\n | { type: \"specific\"; displayId: number };\n\n/** Session-wide payment defaults. Mirrors the parameters of `AcceptPayments.setOptions`. */\nexport type PaymentOptions = {\n receiptConfig?: PaymentReceiptConfig;\n nfcPosition?: NfcPositionConfig;\n /**\n * How long the plugin waits for the card tap, in milliseconds; 0..120000. Pass `null` to restore\n * the plugin's own fallback (~60 seconds). Omit the key to leave the current default alone.\n */\n transactionTimeoutMs?: number | null;\n display?: PaymentDisplay;\n};\n\n/** A payment to run. Mirrors the parameters of `AcceptPayments.pay`. */\nexport type PaymentRequest = {\n /** The amount to charge, in the currency's minor unit (e.g. cents for USD). */\n amount: number;\n /** ISO 4217 currency code. */\n currency: string;\n /** Token of an existing payment session to resume. */\n paymentToken?: string;\n /** Overrides the session default for this payment only. */\n receiptConfig?: PaymentReceiptConfig;\n /** Overrides the session default for this payment only. */\n nfcPosition?: NfcPositionConfig;\n /** Key-value data attached to the payment and echoed back on the {@link PayResult}. */\n metadata?: Record<string, string>;\n /** A fixed tip, in the currency's minor unit. When set, the plugin skips its own tip screen. */\n tip?: number;\n /** Overrides the session default for this payment only; 0..120000 milliseconds. */\n transactionTimeoutMs?: number;\n /** Overrides the session default for this payment only. */\n display?: PaymentDisplay;\n};\n\n/** Handle returned by {@link AcceptPayments.pay}. */\nexport type PaymentSubscription = {\n /**\n * Stops delivering events for this payment. The plugin's UI is already on screen by then — it is\n * dismissed by the user, or the payment is voided with {@link AcceptPayments.cancel}.\n */\n remove: () => void;\n};\n\n// ── Plugin ────────────────────────────────────────────────────────────────────\n\n/** The plugin app's installed/authenticated/ready state. Mirrors `PluginStatus`. */\nexport type PluginStatus =\n | \"notInstalled\"\n | \"notAuthenticated\"\n | \"authenticated\"\n | \"readyForPayments\"\n | \"merchantMismatch\";\n\n/** Whether a newer plugin build is on Google Play. Mirrors `PluginUpdateInfo`. */\nexport type PluginUpdateInfo =\n | { type: \"upToDate\" }\n | { type: \"updateAvailable\"; priority: number }\n | { type: \"unknown\" };\n\n/** Why an activation attempt failed. Mirrors `ActivateTerminalFailureReason`. */\nexport type ActivateTerminalFailureReason =\n | \"INVALID_INTENT\"\n | \"HANDOVER_FAILED\"\n | \"CONFIRM_FAILED\"\n | \"MERCHANT_NOT_ONBOARDED\"\n | \"UNKNOWN\";\n\n/** Outcome of {@link AcceptPlugin.activateTerminal}. Mirrors `ActivateTerminalResult`. */\nexport type ActivateTerminalResult =\n | { type: \"success\" }\n | { type: \"canceled\" }\n | { type: \"failed\"; reason: ActivateTerminalFailureReason };\n\n// ── Displays ──────────────────────────────────────────────────────────────────\n\n/** One display the device reports. Mirrors `AcceptDisplay`. */\nexport type AcceptDisplay = {\n id: number;\n name: string;\n isPrimary: boolean;\n isPresentation: boolean;\n widthPx: number;\n heightPx: number;\n};\n\n// ── Theming ───────────────────────────────────────────────────────────────────\n\n/** Mirrors `AcceptThemeColors`. Values are hex strings — `#RRGGBB` or `#AARRGGBB`. */\nexport type AcceptThemeColors = {\n primary?: string;\n onPrimary?: string;\n primaryContainer?: string;\n onPrimaryContainer?: string;\n secondary?: string;\n onSecondary?: string;\n secondaryContainer?: string;\n onSecondaryContainer?: string;\n error?: string;\n onError?: string;\n errorContainer?: string;\n onErrorContainer?: string;\n background?: string;\n onBackground?: string;\n surface?: string;\n onSurface?: string;\n surfaceVariant?: string;\n onSurfaceVariant?: string;\n outline?: string;\n outlineVariant?: string;\n warning?: string;\n onWarning?: string;\n warningContainer?: string;\n onWarningContainer?: string;\n success?: string;\n onSuccess?: string;\n successContainer?: string;\n onSuccessContainer?: string;\n};\n\n/**\n * Mirrors `AcceptThemeImages`. Each value is a URL the plugin loads — either an `https://` URL, or\n * a `content://` URL produced by {@link Accept.createLocalThemeImageUri} for an image the host app\n * holds locally.\n */\nexport type AcceptThemeImages = {\n logoText?: string;\n logoTextSolid?: string;\n logoSymbol?: string;\n logoSymbolWithBackground?: string;\n};\n\n/** Mirrors `AcceptThemeVariant`. */\nexport type AcceptThemeVariant = {\n colors?: AcceptThemeColors;\n images?: AcceptThemeImages;\n};\n\n/** Branding applied to the plugin's activation, status, and payment screens. Mirrors `AcceptTheme`. */\nexport type AcceptTheme = {\n light?: AcceptThemeVariant;\n dark?: AcceptThemeVariant;\n};\n\n// ── Subscriptions ─────────────────────────────────────────────────────────────\n\n/** Handle returned by the `on*` listeners. Mirrors Expo's `EventSubscription`. */\nexport type AcceptSubscription = {\n remove: () => void;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Accept.types.js","sourceRoot":"","sources":["../src/Accept.types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG","sourcesContent":["/**\n * Types mirroring the Accept SDK for Android.\n *\n * Every name here corresponds 1:1 to a type in `com.tapaya.accept`, so the Android reference\n * documentation applies unchanged. Kotlin sealed interfaces become tagged unions discriminated on\n * `type`; Kotlin enums become string-literal unions.\n */\n\n// ── Lifecycle ─────────────────────────────────────────────────────────────────\n\n/**\n * Lifecycle state of the SDK. Mirrors `SdkState`.\n *\n * - `idle` — {@link Accept.initialize} has not been called yet.\n * - `initialized` — ready for {@link AcceptAuth.authenticate}.\n * - `authenticated` — the merchant and payments surfaces are usable.\n */\nexport type SdkState = \"idle\" | \"initialized\" | \"authenticated\";\n\n/** Options for {@link Accept.initialize}. */\nexport type InitializeOptions = {\n /** `true` to target production, `false` (the default) to target sandbox. */\n isProduction?: boolean;\n};\n\n// ── Diagnostics ───────────────────────────────────────────────────────────────\n\n/** Verbosity threshold for the SDK's diagnostic logging, least to most verbose. */\nexport type AcceptLogLevel =\n \"NONE\" | \"ERROR\" | \"WARN\" | \"INFO\" | \"DEBUG\" | \"VERBOSE\";\n\n/** A single diagnostic log line, delivered to the listener passed to {@link Accept.setLogger}. */\nexport type AcceptLogEntry = {\n level: AcceptLogLevel;\n /** Stable Logcat-style tag identifying the SDK. */\n tag: string;\n /** Human-readable, already redacted message. */\n message: string;\n /** Message of the cause associated with this line, when there is one. */\n throwable: string | null;\n};\n\n// ── Errors ────────────────────────────────────────────────────────────────────\n\n/** Discriminator on {@link AcceptError}; mirrors the `AcceptException` subclass names. */\nexport type AcceptErrorCode =\n | \"NotInitialized\"\n | \"NotAuthenticated\"\n | \"PluginUnavailable\"\n | \"PaymentInProgress\"\n | \"ActivationInProgress\"\n | \"PluginAlreadyAuthenticated\"\n | \"PluginMerchantMismatch\"\n | \"NoTidsAvailableForMerchant\"\n | \"MerchantOnboardingIncomplete\"\n | \"UnsupportedCurrency\"\n | \"CurrencyNotAvailableForMerchant\"\n | \"AmountBelowMinimum\"\n | \"TransactionTimeoutOutOfRange\"\n | \"PluginNotReadyForPayments\"\n | \"PaymentCreationFailed\"\n | \"LocationPermissionRequired\"\n | \"LocationUnavailable\"\n | \"LocationTimeout\"\n | \"NoInternetConnection\"\n | \"SessionExpired\"\n | \"PaymentNotFound\"\n | \"PluginStoreUnavailable\"\n | \"PluginSelfInstallUnavailable\"\n | \"PluginInstallPermissionRequired\"\n | \"PluginInstallAuthRequired\"\n | \"PluginDownloadNotPermitted\"\n | \"PluginTimeout\"\n | \"UnknownEnvironment\"\n | \"Unknown\";\n\n/** The payload fields carried by the error codes that have any. */\nexport type AcceptErrorDetails = {\n /** `MerchantOnboardingIncomplete`: the merchant's current onboarding state. */\n state?: OnboardingState;\n /** `UnsupportedCurrency`, `CurrencyNotAvailableForMerchant`, `AmountBelowMinimum`. */\n currency?: string;\n /** `AmountBelowMinimum`: the minimum required amount, in minor units. */\n minimum?: number;\n /** `TransactionTimeoutOutOfRange`: the out-of-range value that was passed, in milliseconds. */\n transactionTimeoutMs?: number;\n /** `PluginNotReadyForPayments`: the plugin's status at the time of the call. */\n status?: PluginStatus;\n /** `UnknownEnvironment`: the environment key that was not recognized. */\n environment?: string;\n /** `PaymentCreationFailed`, `Unknown`: the underlying error's message. Not for end-user display. */\n cause?: string;\n};\n\n// ── SDK configuration ─────────────────────────────────────────────────────────\n\n/** The minimum payable amount for one currency. Mirrors `MinimumAmount`. */\nexport type MinimumAmount = {\n /** ISO 4217 currency code. */\n currency: string;\n /** The minimum amount, in the currency's minor unit. */\n amount: number;\n};\n\n// ── Merchant ──────────────────────────────────────────────────────────────────\n\n/** Mirrors `BusinessType`. */\nexport type BusinessType =\n | \"INDIVIDUAL\"\n | \"COMPANY\"\n | \"NONPROFIT_ORGANIZATION\"\n | \"GOVERNMENT_ENTITY\"\n | \"PARTNERSHIP\";\n\n/** The merchant's payment configuration. Mirrors `MerchantConfig`. */\nexport type MerchantConfig = {\n /** ISO 4217 codes the merchant is configured to accept. */\n availableCurrencies: string[];\n /** The merchant's default currency, when one is set. */\n currency: string | null;\n};\n\n/** The merchant's business profile. Mirrors `MerchantInformation`. */\nexport type MerchantInformation = {\n merchantId: string;\n email: string;\n businessType: BusinessType;\n legalName: string;\n registrationNumber: string;\n mcc: string;\n addressLine1: string;\n city: string;\n country: string;\n vatNumber: string | null;\n incorporationDate: string | null;\n addressLine2: string | null;\n postalCode: string | null;\n state: string | null;\n phone: string | null;\n averageItemValue: number | null;\n expectedMonthlyTurnover: number | null;\n businessModelDescription: string | null;\n numberOfEmployees: number | null;\n annualTurnover: number | null;\n balanceSheetTotal: number | null;\n statementDescriptor: string | null;\n termsVersion: string | null;\n};\n\n/** Mirrors `OnboardingState`. */\nexport type OnboardingState =\n | \"NOT_STARTED\"\n | \"PENDING\"\n | \"ACTIVE\"\n | \"ATTENTION_NEEDED\"\n | \"ACTION_REQUIRED\"\n | \"BLOCKED\"\n | \"WAITING_FOR_KYB\"\n | \"WAITING_FOR_STAKEHOLDERS\"\n | \"PENDING_ACQUIRER_APPROVAL\";\n\n/** Whether the merchant can accept payments, or what is blocking it. Mirrors `OnboardingStatus`. */\nexport type OnboardingStatus =\n | { type: \"readyForPayments\" }\n | { type: \"requiresAction\"; state: OnboardingState };\n\n// ── Payments ──────────────────────────────────────────────────────────────────\n\n/** Lifecycle state of a payment on the backend. Mirrors `PaymentState`. */\nexport type PaymentState =\n \"PENDING\" | \"SUCCESS\" | \"CANCELLED\" | \"REFUNDED\" | \"FAILED\" | \"ACTION_NEEDED\";\n\n/** Mirrors `PaymentStatus`. Amounts are decimal strings as returned by the backend. */\nexport type PaymentStatus = {\n state: PaymentState;\n paymentToken: string;\n requestedAmount: string;\n requestedCurrency: string;\n settlementAmount: string;\n settlementCurrency: string;\n createdAt: string;\n receiptUrl: string;\n processedAt: string | null;\n};\n\n/** Mirrors `RefundReason`. */\nexport type RefundReason =\n \"CUSTOMER_REQUEST\" | \"DUPLICATE\" | \"FRAUDULENT\" | \"EXPIRED_CHARGE\";\n\n/** Card-scheme detail for the completed transaction. Mirrors `ReceiptDetails`. */\nexport type ReceiptDetails = {\n merchantId: string | null;\n terminalId: string | null;\n cardBrand: string | null;\n appLabel: string | null;\n aid: string | null;\n maskedPan: string | null;\n responseCode: string | null;\n transactionTimestamp: string | null;\n};\n\n/** Why the plugin reported a `failed` {@link PayResult}. Mirrors `PayFailureReason`. */\nexport type PayFailureReason =\n | \"INVALID_INTENT\"\n | \"NOT_ACTIVATED\"\n | \"TERMINAL_INIT_FAILED\"\n | \"PAYMENT_SETUP_FAILED\"\n | \"PLUGIN_UNAVAILABLE\"\n | \"UNKNOWN\";\n\n/** Terminal outcome of a payment run by the plugin. Mirrors `PayResult`. */\nexport type PayResult =\n | {\n type: \"success\";\n paymentToken: string;\n metadata: Record<string, string> | null;\n authCode: string | null;\n receiptDetails: ReceiptDetails | null;\n receiptUrl: string | null;\n }\n | {\n type: \"declined\";\n metadata: Record<string, string> | null;\n receiptDetails: ReceiptDetails | null;\n receiptUrl: string | null;\n }\n | { type: \"canceled\"; metadata: Record<string, string> | null }\n | {\n type: \"failed\";\n reason: PayFailureReason;\n metadata: Record<string, string> | null;\n };\n\n/**\n * Lifecycle of a payment request, delivered to the listener passed to {@link AcceptPayments.pay}.\n * Mirrors `PaymentEvent`.\n *\n * Exactly one of `result` or `creationFailed` ends the stream.\n */\nexport type PaymentEvent =\n | { type: \"creating\" }\n | { type: \"created\"; paymentToken: string; receiptUrl: string | null }\n | { type: \"launched\" }\n | { type: \"result\"; payResult: PayResult }\n | {\n type: \"creationFailed\";\n error: { code: AcceptErrorCode; message: string } & AcceptErrorDetails;\n };\n\n/** How the plugin dismisses its receipt screen. Mirrors `DismissBehavior`. */\nexport type DismissBehavior =\n { type: \"manual\" } | { type: \"delayed\"; delayMs: number };\n\n/** Whether the plugin prints a paper receipt. Mirrors `ReceiptPrintBehavior`. */\nexport type ReceiptPrintBehavior = \"automatic\" | \"onDemand\" | \"disabled\";\n\n/** What the plugin shows after a payment completes. Mirrors `PaymentReceiptConfig`. */\nexport type PaymentReceiptConfig =\n | { type: \"dismissImmediately\" }\n | {\n type: \"show\";\n /** Defaults to `true`. */\n showQrCodeReceipt?: boolean;\n /** Defaults to `{ type: 'manual' }`. */\n dismissBehavior?: DismissBehavior;\n /** Defaults to `'onDemand'`. */\n printBehavior?: ReceiptPrintBehavior;\n };\n\n/** Which face of the device carries the NFC antenna. Mirrors `OnDeviceSurface`. */\nexport type OnDeviceSurface = \"back\" | \"frontScreen\";\n\n/** Where the merchant should tap the card. Mirrors `NfcPositionConfig`. */\nexport type NfcPositionConfig =\n | { type: \"unspecified\" }\n | { type: \"externalAbove\" }\n | {\n type: \"externalReader\";\n /** Replaces the companion's own prompt; you own its localization. Blank keeps the default. */\n message?: string;\n /** Which screen edge the reader sits beyond. Omit to show no chevrons. */\n indicator?: ReaderIndicator;\n }\n | {\n type: \"onDevice\";\n surface: OnDeviceSurface;\n /** Horizontal position of the antenna, 0..1 across the surface. */\n xFraction: number;\n /** Vertical position of the antenna, 0..1 down the surface. */\n yFraction: number;\n };\n\n/** Screen edge an external reader sits beyond, in the device's natural orientation. Mirrors `ReaderEdge`. */\nexport type ReaderEdge = \"top\" | \"right\" | \"bottom\" | \"left\";\n\n/** Where an external reader sits relative to the screen. Mirrors `ReaderIndicator`. */\nexport type ReaderIndicator = {\n edge: ReaderEdge;\n /**\n * Position along {@link edge}, 0..1: left to right along `top`/`bottom`, top to bottom along\n * `left`/`right`. Defaults to 0.5.\n */\n offsetFraction?: number;\n};\n\n/**\n * Whether the payment UI may rotate 180° when the merchant turns the device toward the customer.\n * Mirrors `CustomerFacingFlipConfig`. `'disabled'` is for hardware that is already\n * customer-facing — a fixed POS, a dual-sided panel, a device in a stand — where the turn never\n * happens and the sensors only produce accidental flips. A companion build that predates the\n * option ignores it.\n */\nexport type CustomerFacingFlipConfig = \"automatic\" | \"disabled\";\n\n/** Which screen the plugin's payment UI runs on. Mirrors `PaymentDisplay`. */\nexport type PaymentDisplay =\n | { type: \"default\" }\n | { type: \"customerFacing\" }\n | { type: \"specific\"; displayId: number };\n\n/** Session-wide payment defaults. Mirrors the parameters of `AcceptPayments.setOptions`. */\nexport type PaymentOptions = {\n receiptConfig?: PaymentReceiptConfig;\n nfcPosition?: NfcPositionConfig;\n /**\n * How long the plugin waits for the card tap, in milliseconds; 0..120000. Pass `null` to restore\n * the plugin's own fallback (~60 seconds). Omit the key to leave the current default alone.\n */\n transactionTimeoutMs?: number | null;\n display?: PaymentDisplay;\n /** Defaults to `'automatic'`. */\n customerFacingFlip?: CustomerFacingFlipConfig;\n};\n\n/** A payment to run. Mirrors the parameters of `AcceptPayments.pay`. */\nexport type PaymentRequest = {\n /** The amount to charge, in the currency's minor unit (e.g. cents for USD). */\n amount: number;\n /** ISO 4217 currency code. */\n currency: string;\n /** Token of an existing payment session to resume. */\n paymentToken?: string;\n /** Overrides the session default for this payment only. */\n receiptConfig?: PaymentReceiptConfig;\n /** Overrides the session default for this payment only. */\n nfcPosition?: NfcPositionConfig;\n /** Key-value data attached to the payment and echoed back on the {@link PayResult}. */\n metadata?: Record<string, string>;\n /** A fixed tip, in the currency's minor unit. When set, the plugin skips its own tip screen. */\n tip?: number;\n /** Overrides the session default for this payment only; 0..120000 milliseconds. */\n transactionTimeoutMs?: number;\n /** Overrides the session default for this payment only. */\n display?: PaymentDisplay;\n /** Overrides the session default for this payment only. */\n customerFacingFlip?: CustomerFacingFlipConfig;\n};\n\n/** Handle returned by {@link AcceptPayments.pay}. */\nexport type PaymentSubscription = {\n /**\n * Stops delivering events for this payment. The plugin's UI is already on screen by then — it is\n * dismissed by the user, or the payment is voided with {@link AcceptPayments.cancel}.\n */\n remove: () => void;\n};\n\n// ── Plugin ────────────────────────────────────────────────────────────────────\n\n/** The plugin app's installed/authenticated/ready state. Mirrors `PluginStatus`. */\nexport type PluginStatus =\n | \"notInstalled\"\n | \"notAuthenticated\"\n | \"authenticated\"\n | \"readyForPayments\"\n | \"merchantMismatch\";\n\n/** Whether a newer plugin build is on Google Play. Mirrors `PluginUpdateInfo`. */\nexport type PluginUpdateInfo =\n | { type: \"upToDate\" }\n | { type: \"updateAvailable\"; priority: number }\n | { type: \"unknown\" };\n\n/** Why an activation attempt failed. Mirrors `ActivateTerminalFailureReason`. */\nexport type ActivateTerminalFailureReason =\n | \"INVALID_INTENT\"\n | \"HANDOVER_FAILED\"\n | \"CONFIRM_FAILED\"\n | \"MERCHANT_NOT_ONBOARDED\"\n | \"UNKNOWN\";\n\n/** Outcome of {@link AcceptPlugin.activateTerminal}. Mirrors `ActivateTerminalResult`. */\nexport type ActivateTerminalResult =\n | { type: \"success\" }\n | { type: \"canceled\" }\n | { type: \"failed\"; reason: ActivateTerminalFailureReason };\n\n// ── Displays ──────────────────────────────────────────────────────────────────\n\n/** One display the device reports. Mirrors `AcceptDisplay`. */\nexport type AcceptDisplay = {\n id: number;\n name: string;\n isPrimary: boolean;\n isPresentation: boolean;\n widthPx: number;\n heightPx: number;\n};\n\n// ── Theming ───────────────────────────────────────────────────────────────────\n\n/** Mirrors `AcceptThemeColors`. Values are hex strings — `#RRGGBB` or `#AARRGGBB`. */\nexport type AcceptThemeColors = {\n primary?: string;\n onPrimary?: string;\n primaryContainer?: string;\n onPrimaryContainer?: string;\n secondary?: string;\n onSecondary?: string;\n secondaryContainer?: string;\n onSecondaryContainer?: string;\n error?: string;\n onError?: string;\n errorContainer?: string;\n onErrorContainer?: string;\n background?: string;\n onBackground?: string;\n surface?: string;\n onSurface?: string;\n surfaceVariant?: string;\n onSurfaceVariant?: string;\n outline?: string;\n outlineVariant?: string;\n warning?: string;\n onWarning?: string;\n warningContainer?: string;\n onWarningContainer?: string;\n success?: string;\n onSuccess?: string;\n successContainer?: string;\n onSuccessContainer?: string;\n};\n\n/**\n * Mirrors `AcceptThemeImages`. Each value is a URL the plugin loads — either an `https://` URL, or\n * a `content://` URL produced by {@link Accept.createLocalThemeImageUri} for an image the host app\n * holds locally.\n */\nexport type AcceptThemeImages = {\n logoText?: string;\n logoTextSolid?: string;\n logoSymbol?: string;\n logoSymbolWithBackground?: string;\n};\n\n/** Mirrors `AcceptThemeVariant`. */\nexport type AcceptThemeVariant = {\n colors?: AcceptThemeColors;\n images?: AcceptThemeImages;\n};\n\n/** Branding applied to the plugin's activation, status, and payment screens. Mirrors `AcceptTheme`. */\nexport type AcceptTheme = {\n light?: AcceptThemeVariant;\n dark?: AcceptThemeVariant;\n};\n\n// ── Subscriptions ─────────────────────────────────────────────────────────────\n\n/** Handle returned by the `on*` listeners. Mirrors Expo's `EventSubscription`. */\nexport type AcceptSubscription = {\n remove: () => void;\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drops every key whose value is `undefined`, at any depth, before an object crosses the bridge.
|
|
3
|
+
*
|
|
4
|
+
* Expo's converter for a `Map<String, Any?>` argument rejects an explicit `undefined` with
|
|
5
|
+
* `ERR_UNEXPECTED` ("Value is undefined, expected an Object") rather than treating it as absent,
|
|
6
|
+
* which is what an optional property means in TypeScript. Removing the key keeps the two the same.
|
|
7
|
+
*/
|
|
8
|
+
export declare function withoutUndefined<T>(value: T): T;
|
|
9
|
+
//# sourceMappingURL=withoutUndefined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withoutUndefined.d.ts","sourceRoot":"","sources":["../src/withoutUndefined.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAQ/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Drops every key whose value is `undefined`, at any depth, before an object crosses the bridge.
|
|
3
|
+
*
|
|
4
|
+
* Expo's converter for a `Map<String, Any?>` argument rejects an explicit `undefined` with
|
|
5
|
+
* `ERR_UNEXPECTED` ("Value is undefined, expected an Object") rather than treating it as absent,
|
|
6
|
+
* which is what an optional property means in TypeScript. Removing the key keeps the two the same.
|
|
7
|
+
*/
|
|
8
|
+
export function withoutUndefined(value) {
|
|
9
|
+
if (Array.isArray(value))
|
|
10
|
+
return value.map(withoutUndefined);
|
|
11
|
+
if (value === null || typeof value !== "object")
|
|
12
|
+
return value;
|
|
13
|
+
return Object.fromEntries(Object.entries(value)
|
|
14
|
+
.filter(([, entry]) => entry !== undefined)
|
|
15
|
+
.map(([key, entry]) => [key, withoutUndefined(entry)]));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=withoutUndefined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withoutUndefined.js","sourceRoot":"","sources":["../src/withoutUndefined.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAI,KAAQ;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAM,CAAC;IAClE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;SAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CACpD,CAAC;AACT,CAAC","sourcesContent":["/**\n * Drops every key whose value is `undefined`, at any depth, before an object crosses the bridge.\n *\n * Expo's converter for a `Map<String, Any?>` argument rejects an explicit `undefined` with\n * `ERR_UNEXPECTED` (\"Value is undefined, expected an Object\") rather than treating it as absent,\n * which is what an optional property means in TypeScript. Removing the key keeps the two the same.\n */\nexport function withoutUndefined<T>(value: T): T {\n if (Array.isArray(value)) return value.map(withoutUndefined) as T;\n if (value === null || typeof value !== \"object\") return value;\n return Object.fromEntries(\n Object.entries(value)\n .filter(([, entry]) => entry !== undefined)\n .map(([key, entry]) => [key, withoutUndefined(entry)]),\n ) as T;\n}\n"]}
|