@tapayadot/accept-react-native 1.3.2 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +196 -363
  2. package/android/build.gradle +23 -34
  3. package/android/src/main/java/com/tapaya/acceptsdkreactnative/AcceptSdkReactNativeModule.kt +191 -673
  4. package/android/src/main/java/com/tapaya/acceptsdkreactnative/Errors.kt +81 -0
  5. package/android/src/main/java/com/tapaya/acceptsdkreactnative/Parsing.kt +166 -0
  6. package/android/src/main/java/com/tapaya/acceptsdkreactnative/Serialization.kt +216 -0
  7. package/app.json +2 -2
  8. package/app.plugin.js +1 -1
  9. package/build/Accept.d.ts +255 -0
  10. package/build/Accept.d.ts.map +1 -0
  11. package/build/Accept.js +387 -0
  12. package/build/Accept.js.map +1 -0
  13. package/build/Accept.types.d.ts +352 -0
  14. package/build/Accept.types.d.ts.map +1 -0
  15. package/build/Accept.types.js +9 -0
  16. package/build/Accept.types.js.map +1 -0
  17. package/build/AcceptError.d.ts +53 -0
  18. package/build/AcceptError.d.ts.map +1 -0
  19. package/build/AcceptError.js +107 -0
  20. package/build/AcceptError.js.map +1 -0
  21. package/build/AcceptSdkReactNativeModule.d.ts +67 -26
  22. package/build/AcceptSdkReactNativeModule.d.ts.map +1 -1
  23. package/build/AcceptSdkReactNativeModule.js +53 -3
  24. package/build/AcceptSdkReactNativeModule.js.map +1 -1
  25. package/build/index.d.ts +7 -237
  26. package/build/index.d.ts.map +1 -1
  27. package/build/index.js +7 -254
  28. package/build/index.js.map +1 -1
  29. package/build/utils.d.ts.map +1 -1
  30. package/build/utils.js +2 -2
  31. package/build/utils.js.map +1 -1
  32. package/expo-module.config.json +1 -6
  33. package/package.json +8 -12
  34. package/plugin/withAcceptSdk.js +45 -0
  35. package/build/AcceptSdkReactNative.types.d.ts +0 -259
  36. package/build/AcceptSdkReactNative.types.d.ts.map +0 -1
  37. package/build/AcceptSdkReactNative.types.js +0 -2
  38. package/build/AcceptSdkReactNative.types.js.map +0 -1
  39. package/ios/.xcode.env +0 -11
  40. package/ios/AcceptSdkReactNative.podspec +0 -33
  41. package/ios/AcceptSdkReactNativeAppDelegate.swift +0 -13
  42. package/ios/AcceptSdkReactNativeModule.swift +0 -749
  43. package/ios/Podfile +0 -63
  44. package/ios/Podfile.properties.json +0 -4
  45. package/ios/acceptsdkreactnative.xcodeproj/project.pbxproj +0 -540
  46. package/ios/acceptsdkreactnative.xcodeproj/xcshareddata/xcschemes/acceptsdkreactnative.xcscheme +0 -88
  47. package/plugin/withCustomRepoModule.js +0 -96
@@ -0,0 +1,81 @@
1
+ package com.tapaya.acceptsdkreactnative
2
+
3
+ import com.tapaya.accept.AcceptException
4
+ import com.tapaya.accept.AmountBelowMinimum
5
+ import com.tapaya.accept.CurrencyNotAvailableForMerchant
6
+ import com.tapaya.accept.MerchantOnboardingIncomplete
7
+ import com.tapaya.accept.PaymentCreationFailed
8
+ import com.tapaya.accept.PluginNotReadyForPayments
9
+ import com.tapaya.accept.TransactionTimeoutOutOfRange
10
+ import com.tapaya.accept.Unknown
11
+ import com.tapaya.accept.UnknownEnvironment
12
+ import com.tapaya.accept.UnsupportedCurrency
13
+ import expo.modules.kotlin.exception.CodedException
14
+ import kotlinx.coroutines.CancellationException
15
+ import org.json.JSONObject
16
+
17
+ /**
18
+ * The error code carried across the bridge for [this]. Mirrors the Kotlin type name exactly, so
19
+ * `AcceptError.code` on the JavaScript side is a discriminated union over the same names the
20
+ * Android SDK documents.
21
+ */
22
+ internal fun AcceptException.errorCode(): String = this::class.simpleName ?: "Unknown"
23
+
24
+ /**
25
+ * The payload-carrying fields of [this], keyed as the JavaScript `AcceptError` reads them.
26
+ * Errors without extra fields serialize to an empty map.
27
+ */
28
+ internal fun AcceptException.errorDetails(): Map<String, Any?> = when (this) {
29
+ is MerchantOnboardingIncomplete -> mapOf("state" to state.name)
30
+ is UnsupportedCurrency -> mapOf("currency" to code)
31
+ is CurrencyNotAvailableForMerchant -> mapOf("currency" to code)
32
+ is AmountBelowMinimum -> mapOf("minimum" to minimum, "currency" to currency)
33
+ is TransactionTimeoutOutOfRange -> mapOf("transactionTimeoutMs" to transactionTimeout.inWholeMilliseconds)
34
+ is PluginNotReadyForPayments -> mapOf("status" to status.serialize())
35
+ is UnknownEnvironment -> mapOf("environment" to key)
36
+ is PaymentCreationFailed -> mapOf("cause" to cause.message)
37
+ is Unknown -> mapOf("cause" to cause.message)
38
+ else -> emptyMap()
39
+ }
40
+
41
+ /** [this] as the `{ code, message, ... }` shape the JavaScript `AcceptError` is built from. */
42
+ internal fun AcceptException.serialize(): Map<String, Any?> =
43
+ mapOf("code" to errorCode(), "message" to (message ?: errorCode())) + errorDetails()
44
+
45
+ /**
46
+ * Bridge-facing wrapper for an [AcceptException].
47
+ *
48
+ * Expo only carries a `code` and a `message` across the bridge, so the message is a JSON object
49
+ * holding the human-readable text alongside the error's own fields; the JavaScript wrapper parses
50
+ * it back into a typed `AcceptError`. A message that fails to parse there is surfaced verbatim, so
51
+ * an uncaught rejection still reads sensibly in a stack trace.
52
+ */
53
+ internal class AcceptCodedException(
54
+ exception: AcceptException,
55
+ ) : CodedException(
56
+ exception.errorCode(),
57
+ JSONObject(exception.serialize()).toString(),
58
+ exception,
59
+ )
60
+
61
+ /**
62
+ * Runs [block], translating any [AcceptException] it raises into an [AcceptCodedException].
63
+ *
64
+ * [CancellationException] is rethrown untouched to keep structured concurrency intact; anything
65
+ * else is left to Expo's own `UnexpectedException` handling, which is the honest representation of
66
+ * a failure the SDK itself did not classify.
67
+ */
68
+ internal suspend fun <T> sdkCall(block: suspend () -> T): T = try {
69
+ block()
70
+ } catch (e: CancellationException) {
71
+ throw e
72
+ } catch (e: AcceptException) {
73
+ throw AcceptCodedException(e)
74
+ }
75
+
76
+ /** Blocking counterpart of [sdkCall], for the SDK's non-suspending surfaces. */
77
+ internal fun <T> sdkCallSync(block: () -> T): T = try {
78
+ block()
79
+ } catch (e: AcceptException) {
80
+ throw AcceptCodedException(e)
81
+ }
@@ -0,0 +1,166 @@
1
+ package com.tapaya.acceptsdkreactnative
2
+
3
+ import com.tapaya.accept.AcceptLogLevel
4
+ import com.tapaya.accept.domain.data.AcceptTheme
5
+ import com.tapaya.accept.domain.data.AcceptThemeColors
6
+ import com.tapaya.accept.domain.data.AcceptThemeImages
7
+ import com.tapaya.accept.domain.data.AcceptThemeVariant
8
+ import com.tapaya.accept.domain.data.DismissBehavior
9
+ import com.tapaya.accept.domain.data.NfcPositionConfig
10
+ import com.tapaya.accept.domain.data.OnDeviceSurface
11
+ import com.tapaya.accept.domain.data.PaymentDisplay
12
+ import com.tapaya.accept.domain.data.PaymentReceiptConfig
13
+ import com.tapaya.accept.domain.data.ReceiptPrintBehavior
14
+ import com.tapaya.accept.domain.data.RefundReason
15
+ import expo.modules.kotlin.exception.CodedException
16
+ import kotlin.time.Duration.Companion.milliseconds
17
+
18
+ /**
19
+ * Parsers turning the plain maps the bridge carries into the Android SDK's domain types.
20
+ *
21
+ * The TypeScript side is the contract, so a shape that doesn't match one of the cases here is a
22
+ * programming error rather than user input: it raises a coded `ERR_INVALID_ARGUMENT` instead of
23
+ * silently falling back to a default, which would take a payment on settings the caller didn't ask
24
+ * for.
25
+ */
26
+
27
+ private fun invalid(what: String, value: Any?): Nothing =
28
+ throw CodedException("ERR_INVALID_ARGUMENT", "unsupported $what: $value", null)
29
+
30
+ @Suppress("UNCHECKED_CAST")
31
+ private fun Map<String, Any?>.map(key: String): Map<String, Any?>? = this[key] as? Map<String, Any?>
32
+
33
+ private fun Map<String, Any?>.string(key: String): String? = this[key] as? String
34
+
35
+ private fun Map<String, Any?>.bool(key: String, default: Boolean): Boolean = this[key] as? Boolean ?: default
36
+
37
+ /** JavaScript hands every number over as a `Double`; a few arrive already narrowed. */
38
+ private fun Map<String, Any?>.long(key: String): Long? = when (val value = this[key]) {
39
+ is Number -> value.toLong()
40
+ else -> null
41
+ }
42
+
43
+ private fun Map<String, Any?>.float(key: String): Float? = when (val value = this[key]) {
44
+ is Number -> value.toFloat()
45
+ else -> null
46
+ }
47
+
48
+ private fun Map<String, Any?>.int(key: String): Int? = when (val value = this[key]) {
49
+ is Number -> value.toInt()
50
+ else -> null
51
+ }
52
+
53
+ internal fun parseLogLevel(level: String): AcceptLogLevel =
54
+ AcceptLogLevel.entries.firstOrNull { it.name.equals(level, ignoreCase = true) }
55
+ ?: invalid("log level", level)
56
+
57
+ internal fun parseRefundReason(reason: String): RefundReason =
58
+ RefundReason.entries.firstOrNull { it.name.equals(reason, ignoreCase = true) }
59
+ ?: invalid("refund reason", reason)
60
+
61
+ internal fun parsePaymentDisplay(display: Map<String, Any?>): PaymentDisplay =
62
+ when (val type = display.string("type")) {
63
+ "default" -> PaymentDisplay.Default
64
+ "customerFacing" -> PaymentDisplay.CustomerFacing
65
+ "specific" -> PaymentDisplay.Specific(display.int("displayId") ?: invalid("display id", display["displayId"]))
66
+ else -> invalid("payment display", type)
67
+ }
68
+
69
+ internal fun parseNfcPosition(config: Map<String, Any?>): NfcPositionConfig =
70
+ when (val type = config.string("type")) {
71
+ "unspecified" -> NfcPositionConfig.Unspecified
72
+ "externalAbove" -> NfcPositionConfig.ExternalAbove
73
+ "externalReader" -> NfcPositionConfig.ExternalReader(config.string("message"))
74
+ "onDevice" -> NfcPositionConfig.OnDevice(
75
+ surface = when (val surface = config.string("surface")) {
76
+ "back" -> OnDeviceSurface.BACK
77
+ "frontScreen" -> OnDeviceSurface.FRONT_SCREEN
78
+ else -> invalid("NFC surface", surface)
79
+ },
80
+ xFraction = config.float("xFraction") ?: invalid("xFraction", config["xFraction"]),
81
+ yFraction = config.float("yFraction") ?: invalid("yFraction", config["yFraction"]),
82
+ )
83
+
84
+ else -> invalid("NFC position", type)
85
+ }
86
+
87
+ internal fun parseReceiptConfig(config: Map<String, Any?>): PaymentReceiptConfig =
88
+ when (val type = config.string("type")) {
89
+ "dismissImmediately" -> PaymentReceiptConfig.DismissImmediately
90
+ "show" -> PaymentReceiptConfig.Show(
91
+ showQrCodeReceipt = config.bool("showQrCodeReceipt", default = true),
92
+ dismissBehavior = config.map("dismissBehavior")?.let(::parseDismissBehavior) ?: DismissBehavior.Manual,
93
+ printBehavior = config.string("printBehavior")?.let(::parsePrintBehavior) ?: ReceiptPrintBehavior.OnDemand,
94
+ )
95
+
96
+ else -> invalid("receipt config", type)
97
+ }
98
+
99
+ private fun parseDismissBehavior(behavior: Map<String, Any?>): DismissBehavior =
100
+ when (val type = behavior.string("type")) {
101
+ "manual" -> DismissBehavior.Manual
102
+ "delayed" -> DismissBehavior.Delayed(
103
+ (behavior.long("delayMs") ?: invalid("dismiss delay", behavior["delayMs"])).milliseconds,
104
+ )
105
+
106
+ else -> invalid("dismiss behavior", type)
107
+ }
108
+
109
+ private fun parsePrintBehavior(behavior: String): ReceiptPrintBehavior = when (behavior) {
110
+ "automatic" -> ReceiptPrintBehavior.Automatic
111
+ "onDemand" -> ReceiptPrintBehavior.OnDemand
112
+ "disabled" -> ReceiptPrintBehavior.Disabled
113
+ else -> invalid("print behavior", behavior)
114
+ }
115
+
116
+ internal fun parseTheme(theme: Map<String, Any?>): AcceptTheme = AcceptTheme(
117
+ light = theme.map("light")?.let(::parseThemeVariant),
118
+ dark = theme.map("dark")?.let(::parseThemeVariant),
119
+ )
120
+
121
+ private fun parseThemeVariant(variant: Map<String, Any?>): AcceptThemeVariant = AcceptThemeVariant(
122
+ colors = variant.map("colors")?.let(::parseThemeColors) ?: AcceptThemeColors(),
123
+ images = variant.map("images")?.let(::parseThemeImages) ?: AcceptThemeImages(),
124
+ )
125
+
126
+ private fun parseThemeColors(colors: Map<String, Any?>): AcceptThemeColors = AcceptThemeColors(
127
+ primary = colors.string("primary"),
128
+ onPrimary = colors.string("onPrimary"),
129
+ primaryContainer = colors.string("primaryContainer"),
130
+ onPrimaryContainer = colors.string("onPrimaryContainer"),
131
+ secondary = colors.string("secondary"),
132
+ onSecondary = colors.string("onSecondary"),
133
+ secondaryContainer = colors.string("secondaryContainer"),
134
+ onSecondaryContainer = colors.string("onSecondaryContainer"),
135
+ error = colors.string("error"),
136
+ onError = colors.string("onError"),
137
+ errorContainer = colors.string("errorContainer"),
138
+ onErrorContainer = colors.string("onErrorContainer"),
139
+ background = colors.string("background"),
140
+ onBackground = colors.string("onBackground"),
141
+ surface = colors.string("surface"),
142
+ onSurface = colors.string("onSurface"),
143
+ surfaceVariant = colors.string("surfaceVariant"),
144
+ onSurfaceVariant = colors.string("onSurfaceVariant"),
145
+ outline = colors.string("outline"),
146
+ outlineVariant = colors.string("outlineVariant"),
147
+ warning = colors.string("warning"),
148
+ onWarning = colors.string("onWarning"),
149
+ warningContainer = colors.string("warningContainer"),
150
+ onWarningContainer = colors.string("onWarningContainer"),
151
+ success = colors.string("success"),
152
+ onSuccess = colors.string("onSuccess"),
153
+ successContainer = colors.string("successContainer"),
154
+ onSuccessContainer = colors.string("onSuccessContainer"),
155
+ )
156
+
157
+ private fun parseThemeImages(images: Map<String, Any?>): AcceptThemeImages = AcceptThemeImages(
158
+ logoText = images.string("logoText"),
159
+ logoTextSolid = images.string("logoTextSolid"),
160
+ logoSymbol = images.string("logoSymbol"),
161
+ logoSymbolWithBackground = images.string("logoSymbolWithBackground"),
162
+ )
163
+
164
+ /** The `metadata` map attached to a payment; the SDK takes string values only. */
165
+ internal fun parseMetadata(metadata: Map<String, Any?>?): Map<String, String> =
166
+ metadata.orEmpty().mapNotNull { (key, value) -> (value as? String)?.let { key to it } }.toMap()
@@ -0,0 +1,216 @@
1
+ package com.tapaya.acceptsdkreactnative
2
+
3
+ import com.tapaya.accept.ActivateTerminalResult
4
+ import com.tapaya.accept.SdkState
5
+ import com.tapaya.accept.domain.data.AcceptDisplay
6
+ import com.tapaya.accept.domain.data.AcceptTheme
7
+ import com.tapaya.accept.domain.data.AcceptThemeColors
8
+ import com.tapaya.accept.domain.data.AcceptThemeImages
9
+ import com.tapaya.accept.domain.data.AcceptThemeVariant
10
+ import com.tapaya.accept.domain.data.MerchantConfig
11
+ import com.tapaya.accept.domain.data.MerchantInformation
12
+ import com.tapaya.accept.domain.data.MinimumAmount
13
+ import com.tapaya.accept.domain.data.OnboardingStatus
14
+ import com.tapaya.accept.domain.data.PayResult
15
+ import com.tapaya.accept.domain.data.PaymentEvent
16
+ import com.tapaya.accept.domain.data.PaymentStatus
17
+ import com.tapaya.accept.domain.data.PluginStatus
18
+ import com.tapaya.accept.domain.data.PluginUpdateInfo
19
+ import com.tapaya.accept.domain.data.ReceiptDetails
20
+
21
+ /**
22
+ * Serializers turning the Android SDK's domain types into the plain maps the bridge carries.
23
+ *
24
+ * Sealed hierarchies become a `type` discriminator plus that case's fields, matching the tagged
25
+ * unions declared in `src/Accept.types.ts`; enums become their `name`, which is what the
26
+ * TypeScript string-literal unions spell.
27
+ */
28
+
29
+ internal fun SdkState.serialize(): String = when (this) {
30
+ SdkState.Idle -> "idle"
31
+ SdkState.Initialized -> "initialized"
32
+ SdkState.Authenticated -> "authenticated"
33
+ }
34
+
35
+ internal fun MinimumAmount.serialize(): Map<String, Any?> = mapOf(
36
+ "currency" to currency,
37
+ "amount" to amount,
38
+ )
39
+
40
+ internal fun MerchantConfig.serialize(): Map<String, Any?> = mapOf(
41
+ "availableCurrencies" to availableCurrencies,
42
+ "currency" to currency,
43
+ )
44
+
45
+ internal fun MerchantInformation.serialize(): Map<String, Any?> = mapOf(
46
+ "merchantId" to merchantId.toString(),
47
+ "email" to email,
48
+ "businessType" to businessType.name,
49
+ "legalName" to legalName,
50
+ "registrationNumber" to registrationNumber,
51
+ "mcc" to mcc,
52
+ "addressLine1" to addressLine1,
53
+ "city" to city,
54
+ "country" to country,
55
+ "vatNumber" to vatNumber,
56
+ "incorporationDate" to incorporationDate,
57
+ "addressLine2" to addressLine2,
58
+ "postalCode" to postalCode,
59
+ "state" to state,
60
+ "phone" to phone,
61
+ "averageItemValue" to averageItemValue,
62
+ "expectedMonthlyTurnover" to expectedMonthlyTurnover,
63
+ "businessModelDescription" to businessModelDescription,
64
+ "numberOfEmployees" to numberOfEmployees,
65
+ "annualTurnover" to annualTurnover,
66
+ "balanceSheetTotal" to balanceSheetTotal,
67
+ "statementDescriptor" to statementDescriptor,
68
+ "termsVersion" to termsVersion,
69
+ )
70
+
71
+ internal fun OnboardingStatus.serialize(): Map<String, Any?> = when (this) {
72
+ OnboardingStatus.ReadyForPayments -> mapOf("type" to "readyForPayments")
73
+ is OnboardingStatus.RequiresAction -> mapOf("type" to "requiresAction", "state" to state.name)
74
+ }
75
+
76
+ internal fun PaymentStatus.serialize(): Map<String, Any?> = mapOf(
77
+ "state" to state.name,
78
+ "paymentToken" to paymentToken,
79
+ "requestedAmount" to requestedAmount,
80
+ "requestedCurrency" to requestedCurrency,
81
+ "settlementAmount" to settlementAmount,
82
+ "settlementCurrency" to settlementCurrency,
83
+ "createdAt" to createdAt,
84
+ "receiptUrl" to receiptUrl,
85
+ "processedAt" to processedAt,
86
+ )
87
+
88
+ internal fun ReceiptDetails.serialize(): Map<String, Any?> = mapOf(
89
+ "merchantId" to merchantId,
90
+ "terminalId" to terminalId,
91
+ "cardBrand" to cardBrand,
92
+ "appLabel" to appLabel,
93
+ "aid" to aid,
94
+ "maskedPan" to maskedPan,
95
+ "responseCode" to responseCode,
96
+ "transactionTimestamp" to transactionTimestamp,
97
+ )
98
+
99
+ internal fun PayResult.serialize(): Map<String, Any?> = when (this) {
100
+ is PayResult.Success -> mapOf(
101
+ "type" to "success",
102
+ "paymentToken" to paymentToken,
103
+ "metadata" to metadata,
104
+ "authCode" to authCode,
105
+ "receiptDetails" to receiptDetails?.serialize(),
106
+ "receiptUrl" to receiptUrl,
107
+ )
108
+
109
+ is PayResult.Declined -> mapOf(
110
+ "type" to "declined",
111
+ "metadata" to metadata,
112
+ "receiptDetails" to receiptDetails?.serialize(),
113
+ "receiptUrl" to receiptUrl,
114
+ )
115
+
116
+ is PayResult.Canceled -> mapOf(
117
+ "type" to "canceled",
118
+ "metadata" to metadata,
119
+ )
120
+
121
+ is PayResult.Failed -> mapOf(
122
+ "type" to "failed",
123
+ "reason" to reason.name,
124
+ "metadata" to metadata,
125
+ )
126
+ }
127
+
128
+ internal fun PaymentEvent.serialize(): Map<String, Any?> = when (this) {
129
+ PaymentEvent.Creating -> mapOf("type" to "creating")
130
+ PaymentEvent.Launched -> mapOf("type" to "launched")
131
+ is PaymentEvent.Created -> mapOf(
132
+ "type" to "created",
133
+ "paymentToken" to paymentToken,
134
+ "receiptUrl" to receiptUrl,
135
+ )
136
+
137
+ is PaymentEvent.Result -> mapOf("type" to "result", "payResult" to payResult.serialize())
138
+ is PaymentEvent.CreationFailed -> mapOf("type" to "creationFailed", "error" to cause.serialize())
139
+ }
140
+
141
+ internal fun PluginStatus.serialize(): String = when (this) {
142
+ PluginStatus.NotInstalled -> "notInstalled"
143
+ PluginStatus.NotAuthenticated -> "notAuthenticated"
144
+ PluginStatus.Authenticated -> "authenticated"
145
+ PluginStatus.ReadyForPayments -> "readyForPayments"
146
+ PluginStatus.MerchantMismatch -> "merchantMismatch"
147
+ }
148
+
149
+ internal fun PluginUpdateInfo.serialize(): Map<String, Any?> = when (this) {
150
+ PluginUpdateInfo.UpToDate -> mapOf("type" to "upToDate")
151
+ PluginUpdateInfo.Unknown -> mapOf("type" to "unknown")
152
+ is PluginUpdateInfo.UpdateAvailable -> mapOf("type" to "updateAvailable", "priority" to priority)
153
+ }
154
+
155
+ internal fun ActivateTerminalResult.serialize(): Map<String, Any?> = when (this) {
156
+ ActivateTerminalResult.Success -> mapOf("type" to "success")
157
+ ActivateTerminalResult.Canceled -> mapOf("type" to "canceled")
158
+ is ActivateTerminalResult.Failed -> mapOf("type" to "failed", "reason" to reason.name)
159
+ }
160
+
161
+ internal fun AcceptDisplay.serialize(): Map<String, Any?> = mapOf(
162
+ "id" to id,
163
+ "name" to name,
164
+ "isPrimary" to isPrimary,
165
+ "isPresentation" to isPresentation,
166
+ "widthPx" to widthPx,
167
+ "heightPx" to heightPx,
168
+ )
169
+
170
+ internal fun AcceptTheme.serialize(): Map<String, Any?> = mapOf(
171
+ "light" to light?.serialize(),
172
+ "dark" to dark?.serialize(),
173
+ )
174
+
175
+ private fun AcceptThemeVariant.serialize(): Map<String, Any?> = mapOf(
176
+ "colors" to colors.serialize(),
177
+ "images" to images.serialize(),
178
+ )
179
+
180
+ private fun AcceptThemeColors.serialize(): Map<String, Any?> = mapOf(
181
+ "primary" to primary,
182
+ "onPrimary" to onPrimary,
183
+ "primaryContainer" to primaryContainer,
184
+ "onPrimaryContainer" to onPrimaryContainer,
185
+ "secondary" to secondary,
186
+ "onSecondary" to onSecondary,
187
+ "secondaryContainer" to secondaryContainer,
188
+ "onSecondaryContainer" to onSecondaryContainer,
189
+ "error" to error,
190
+ "onError" to onError,
191
+ "errorContainer" to errorContainer,
192
+ "onErrorContainer" to onErrorContainer,
193
+ "background" to background,
194
+ "onBackground" to onBackground,
195
+ "surface" to surface,
196
+ "onSurface" to onSurface,
197
+ "surfaceVariant" to surfaceVariant,
198
+ "onSurfaceVariant" to onSurfaceVariant,
199
+ "outline" to outline,
200
+ "outlineVariant" to outlineVariant,
201
+ "warning" to warning,
202
+ "onWarning" to onWarning,
203
+ "warningContainer" to warningContainer,
204
+ "onWarningContainer" to onWarningContainer,
205
+ "success" to success,
206
+ "onSuccess" to onSuccess,
207
+ "successContainer" to successContainer,
208
+ "onSuccessContainer" to onSuccessContainer,
209
+ )
210
+
211
+ private fun AcceptThemeImages.serialize(): Map<String, Any?> = mapOf(
212
+ "logoText" to logoText,
213
+ "logoTextSolid" to logoTextSolid,
214
+ "logoSymbol" to logoSymbol,
215
+ "logoSymbolWithBackground" to logoSymbolWithBackground,
216
+ )
package/app.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "plugins": [
3
- "./plugin/withCustomRepoModule.js"
3
+ "./plugin/withAcceptSdk.js"
4
4
  ]
5
- }
5
+ }
package/app.plugin.js CHANGED
@@ -1 +1 @@
1
- module.exports = require("./plugin/withCustomRepoModule");
1
+ module.exports = require("./plugin/withAcceptSdk");