gomarketme-react-native 4.0.1 → 5.0.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 (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +105 -49
  3. package/android/build.gradle +46 -0
  4. package/android/libs/core-5.0.0.jar +0 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativeModule.kt +184 -0
  7. package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativePackage.kt +16 -0
  8. package/gomarketme-react-native.podspec +18 -0
  9. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/Info.plist +44 -0
  10. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
  11. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
  12. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.abi.json +2932 -0
  13. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.package.swiftinterface +86 -0
  14. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.private.swiftinterface +86 -0
  15. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  16. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftinterface +86 -0
  17. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
  18. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
  19. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.abi.json +2932 -0
  20. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +86 -0
  21. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +86 -0
  22. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +86 -0
  24. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +2932 -0
  25. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +86 -0
  26. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +86 -0
  27. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +86 -0
  29. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/_CodeSignature/CodeResources +101 -0
  30. package/ios/GoMarketMeReactNative.swift +133 -0
  31. package/ios/GoMarketMeReactNativeBridge.m +17 -0
  32. package/{dist → lib}/index.d.ts +27 -30
  33. package/lib/index.js +172 -0
  34. package/package.json +38 -19
  35. package/react-native.config.js +12 -0
  36. package/dist/index.js +0 -544
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) GoMarketMe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,96 +1,152 @@
1
1
  <div align="center">
2
- <img src="https://static.gomarketme.net/assets/gmm-icon.png" alt="GoMarketMe"/>
3
- <br>
4
- <h1>gomarketme-react-native</h1>
5
- <p>Affiliate marketing for React Native apps on iOS and Android.</p>
2
+ <img src="https://static.gomarketme.net/assets/gmm-icon.png" alt="GoMarketMe" />
3
+ <br />
4
+ <h1>GoMarketMe React Native SDK</h1>
5
+ <p>Affiliate marketing for React Native and Expo apps on iOS and Android.</p>
6
6
  </div>
7
7
 
8
8
  ## Installation
9
9
 
10
- ### Using npm
10
+ ### npm
11
11
 
12
12
  ```bash
13
- npm install gomarketme-react-native@4.0.1
13
+ npm install gomarketme-react-native@5.0.1
14
14
  ```
15
15
 
16
- ### Using yarn
16
+ ### Yarn
17
17
 
18
18
  ```bash
19
- yarn add gomarketme-react-native@4.0.1
19
+ yarn add gomarketme-react-native@5.0.1
20
20
  ```
21
21
 
22
- ### Using pnpm
22
+ ### pnpm
23
23
 
24
24
  ```bash
25
- pnpm add gomarketme-react-native@4.0.1
25
+ pnpm add gomarketme-react-native@5.0.1
26
26
  ```
27
- ##
28
27
 
29
- GoMarketMe is built on top of react-native-iap, so you may also need to install the following packages:
30
- ```bash
31
- npm install react-native-iap react-native-nitro-modules
32
- (or yarn add react-native-iap react-native-nitro-modules)
33
- (or pnpm add react-native-iap react-native-nitro-modules)
34
- ```
35
28
 
36
29
  ## Usage
37
30
 
38
- ⚙️ Basic Integration
31
+ GoMarketMe takes only a few lines to set up.
32
+
33
+ ### Step 1/3: Initialize
39
34
 
40
- To initialize GoMarketMe, import the `gomarketme` package and initialize the SDK with your API key:
35
+ Import `gomarketme-react-native` and initialize the SDK with your GoMarketMe API key.
41
36
 
42
37
  ```tsx
38
+ import { useEffect } from 'react';
43
39
  import GoMarketMe from 'gomarketme-react-native';
44
40
 
45
41
  useEffect(() => {
46
-
47
- GoMarketMe.initialize('API_KEY'); // Initialize with your API key
42
+ const initializeGoMarketMe = async () => {
43
+ await GoMarketMe.initialize('API_KEY');
44
+ };
48
45
 
46
+ initializeGoMarketMe();
49
47
  }, []);
50
48
  ```
51
49
 
52
- No further steps needed. The SDK automatically attributes and reports your affiliate sales in real time.
50
+ Replace `API_KEY` with your actual GoMarketMe API key. You can find it on the product onboarding page and under **Profile > API Key**.
51
+
52
+ ### Alternative Step 1/3: Programmatic Affiliate Marketing
53
53
 
54
- ⚙️ OR - Advanced Integration
54
+ For apps that want to customize the user experience based on affiliate attribution, initialize GoMarketMe and read affiliate marketing data after initialization.
55
55
 
56
- Use this approach for more advanced scenarios, such as:
57
- - Affiliate-aware paywalls: Offer exclusive pricing or promotions to users acquired through affiliate campaigns.
58
- - Personalized onboarding: For example, a social or fitness app can automatically make new users follow the influencer who referred them, strengthening engagement and maximizing the affiliate’s impact.
56
+ This enables [Programmatic Affiliate Marketing](https://gomarketme.co/programmatic-affiliate-marketing/), including affiliate-aware paywalls, personalized onboarding, promotions, and custom in-app experiences.
59
57
 
60
58
  ```tsx
61
- import GoMarketMe from 'gomarketme-react-native';
62
-
63
- const goMarketMeSDK = GoMarketMe;
64
- const [affiliateData, setAffiliateData] = useState<GoMarketMeAffiliateMarketingData | null>(null);
59
+ import { useEffect, useState } from 'react';
60
+ import GoMarketMe, {
61
+ GoMarketMeAffiliateMarketingData,
62
+ } from 'gomarketme-react-native';
63
+
64
+ const [affiliateData, setAffiliateData] =
65
+ useState<GoMarketMeAffiliateMarketingData | null>(null);
65
66
 
66
67
  useEffect(() => {
67
-
68
- const initGoMarketMe = async () => {
69
-
70
- await goMarketMeSDK.initialize('API_KEY'); // Initialize with your API key
71
- const data = goMarketMeSDK.affiliateMarketingData;
72
-
73
- if (data) { // user acquired through affiliate campaign
74
-
75
- console.log('Affiliate ID:', data.affiliate?.id); // maps to GoMarketMe > Affiliates > Export > id column
76
- console.log('Affiliate %:', data.saleDistribution?.affiliatePercentage); // maps to GoMarketMe > Campaigns > [Name] > Affiliate's Revenue Split (%)
77
- console.log('Campaign ID:', data.campaign?.id); // maps to GoMarketMe > Campaigns > [Name] > id in the URL
78
-
79
- setAffiliateData(data);
68
+ const initializeGoMarketMe = async () => {
69
+ await GoMarketMe.initialize('API_KEY');
70
+
71
+ const data = GoMarketMe.affiliateMarketingData;
72
+
73
+ if (!data) {
74
+ return;
80
75
  }
81
76
 
77
+ // Maps to GoMarketMe > Affiliates > Export > id column.
78
+ console.log('Affiliate ID:', data.affiliate?.id);
79
+
80
+ // Maps to GoMarketMe > Campaigns > [Name] > Affiliate's Revenue Split (%).
81
+ console.log('Affiliate %:', data.saleDistribution?.affiliatePercentage);
82
+
83
+ // Maps to GoMarketMe > Campaigns > [Name] > id in the URL.
84
+ console.log('Campaign ID:', data.campaign?.id);
85
+
86
+ // Use this data to customize onboarding, paywalls, promotions, or in-app experiences.
87
+ setAffiliateData(data);
82
88
  };
83
89
 
84
- initGoMarketMe();
90
+ initializeGoMarketMe();
85
91
  }, []);
86
92
  ```
87
93
 
88
- Make sure to replace `API_KEY` with your actual GoMarketMe API key. You can find it on the product onboarding page and under **Profile > API Key**.
94
+ ### Step 2/3: Sync after purchase
89
95
 
90
- For Expo, go to [https://www.npmjs.com/package/gomarketme-react-native-expo](https://www.npmjs.com/package/gomarketme-react-native-expo).
96
+ After your app completes a purchase through `react-native-iap`, `expo-iap`, RevenueCat, Adapty, or another in-app purchase provider, call:
91
97
 
92
- ## Support
98
+ ```tsx
99
+ await GoMarketMe.syncAllTransactions();
100
+ ```
101
+
102
+ If your purchase library lets you decide when to finish, acknowledge, consume, or complete the transaction, call `syncAllTransactions()` first.
103
+
104
+ ```tsx
105
+ purchaseUpdateSub = purchaseUpdatedListener(async purchase => {
106
+ await GoMarketMe.syncAllTransactions();
107
+
108
+ await finishTransaction({ purchase, isConsumable: true });
109
+ });
110
+ ```
111
+
112
+ ### Step 3/3: iOS consumables only
113
+
114
+ If your iOS app sells consumable in-app purchases, add this key to your app's `Info.plist`:
115
+
116
+ ```xml
117
+ <key>SKIncludeConsumableInAppPurchaseHistory</key>
118
+ <true/>
119
+ ```
120
+
121
+ That's it. GoMarketMe automatically attributes and reports affiliate sales.
122
+
123
+ ## Platform Support
93
124
 
94
- Check out our sample React Native app at [https://github.com/GoMarketMe/gomarketme-react-native-sample-app](https://github.com/GoMarketMe/gomarketme-react-native-sample-app).
125
+ | Platform | Support | Notes |
126
+ | ----------------- | ------- | --------------------------------------- |
127
+ | iOS | ✅ | StoreKit 2, requires iOS 15+ |
128
+ | Android | ✅ | Google Play Billing v8.0.0+ |
129
+ | Expo Go | ❌ | Not supported |
130
+ | Expo Dev Client | ✅ | Full support |
131
+ | Bare React Native | ✅ | Full support |
132
+
133
+ ## IAP Provider Compatibility
134
+
135
+ | Provider | Support | Notes |
136
+ |---|---:|---|
137
+ | react-native-iap | ✅ | Full support |
138
+ | expo-iap | ✅ | Full support |
139
+ | RevenueCat | ✅ | Supports Apple and Google IAPs |
140
+ | Adapty | ✅ | Supports Apple and Google IAPs |
141
+
142
+ GoMarketMe works alongside `react-native-iap`, `expo-iap`, RevenueCat, Adapty, and other IAP providers.
143
+
144
+ ## Sample app
145
+
146
+ Check out the sample React Native app:
147
+
148
+ [https://github.com/GoMarketMe/gomarketme-react-native-sample-app](https://github.com/GoMarketMe/gomarketme-react-native-sample-app)
149
+
150
+ ## Support
95
151
 
96
- If you run into any issues, please reach out to us at [integrations@gomarketme.co](mailto:integrations@gomarketme.co) or visit [https://gomarketme.co](https://gomarketme.co).
152
+ For integration support, contact [integrations@gomarketme.co](mailto:integrations@gomarketme.co) or visit [https://gomarketme.co](https://gomarketme.co).
@@ -0,0 +1,46 @@
1
+ buildscript {
2
+ ext.kotlin_version = '2.1.0'
3
+
4
+ repositories {
5
+ google()
6
+ mavenCentral()
7
+ }
8
+
9
+ dependencies {
10
+ classpath 'com.android.tools.build:gradle:8.7.3'
11
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
12
+ }
13
+ }
14
+
15
+ apply plugin: 'com.android.library'
16
+ apply plugin: 'org.jetbrains.kotlin.android'
17
+
18
+ android {
19
+ namespace 'co.gomarketme.reactnative'
20
+ compileSdk 35
21
+
22
+ defaultConfig {
23
+ minSdk 23
24
+ }
25
+
26
+ compileOptions {
27
+ sourceCompatibility JavaVersion.VERSION_17
28
+ targetCompatibility JavaVersion.VERSION_17
29
+ }
30
+
31
+ kotlinOptions {
32
+ jvmTarget = '17'
33
+ }
34
+ }
35
+
36
+ repositories {
37
+ google()
38
+ mavenCentral()
39
+ }
40
+
41
+ dependencies {
42
+ implementation files('libs/core-5.0.0.jar')
43
+ implementation 'com.android.billingclient:billing:8.3.0'
44
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0'
45
+ compileOnly 'com.facebook.react:react-android:+'
46
+ }
Binary file
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <uses-permission android:name="com.android.vending.BILLING" />
3
+ </manifest>
@@ -0,0 +1,184 @@
1
+ package co.gomarketme.reactnative
2
+
3
+ import android.util.Log
4
+ import co.gomarketme.core.GoMarketMeGoogleCore
5
+ import co.gomarketme.core.GoMarketMeGoogleCoreConfiguration
6
+ import com.facebook.react.bridge.Arguments
7
+ import com.facebook.react.bridge.Promise
8
+ import com.facebook.react.bridge.ReactApplicationContext
9
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
10
+ import com.facebook.react.bridge.ReactMethod
11
+ import com.facebook.react.bridge.WritableArray
12
+ import com.facebook.react.bridge.WritableMap
13
+ import kotlinx.coroutines.CoroutineScope
14
+ import kotlinx.coroutines.Dispatchers
15
+ import kotlinx.coroutines.SupervisorJob
16
+ import kotlinx.coroutines.launch
17
+
18
+ class GoMarketMeReactNativeModule(
19
+ private val reactContext: ReactApplicationContext
20
+ ) : ReactContextBaseJavaModule(reactContext) {
21
+ private var core: GoMarketMeGoogleCore? = null
22
+ private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
23
+
24
+ override fun getName(): String = MODULE_NAME
25
+
26
+ @ReactMethod
27
+ fun initialize(
28
+ apiKey: String,
29
+ sdkType: String,
30
+ sdkVersion: String,
31
+ isProduction: Boolean,
32
+ promise: Promise
33
+ ) {
34
+ val trimmedApiKey = apiKey.trim()
35
+
36
+ if (trimmedApiKey.isEmpty()) {
37
+ promise.reject("invalid_arguments", "apiKey is required")
38
+ return
39
+ }
40
+
41
+ val initialConfiguration = GoMarketMeGoogleCoreConfiguration(
42
+ apiKey = trimmedApiKey,
43
+ sdkType = sdkType.ifBlank { "ReactNative" },
44
+ sdkVersion = sdkVersion.takeIf { it.isNotBlank() },
45
+ isProduction = isProduction
46
+ )
47
+
48
+ val googleCore = core ?: GoMarketMeGoogleCore(reactContext.applicationContext)
49
+
50
+ if (IS_DEBUG_LOGGING_ENABLED) {
51
+ googleCore.onPurchase = { event ->
52
+ Log.d(TAG, "purchase observed by core: ${event.toMap()}")
53
+ }
54
+
55
+ googleCore.onError = { throwable ->
56
+ Log.e(TAG, "core error", throwable)
57
+ }
58
+ } else {
59
+ googleCore.onPurchase = null
60
+ googleCore.onError = null
61
+ }
62
+
63
+ scope.launch {
64
+ try {
65
+ val prepared = googleCore.prepareAttribution(initialConfiguration)
66
+ val config = prepared.first
67
+ val affiliateMarketingData = prepared.second
68
+
69
+ googleCore.configure(config)
70
+ googleCore.start()
71
+ core = googleCore
72
+
73
+ val response = Arguments.createMap().apply {
74
+ putBoolean("initialized", true)
75
+ putString("platform", "android")
76
+ putString("source", config.sourceName)
77
+ putMap("affiliateMarketingData", affiliateMarketingData.toWritableMap())
78
+ }
79
+
80
+ promise.resolve(response)
81
+ } catch (throwable: Throwable) {
82
+ promise.reject("initialize_failed", throwable.message, throwable)
83
+ }
84
+ }
85
+ }
86
+
87
+ @ReactMethod
88
+ fun syncAllTransactions(promise: Promise) {
89
+ val googleCore = core
90
+
91
+ if (googleCore == null) {
92
+ promise.reject("not_initialized", "GoMarketMe SDK must be initialized before syncing transactions")
93
+ return
94
+ }
95
+
96
+ scope.launch {
97
+ try {
98
+ val result = googleCore.sendCurrentPurchasesWithResult()
99
+
100
+ val response = Arguments.createMap().apply {
101
+ putInt("fetchedCount", result.fetchedCount)
102
+ putInt("sentCount", result.sentCount)
103
+ putInt("failedCount", result.failedCount)
104
+ putBoolean("success", result.success)
105
+ }
106
+
107
+ promise.resolve(response)
108
+ } catch (throwable: Throwable) {
109
+ promise.reject("sync_all_transactions_failed", throwable.message, throwable)
110
+ }
111
+ }
112
+ }
113
+
114
+ @ReactMethod
115
+ fun stop() {
116
+ core?.stop()
117
+ core = null
118
+ }
119
+
120
+ override fun invalidate() {
121
+ stop()
122
+ super.invalidate()
123
+ }
124
+
125
+ private fun Map<String, Any?>.toWritableMap(): WritableMap {
126
+ val writableMap = Arguments.createMap()
127
+
128
+ forEach { (key, value) ->
129
+ writableMap.putAny(key, value)
130
+ }
131
+
132
+ return writableMap
133
+ }
134
+
135
+ private fun WritableMap.putAny(key: String, value: Any?) {
136
+ when (value) {
137
+ null -> putNull(key)
138
+ is Boolean -> putBoolean(key, value)
139
+ is Int -> putInt(key, value)
140
+ is Long -> putDouble(key, value.toDouble())
141
+ is Float -> putDouble(key, value.toDouble())
142
+ is Double -> putDouble(key, value)
143
+ is Number -> putDouble(key, value.toDouble())
144
+ is String -> putString(key, value)
145
+ is Map<*, *> -> putMap(key, value.toStringKeyMap().toWritableMap())
146
+ is Iterable<*> -> putArray(key, value.toWritableArray())
147
+ is Array<*> -> putArray(key, value.asIterable().toWritableArray())
148
+ else -> putString(key, value.toString())
149
+ }
150
+ }
151
+
152
+ private fun Iterable<*>.toWritableArray(): WritableArray {
153
+ val writableArray = Arguments.createArray()
154
+
155
+ forEach { value ->
156
+ when (value) {
157
+ null -> writableArray.pushNull()
158
+ is Boolean -> writableArray.pushBoolean(value)
159
+ is Int -> writableArray.pushInt(value)
160
+ is Long -> writableArray.pushDouble(value.toDouble())
161
+ is Float -> writableArray.pushDouble(value.toDouble())
162
+ is Double -> writableArray.pushDouble(value)
163
+ is Number -> writableArray.pushDouble(value.toDouble())
164
+ is String -> writableArray.pushString(value)
165
+ is Map<*, *> -> writableArray.pushMap(value.toStringKeyMap().toWritableMap())
166
+ is Iterable<*> -> writableArray.pushArray(value.toWritableArray())
167
+ is Array<*> -> writableArray.pushArray(value.asIterable().toWritableArray())
168
+ else -> writableArray.pushString(value.toString())
169
+ }
170
+ }
171
+
172
+ return writableArray
173
+ }
174
+
175
+ private fun Map<*, *>.toStringKeyMap(): Map<String, Any?> = entries.associate { (key, value) ->
176
+ key.toString() to value
177
+ }
178
+
179
+ private companion object {
180
+ const val MODULE_NAME = "GoMarketMeReactNative"
181
+ const val TAG = "GoMarketMeReactNative"
182
+ const val IS_DEBUG_LOGGING_ENABLED = false
183
+ }
184
+ }
@@ -0,0 +1,16 @@
1
+ package co.gomarketme.reactnative
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+
8
+ class GoMarketMeReactNativePackage : ReactPackage {
9
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
10
+ return listOf(GoMarketMeReactNativeModule(reactContext))
11
+ }
12
+
13
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
14
+ return emptyList()
15
+ }
16
+ }
@@ -0,0 +1,18 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'gomarketme-react-native'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.homepage = package['homepage']
10
+ s.license = package['license']
11
+ s.author = package['author']
12
+ s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13
+ s.platforms = { :ios => '15.0' }
14
+ s.source_files = 'ios/**/*.{h,m,mm,swift}'
15
+ s.vendored_frameworks = 'ios/Frameworks/GoMarketMeAppleCoreKit.xcframework'
16
+ s.dependency 'React-Core'
17
+ s.swift_version = '5.9'
18
+ end
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
+ <key>LibraryPath</key>
13
+ <string>GoMarketMeAppleCoreKit.framework</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ <string>x86_64</string>
18
+ </array>
19
+ <key>SupportedPlatform</key>
20
+ <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
23
+ </dict>
24
+ <dict>
25
+ <key>BinaryPath</key>
26
+ <string>GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit</string>
27
+ <key>LibraryIdentifier</key>
28
+ <string>ios-arm64</string>
29
+ <key>LibraryPath</key>
30
+ <string>GoMarketMeAppleCoreKit.framework</string>
31
+ <key>SupportedArchitectures</key>
32
+ <array>
33
+ <string>arm64</string>
34
+ </array>
35
+ <key>SupportedPlatform</key>
36
+ <string>ios</string>
37
+ </dict>
38
+ </array>
39
+ <key>CFBundlePackageType</key>
40
+ <string>XFWK</string>
41
+ <key>XCFrameworkFormatVersion</key>
42
+ <string>1.0</string>
43
+ </dict>
44
+ </plist>