@altcraft/react-native-sdk 0.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 (33) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +46 -0
  3. package/Sdk.podspec +48 -0
  4. package/android/build.gradle +78 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/altcraft/sdk/SdkModule.kt +1242 -0
  8. package/android/src/main/java/com/altcraft/sdk/SdkPackage.kt +33 -0
  9. package/android/src/main/java/com/altcraft/sdk/interfaces/RnFCMProvider.kt +27 -0
  10. package/android/src/main/java/com/altcraft/sdk/interfaces/RnHMSProvider.kt +32 -0
  11. package/android/src/main/java/com/altcraft/sdk/interfaces/RnJWTProvider.kt +21 -0
  12. package/android/src/main/java/com/altcraft/sdk/interfaces/RnRustoreProvider.kt +53 -0
  13. package/ios/Sdk.h +19 -0
  14. package/ios/Sdk.mm +1112 -0
  15. package/ios/SdkModule.swift +888 -0
  16. package/ios/protocols/RNAPNSProvider.swift +15 -0
  17. package/ios/protocols/RNFCMProvider.swift +24 -0
  18. package/ios/protocols/RNHMSProvider.swift +24 -0
  19. package/ios/protocols/RNJWTProvider.swift +15 -0
  20. package/lib/module/NativeSdk.js +13 -0
  21. package/lib/module/NativeSdk.js.map +1 -0
  22. package/lib/module/index.js +561 -0
  23. package/lib/module/index.js.map +1 -0
  24. package/lib/module/package.json +1 -0
  25. package/lib/typescript/package.json +1 -0
  26. package/lib/typescript/src/NativeSdk.d.ts +114 -0
  27. package/lib/typescript/src/NativeSdk.d.ts.map +1 -0
  28. package/lib/typescript/src/index.d.ts +391 -0
  29. package/lib/typescript/src/index.d.ts.map +1 -0
  30. package/package.json +128 -0
  31. package/react-native.config.js +10 -0
  32. package/src/NativeSdk.ts +171 -0
  33. package/src/index.tsx +670 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ # END-USER LICENSE AGREEMENT
2
+
3
+ Copyright © 2024 Altcraft LLC. All rights reserved.
4
+
5
+ 1. **GRANT OF LICENSE**: This document grants you certain rights to use the Altcraft Mobile SDK (hereinafter referred to as the "Software"). All rights not expressly granted are reserved by the copyright holder.
6
+
7
+ 2. **USE**: You have the right to use and distribute the Software for both commercial and non-commercial purposes.
8
+
9
+ 3. **MODIFICATION WITHOUT PUBLICATION**: You may modify the Software for your own use without the obligation to publish these modifications.
10
+
11
+ 4. **MODIFICATION WITH PUBLICATION**: Any publication of modified Software requires prior written permission from the copyright holder.
12
+
13
+ 5. **DISCLAIMER OF WARRANTY**: The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement.
14
+
15
+ 6. **LIMITATION OF LIABILITY**: In no event shall the copyright holder be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this Software, even if advised of the possibility of such damage.
16
+
17
+ 7. **DISTRIBUTION**: When distributing the Software, you must provide all recipients with a copy of this license agreement.
18
+
19
+ 8. **COPYRIGHT NOTICE AND THIRD-PARTY COMPONENTS**:
20
+ This Software may include components released under other licenses. A complete list of these components and their respective licenses is provided below:
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Altcraft React Native SDK
2
+
3
+ ![Altcraft SDK Logo](https://guides.altcraft.com/img/logo.svg)
4
+
5
+ [![npm version](https://img.shields.io/npm/v/altcraft-react-native-sdk?style=flat-square)](https://www.npmjs.com/package/altcraft-react-native-sdk)
6
+ [![npm downloads](https://img.shields.io/npm/dm/altcraft-react-native-sdk?style=flat-square)](https://www.npmjs.com/package/altcraft-react-native-sdk)
7
+ [![React Native](https://img.shields.io/badge/React%20Native-0.70%2B-blue?style=flat-square)](#)
8
+ [![Platforms](https://img.shields.io/badge/Platform-Android-green?style=flat-square)](#)
9
+ [![Push](https://img.shields.io/badge/Push-Firebase%20FCM%20%7C%20Huawei%20HMS%20%7C%20RuStore-green?style=flat-square)](#)
10
+
11
+ Altcraft React Native SDK. It helps manage push subscriptions, tokens, SDK events, and sending mobile events to the Altcraft platform.
12
+
13
+ ---
14
+
15
+ ## Features
16
+
17
+ - Push subscription management:
18
+ - `pushSubscribe`
19
+ - `pushSuspend`
20
+ - `pushUnSubscribe`
21
+ - `getStatus...` APIs
22
+ - Push token management:
23
+ - get current token (`getPushToken`)
24
+ - set/delete token, force update, provider priority list
25
+ - JWT support (`setJwt`)
26
+ - Mobile events (`mobileEvent`)
27
+ - SDK event stream from native to JS (`subscribeToEvents`)
28
+ - Push intake forwarding (`takePush`) to native SDK
29
+
30
+ ---
31
+
32
+ ## Requirements
33
+
34
+ - React Native: depends on your RN version and New Architecture setup (TurboModules).
35
+ - Android:
36
+ - `minSdk` and `compileSdk` depend on your app configuration
37
+ - Push provider integrated in the host app (FCM / APNS/ HMS / RuStore)
38
+
39
+ ---
40
+
41
+ ## Installation
42
+
43
+ ```sh
44
+ yarn add altcraft-react-native-sdk
45
+ # or
46
+ npm i altcraft-react-native-sdk
package/Sdk.podspec ADDED
@@ -0,0 +1,48 @@
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 = "Sdk"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platform = :ios, min_ios_version_supported
14
+
15
+ s.source = {
16
+ :git => "https://github.com/altcraft/react-native-sdk.git",
17
+ :tag => s.version.to_s
18
+ }
19
+
20
+ # --- Sources ---
21
+ s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
22
+ s.public_header_files = "ios/**/*.h"
23
+
24
+ # --- Swift / Module settings (critical for <Sdk/Sdk-Swift.h>) ---
25
+ s.swift_version = "5.0"
26
+ s.pod_target_xcconfig = {
27
+ "DEFINES_MODULE" => "YES",
28
+ "CLANG_ENABLE_MODULES" => "YES",
29
+ "SWIFT_INSTALL_OBJC_HEADER" => "YES"
30
+ }
31
+
32
+ # --- Native dependency ---
33
+ s.dependency "Altcraft", "0.1.2"
34
+
35
+ # --- React Native module deps ---
36
+ install_modules_dependencies(s)
37
+
38
+ if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
39
+ s.dependency "React-Codegen"
40
+ s.dependency "RCT-Folly"
41
+ s.dependency "RCTRequired"
42
+ s.dependency "RCTTypeSafety"
43
+ s.dependency "ReactCommon/turbomodule/core"
44
+ s.dependency "React-RCTFabric"
45
+ s.dependency "React-NativeModulesApple"
46
+ end
47
+ end
48
+
@@ -0,0 +1,78 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Sdk_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ apply plugin: "com.facebook.react"
23
+
24
+ def getExtOrIntegerDefault(name) {
25
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Sdk_" + name]).toInteger()
26
+ }
27
+
28
+ android {
29
+ namespace "com.sdk"
30
+
31
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36
+ }
37
+
38
+ buildFeatures {
39
+ buildConfig true
40
+ }
41
+
42
+ buildTypes {
43
+ release {
44
+ minifyEnabled false
45
+ }
46
+ }
47
+
48
+ lintOptions {
49
+ disable "GradleCompatible"
50
+ }
51
+
52
+ compileOptions {
53
+ sourceCompatibility JavaVersion.VERSION_1_8
54
+ targetCompatibility JavaVersion.VERSION_1_8
55
+ }
56
+
57
+ sourceSets {
58
+ main {
59
+ java.srcDirs += [
60
+ "generated/java",
61
+ "generated/jni"
62
+ ]
63
+ }
64
+ }
65
+ }
66
+
67
+ repositories {
68
+ mavenCentral()
69
+ google()
70
+ }
71
+
72
+ def kotlin_version = getExtOrDefault("kotlinVersion")
73
+
74
+ dependencies {
75
+ implementation "com.facebook.react:react-android"
76
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
+ implementation "com.altcraft:android-sdk:1.0.2"
78
+ }
@@ -0,0 +1,5 @@
1
+ Sdk_kotlinVersion=2.0.21
2
+ Sdk_minSdkVersion=24
3
+ Sdk_targetSdkVersion=34
4
+ Sdk_compileSdkVersion=35
5
+ Sdk_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>