@screeb/react-native 2.1.17 → 2.2.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 (33) hide show
  1. package/README.md +24 -5
  2. package/{screeb-module.podspec → ScreebReactNative.podspec} +6 -4
  3. package/android/build.gradle +36 -86
  4. package/android/gradle.properties +5 -3
  5. package/android/src/main/AndroidManifest.xml +1 -3
  6. package/android/src/main/java/app/screeb/reactnative/ScreebReactNativeModule.kt +258 -0
  7. package/android/src/main/java/app/screeb/reactnative/ScreebReactNativePackage.kt +33 -0
  8. package/ios/ScreebReactNative.m +63 -0
  9. package/ios/{ScreebModule.swift → ScreebReactNative.swift} +116 -32
  10. package/lib/module/NativeScreebReactNative.js +10 -0
  11. package/lib/module/NativeScreebReactNative.js.map +1 -0
  12. package/lib/module/index.js +170 -88
  13. package/lib/module/index.js.map +1 -0
  14. package/lib/module/package.json +1 -0
  15. package/lib/typescript/package.json +1 -0
  16. package/lib/typescript/src/NativeScreebReactNative.d.ts +49 -0
  17. package/lib/typescript/src/NativeScreebReactNative.d.ts.map +1 -0
  18. package/lib/typescript/src/index.d.ts +25 -0
  19. package/lib/typescript/src/index.d.ts.map +1 -0
  20. package/package.json +153 -59
  21. package/src/NativeScreebReactNative.ts +81 -0
  22. package/src/index.tsx +251 -144
  23. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  24. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  25. package/android/gradlew +0 -185
  26. package/android/gradlew.bat +0 -89
  27. package/android/src/main/java/com/screebmodule/ScreebModuleModule.kt +0 -186
  28. package/android/src/main/java/com/screebmodule/ScreebModulePackage.kt +0 -17
  29. package/ios/ScreebModule-Bridging-Header.h +0 -3
  30. package/ios/ScreebModule.m +0 -24
  31. package/ios/ScreebModule.xcodeproj/project.pbxproj +0 -293
  32. package/lib/commonjs/index.js +0 -130
  33. package/lib/typescript/index.d.ts +0 -13
package/package.json CHANGED
@@ -1,61 +1,155 @@
1
1
  {
2
- "name": "@screeb/react-native",
3
- "version": "2.1.17",
4
- "description": "Continuous Product Discovery",
5
- "scripts": {
6
- "clean": "rm -rf lib/",
7
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
8
- "build": "npm run clean ; tsc -p tsconfig.build.json && tsc -p tsconfig.build.cjs.json"
9
- },
10
- "react-native": "src/index.tsx",
11
- "main": "lib/commonjs/index.js",
12
- "module": "lib/module/index.js",
13
- "source": "src/index.tsx",
14
- "keywords": [
15
- "react-native",
16
- "ios",
17
- "android",
18
- "screeb",
19
- "survey"
20
- ],
21
- "files": [
22
- "src",
23
- "lib",
24
- "android",
25
- "ios",
26
- "cpp",
27
- "screeb-module.podspec",
28
- "!lib/typescript/example",
29
- "!android/build",
30
- "!ios/build",
31
- "!**/__tests__",
32
- "!**/__fixtures__",
33
- "!**/__mocks__"
34
- ],
35
- "repository": {
36
- "type": "git",
37
- "url": "git+https://github.com/ScreebApp/sdk-reactnative.git"
38
- },
39
- "author": "Clement <clement@screeb.app> (https://github.com/clement-screeb)",
40
- "contributors": [
41
- "Marty <martin@screeb.app> (https://github.com/MD4)",
42
- "Samuel <samuel@screeb.app> (https://github.com/samber)",
43
- "Alexis <alexis@screeb.app> (https://github.com/alexays)"
44
- ],
45
- "license": "MIT",
46
- "bugs": {
47
- "url": "https://github.com/ScreebApp/sdk-reactnative/issues"
48
- },
49
- "homepage": "https://github.com/ScreebApp/sdk-reactnative#readme",
50
- "publishConfig": {
51
- "registry": "https://registry.npmjs.org/"
52
- },
53
- "peerDependencies": {
54
- "react": "*",
55
- "react-native": "*"
56
- },
57
- "types": "./lib/typescript/index.d.ts",
58
- "devDependencies": {
59
- "typescript": "^5.1.6"
60
- }
2
+ "name": "@screeb/react-native",
3
+ "version": "2.2.0",
4
+ "description": "Continuous Product Discovery",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace screeb-react-native-example",
36
+ "example:expo": "yarn workspace example-expo start",
37
+ "typecheck": "tsc",
38
+ "lint": "eslint . --ext .js,.ts,.tsx --ignore-pattern example/** --ignore-pattern example-expo/**",
39
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
+ "prepare": "bob build",
41
+ "release": "release-it --only-version"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/ScreebApp/sdk-reactnative.git"
51
+ },
52
+ "author": "Alexis <alexis@screeb.app> (https://github.com/Alexays)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/ScreebApp/sdk-reactnative/issues"
56
+ },
57
+ "homepage": "https://github.com/ScreebApp/sdk-reactnative#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@commitlint/config-conventional": "^19.8.1",
63
+ "@eslint/compat": "^1.3.2",
64
+ "@eslint/eslintrc": "^3.3.1",
65
+ "@eslint/js": "^9.35.0",
66
+ "@react-native-community/cli": "20.0.1",
67
+ "@react-native/babel-preset": "0.81.1",
68
+ "@react-native/eslint-config": "^0.81.1",
69
+ "@release-it/conventional-changelog": "^10.0.1",
70
+ "@types/react": "^19.1.0",
71
+ "commitlint": "^19.8.1",
72
+ "del-cli": "^6.0.0",
73
+ "eslint": "^9.35.0",
74
+ "eslint-config-prettier": "^10.1.8",
75
+ "eslint-plugin-prettier": "^5.5.4",
76
+ "prettier": "^3.6.2",
77
+ "react": "19.1.0",
78
+ "react-native": "0.81.1",
79
+ "react-native-builder-bob": "^0.40.13",
80
+ "release-it": "^19.0.4",
81
+ "turbo": "^2.5.6",
82
+ "typescript": "^5.9.2"
83
+ },
84
+ "peerDependencies": {
85
+ "react": "*",
86
+ "react-native": "*"
87
+ },
88
+ "workspaces": [
89
+ "example",
90
+ "example-expo"
91
+ ],
92
+ "packageManager": "yarn@3.6.1",
93
+ "commitlint": {
94
+ "extends": [
95
+ "@commitlint/config-conventional"
96
+ ]
97
+ },
98
+ "release-it": {
99
+ "git": {
100
+ "commitMessage": "chore: release ${version}",
101
+ "tagName": "v${version}"
102
+ },
103
+ "npm": {
104
+ "publish": true
105
+ },
106
+ "github": {
107
+ "release": true
108
+ },
109
+ "plugins": {
110
+ "@release-it/conventional-changelog": {
111
+ "preset": {
112
+ "name": "angular"
113
+ }
114
+ }
115
+ }
116
+ },
117
+ "prettier": {
118
+ "quoteProps": "consistent",
119
+ "singleQuote": true,
120
+ "tabWidth": 2,
121
+ "trailingComma": "es5",
122
+ "useTabs": false
123
+ },
124
+ "react-native-builder-bob": {
125
+ "source": "src",
126
+ "output": "lib",
127
+ "targets": [
128
+ [
129
+ "module",
130
+ {
131
+ "esm": true
132
+ }
133
+ ],
134
+ [
135
+ "typescript",
136
+ {
137
+ "project": "tsconfig.build.json"
138
+ }
139
+ ]
140
+ ]
141
+ },
142
+ "codegenConfig": {
143
+ "name": "ScreebReactNativeSpec",
144
+ "type": "modules",
145
+ "jsSrcsDir": "src",
146
+ "android": {
147
+ "javaPackageName": "app.screeb.reactnative"
148
+ }
149
+ },
150
+ "create-react-native-library": {
151
+ "languages": "kotlin-objc",
152
+ "type": "turbo-module",
153
+ "version": "0.54.8"
154
+ }
61
155
  }
@@ -0,0 +1,81 @@
1
+ import { type TurboModule, TurboModuleRegistry } from "react-native";
2
+
3
+ type HookIdsMap = { [key: string]: string };
4
+ type InitOptions = {
5
+ isDebugMode?: boolean;
6
+ disableMirror?: boolean;
7
+ };
8
+
9
+ export interface Spec extends TurboModule {
10
+ initSdk(
11
+ channelId: string,
12
+ userId?: string,
13
+ properties?: { [key: string]: unknown } | null,
14
+ hooks?: HookIdsMap,
15
+ initOptions?: InitOptions,
16
+ language?: string,
17
+ ): Promise<void>;
18
+ setIdentity(
19
+ userId: string,
20
+ properties?: { [key: string]: unknown } | null,
21
+ ): Promise<void>;
22
+ setProperties(properties?: { [key: string]: unknown } | null): Promise<void>;
23
+ assignGroup(
24
+ type: string | null,
25
+ name: string,
26
+ properties?: { [key: string]: unknown } | null,
27
+ ): Promise<void>;
28
+ unassignGroup(
29
+ type: string | null,
30
+ name: string,
31
+ properties?: { [key: string]: unknown } | null,
32
+ ): Promise<void>;
33
+ trackEvent(
34
+ name: string,
35
+ properties?: { [key: string]: unknown } | null,
36
+ ): Promise<void>;
37
+ trackScreen(
38
+ name: string,
39
+ properties?: { [key: string]: unknown } | null,
40
+ ): Promise<void>;
41
+ startSurvey(
42
+ surveyId: string,
43
+ allowMultipleResponses?: boolean,
44
+ hiddenFields?: { [key: string]: unknown } | null,
45
+ ignoreSurveyStatus?: boolean,
46
+ hooks?: HookIdsMap,
47
+ language?: string,
48
+ distributionId?: string,
49
+ ): Promise<void>;
50
+ startMessage(
51
+ messageId: string,
52
+ allowMultipleResponses?: boolean,
53
+ hiddenFields?: { [key: string]: unknown } | null,
54
+ ignoreMessageStatus?: boolean,
55
+ hooks?: HookIdsMap,
56
+ language?: string,
57
+ distributionId?: string,
58
+ ): Promise<void>;
59
+ debug(): Promise<void>;
60
+ debugTargeting(): Promise<void>;
61
+ resetIdentity(): Promise<void>;
62
+ closeSdk(): Promise<void>;
63
+ closeSurvey(surveyId?: string): Promise<void>;
64
+ closeMessage(messageId?: string): Promise<void>;
65
+ onHookResult(
66
+ hookId: string,
67
+ result: { [key: string]: unknown },
68
+ ): Promise<void>;
69
+ }
70
+
71
+ const module = TurboModuleRegistry.get<Spec>("ScreebReactNative");
72
+ if (!module) {
73
+ const LINKING_ERROR =
74
+ `The native module "ScreebReactNative" could not be found.\n` +
75
+ "- Ensure the iOS/Android native code is compiled (iOS: run 'pod install' in the example app, then rebuild).\n" +
76
+ "- If you're developing locally, run 'yarn prepare' to rebuild the JS output.\n" +
77
+ "- On iOS, make sure the podspec is included and the app is rebuilt (not just reloaded).";
78
+ throw new Error(LINKING_ERROR);
79
+ }
80
+
81
+ export default module as Spec;