@pinwheel/react-native-pinwheel 3.0.5 → 3.2.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/Info.plist +44 -0
  2. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
  3. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
  4. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Info.plist +0 -0
  5. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/Modules/module.modulemap +6 -0
  6. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/ObjCWrapper +0 -0
  7. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/README.md +15 -0
  8. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
  9. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/ObjCWrapper.h +18 -0
  10. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Headers/PinwheelVCWrapper.h +14 -0
  11. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Info.plist +0 -0
  12. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/Modules/module.modulemap +6 -0
  13. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/ObjCWrapper +0 -0
  14. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/README.md +15 -0
  15. package/PinwheelLinkSDKObjC/ObjCWrapper.xcframework/ios-arm64_x86_64-simulator/ObjCWrapper.framework/_CodeSignature/CodeResources +146 -0
  16. package/RNPinwheelSDK.podspec +21 -17
  17. package/android/build.gradle +26 -35
  18. package/android/src/main/java/com/rtnpinwheel/Pinwheel.kt +103 -0
  19. package/android/src/main/java/com/{underdog_tech/react/PinwheelViewManager.kt → rtnpinwheel/PinwheelEventsModule.kt} +55 -120
  20. package/android/src/main/java/com/rtnpinwheel/PinwheelManager.kt +54 -0
  21. package/android/src/main/java/com/{underdog_tech/react → rtnpinwheel}/PinwheelPackage.kt +7 -9
  22. package/ios/RTNPinwheelEvents.h +13 -0
  23. package/ios/{RNTPinwheelEvents.m → RTNPinwheelEvents.mm} +15 -3
  24. package/ios/RTNPinwheelManager.mm +21 -0
  25. package/ios/RTNPinwheelView.h +17 -0
  26. package/ios/RTNPinwheelView.mm +102 -0
  27. package/package.json +32 -9
  28. package/src/NativePinwheelEvents.ts +62 -0
  29. package/src/Pinwheel.tsx +80 -0
  30. package/src/PinwheelEvents.ts +23 -0
  31. package/src/RTNPinwheelNativeComponent.ts +15 -0
  32. package/src/client-events/client.ts +17 -0
  33. package/src/client-events/registry/v2.3.ts +166 -0
  34. package/src/client-events/registry/v3.ts +47 -0
  35. package/src/client-events/utils.ts +12 -0
  36. package/src/index.ts +3 -0
  37. package/.vscode/settings.json +0 -4
  38. package/CHANGELOG.md +0 -152
  39. package/android/src/main/AndroidManifest.xml +0 -6
  40. package/android/src/main/java/com/underdog_tech/react/RNTPinwheelEvents.kt +0 -51
  41. package/dist/client-events/client.d.ts +0 -10
  42. package/dist/client-events/client.js +0 -1
  43. package/dist/client-events/registry/v2.3.d.ts +0 -125
  44. package/dist/client-events/registry/v2.3.js +0 -1
  45. package/dist/client-events/registry/v3.d.ts +0 -25
  46. package/dist/client-events/registry/v3.js +0 -4
  47. package/dist/client-events/utils.d.ts +0 -9
  48. package/dist/client-events/utils.js +0 -1
  49. package/dist/constants.d.ts +0 -4
  50. package/dist/constants.js +0 -4
  51. package/dist/index.d.ts +0 -5
  52. package/dist/index.js +0 -49
  53. package/dist/pinwheel-view.d.ts +0 -6
  54. package/dist/pinwheel-view.js +0 -2
  55. package/dist/pinwheel-wrapper.android.d.ts +0 -4
  56. package/dist/pinwheel-wrapper.android.js +0 -33
  57. package/dist/pinwheel-wrapper.ios.d.ts +0 -4
  58. package/dist/pinwheel-wrapper.ios.js +0 -17
  59. package/ios/RNTPinwheelEvents.h +0 -9
  60. package/ios/RNTPinwheelManager.m +0 -21
  61. package/ios/RNTPinwheelView.h +0 -12
  62. package/ios/RNTPinwheelView.m +0 -65
@@ -0,0 +1,80 @@
1
+ import React, { useEffect, useCallback } from 'react';
2
+ import { SafeAreaView } from 'react-native';
3
+ import RTNPinwheel from './RTNPinwheelNativeComponent';
4
+ import { PinwheelEvents } from './PinwheelEvents';
5
+ import { LinkOptions } from './client-events/client';
6
+
7
+ const Pinwheel = ({
8
+ linkToken,
9
+ onLogin,
10
+ onLoginAttempt,
11
+ onSuccess,
12
+ onError,
13
+ onExit,
14
+ onEvent,
15
+ }: LinkOptions) => {
16
+ const eventsListener = useCallback(
17
+ (event: any) => {
18
+ if (!event) {
19
+ return;
20
+ }
21
+
22
+ const { name, payload } = event;
23
+ if (!name) {
24
+ return;
25
+ }
26
+
27
+ // Our Android SDK, since the beginning, has been firing events with upper case.
28
+ // Since we are now wrapping the Android SDK to create the RN SDK, we need to reconcile
29
+ // the event names here.
30
+ const normalizedName = name.toLowerCase();
31
+ onEvent && onEvent(normalizedName, payload);
32
+
33
+ switch (normalizedName) {
34
+ case 'exit':
35
+ // console.log(`case: exit, onExit: ${onExit}`);
36
+ onExit && onExit(payload);
37
+ break;
38
+ case 'success':
39
+ // console.log(`case: success, onSuccess: ${onSuccess}`);
40
+ onSuccess && onSuccess(payload);
41
+ break;
42
+ case 'login':
43
+ // console.log(`case: login, onLogin: ${onLogin}`);
44
+ onLogin && onLogin(payload);
45
+ break;
46
+ case 'login_attempt':
47
+ // console.log(`case: login_attempt, onLoginAttempt: ${onLoginAttempt}`);
48
+ onLoginAttempt && onLoginAttempt(payload);
49
+ break;
50
+ case 'error':
51
+ // console.log(`case: error, onError: ${onError}`);
52
+ onError && onError(payload);
53
+ break;
54
+ default:
55
+ }
56
+ },
57
+ [onError, onEvent, onExit, onLogin, onLoginAttempt, onSuccess]
58
+ );
59
+
60
+ useEffect(() => {
61
+ const listener = PinwheelEvents.addListener(eventsListener);
62
+
63
+ return () => {
64
+ listener.remove();
65
+ };
66
+ }, [eventsListener]);
67
+
68
+ return (
69
+ <SafeAreaView style={{ width: '100%', height: '100%' }}>
70
+ {linkToken && (
71
+ <RTNPinwheel
72
+ style={{ width: '100%', height: '100%' }}
73
+ token={linkToken}
74
+ />
75
+ )}
76
+ </SafeAreaView>
77
+ );
78
+ };
79
+
80
+ export default Pinwheel;
@@ -0,0 +1,23 @@
1
+ import {EmitterSubscription, Platform} from 'react-native';
2
+ import {
3
+ addListener,
4
+ removeAllListeners,
5
+ } from './NativePinwheelEvents';
6
+
7
+
8
+ export const PinwheelEvents = {
9
+ addListener(callback: (events: any) => void): EmitterSubscription {
10
+ return addListener(callback);
11
+ },
12
+
13
+ /**
14
+ * (iOS and Android Only)
15
+ * Removes all previously registered listeners and turns off notifications on the native side.
16
+ * ```javascript
17
+ * Clipboard.removeAllListeners();
18
+ * ```
19
+ */
20
+ removeAllListeners() {
21
+ removeAllListeners();
22
+ },
23
+ };
@@ -0,0 +1,15 @@
1
+ import type { ViewProps } from "react-native";
2
+ import type { HostComponent } from "react-native";
3
+ import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
4
+
5
+ type Event = {
6
+ name: string;
7
+ }
8
+
9
+ export interface NativeProps extends ViewProps {
10
+ token: string;
11
+ }
12
+
13
+ export default codegenNativeComponent<NativeProps>(
14
+ "RTNPinwheel"
15
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,17 @@
1
+ import type {
2
+ LoginEventPayload,
3
+ SuccessEventPayload,
4
+ EventHandler,
5
+ ErrorEventPayload,
6
+ LoginAttemptEventPayload
7
+ } from './registry/v3'
8
+
9
+ export type LinkOptions = {
10
+ linkToken: string
11
+ onLogin?: (payload: LoginEventPayload) => void
12
+ onLoginAttempt?: (payload: LoginAttemptEventPayload) => void
13
+ onSuccess?: (payload: SuccessEventPayload) => void
14
+ onError?: (error: ErrorEventPayload) => void
15
+ onExit?: (error?: ErrorEventPayload) => void
16
+ onEvent?: EventHandler
17
+ }
@@ -0,0 +1,166 @@
1
+ /* eslint-disable @typescript-eslint/ban-types */
2
+ import type { AdditionsType, ModificationsType, RemovalsType } from '../utils'
3
+
4
+ export type PinwheelErrorType =
5
+ | 'sandboxError'
6
+ | 'clientError'
7
+ | 'systemError'
8
+ | 'userActionRequired'
9
+ | 'platformError'
10
+ | 'invalidAccountsConfiguration'
11
+ | 'invalidUserInput'
12
+ | 'invalidLinkToken'
13
+ | 'networkError'
14
+
15
+ export type LinkApiJob = 'login' | 'direct_deposit_switch' | 'card_switch'
16
+
17
+ export type OpenEventPayload = {}
18
+
19
+ export type SelectEmployerEventPayload = {
20
+ selectedEmployerId: string
21
+ selectedEmployerName: string
22
+ }
23
+
24
+ export type SelectPlatformEventPayload = {
25
+ selectedPlatformId: string
26
+ selectedPlatformName: string
27
+ }
28
+
29
+ export type IncorrectPlatformGivenEventPayload = {}
30
+
31
+ export type LoginAttemptEventPayload = {
32
+ platformId: string
33
+ }
34
+
35
+ export type LoginEventPayload = {
36
+ accountId: string
37
+ platformId: string
38
+ }
39
+
40
+ export type InputAmountEventPayload = {
41
+ value: number
42
+ unit: '$' | '%'
43
+ }
44
+
45
+ type _PartialSwitch<T> = { action: 'partial_switch'; allocation: T }
46
+ type InputAllocationPercentage = _PartialSwitch<{
47
+ type: 'percentage'
48
+ value: number
49
+ }>
50
+ type InputAllocationAmount = _PartialSwitch<{
51
+ type: 'amount'
52
+ value: number
53
+ }>
54
+ type InputAllocationRemainder = _PartialSwitch<{
55
+ type: 'remainder'
56
+ }>
57
+ export type InputAllocationEventPayload =
58
+ | { action: 'full_switch' }
59
+ | InputAllocationRemainder
60
+ | InputAllocationAmount
61
+ | InputAllocationPercentage
62
+
63
+ /**
64
+ * @deprecated - Use `InputAllocationEventPayload` instead.
65
+ */
66
+ export type InputAllocation = InputAllocationEventPayload
67
+
68
+ export type CardSwitchBeginEventPayload = {}
69
+
70
+ export type DocUploadsBeginEventPayload = {
71
+ uploadedDocumentsSubmittedCount?: number
72
+ }
73
+
74
+ export type DocUploadsSubmittedEventPayload = {
75
+ uploadedDocumentSubmittedCount: number
76
+ }
77
+
78
+ export type DdFormBeginEventPayload = {}
79
+
80
+ export type DdFormCreateEventPayload = {
81
+ url: string
82
+ }
83
+
84
+ export type DdFormDownloadEventPayload = {}
85
+
86
+ export type ScreenTransitionEventPayload = {
87
+ screenName: string
88
+ selectedEmployerId?: string
89
+ selectedEmployerName?: string
90
+ selectedPlatformId?: string
91
+ selectedPlatformName?: string
92
+ }
93
+
94
+ /**
95
+ * @deprecated - Use `ScreenTransitionEventPayload` instead.
96
+ */
97
+ export type ScreenTransition = ScreenTransitionEventPayload
98
+
99
+ export type ExitEventPayload = Record<string, never>
100
+
101
+ export type SuccessEventPayload = {
102
+ accountId: string
103
+ platformId: string
104
+ job: LinkApiJob
105
+ params?: {
106
+ amount?: { value: number; unit: '%' | '$' }
107
+ }
108
+ }
109
+
110
+ export type ErrorEventPayload = {
111
+ type: PinwheelErrorType
112
+ code: string
113
+ message: string
114
+ pendingRetry: boolean
115
+ }
116
+
117
+ export type OtherEventPayload = {
118
+ name: string;
119
+ payload: {
120
+ key: string;
121
+ value: string;
122
+ type: 'string' | 'boolean' | 'number';
123
+ }[];
124
+ };
125
+
126
+ /**
127
+ * @deprecated - Use `ErrorEventPayload` instead.
128
+ */
129
+ export type PinwheelError = ErrorEventPayload
130
+
131
+ type EventPayloadAdditions = {
132
+ open: OpenEventPayload
133
+ select_employer: SelectEmployerEventPayload
134
+ select_platform: SelectPlatformEventPayload
135
+ incorrect_platform_given: IncorrectPlatformGivenEventPayload
136
+ login_attempt: LoginAttemptEventPayload
137
+ login: LoginEventPayload
138
+ input_amount: InputAmountEventPayload
139
+ input_allocation: InputAllocationEventPayload
140
+ card_switch_begin: CardSwitchBeginEventPayload
141
+ doc_uploads_begin: DocUploadsBeginEventPayload
142
+ doc_uploads_submitted: DocUploadsSubmittedEventPayload
143
+ dd_form_begin: DdFormBeginEventPayload
144
+ dd_form_create: DdFormCreateEventPayload
145
+ dd_form_download: DdFormDownloadEventPayload
146
+ screen_transition: ScreenTransitionEventPayload
147
+ exit: ErrorEventPayload | ExitEventPayload
148
+ other_event: OtherEventPayload;
149
+ success: SuccessEventPayload
150
+ error: ErrorEventPayload
151
+ }
152
+
153
+ type EventPayloadModifications = {}
154
+
155
+ type EventPayloadRemovals = []
156
+
157
+ export type EventPayloadMap = Omit<
158
+ AdditionsType<EventPayloadAdditions> &
159
+ ModificationsType<EventPayloadModifications>,
160
+ keyof RemovalsType<EventPayloadRemovals>
161
+ >
162
+
163
+ export type EventHandler = <T extends keyof EventPayloadMap>(
164
+ eventName: T,
165
+ payload: EventPayloadMap[T]
166
+ ) => void
@@ -0,0 +1,47 @@
1
+ /* eslint-disable camelcase */
2
+ /* eslint-disable @typescript-eslint/ban-types */
3
+ import type { AdditionsType, ModificationsType, RemovalsType } from '../utils'
4
+ import type { EventPayloadMap as EventPayloadMapV2, LinkApiJob } from './v2.3'
5
+
6
+ import { InputAllocationEventPayload as InputAllocationEventPayload2_3 } from './v2.3'
7
+
8
+ /*
9
+ * Export all the types from V3 and we override whatever changes
10
+ */
11
+ export * from './v2.3'
12
+
13
+ export type SuccessEventPayload = {
14
+ accountId: string
15
+ platformId: string
16
+ job: LinkApiJob
17
+ params?: InputAllocationEventPayload
18
+ }
19
+
20
+ export type InputAllocationEventPayload =
21
+ | { action: null; allocation: null }
22
+ | InputAllocationEventPayload2_3
23
+
24
+ /**
25
+ * @deprecated - Use `InputAllocationEventPayload` instead.
26
+ */
27
+ export type InputAllocation = InputAllocationEventPayload
28
+
29
+ type EventPayloadAdditions = {}
30
+
31
+ type EventPayloadModifications = {
32
+ input_allocation: InputAllocationEventPayload
33
+ }
34
+
35
+ type EventPayloadRemovals = ['input_amount']
36
+
37
+ export type EventPayloadMap = Omit<
38
+ EventPayloadMapV2 &
39
+ AdditionsType<EventPayloadAdditions> &
40
+ ModificationsType<EventPayloadModifications>,
41
+ keyof RemovalsType<EventPayloadRemovals>
42
+ >
43
+
44
+ export type EventHandler = <T extends keyof EventPayloadMap>(
45
+ eventName: T,
46
+ payload: EventPayloadMap[T]
47
+ ) => void
@@ -0,0 +1,12 @@
1
+ // Generic types for additions, modifications, and removals
2
+ export type AdditionsType<Additions> = {
3
+ [Event in keyof Additions]: Additions[Event]
4
+ }
5
+
6
+ export type ModificationsType<Modifications> = {
7
+ [Event in keyof Modifications]: Modifications[Event]
8
+ }
9
+
10
+ export type RemovalsType<Removals extends string[]> = {
11
+ [Event in Removals[number]]: never
12
+ }
package/src/index.ts ADDED
@@ -0,0 +1,3 @@
1
+ import Pinwheel from "./Pinwheel";
2
+
3
+ export default Pinwheel;
@@ -1,4 +0,0 @@
1
- {
2
- "java.compile.nullAnalysis.mode": "automatic",
3
- "java.configuration.updateBuildConfiguration": "interactive"
4
- }
package/CHANGELOG.md DELETED
@@ -1,152 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- # 3.0.x Releases
6
-
7
- - `3.0.x` Releases - [3.0.0](#300) | [3.0.1](#301) | [3.0.2](#302) | [3.0.3](#303) | [3.0.4](#304) | [3.0.5](#305)
8
-
9
- ---
10
-
11
- ### [3.0.5](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.5)
12
-
13
- Expand internal functionality to support a broader range of platforms and increase conversion rate. Export `OtherEventPayload` event payload type for the `other_event` event.
14
-
15
- ### [3.0.4](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.4)
16
-
17
- ####
18
- Bugfix: Normalize event names to lower case. Event names began firing as uppercase in versions 3.0.0 and 2.5.0.
19
-
20
- ### [3.0.3](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.3)
21
-
22
- Changed Minimum Android SDK requirements to 22
23
-
24
- ### [3.0.2](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.2)
25
-
26
- Changed example app Minimum Android SDK requirements to 22
27
-
28
- ### [3.0.1](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.1)
29
-
30
- Expand internal functionality to support a broader range of platforms and increase conversion rate.
31
-
32
- ### [3.0.0](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/3.0.0)
33
-
34
- This new major version bump introduces an updated API to support partner-based switches.
35
-
36
- #### Changed
37
- - The `action` field in `input_allocation` event is now optional.
38
- - The `params` field in the `success` event uses the `input_allocation` schema with fields `action` and `allocation`.
39
-
40
- #### Removed
41
- - Removed `LinkResult` type export. This was the old `success` event payload. The new payload has the same format as the newly exported `SuccessEventPayload`.
42
- - Removed `EventPayload` type export. The event handler function will now be implicitly typed.
43
- - Removed `ScreenTransition` type export. Use `ScreenTransitionEventPayload` instead.
44
- - Removed `EmptyPayloadObject` type export.
45
- - Removed `Error` type export. Use `ErrorEventPayload` instead. (`Error` was marked as deprecated in version 2.)
46
- - Removed `ErrorType` type export. Use `PinwheelErrorType` instead. (`ErrorType` was marked as deprecated in version 2.)
47
- - Removed `input_amount` event. Use `input_allocation` even instead.
48
- - Removed `PINWHEEL_MESSAGE_TYPES`.
49
-
50
- ## 2.5.x Releases
51
-
52
- [2.5.0](#250) | [2.5.1](#251) | [2.5.2](#252) | [2.5.3](#253) | [2.5.4](#254)
53
-
54
- ---
55
- ### [2.5.4](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.5.4)
56
-
57
- #### Bugfix
58
- Normalize event names to lower case. Event names began firing as uppercase in versions 3.0.0 and 2.5.0.
59
-
60
- ### [2.5.3](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.5.3)
61
-
62
- #### Notes
63
-
64
- Changed Minimum Android SDK requirements to 22
65
-
66
- ### [2.5.2](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.5.2)
67
-
68
- #### Notes
69
-
70
- Expand internal functionality to support a broader range of platforms and increase conversion rate.
71
-
72
- ### 2.5.1
73
-
74
- #### Notes
75
-
76
- - Internal contract changes
77
-
78
- ### 2.5.0
79
-
80
- #### Notes
81
-
82
- We're thrilled to announce the latest version of our SDK! While you'll find that our familiar API contract remains unchanged, there's a host of improvements that make this upgrade indispensable:
83
-
84
- - **Enhanced Redundancy**: 🛡️ We've fortified our systems, ensuring smoother recovery from integration failures for a significant percentage of our traffic.
85
- - **Superior Uptime**: 🦾 Reliability is a top priority. This upgrade brings even more robust uptime for DDS integrations.
86
- - **Increased Conversion**: ↗️ We are leveraging system level features to increase conversion.
87
- - **Easy Upgrade**: 🥧 No changes were made to the API contract. Easy as pie.
88
-
89
- ## 2.4.x Releases
90
-
91
- [2.4.0](#240)
92
-
93
- ---
94
-
95
- ### 2.4.0
96
-
97
- - Removing `overrides` from main package.
98
- - Updating example app to use newest ReactNative versions.
99
- - Changing devDependencies to use newest React Native Webview (for typing).
100
-
101
- ## 2.3.x Releases
102
-
103
- [2.3.4](#234) | [2.3.5](#235) | [2.3.6](#236) | [2.3.10](#2310) | [2.3.12](#2312) | [2.3.13](#2313) | [2.3.14](#2314) | [2.3.17](#2317)
104
-
105
- ---
106
-
107
- ### 2.3.17
108
-
109
- Export `ScreenTransition` event payload type for the `screen_transition` event.
110
-
111
-
112
- ### 2.3.14
113
-
114
- Remove `hermes-engine` and `shell-quote` sub-dependencies from package-lock files.
115
-
116
- ### 2.3.13
117
-
118
- Bump `hermes-engine` and `shell-quote` sub-dependency package.
119
-
120
- ### 2.3.12
121
-
122
- Add CircleCI scripting and local scripts.
123
- - Add `npm run dev` script.
124
- - Remove need for hardcoding api secret in code to run locally.
125
-
126
- ### 2.3.10
127
-
128
- Use node 16.7.0 instead of 12.16.1 to install dependencies.
129
-
130
- ### [2.3.6](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.3.6)
131
-
132
- N/A
133
-
134
- ### [2.3.5](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.3.5)
135
-
136
- N/A
137
-
138
- ### [2.3.4](https://www.npmjs.com/package/@pinwheel/react-native-pinwheel/v/2.3.4)
139
-
140
- #### Added
141
-
142
- - Export `EventPayload` type.
143
- - Export `PinwheelError` type.
144
- - Export `PinwheelErrorType` type.
145
- - Export `EmptyPayloadObject` type as `Record<string, never>`.
146
-
147
- ##### Updated
148
-
149
- - `EventPayload` is no longer a union containing `{}`. It now contains `Record<string, never>` instead due to [this behavior](https://github.com/Microsoft/TypeScript/wiki/FAQ#why-are-all-types-assignable-to-empty-interfaces).
150
- - Mark exported `Error` type as **@deprecated** because it collides with the built-in javascript `Error` object. Replaced with `PinwheelError`.
151
- - Mark exported `ErrorType` type as **@deprecated** because the new naming convention is prefixing with "`PinwheelError`". Replaced with `PinwheelErrorType`.
152
- - Update `onExit` type to be `(error: PinwheelError | Record<string, never>)` to be accurate with current functionality.
@@ -1,6 +0,0 @@
1
-
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.underdog_tech.react">
4
-
5
- </manifest>
6
-
@@ -1,51 +0,0 @@
1
- package com.underdog_tech.react
2
-
3
- import com.facebook.react.bridge.Arguments
4
- import com.facebook.react.bridge.ReactApplicationContext
5
- import com.facebook.react.bridge.ReactContextBaseJavaModule
6
- import com.facebook.react.bridge.ReactMethod
7
- import com.facebook.react.bridge.WritableMap
8
- import com.facebook.react.modules.core.DeviceEventManagerModule
9
-
10
- class RNTPinwheelEvents(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
11
- companion object {
12
- private const val EVENT_KEY = "PINWHEEL_EVENT"
13
- }
14
-
15
- override fun getName(): String {
16
- return "RNTPinwheelEvents"
17
- }
18
-
19
- @ReactMethod
20
- fun anExposedMethod() {
21
- val currentContext = reactApplicationContext
22
- val eventName = "PINWHEEL_EVENT"
23
- val params: WritableMap = Arguments.createMap().apply {
24
- putString("type", "myEventType")
25
- }
26
- sendEvent(currentContext, eventName, params)
27
- }
28
-
29
- fun sendEvent(reactContext: ReactApplicationContext, eventName: String, params: WritableMap?) {
30
- reactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit(eventName, params)
31
- }
32
-
33
- private var listenerCount = 0
34
-
35
- @ReactMethod
36
- fun addListener(eventName: String) {
37
- if (listenerCount == 0) {
38
- // Set up any upstream listeners or background tasks as necessary
39
- }
40
-
41
- listenerCount += 1
42
- }
43
-
44
- @ReactMethod
45
- fun removeListeners(count: Int) {
46
- listenerCount -= count
47
- if (listenerCount == 0) {
48
- // Remove upstream listeners, stop unnecessary background tasks
49
- }
50
- }
51
- }
@@ -1,10 +0,0 @@
1
- import type { LoginEventPayload, SuccessEventPayload, EventHandler, ErrorEventPayload, LoginAttemptEventPayload } from './registry/v3';
2
- export type LinkOptions = {
3
- linkToken: string;
4
- onLogin?: (payload: LoginEventPayload) => void;
5
- onLoginAttempt?: (payload: LoginAttemptEventPayload) => void;
6
- onSuccess?: (payload: SuccessEventPayload) => void;
7
- onError?: (error: ErrorEventPayload) => void;
8
- onExit?: (error?: ErrorEventPayload) => void;
9
- onEvent?: EventHandler;
10
- };
@@ -1 +0,0 @@
1
- export {};