@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.
@@ -17,5 +17,5 @@ Pod::Spec.new do |s|
17
17
 
18
18
  install_modules_dependencies(s)
19
19
 
20
- s.dependency 'PinwheelSDK', '3.4.1'
20
+ s.dependency 'PinwheelSDK', '3.4.2'
21
21
  end
@@ -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.5.3", getReactNativeVersion(), this.handleInsets, this.useDarkMode)
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
- init {
30
- Companion.context = context
31
- }
32
+ init {
33
+ Companion.context = context
34
+ }
32
35
 
33
- override fun getName(): String = NAME
36
+ override fun getName(): String = NAME
34
37
 
35
- @ReactMethod
36
- fun setListener() {
37
- hasListeners = true;
38
- }
38
+ @ReactMethod
39
+ fun setListener() {
40
+ hasListeners = true;
41
+ }
39
42
 
40
- @ReactMethod
41
- fun removeListener() {
42
- hasListeners = false;
43
- }
43
+ @ReactMethod
44
+ fun removeListener() {
45
+ hasListeners = false;
46
+ }
44
47
 
45
- @ReactMethod
46
- fun addListener(eventName: String) {
47
- // Keep: Required for RN built in Event Emitter Calls.
48
- }
48
+ @ReactMethod
49
+ fun addListener(eventName: String) {
50
+ // Keep: Required for RN built in Event Emitter Calls.
51
+ }
49
52
 
50
- @ReactMethod
51
- fun removeListeners(count: Int) {
52
- // Keep: Required for RN built in Event Emitter Calls.
53
- }
53
+ @ReactMethod
54
+ fun removeListeners(count: Int) {
55
+ // Keep: Required for RN built in Event Emitter Calls.
56
+ }
54
57
 
55
- override fun onEvent(eventName: PinwheelEventType, payload: PinwheelEventPayload?) {
56
- if (!hasListeners) return
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
- companion object {
70
- const val NAME = "RTNPinwheelEvents"
71
- const val PinwheelEventName = "PINWHEEL_EVENT"
72
- private var context: ReactApplicationContext? = null
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
  }
@@ -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.5.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.5.3"
240
+ version:@"3.6.0"
241
241
  useDarkMode:self.useDarkMode
242
242
  useAppBoundDomains:NO
243
243
  useAppBoundDomainsForNativeLink:NO];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinwheel/react-native-pinwheel",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -96,7 +96,6 @@ export type OtherEventPayload = {
96
96
  export type BillSwitchPayload = {
97
97
  platformId: string;
98
98
  platformName: string;
99
- isGuidedSwitch: boolean;
100
99
  isIntegratedSwitch: boolean;
101
100
  frequency: string;
102
101
  nextPaymentDate: string;
@@ -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;