com-tapp-so-sdk 0.1.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 (35) hide show
  1. package/ComTappSoSdk.podspec +50 -0
  2. package/LICENSE +20 -0
  3. package/README.md +263 -0
  4. package/android/build.gradle +114 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/comtappsosdk/ComTappSoSdkModule.kt +354 -0
  8. package/android/src/main/java/com/comtappsosdk/ComTappSoSdkPackage.kt +45 -0
  9. package/ios/ComTappSoSdk.h +62 -0
  10. package/ios/ComTappSoSdk.mm +343 -0
  11. package/ios/generated/ComTappSoSdkSpec/ComTappSoSdkSpec-generated.mm +81 -0
  12. package/ios/generated/ComTappSoSdkSpec/ComTappSoSdkSpec.h +84 -0
  13. package/ios/generated/ComTappSoSdkSpecJSI-generated.cpp +76 -0
  14. package/ios/generated/ComTappSoSdkSpecJSI.h +125 -0
  15. package/lib/module/NativeComTappSoSdk.js +5 -0
  16. package/lib/module/NativeComTappSoSdk.js.map +1 -0
  17. package/lib/module/Types.js +47 -0
  18. package/lib/module/Types.js.map +1 -0
  19. package/lib/module/events.js +17 -0
  20. package/lib/module/events.js.map +1 -0
  21. package/lib/module/index.js +58 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/typescript/src/NativeComTappSoSdk.d.ts +37 -0
  24. package/lib/typescript/src/NativeComTappSoSdk.d.ts.map +1 -0
  25. package/lib/typescript/src/Types.d.ts +145 -0
  26. package/lib/typescript/src/Types.d.ts.map +1 -0
  27. package/lib/typescript/src/events.d.ts +10 -0
  28. package/lib/typescript/src/events.d.ts.map +1 -0
  29. package/lib/typescript/src/index.d.ts +13 -0
  30. package/lib/typescript/src/index.d.ts.map +1 -0
  31. package/package.json +169 -0
  32. package/src/NativeComTappSoSdk.ts +46 -0
  33. package/src/Types.ts +149 -0
  34. package/src/events.ts +21 -0
  35. package/src/index.tsx +81 -0
package/package.json ADDED
@@ -0,0 +1,169 @@
1
+ {
2
+ "name": "com-tapp-so-sdk",
3
+ "version": "0.1.0",
4
+ "description": "react native tapp sdk",
5
+ "sideEffects": false,
6
+ "engines": {
7
+ "node": ">=18"
8
+ },
9
+ "main": "./lib/module/index.js",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "source": "./src/index.tsx",
14
+ "types": "./lib/typescript/src/index.d.ts",
15
+ "default": "./lib/module/index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "src",
21
+ "lib",
22
+ "android",
23
+ "ios",
24
+ "cpp",
25
+ "*.podspec",
26
+ "react-native.config.js",
27
+ "!ios/build",
28
+ "!android/build",
29
+ "!android/gradle",
30
+ "!android/gradlew",
31
+ "!android/gradlew.bat",
32
+ "!android/local.properties",
33
+ "!**/__tests__",
34
+ "!**/__fixtures__",
35
+ "!**/__mocks__",
36
+ "!**/.*"
37
+ ],
38
+ "scripts": {
39
+ "example": "yarn workspace com-tapp-so-sdk-example",
40
+ "test": "jest",
41
+ "typecheck": "tsc",
42
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
43
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
44
+ "prepare": "bob build",
45
+ "release": "release-it --only-version"
46
+ },
47
+ "keywords": [
48
+ "react-native",
49
+ "ios",
50
+ "android"
51
+ ],
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git+https://github.com/tapp-so/Tapp-RN"
55
+ },
56
+ "author": "nick@tapp.so <nick@tapp.so> (https://www.tapp.so/)",
57
+ "license": "MIT",
58
+ "bugs": {
59
+ "url": "https://github.com/tapp-so/Tapp-RN/issues"
60
+ },
61
+ "homepage": "https://github.com/tapp-so/Tapp-RN#readme",
62
+ "publishConfig": {
63
+ "registry": "https://registry.npmjs.org/"
64
+ },
65
+ "devDependencies": {
66
+ "@commitlint/config-conventional": "^19.8.1",
67
+ "@eslint/compat": "^1.3.2",
68
+ "@eslint/eslintrc": "^3.3.1",
69
+ "@eslint/js": "^9.35.0",
70
+ "@evilmartians/lefthook": "^1.12.3",
71
+ "@react-native-community/cli": "20.0.1",
72
+ "@react-native/babel-preset": "0.81.1",
73
+ "@react-native/eslint-config": "^0.81.1",
74
+ "@release-it/conventional-changelog": "^10.0.1",
75
+ "@types/jest": "^29.5.14",
76
+ "@types/react": "^19.1.0",
77
+ "commitlint": "^19.8.1",
78
+ "del-cli": "^6.0.0",
79
+ "eslint": "^9.35.0",
80
+ "eslint-config-prettier": "^10.1.8",
81
+ "eslint-plugin-prettier": "^5.5.4",
82
+ "jest": "^29.7.0",
83
+ "prettier": "^3.6.2",
84
+ "react": "19.1.0",
85
+ "react-native": "0.81.1",
86
+ "react-native-builder-bob": "^0.40.14",
87
+ "release-it": "^19.0.4",
88
+ "turbo": "^2.5.6",
89
+ "typescript": "^5.9.2"
90
+ },
91
+ "peerDependencies": {
92
+ "react": ">=17",
93
+ "react-native": ">=0.70.0"
94
+ },
95
+ "workspaces": [
96
+ "example"
97
+ ],
98
+ "packageManager": "yarn@3.6.1",
99
+ "jest": {
100
+ "preset": "react-native",
101
+ "modulePathIgnorePatterns": [
102
+ "<rootDir>/example/node_modules",
103
+ "<rootDir>/lib/"
104
+ ]
105
+ },
106
+ "commitlint": {
107
+ "extends": [
108
+ "@commitlint/config-conventional"
109
+ ]
110
+ },
111
+ "release-it": {
112
+ "git": {
113
+ "commitMessage": "chore: release ${version}",
114
+ "tagName": "v${version}"
115
+ },
116
+ "npm": {
117
+ "publish": true
118
+ },
119
+ "github": {
120
+ "release": true
121
+ },
122
+ "plugins": {
123
+ "@release-it/conventional-changelog": {
124
+ "preset": {
125
+ "name": "angular"
126
+ }
127
+ }
128
+ }
129
+ },
130
+ "prettier": {
131
+ "quoteProps": "consistent",
132
+ "singleQuote": true,
133
+ "tabWidth": 2,
134
+ "trailingComma": "es5",
135
+ "useTabs": false
136
+ },
137
+ "react-native-builder-bob": {
138
+ "source": "src",
139
+ "output": "lib",
140
+ "targets": [
141
+ "module",
142
+ [
143
+ "typescript",
144
+ {
145
+ "project": "tsconfig.build.json"
146
+ }
147
+ ],
148
+ "codegen"
149
+ ]
150
+ },
151
+ "codegenConfig": {
152
+ "name": "ComTappSoSdkSpec",
153
+ "type": "modules",
154
+ "jsSrcsDir": "src",
155
+ "outputDir": {
156
+ "ios": "ios/generated",
157
+ "android": "android/build/generated/source/codegen"
158
+ },
159
+ "android": {
160
+ "javaPackageName": "com.comtappsosdk"
161
+ },
162
+ "includesGeneratedCode": true
163
+ },
164
+ "create-react-native-library": {
165
+ "languages": "kotlin-objc",
166
+ "type": "turbo-module",
167
+ "version": "0.54.8"
168
+ }
169
+ }
@@ -0,0 +1,46 @@
1
+ import { TurboModuleRegistry, type TurboModule } from 'react-native';
2
+ import { type UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
3
+
4
+ export interface Spec extends TurboModule {
5
+ start(authToken: string, env: string, tappToken: string): void;
6
+
7
+ url(
8
+ influencer: string,
9
+ adGroup?: string,
10
+ creative?: string,
11
+ data?: { [key: string]: string }
12
+ ): Promise<string>;
13
+
14
+ handleTappEvent(
15
+ eventAction: number,
16
+ customValue?: string,
17
+ metadata?: UnsafeObject
18
+ ): Promise<string>;
19
+
20
+ fetchLinkData(deepLink: string): Promise<{
21
+ error: boolean;
22
+ message?: string;
23
+ tappUrl?: string;
24
+ attrTappUrl?: string;
25
+ influencer?: string;
26
+ data?: { [key: string]: string };
27
+ isFirstSession?: boolean;
28
+ deepLink?: string;
29
+ }>;
30
+
31
+ shouldProcess(deepLink: string): Promise<boolean>;
32
+
33
+ fetchOriginLinkData(): Promise<{
34
+ error: boolean;
35
+ message?: string;
36
+ tappUrl?: string;
37
+ attrTappUrl?: string;
38
+ influencer?: string;
39
+ data?: { [key: string]: string };
40
+ isFirstSession?: boolean;
41
+ }>;
42
+
43
+ simulateTestEvent(): void;
44
+ }
45
+
46
+ export default TurboModuleRegistry.getEnforcing<Spec>('ComTappSoSdk');
package/src/Types.ts ADDED
@@ -0,0 +1,149 @@
1
+ export type InitConfig = {
2
+ authToken: string;
3
+ env: EnvironmentType;
4
+ tappToken: string;
5
+ //affiliate: AffiliateType;
6
+ };
7
+
8
+ export type EnvironmentType = 'PRODUCTION' | 'SANDBOX';
9
+
10
+ export type AffiliateType = 'ADJUST' | 'APPFLYER' | 'TAPP' | 'TAPP_NATIVE';
11
+
12
+ export enum EventAction {
13
+ TAPP_ADD_PAYMENT_INFO = 1,
14
+ TAPP_ADD_TO_CART = 2,
15
+ TAPP_ADD_TO_WISHLIST = 3,
16
+ TAPP_COMPLETE_REGISTRATION = 4,
17
+ TAPP_CONTACT = 5,
18
+ TAPP_CUSTOMIZE_PRODUCT = 6,
19
+ TAPP_DONATE = 7,
20
+ TAPP_FIND_LOCATION = 8,
21
+ TAPP_INITIATE_CHECKOUT = 9,
22
+ TAPP_GENERATE_LEAD = 10,
23
+ TAPP_PURCHASE = 11,
24
+ TAPP_SCHEDULE = 12,
25
+ TAPP_SEARCH = 13,
26
+ TAPP_START_TRIAL = 14,
27
+ TAPP_SUBMIT_APPLICATION = 15,
28
+ TAPP_SUBSCRIBE = 16,
29
+ TAPP_VIEW_CONTENT = 17,
30
+ TAPP_CLICK_BUTTON = 18,
31
+ TAPP_DOWNLOAD_FILE = 19,
32
+ TAPP_JOIN_GROUP = 20,
33
+ TAPP_ACHIEVE_LEVEL = 21,
34
+ TAPP_CREATE_GROUP = 22,
35
+ TAPP_CREATE_ROLE = 23,
36
+ TAPP_LINK_CLICK = 24,
37
+ TAPP_LINK_IMPRESSION = 25,
38
+ TAPP_APPLY_FOR_LOAN = 26,
39
+ TAPP_LOAN_APPROVAL = 27,
40
+ TAPP_LOAN_DISBURSAL = 28,
41
+ TAPP_LOGIN = 29,
42
+ TAPP_RATE = 30,
43
+ TAPP_SPEND_CREDITS = 31,
44
+ TAPP_UNLOCK_ACHIEVEMENT = 32,
45
+ TAPP_ADD_SHIPPING_INFO = 33,
46
+ TAPP_EARN_VIRTUAL_CURRENCY = 34,
47
+ TAPP_START_LEVEL = 35,
48
+ TAPP_COMPLETE_LEVEL = 36,
49
+ TAPP_POST_SCORE = 37,
50
+ TAPP_SELECT_CONTENT = 38,
51
+ TAPP_BEGIN_TUTORIAL = 39,
52
+ TAPP_COMPLETE_TUTORIAL = 40,
53
+ CUSTOM = 0, // Special case for custom events
54
+ }
55
+
56
+ export type TappMetadataValue = string | boolean | number;
57
+ export type TappMetadata = Record<string, TappMetadataValue>;
58
+
59
+ export type TappEventType = {
60
+ eventAction: EventAction; // Enum for event actions
61
+ customValue?: string; // Optional custom value for custom events
62
+ metadata?: TappMetadata; // Optional event metadata (flat primitives only)
63
+ };
64
+
65
+ export type AdjustTrackAdRevenueType = {
66
+ source: string;
67
+ revenue: number;
68
+ currency: string;
69
+ };
70
+
71
+ export type AdjustPurchaseVerificationResult = {
72
+ success: boolean;
73
+ message: string;
74
+ };
75
+ export type TappLinkDataResponse = {
76
+ error: boolean;
77
+ message?: string;
78
+ tappUrl?: string;
79
+ attrTappUrl?: string;
80
+ influencer?: string;
81
+ data?: { [key: string]: string };
82
+ isFirstSession?: boolean;
83
+ deepLink?: string;
84
+ };
85
+
86
+ export type AdjustAttributionType = {
87
+ adid: string; // Not provided on Android, so will be an empty string.
88
+ trackerToken: string;
89
+ trackerName: string;
90
+ network: string;
91
+ campaign: string;
92
+ adgroup: string;
93
+ creative: string;
94
+ clickLabel: string;
95
+ costType: string;
96
+ costAmount: number;
97
+ costCurrency: string;
98
+ fbInstallReferrer: string; // Specific to Android.
99
+ costInUsd: number; // Not provided on Android, defaults to 0.0.
100
+ callbackParams: { [key: string]: string }; // Not available on Android, returned as an empty object.
101
+ partnerParams: { [key: string]: string }; // Not available on Android, returned as an empty object.
102
+ };
103
+
104
+ export interface VerifyResult {
105
+ verificationStatus: string;
106
+ code: number;
107
+ message: string;
108
+ }
109
+
110
+ export interface AppStoreSubscription {
111
+ price: number;
112
+ currency: string;
113
+ transactionId: string;
114
+ transactionDate?: number; // Timestamp
115
+ salesRegion?: string;
116
+ callbackParameters?: { [key: string]: string };
117
+ partnerParameters?: { [key: string]: string };
118
+ }
119
+
120
+ export interface PlayStoreSubscription {
121
+ price: number;
122
+ currency: string;
123
+ sku: string;
124
+ orderId: string;
125
+ signature: string;
126
+ purchaseToken: string;
127
+ purchaseTime?: number;
128
+ }
129
+
130
+ export type UpdateSkanConversionValueType = {
131
+ value: number;
132
+ coarseValue?: string;
133
+ lockWindow?: number;
134
+ };
135
+
136
+ export type VerifyPlayStorePurchaseType = {
137
+ transactionId: string;
138
+ productId: string;
139
+ };
140
+
141
+ export type VerifyPlayStorePurchaseCompletionType = (result: {
142
+ verificationStatus: string;
143
+ code: number;
144
+ message: string;
145
+ }) => void;
146
+ export interface DeferredLinkDelegate {
147
+ didReceiveDeferredLink(linkDataResponse: TappLinkDataResponse): void;
148
+ testListener(test: string): void;
149
+ }
package/src/events.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { NativeEventEmitter, NativeModules } from 'react-native';
2
+ import type { TappLinkDataResponse } from './Types';
3
+
4
+ const { EventEmitter } = NativeModules;
5
+ const eventEmitter = new NativeEventEmitter(EventEmitter);
6
+
7
+ export function addDeferredLinkListener(
8
+ listener: (response: TappLinkDataResponse) => void
9
+ ) {
10
+ return eventEmitter.addListener('onDeferredLinkReceived', listener);
11
+ }
12
+
13
+ export function addDidFailResolvingURLListener(
14
+ listener: (response: { url: string; error: string }) => void
15
+ ) {
16
+ return eventEmitter.addListener('onDidFailResolvingURL', listener);
17
+ }
18
+
19
+ export function addTestListener(listener: (data: { test: string }) => void) {
20
+ return eventEmitter.addListener('onTestListener', listener);
21
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,81 @@
1
+ import ComTappSoSdk from './NativeComTappSoSdk';
2
+ import { Platform } from 'react-native';
3
+ import {
4
+ EventAction,
5
+ type InitConfig,
6
+ type TappEventType,
7
+ type TappLinkDataResponse,
8
+ } from './Types';
9
+
10
+ // Helper to handle unsupported platforms
11
+ const unsupportedPlatformMessage = (methodName: string) => {
12
+ console.log(`[${Platform.OS}] Method "${methodName}" is not supported.`);
13
+ };
14
+
15
+ export function start(config: InitConfig): void {
16
+ if (Platform.OS === 'web') {
17
+ unsupportedPlatformMessage('start');
18
+ }
19
+ ComTappSoSdk.start(config.authToken, config.env, config.tappToken);
20
+ }
21
+
22
+ export function url(
23
+ influencer: string,
24
+ adGroup?: string,
25
+ creative?: string,
26
+ data?: { [key: string]: string }
27
+ ): Promise<string> {
28
+ if (Platform.OS === 'web') {
29
+ unsupportedPlatformMessage('url');
30
+ }
31
+ return ComTappSoSdk.url(influencer, adGroup, creative, data);
32
+ }
33
+
34
+ export function handleTappEvent(event: TappEventType): Promise<string> {
35
+ if (Platform.OS === 'web') {
36
+ unsupportedPlatformMessage('handleTappEvent');
37
+ }
38
+
39
+ const value = event.customValue ?? 'custom_event_autogenerated';
40
+ const customValue =
41
+ event.eventAction === EventAction.CUSTOM ? value : undefined;
42
+
43
+ const metadata = event.metadata;
44
+
45
+ return ComTappSoSdk.handleTappEvent(
46
+ event.eventAction as number,
47
+ customValue,
48
+ metadata
49
+ );
50
+ }
51
+
52
+ export function fetchLinkData(deepLink: string): Promise<TappLinkDataResponse> {
53
+ if (Platform.OS === 'web') {
54
+ unsupportedPlatformMessage('fetchLinkData');
55
+ }
56
+ return ComTappSoSdk.fetchLinkData(deepLink);
57
+ }
58
+
59
+ export function shouldProcess(deepLink: string): Promise<boolean> {
60
+ if (Platform.OS === 'web') {
61
+ unsupportedPlatformMessage('shouldProcess');
62
+ }
63
+ return ComTappSoSdk.shouldProcess(deepLink);
64
+ }
65
+
66
+ export function fetchOriginLinkData(): Promise<TappLinkDataResponse> {
67
+ if (Platform.OS === 'web') {
68
+ unsupportedPlatformMessage('fetchOriginLinkData');
69
+ }
70
+ return ComTappSoSdk.fetchOriginLinkData();
71
+ }
72
+
73
+ export function simulateTestEvent(): void {
74
+ if (Platform.OS === 'web' || Platform.OS === 'ios') {
75
+ unsupportedPlatformMessage('simulateTestEvent');
76
+ }
77
+ return ComTappSoSdk.simulateTestEvent();
78
+ }
79
+
80
+ export * from './Types';
81
+ export * from './events';