@pinwheel/react-native-pinwheel 3.5.3 → 3.6.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/RNPinwheelSDK.podspec +1 -1
- package/android/src/main/java/com/rtnpinwheel/Pinwheel.kt +1 -1
- package/android/src/main/java/com/rtnpinwheel/PinwheelEventsModule.kt +76 -38
- package/ios/RTNPinwheelView.mm +2 -2
- package/package.json +1 -1
- package/src/client-events/registry/v2.3.d.ts +0 -1
- package/src/client-events/registry/v2.3.ts +0 -1
package/RNPinwheelSDK.podspec
CHANGED
|
@@ -89,7 +89,7 @@ class Pinwheel : FrameLayout {
|
|
|
89
89
|
Handler(Looper.getMainLooper()).post {
|
|
90
90
|
if (this.pinwheelFragment == null) {
|
|
91
91
|
this.token?.let {
|
|
92
|
-
val pinwheelFragment = PinwheelFragment.newInstanceWithAdvancedOptions(it, "react native", "3.
|
|
92
|
+
val pinwheelFragment = PinwheelFragment.newInstanceWithAdvancedOptions(it, "react native", "3.6.0", getReactNativeVersion(), this.handleInsets, this.useDarkMode)
|
|
93
93
|
pinwheelEventListener?.let { listener ->
|
|
94
94
|
pinwheelFragment.pinwheelEventListener = listener
|
|
95
95
|
}
|
|
@@ -14,6 +14,7 @@ import com.underdog_tech.pinwheel_android.model.PinwheelEventType
|
|
|
14
14
|
import com.underdog_tech.pinwheel_android.model.PinwheelInputAllocationPayload
|
|
15
15
|
import com.underdog_tech.pinwheel_android.model.PinwheelTarget
|
|
16
16
|
import com.underdog_tech.pinwheel_android.model.PinwheelAllocation
|
|
17
|
+
import com.underdog_tech.pinwheel_android.model.PinwheelBillSwitchEventPayload
|
|
17
18
|
import com.underdog_tech.pinwheel_android.model.PinwheelParams
|
|
18
19
|
import com.underdog_tech.pinwheel_android.model.PinwheelResult
|
|
19
20
|
import com.underdog_tech.pinwheel_android.model.PinwheelError
|
|
@@ -22,56 +23,58 @@ import com.underdog_tech.pinwheel_android.model.PinwheelSelectedPlatformPayload
|
|
|
22
23
|
import com.underdog_tech.pinwheel_android.model.PinwheelLoginPayload
|
|
23
24
|
import com.underdog_tech.pinwheel_android.model.PinwheelLoginAttemptPayload
|
|
24
25
|
import com.underdog_tech.pinwheel_android.model.PinwheelDDFormCreatePayload
|
|
26
|
+
import com.underdog_tech.pinwheel_android.model.PinwheelExternalAccountConnectedPayload
|
|
27
|
+
import com.underdog_tech.pinwheel_android.model.PinwheelOtherEventPayload
|
|
25
28
|
import com.underdog_tech.pinwheel_android.model.PinwheelScreenTransitionPayload
|
|
26
29
|
|
|
27
30
|
@ReactModule(name = PinwheelEventsModule.NAME)
|
|
28
31
|
class PinwheelEventsModule(private val context: ReactApplicationContext) : ReactContextBaseJavaModule(context), PinwheelEventListener {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
init {
|
|
33
|
+
Companion.context = context
|
|
34
|
+
}
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
override fun getName(): String = NAME
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
@ReactMethod
|
|
39
|
+
fun setListener() {
|
|
40
|
+
hasListeners = true;
|
|
41
|
+
}
|
|
39
42
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
@ReactMethod
|
|
44
|
+
fun removeListener() {
|
|
45
|
+
hasListeners = false;
|
|
46
|
+
}
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
@ReactMethod
|
|
49
|
+
fun addListener(eventName: String) {
|
|
50
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
51
|
+
}
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
@ReactMethod
|
|
54
|
+
fun removeListeners(count: Int) {
|
|
55
|
+
// Keep: Required for RN built in Event Emitter Calls.
|
|
56
|
+
}
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
val params = WritableNativeMap()
|
|
59
|
-
params.putString("name", eventName.toString())
|
|
60
|
-
if (payload != null) {
|
|
61
|
-
params.putMap("payload", payload.toWritableMap())
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
context
|
|
65
|
-
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
66
|
-
.emit(Companion.PinwheelEventName, params)
|
|
67
|
-
}
|
|
58
|
+
override fun onEvent(eventName: PinwheelEventType, payload: PinwheelEventPayload?) {
|
|
59
|
+
if (!hasListeners) return
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
private var hasListeners = false;
|
|
61
|
+
val params = WritableNativeMap()
|
|
62
|
+
params.putString("name", eventName.toString())
|
|
63
|
+
if (payload != null) {
|
|
64
|
+
params.putMap("payload", payload.toWritableMap())
|
|
74
65
|
}
|
|
66
|
+
|
|
67
|
+
context
|
|
68
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
69
|
+
.emit(Companion.PinwheelEventName, params)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
companion object {
|
|
73
|
+
const val NAME = "RTNPinwheelEvents"
|
|
74
|
+
const val PinwheelEventName = "PINWHEEL_EVENT"
|
|
75
|
+
private var context: ReactApplicationContext? = null
|
|
76
|
+
private var hasListeners = false;
|
|
77
|
+
}
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
fun PinwheelTarget.toWritableMap(): WritableMap {
|
|
@@ -109,30 +112,37 @@ fun PinwheelEventPayload.toWritableMap(): WritableMap = when (this) {
|
|
|
109
112
|
putString("job", this@toWritableMap.job)
|
|
110
113
|
putMap("params", this@toWritableMap.params?.toWritableMap())
|
|
111
114
|
}
|
|
115
|
+
|
|
112
116
|
is PinwheelError -> Arguments.createMap().apply {
|
|
113
117
|
putString("type", this@toWritableMap.type)
|
|
114
118
|
putString("code", this@toWritableMap.code)
|
|
115
119
|
putString("message", this@toWritableMap.message)
|
|
116
120
|
putBoolean("pendingRetry", this@toWritableMap.pendingRetry)
|
|
117
121
|
}
|
|
122
|
+
|
|
118
123
|
is PinwheelSelectedEmployerPayload -> Arguments.createMap().apply {
|
|
119
124
|
putString("selectedEmployerId", this@toWritableMap.selectedEmployerId)
|
|
120
125
|
putString("selectedEmployerName", this@toWritableMap.selectedEmployerName)
|
|
121
126
|
}
|
|
127
|
+
|
|
122
128
|
is PinwheelSelectedPlatformPayload -> Arguments.createMap().apply {
|
|
123
129
|
putString("selectedPlatformId", this@toWritableMap.selectedPlatformId)
|
|
124
130
|
putString("selectedPlatformName", this@toWritableMap.selectedPlatformName)
|
|
125
131
|
}
|
|
132
|
+
|
|
126
133
|
is PinwheelLoginPayload -> Arguments.createMap().apply {
|
|
127
134
|
putString("accountId", this@toWritableMap.accountId)
|
|
128
135
|
putString("platformId", this@toWritableMap.platformId)
|
|
129
136
|
}
|
|
137
|
+
|
|
130
138
|
is PinwheelLoginAttemptPayload -> Arguments.createMap().apply {
|
|
131
139
|
putString("platformId", this@toWritableMap.platformId)
|
|
132
140
|
}
|
|
141
|
+
|
|
133
142
|
is PinwheelDDFormCreatePayload -> Arguments.createMap().apply {
|
|
134
143
|
putString("url", this@toWritableMap.url)
|
|
135
144
|
}
|
|
145
|
+
|
|
136
146
|
is PinwheelScreenTransitionPayload -> Arguments.createMap().apply {
|
|
137
147
|
putString("screenName", this@toWritableMap.screenName)
|
|
138
148
|
putString("selectedEmployerId", this@toWritableMap.selectedEmployerId)
|
|
@@ -140,5 +150,33 @@ fun PinwheelEventPayload.toWritableMap(): WritableMap = when (this) {
|
|
|
140
150
|
putString("selectedPlatformId", this@toWritableMap.selectedPlatformId)
|
|
141
151
|
putString("selectedPlatformName", this@toWritableMap.selectedPlatformName)
|
|
142
152
|
}
|
|
153
|
+
|
|
154
|
+
is PinwheelOtherEventPayload -> Arguments.createMap().apply {
|
|
155
|
+
putString("name", this@toWritableMap.name)
|
|
156
|
+
val payloadArray = Arguments.createArray()
|
|
157
|
+
this@toWritableMap.payload.forEach { item ->
|
|
158
|
+
val map = Arguments.createMap()
|
|
159
|
+
map.putString("key", item.key)
|
|
160
|
+
map.putString("value", item.value)
|
|
161
|
+
map.putString("type", item.type.name)
|
|
162
|
+
payloadArray.pushMap(map)
|
|
163
|
+
}
|
|
164
|
+
putArray("payload", payloadArray)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
is PinwheelBillSwitchEventPayload -> Arguments.createMap().apply {
|
|
168
|
+
putString("platformId", this@toWritableMap.platformId)
|
|
169
|
+
putString("platformName", this@toWritableMap.platformName)
|
|
170
|
+
putBoolean("isIntegratedSwitch", this@toWritableMap.isIntegratedSwitch)
|
|
171
|
+
putString("frequency", this@toWritableMap.frequency)
|
|
172
|
+
putString("nextPaymentDate", this@toWritableMap.nextPaymentDate)
|
|
173
|
+
putInt("amountCents", this@toWritableMap.amountCents)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
is PinwheelExternalAccountConnectedPayload -> Arguments.createMap().apply {
|
|
177
|
+
putString("institutionName", this@toWritableMap.institutionName)
|
|
178
|
+
putString("accountName", this@toWritableMap.accountName)
|
|
179
|
+
}
|
|
180
|
+
|
|
143
181
|
else -> throw IllegalArgumentException("Unsupported PinwheelEventPayload type")
|
|
144
182
|
}
|
package/ios/RTNPinwheelView.mm
CHANGED
|
@@ -74,7 +74,7 @@ using namespace facebook::react;
|
|
|
74
74
|
[[PinwheelWrapperVC alloc] initWithToken:self.token
|
|
75
75
|
delegate:self
|
|
76
76
|
sdk:@"react native"
|
|
77
|
-
version:@"3.
|
|
77
|
+
version:@"3.6.0"
|
|
78
78
|
useDarkMode:self.useDarkMode
|
|
79
79
|
useAppBoundDomains:NO
|
|
80
80
|
useAppBoundDomainsForNativeLink:NO];
|
|
@@ -237,7 +237,7 @@ Class<RCTComponentViewProtocol> RTNPinwheelCls(void) {
|
|
|
237
237
|
[[PinwheelWrapperVC alloc] initWithToken:self.token
|
|
238
238
|
delegate:self
|
|
239
239
|
sdk:@"react native"
|
|
240
|
-
version:@"3.
|
|
240
|
+
version:@"3.6.0"
|
|
241
241
|
useDarkMode:self.useDarkMode
|
|
242
242
|
useAppBoundDomains:NO
|
|
243
243
|
useAppBoundDomainsForNativeLink:NO];
|
package/package.json
CHANGED
|
@@ -126,7 +126,6 @@ export type OtherEventPayload = {
|
|
|
126
126
|
export type BillSwitchPayload = {
|
|
127
127
|
platformId: string;
|
|
128
128
|
platformName: string;
|
|
129
|
-
isGuidedSwitch: boolean; // deprecated: will be removed in future version
|
|
130
129
|
isIntegratedSwitch: boolean;
|
|
131
130
|
frequency: string;
|
|
132
131
|
nextPaymentDate: string;
|