@survicate/react-native-survicate 4.1.0 → 4.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 (82) hide show
  1. package/README.md +53 -7
  2. package/android/build.gradle +23 -2
  3. package/android/src/main/AndroidManifest.xml +2 -1
  4. package/android/src/main/AndroidManifestNew.xml +3 -0
  5. package/android/src/main/java/com/survicate/react/SurvicateModuleImpl.java +2 -2
  6. package/app.plugin.js +10 -0
  7. package/ios/SurvicateBindings.mm +2 -2
  8. package/ios/SurvicateBindings.xcworkspace/xcuserdata/pawelgodlewski.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  9. package/lib/commonjs/expo/types.js +2 -0
  10. package/lib/commonjs/expo/types.js.map +1 -0
  11. package/lib/commonjs/expo/withSurvicate.js +19 -0
  12. package/lib/commonjs/expo/withSurvicate.js.map +1 -0
  13. package/lib/commonjs/expo/withSurvicateAndroid.js +79 -0
  14. package/lib/commonjs/expo/withSurvicateAndroid.js.map +1 -0
  15. package/lib/commonjs/expo/withSurvicateiOS.js +17 -0
  16. package/lib/commonjs/expo/withSurvicateiOS.js.map +1 -0
  17. package/lib/module/expo/types.js +2 -0
  18. package/lib/module/expo/types.js.map +1 -0
  19. package/lib/module/expo/withSurvicate.js +13 -0
  20. package/lib/module/expo/withSurvicate.js.map +1 -0
  21. package/lib/module/expo/withSurvicateAndroid.js +72 -0
  22. package/lib/module/expo/withSurvicateAndroid.js.map +1 -0
  23. package/lib/module/expo/withSurvicateiOS.js +10 -0
  24. package/lib/module/expo/withSurvicateiOS.js.map +1 -0
  25. package/lib/typescript/expo/types.d.ts +4 -0
  26. package/lib/typescript/expo/types.d.ts.map +1 -0
  27. package/lib/typescript/expo/withSurvicate.d.ts +8 -0
  28. package/lib/typescript/expo/withSurvicate.d.ts.map +1 -0
  29. package/lib/typescript/expo/withSurvicateAndroid.d.ts +5 -0
  30. package/lib/typescript/expo/withSurvicateAndroid.d.ts.map +1 -0
  31. package/lib/typescript/expo/withSurvicateiOS.d.ts +4 -0
  32. package/lib/typescript/expo/withSurvicateiOS.d.ts.map +1 -0
  33. package/package.json +22 -7
  34. package/react-native-survicate.podspec +1 -1
  35. package/src/expo/types.ts +3 -0
  36. package/src/expo/withSurvicate.ts +20 -0
  37. package/src/expo/withSurvicateAndroid.ts +100 -0
  38. package/src/expo/withSurvicateiOS.ts +11 -0
  39. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  40. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  41. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  42. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  43. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  44. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  45. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  46. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  47. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  48. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  49. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  50. package/android/.gradle/7.5.1/gc.properties +0 -0
  51. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  52. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  53. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  54. package/android/.gradle/config.properties +0 -2
  55. package/android/.gradle/file-system.probe +0 -0
  56. package/android/.gradle/vcs-1/gc.properties +0 -0
  57. package/android/.idea/compiler.xml +0 -6
  58. package/android/.idea/gradle.xml +0 -18
  59. package/android/.idea/migrations.xml +0 -10
  60. package/android/.idea/misc.xml +0 -9
  61. package/android/.idea/modules/android.androidTest.iml +0 -6
  62. package/android/.idea/modules/android.iml +0 -6
  63. package/android/.idea/modules/android.main.iml +0 -6
  64. package/android/.idea/modules/android.unitTest.iml +0 -6
  65. package/android/.idea/sonarlint/issuestore/0/d/0df9aa085b7b8db1dccfbc855a1ace7351a87b1f +0 -0
  66. package/android/.idea/sonarlint/issuestore/3/4/348c0bbc5ca5287a00a390486ca37dd7b380944a +0 -0
  67. package/android/.idea/sonarlint/issuestore/5/9/590364a981f27a7c9f1304f29901ba5f8b10c7bb +0 -0
  68. package/android/.idea/sonarlint/issuestore/6/1/61130b71a87185f8a73a14cbce1419badde70d8b +0 -0
  69. package/android/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
  70. package/android/.idea/sonarlint/issuestore/index.pb +0 -11
  71. package/android/.idea/sonarlint/securityhotspotstore/0/d/0df9aa085b7b8db1dccfbc855a1ace7351a87b1f +0 -0
  72. package/android/.idea/sonarlint/securityhotspotstore/3/4/348c0bbc5ca5287a00a390486ca37dd7b380944a +0 -0
  73. package/android/.idea/sonarlint/securityhotspotstore/5/9/590364a981f27a7c9f1304f29901ba5f8b10c7bb +0 -0
  74. package/android/.idea/sonarlint/securityhotspotstore/6/1/61130b71a87185f8a73a14cbce1419badde70d8b +0 -0
  75. package/android/.idea/sonarlint/securityhotspotstore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
  76. package/android/.idea/sonarlint/securityhotspotstore/index.pb +0 -11
  77. package/android/.idea/vcs.xml +0 -6
  78. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  79. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  80. package/android/gradlew +0 -240
  81. package/android/gradlew.bat +0 -91
  82. package/android/local.properties +0 -8
package/README.md CHANGED
@@ -1,17 +1,34 @@
1
- # @survicate/react-native-survicate [![npm version](https://badge.fury.io/js/%40survicate%2Freact-native-survicate.svg)](https://badge.fury.io/js/%40survicate%2Freact-native-survicate)
1
+ # @survicate/react-native-survicate ![npm version](https://img.shields.io/npm/v/%40survicate%2Freact-native-survicate)
2
+
3
+ Integrate Survicate into your React Native application to collect user feedback seamlessly.
2
4
 
3
5
  ## Requirements:
4
6
  - iOS at least on version 12.0
5
7
  - Android at least on version 5
6
8
  - React Native at least on version 0.60.0
7
9
 
8
- ## Getting started
10
+ ## Installation
11
+ This package can be installed using npm or yarn. If you're using Expo, follow the Expo-specific instructions.
12
+
13
+ ### Using npm
14
+ ```sh
15
+ npm install @survicate/react-native-survicate --save
16
+ ```
17
+
18
+ ### Using yarn
19
+ ```sh
20
+ yarn add @survicate/react-native-survicate
21
+ ```
9
22
 
10
- `$ npm install @survicate/react-native-survicate --save`
23
+ ### Using expo
24
+ > Please note that due to custom native code in this package "Expo Go" is not available.
11
25
 
12
- ### Mostly automatic installation
26
+ To use @survicate/react-native-survicate in an Expo managed project use npm, yarn or expo-cli.
27
+ ```sh
28
+ expo install @survicate/react-native-survicate
29
+ ```
13
30
 
14
- `$ react-native link @survicate/react-native-survicate`
31
+ ## Configuration
15
32
 
16
33
  ### Configuring Survicate Bindings for iOS
17
34
  - Add your Survicate workspace key to `Info.plist`
@@ -45,11 +62,30 @@ allprojects {
45
62
  </application>
46
63
  ```
47
64
 
65
+ ### Configuring Survicate Bindings for Expo
66
+ - Add [config plugin](https://docs.expo.dev/config-plugins/introduction/) to `plugins` array of your `app.json` or `app.config.js`
67
+ ```json
68
+ {
69
+ "expo": {
70
+ "plugins": [
71
+ [
72
+ "@survicate/react-native-survicate",
73
+ {
74
+ "workspaceKey": "YOUR_WORKSPACE_KEY"
75
+ }
76
+ ]
77
+ ]
78
+ }
79
+ }
80
+ ```
81
+ > Please note that every time you change the props or plugins, you'll need to [rebuild](https://docs.expo.dev/workflow/customizing/) the native app.
82
+
83
+
48
84
  ## Usage
49
85
  ```javascript
50
86
  import Survicate, {UserTrait} from '@survicate/react-native-survicate';
51
87
 
52
- Survicate.initialize();
88
+ Survicate.initializeSdk();
53
89
  Survicate.invokeEvent("eventName");
54
90
  Survicate.enterScreen("screenName");
55
91
  Survicate.leaveScreen("screenName");
@@ -66,10 +102,20 @@ const listener: SurvicateEventListener = {
66
102
  onSurveyClosed(event: SurveyClosedEvent) {},
67
103
  onSurveyCompleted(event: SurveyCompletedEvent) {},
68
104
  }
69
- Survicate.addSurvicateEventListener(listener);
105
+ const subscription = Survicate.addSurvicateEventListener(listener);
70
106
  Survicate.reset();
71
107
  ```
72
108
 
109
+ ## Issues
110
+
111
+ Got an Issue?
112
+
113
+ To make things more streamlined, we’ve transitioned our issue reporting to our customer support platform. If you encounter any bugs or have feedback, please reach out to our customer support team. Your insights are invaluable to us, and we’re here to help ensure your experience is top-notch!
114
+
115
+ Contact us via Intercom in the application, or drop us an email at: [hello@survicate.com]
116
+
117
+ Thank you for your support and understanding!
118
+
73
119
  ## Changelog
74
120
 
75
121
  The Survicate Mobile SDK change log can be found [here](https://developers.survicate.com/mobile-sdk/react-native/#changelog)
@@ -46,8 +46,29 @@ if (isNewArchitectureEnabled()) {
46
46
  apply plugin: 'com.facebook.react'
47
47
  }
48
48
 
49
+ def supportsNamespace() {
50
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
51
+ def major = parsed[0].toInteger()
52
+ def minor = parsed[1].toInteger()
53
+
54
+ // Namespace support was added in 7.3.0
55
+ if (major == 7 && minor >= 3) {
56
+ return true
57
+ }
58
+
59
+ return major >= 8
60
+ }
61
+
49
62
  android {
50
- namespace "com.survicate.react"
63
+ if (supportsNamespace()) {
64
+ namespace "com.survicate.react"
65
+
66
+ sourceSets {
67
+ main {
68
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
69
+ }
70
+ }
71
+ }
51
72
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
52
73
  buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
53
74
  defaultConfig {
@@ -99,7 +120,7 @@ repositories {
99
120
  dependencies {
100
121
  //noinspection GradleDynamicVersion
101
122
  implementation 'com.facebook.react:react-native:+' // From node_modules
102
- implementation ('com.survicate:survicate-sdk:4.1.0')
123
+ implementation ('com.survicate:survicate-sdk:4.2.0')
103
124
  }
104
125
 
105
126
  if (isNewArchitectureEnabled()) {
@@ -1,3 +1,4 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.survicate.react">
2
3
 
3
4
  </manifest>
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ </manifest>
@@ -75,7 +75,7 @@ public class SurvicateModuleImpl extends SurvicateModule {
75
75
  @ReactMethod
76
76
  public void addListener(String eventName) {
77
77
  if (listenerCount == 0) {
78
- Survicate.setEventListener(eventListener);
78
+ Survicate.addEventListener(eventListener);
79
79
  }
80
80
 
81
81
  listenerCount++;
@@ -86,7 +86,7 @@ public class SurvicateModuleImpl extends SurvicateModule {
86
86
  listenerCount -= count;
87
87
 
88
88
  if (listenerCount == 0) {
89
- Survicate.setEventListener(null);
89
+ Survicate.removeEventListener(eventListener);
90
90
  }
91
91
  }
92
92
 
package/app.plugin.js ADDED
@@ -0,0 +1,10 @@
1
+ const packageJson = require('./package.json');
2
+
3
+ const pkg = {
4
+ name: packageJson.name,
5
+ version: packageJson.version,
6
+ };
7
+
8
+ const plugin = require('./lib/commonjs/expo/withSurvicate');
9
+
10
+ module.exports = plugin.default(pkg);
@@ -66,12 +66,12 @@ RCT_EXPORT_METHOD(setWorkspaceKey:(NSString *)workspaceKey)
66
66
 
67
67
  - (void)startObserving {
68
68
  hasListeners = YES;
69
- [[SurvicateSdk shared] setDelegate:self];
69
+ [[SurvicateSdk shared] addListener:self];
70
70
  }
71
71
 
72
72
  - (void)stopObserving {
73
73
  hasListeners = NO;
74
- [[SurvicateSdk shared] setDelegate:nil];
74
+ [[SurvicateSdk shared] removeListener:self];
75
75
  }
76
76
 
77
77
  - (void)surveyDisplayedWithEvent:(SurveyDisplayedEvent * _Nonnull)event {
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["expo/types.ts"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _configPlugins = require("@expo/config-plugins");
8
+ var _withSurvicateAndroid = require("./withSurvicateAndroid");
9
+ var _withSurvicateiOS = require("./withSurvicateiOS");
10
+ const withSurvicateReactNative = (config, props) => {
11
+ let newConfig = config;
12
+ newConfig = (0, _withSurvicateAndroid.withSurvicateAndroidManifest)(newConfig, props);
13
+ newConfig = (0, _withSurvicateAndroid.withSurvicateAndroidMavenRepository)(newConfig);
14
+ newConfig = (0, _withSurvicateiOS.withSurvicateIosInfoPlist)(newConfig, props);
15
+ return newConfig;
16
+ };
17
+ const configPlugin = pkg => (0, _configPlugins.createRunOncePlugin)(withSurvicateReactNative, pkg.name, pkg.version);
18
+ var _default = exports.default = configPlugin;
19
+ //# sourceMappingURL=withSurvicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","_withSurvicateAndroid","_withSurvicateiOS","withSurvicateReactNative","config","props","newConfig","withSurvicateAndroidManifest","withSurvicateAndroidMavenRepository","withSurvicateIosInfoPlist","configPlugin","pkg","createRunOncePlugin","name","version","_default","exports","default"],"sourceRoot":"../../../src","sources":["expo/withSurvicate.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,MAAMG,wBAA4D,GAAGA,CACnEC,MAAM,EACNC,KAAK,KACF;EACH,IAAIC,SAAS,GAAGF,MAAM;EACtBE,SAAS,GAAG,IAAAC,kDAA4B,EAACD,SAAS,EAAED,KAAK,CAAC;EAC1DC,SAAS,GAAG,IAAAE,yDAAmC,EAACF,SAAS,CAAC;EAC1DA,SAAS,GAAG,IAAAG,2CAAyB,EAACH,SAAS,EAAED,KAAK,CAAC;EACvD,OAAOC,SAAS;AAClB,CAAC;AAED,MAAMI,YAAY,GAAIC,GAAsC,IAC1D,IAAAC,kCAAmB,EAACT,wBAAwB,EAAEQ,GAAG,CAACE,IAAI,EAAEF,GAAG,CAACG,OAAO,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAExDP,YAAY"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withSurvicateAndroidMavenRepository = exports.withSurvicateAndroidManifest = void 0;
7
+ var _configPlugins = require("expo/config-plugins");
8
+ var _generateCode = require("@expo/config-plugins/build/utils/generateCode");
9
+ // Using helpers keeps error messages unified and helps cut down on XML format changes.
10
+ const {
11
+ addMetaDataItemToMainApplication,
12
+ getMainApplicationOrThrow
13
+ } = _configPlugins.AndroidConfig.Manifest;
14
+ const withSurvicateAndroidManifest = (config, props) => {
15
+ return (0, _configPlugins.withAndroidManifest)(config, async config => {
16
+ // Modifiers can be async, but try to keep them fast.
17
+ config.modResults = await setCustomConfigAsync(config.modResults, props.workspaceKey);
18
+ return config;
19
+ });
20
+ };
21
+ exports.withSurvicateAndroidManifest = withSurvicateAndroidManifest;
22
+ async function setCustomConfigAsync(androidManifest, workspaceKey) {
23
+ // Get the <application /> tag and assert if it doesn't exist.
24
+ const mainApplication = getMainApplicationOrThrow(androidManifest);
25
+ addMetaDataItemToMainApplication(mainApplication,
26
+ // value for `android:name`
27
+ "com.survicate.surveys.workspaceKey",
28
+ // value for `android:value`
29
+ workspaceKey);
30
+ return androidManifest;
31
+ }
32
+ const withSurvicateAndroidMavenRepository = config => {
33
+ return (0, _configPlugins.withProjectBuildGradle)(config, async config => {
34
+ if (config.modResults.language !== "groovy") {
35
+ console.warn("Unsupported language for build.gradle. Only 'groovy' is supported.");
36
+ return config;
37
+ }
38
+ config.modResults.contents = await appendContents({
39
+ src: config.modResults.contents,
40
+ newSrc: `allprojects { repositories { maven { url 'https://repo.survicate.com' } } }`,
41
+ tag: "@survicate/react-native-survicate",
42
+ comment: "//"
43
+ }).contents;
44
+ return config;
45
+ });
46
+ };
47
+
48
+ // Fork of config-plugins mergeContents, but appends the contents to the end of the file.
49
+ exports.withSurvicateAndroidMavenRepository = withSurvicateAndroidMavenRepository;
50
+ function appendContents({
51
+ src,
52
+ newSrc,
53
+ tag,
54
+ comment
55
+ }) {
56
+ const header = (0, _generateCode.createGeneratedHeaderComment)(newSrc, tag, comment);
57
+ if (!src.includes(header)) {
58
+ // Ensure the old generated contents are removed.
59
+ const sanitizedTarget = (0, _generateCode.removeGeneratedContents)(src, tag);
60
+ const contentsToAdd = [
61
+ // @something
62
+ header,
63
+ // contents
64
+ newSrc,
65
+ // @end
66
+ `${comment} @generated end ${tag}`].join("\n");
67
+ return {
68
+ contents: sanitizedTarget ?? src + contentsToAdd,
69
+ didMerge: true,
70
+ didClear: !!sanitizedTarget
71
+ };
72
+ }
73
+ return {
74
+ contents: src,
75
+ didClear: false,
76
+ didMerge: false
77
+ };
78
+ }
79
+ //# sourceMappingURL=withSurvicateAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","_generateCode","addMetaDataItemToMainApplication","getMainApplicationOrThrow","AndroidConfig","Manifest","withSurvicateAndroidManifest","config","props","withAndroidManifest","modResults","setCustomConfigAsync","workspaceKey","exports","androidManifest","mainApplication","withSurvicateAndroidMavenRepository","withProjectBuildGradle","language","console","warn","contents","appendContents","src","newSrc","tag","comment","header","createGeneratedHeaderComment","includes","sanitizedTarget","removeGeneratedContents","contentsToAdd","join","didMerge","didClear"],"sourceRoot":"../../../src","sources":["expo/withSurvicateAndroid.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAQA,IAAAC,aAAA,GAAAD,OAAA;AAMA;AACA,MAAM;EAAEE,gCAAgC;EAAEC;AAA0B,CAAC,GACnEC,4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,0CAA4B,EAACJ,MAAM,EAAEC,GAAG,EAAEC,OAAO,CAAC;EACjE,IAAI,CAACH,GAAG,CAACM,QAAQ,CAACF,MAAM,CAAC,EAAE;IACzB;IACA,MAAMG,eAAe,GAAG,IAAAC,qCAAuB,EAACR,GAAG,EAAEE,GAAG,CAAC;IACzD,MAAMO,aAAa,GAAG;IACpB;IACAL,MAAM;IACN;IACAH,MAAM;IACN;IACC,GAAEE,OAAQ,mBAAkBD,GAAI,EAAC,CACnC,CAACQ,IAAI,CAAC,IAAI,CAAC;IACZ,OAAO;MACLZ,QAAQ,EAAES,eAAe,IAAIP,GAAG,GAAGS,aAAa;MAChDE,QAAQ,EAAE,IAAI;MACdC,QAAQ,EAAE,CAAC,CAACL;IACd,CAAC;EACH;EACA,OAAO;IAAET,QAAQ,EAAEE,GAAG;IAAEY,QAAQ,EAAE,KAAK;IAAED,QAAQ,EAAE;EAAM,CAAC;AAC5D"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withSurvicateIosInfoPlist = void 0;
7
+ var _configPlugins = require("expo/config-plugins");
8
+ const withSurvicateIosInfoPlist = (config, props) => {
9
+ return (0, _configPlugins.withInfoPlist)(config, config => {
10
+ config.modResults.Survicate = {
11
+ WorkspaceKey: props.workspaceKey
12
+ };
13
+ return config;
14
+ });
15
+ };
16
+ exports.withSurvicateIosInfoPlist = withSurvicateIosInfoPlist;
17
+ //# sourceMappingURL=withSurvicateiOS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_configPlugins","require","withSurvicateIosInfoPlist","config","props","withInfoPlist","modResults","Survicate","WorkspaceKey","workspaceKey","exports"],"sourceRoot":"../../../src","sources":["expo/withSurvicateiOS.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAGO,MAAMC,yBAA6D,GAAGA,CAACC,MAAM,EAAEC,KAA2B,KAAK;EAClH,OAAO,IAAAC,4BAAa,EAACF,MAAM,EAAGA,MAAM,IAAK;IACrCA,MAAM,CAACG,UAAU,CAACC,SAAS,GAAG;MAC5BC,YAAY,EAAEJ,KAAK,CAACK;IACtB,CAAC;IACD,OAAON,MAAM;EACjB,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAR,yBAAA,GAAAA,yBAAA"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["expo/types.ts"],"mappings":""}
@@ -0,0 +1,13 @@
1
+ import { createRunOncePlugin } from "@expo/config-plugins";
2
+ import { withSurvicateAndroidManifest, withSurvicateAndroidMavenRepository } from "./withSurvicateAndroid";
3
+ import { withSurvicateIosInfoPlist } from "./withSurvicateiOS";
4
+ const withSurvicateReactNative = (config, props) => {
5
+ let newConfig = config;
6
+ newConfig = withSurvicateAndroidManifest(newConfig, props);
7
+ newConfig = withSurvicateAndroidMavenRepository(newConfig);
8
+ newConfig = withSurvicateIosInfoPlist(newConfig, props);
9
+ return newConfig;
10
+ };
11
+ const configPlugin = pkg => createRunOncePlugin(withSurvicateReactNative, pkg.name, pkg.version);
12
+ export default configPlugin;
13
+ //# sourceMappingURL=withSurvicate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createRunOncePlugin","withSurvicateAndroidManifest","withSurvicateAndroidMavenRepository","withSurvicateIosInfoPlist","withSurvicateReactNative","config","props","newConfig","configPlugin","pkg","name","version"],"sourceRoot":"../../../src","sources":["expo/withSurvicate.ts"],"mappings":"AAAA,SAAuBA,mBAAmB,QAAQ,sBAAsB;AAExE,SAASC,4BAA4B,EAAEC,mCAAmC,QAAQ,wBAAwB;AAC1G,SAASC,yBAAyB,QAAQ,oBAAoB;AAE9D,MAAMC,wBAA4D,GAAGA,CACnEC,MAAM,EACNC,KAAK,KACF;EACH,IAAIC,SAAS,GAAGF,MAAM;EACtBE,SAAS,GAAGN,4BAA4B,CAACM,SAAS,EAAED,KAAK,CAAC;EAC1DC,SAAS,GAAGL,mCAAmC,CAACK,SAAS,CAAC;EAC1DA,SAAS,GAAGJ,yBAAyB,CAACI,SAAS,EAAED,KAAK,CAAC;EACvD,OAAOC,SAAS;AAClB,CAAC;AAED,MAAMC,YAAY,GAAIC,GAAsC,IAC1DT,mBAAmB,CAACI,wBAAwB,EAAEK,GAAG,CAACC,IAAI,EAAED,GAAG,CAACE,OAAO,CAAC;AAEtE,eAAeH,YAAY"}
@@ -0,0 +1,72 @@
1
+ import { AndroidConfig, withAndroidManifest, withProjectBuildGradle } from "expo/config-plugins";
2
+ import { createGeneratedHeaderComment, removeGeneratedContents } from "@expo/config-plugins/build/utils/generateCode";
3
+
4
+ // Using helpers keeps error messages unified and helps cut down on XML format changes.
5
+ const {
6
+ addMetaDataItemToMainApplication,
7
+ getMainApplicationOrThrow
8
+ } = AndroidConfig.Manifest;
9
+ export const withSurvicateAndroidManifest = (config, props) => {
10
+ return withAndroidManifest(config, async config => {
11
+ // Modifiers can be async, but try to keep them fast.
12
+ config.modResults = await setCustomConfigAsync(config.modResults, props.workspaceKey);
13
+ return config;
14
+ });
15
+ };
16
+ async function setCustomConfigAsync(androidManifest, workspaceKey) {
17
+ // Get the <application /> tag and assert if it doesn't exist.
18
+ const mainApplication = getMainApplicationOrThrow(androidManifest);
19
+ addMetaDataItemToMainApplication(mainApplication,
20
+ // value for `android:name`
21
+ "com.survicate.surveys.workspaceKey",
22
+ // value for `android:value`
23
+ workspaceKey);
24
+ return androidManifest;
25
+ }
26
+ export const withSurvicateAndroidMavenRepository = config => {
27
+ return withProjectBuildGradle(config, async config => {
28
+ if (config.modResults.language !== "groovy") {
29
+ console.warn("Unsupported language for build.gradle. Only 'groovy' is supported.");
30
+ return config;
31
+ }
32
+ config.modResults.contents = await appendContents({
33
+ src: config.modResults.contents,
34
+ newSrc: `allprojects { repositories { maven { url 'https://repo.survicate.com' } } }`,
35
+ tag: "@survicate/react-native-survicate",
36
+ comment: "//"
37
+ }).contents;
38
+ return config;
39
+ });
40
+ };
41
+
42
+ // Fork of config-plugins mergeContents, but appends the contents to the end of the file.
43
+ function appendContents({
44
+ src,
45
+ newSrc,
46
+ tag,
47
+ comment
48
+ }) {
49
+ const header = createGeneratedHeaderComment(newSrc, tag, comment);
50
+ if (!src.includes(header)) {
51
+ // Ensure the old generated contents are removed.
52
+ const sanitizedTarget = removeGeneratedContents(src, tag);
53
+ const contentsToAdd = [
54
+ // @something
55
+ header,
56
+ // contents
57
+ newSrc,
58
+ // @end
59
+ `${comment} @generated end ${tag}`].join("\n");
60
+ return {
61
+ contents: sanitizedTarget ?? src + contentsToAdd,
62
+ didMerge: true,
63
+ didClear: !!sanitizedTarget
64
+ };
65
+ }
66
+ return {
67
+ contents: src,
68
+ didClear: false,
69
+ didMerge: false
70
+ };
71
+ }
72
+ //# sourceMappingURL=withSurvicateAndroid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AndroidConfig","withAndroidManifest","withProjectBuildGradle","createGeneratedHeaderComment","removeGeneratedContents","addMetaDataItemToMainApplication","getMainApplicationOrThrow","Manifest","withSurvicateAndroidManifest","config","props","modResults","setCustomConfigAsync","workspaceKey","androidManifest","mainApplication","withSurvicateAndroidMavenRepository","language","console","warn","contents","appendContents","src","newSrc","tag","comment","header","includes","sanitizedTarget","contentsToAdd","join","didMerge","didClear"],"sourceRoot":"../../../src","sources":["expo/withSurvicateAndroid.ts"],"mappings":"AAAA,SACEA,aAAa,EAEbC,mBAAmB,EACnBC,sBAAsB,QACjB,qBAAqB;AAG5B,SAEEC,4BAA4B,EAC5BC,uBAAuB,QAClB,+CAA+C;;AAEtD;AACA,MAAM;EAAEC,gCAAgC;EAAEC;AAA0B,CAAC,GACnEN,aAAa,CAACO,QAAQ;AAExB,OAAO,MAAMC,4BAEZ,GAAGA,CAACC,MAAkB,EAAEC,KAA2B,KAAK;EACvD,OAAOT,mBAAmB,CAACQ,MAAM,EAAE,MAAOA,MAAM,IAAK;IACn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;IACN;IACC,GAAEE,OAAQ,mBAAkBD,GAAI,EAAC,CACnC,CAACM,IAAI,CAAC,IAAI,CAAC;IACZ,OAAO;MACLV,QAAQ,EAAEQ,eAAe,IAAIN,GAAG,GAAGO,aAAa;MAChDE,QAAQ,EAAE,IAAI;MACdC,QAAQ,EAAE,CAAC,CAACJ;IACd,CAAC;EACH;EACA,OAAO;IAAER,QAAQ,EAAEE,GAAG;IAAEU,QAAQ,EAAE,KAAK;IAAED,QAAQ,EAAE;EAAM,CAAC;AAC5D"}
@@ -0,0 +1,10 @@
1
+ import { withInfoPlist } from 'expo/config-plugins';
2
+ export const withSurvicateIosInfoPlist = (config, props) => {
3
+ return withInfoPlist(config, config => {
4
+ config.modResults.Survicate = {
5
+ WorkspaceKey: props.workspaceKey
6
+ };
7
+ return config;
8
+ });
9
+ };
10
+ //# sourceMappingURL=withSurvicateiOS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["withInfoPlist","withSurvicateIosInfoPlist","config","props","modResults","Survicate","WorkspaceKey","workspaceKey"],"sourceRoot":"../../../src","sources":["expo/withSurvicateiOS.ts"],"mappings":"AAAA,SAAuBA,aAAa,QAAQ,qBAAqB;AAGjE,OAAO,MAAMC,yBAA6D,GAAGA,CAACC,MAAM,EAAEC,KAA2B,KAAK;EAClH,OAAOH,aAAa,CAACE,MAAM,EAAGA,MAAM,IAAK;IACrCA,MAAM,CAACE,UAAU,CAACC,SAAS,GAAG;MAC5BC,YAAY,EAAEH,KAAK,CAACI;IACtB,CAAC;IACD,OAAOL,MAAM;EACjB,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type SurvicatePluginProps = {
2
+ workspaceKey: string;
3
+ };
4
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/expo/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAA;CACvB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { ConfigPlugin } from "@expo/config-plugins";
2
+ import { SurvicatePluginProps } from "./types";
3
+ declare const configPlugin: (pkg: {
4
+ name: string;
5
+ version: string;
6
+ }) => ConfigPlugin<SurvicatePluginProps>;
7
+ export default configPlugin;
8
+ //# sourceMappingURL=withSurvicate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withSurvicate.d.ts","sourceRoot":"","sources":["../../../src/expo/withSurvicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAe/C,QAAA,MAAM,YAAY,QAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,uCACU,CAAC;AAEvE,eAAe,YAAY,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ConfigPlugin } from "expo/config-plugins";
2
+ import { SurvicatePluginProps } from "./types";
3
+ export declare const withSurvicateAndroidManifest: ConfigPlugin<SurvicatePluginProps>;
4
+ export declare const withSurvicateAndroidMavenRepository: ConfigPlugin;
5
+ //# sourceMappingURL=withSurvicateAndroid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withSurvicateAndroid.d.ts","sourceRoot":"","sources":["../../../src/expo/withSurvicateAndroid.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAW/C,eAAO,MAAM,4BAA4B,EAAE,YAAY,CACrD,oBAAoB,CAUrB,CAAC;AAoBF,eAAO,MAAM,mCAAmC,EAAE,YAiBjD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ConfigPlugin } from 'expo/config-plugins';
2
+ import { SurvicatePluginProps } from './types';
3
+ export declare const withSurvicateIosInfoPlist: ConfigPlugin<SurvicatePluginProps>;
4
+ //# sourceMappingURL=withSurvicateiOS.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withSurvicateiOS.d.ts","sourceRoot":"","sources":["../../../src/expo/withSurvicateiOS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAE7C,eAAO,MAAM,yBAAyB,EAAE,YAAY,CAAC,oBAAoB,CAOxE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@survicate/react-native-survicate",
3
3
  "title": "React Native Survicate Bindings",
4
- "version": "4.1.0",
4
+ "version": "4.2.0",
5
5
  "description": "React Native bindings for Survicate Mobile SDK",
6
6
  "main": "lib/commonjs/index.js",
7
7
  "module": "lib/module/index.js",
@@ -13,12 +13,19 @@
13
13
  "lib",
14
14
  "android",
15
15
  "ios",
16
+ "cpp",
17
+ "app.plugin.js",
16
18
  "react-native-survicate.podspec",
17
19
  "!android/build",
18
20
  "!ios/build",
21
+ "!android/gradle",
22
+ "!android/gradlew",
23
+ "!android/gradlew.bat",
24
+ "!android/local.properties",
19
25
  "!**/__tests__",
20
26
  "!**/__fixtures__",
21
- "!**/__mocks__"
27
+ "!**/__mocks__",
28
+ "!**/.*"
22
29
  ],
23
30
  "scripts": {
24
31
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -31,24 +38,32 @@
31
38
  "baseUrl": "https://github.com/Survicate/survicate-react-native-sdk"
32
39
  },
33
40
  "keywords": [
34
- "react-native"
41
+ "react-native",
42
+ "expo"
35
43
  ],
36
- "author": {
37
- "name": "Survicate",
38
- "email": "help@survicate.com"
39
- },
44
+ "author": "Survicate <hello@survicate.com> (https://survicate.com/)",
40
45
  "license": "MIT",
41
46
  "licenseFilename": "LICENSE",
42
47
  "readmeFilename": "README.md",
48
+ "bugs": {
49
+ "url": "https://survicate.com"
50
+ },
43
51
  "peerDependencies": {
52
+ "expo": ">=49",
44
53
  "react": ">=16.8.6",
45
54
  "react-native": ">=0.60.0"
46
55
  },
56
+ "peerDependenciesMeta": {
57
+ "expo": {
58
+ "optional": true
59
+ }
60
+ },
47
61
  "devDependencies": {
48
62
  "@tsconfig/react-native": "^3.0.2",
49
63
  "@types/jest": "^29.5.4",
50
64
  "@types/react": "^18.2.21",
51
65
  "@types/react-test-renderer": "^18.0.1",
66
+ "expo": "^50.0.11",
52
67
  "react": "18.2.0",
53
68
  "react-native": "0.72.6",
54
69
  "react-native-builder-bob": "^0.23.1",
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
21
21
  s.requires_arc = true
22
22
 
23
23
  s.dependency "React"
24
- s.dependency "Survicate", "4.1.1"
24
+ s.dependency "Survicate", "4.2.0"
25
25
  # ...
26
26
  # s.dependency "..."
27
27
 
@@ -0,0 +1,3 @@
1
+ export type SurvicatePluginProps = {
2
+ workspaceKey: string
3
+ }
@@ -0,0 +1,20 @@
1
+ import { ConfigPlugin, createRunOncePlugin } from "@expo/config-plugins";
2
+ import { SurvicatePluginProps } from "./types";
3
+ import { withSurvicateAndroidManifest, withSurvicateAndroidMavenRepository } from "./withSurvicateAndroid";
4
+ import { withSurvicateIosInfoPlist } from "./withSurvicateiOS";
5
+
6
+ const withSurvicateReactNative: ConfigPlugin<SurvicatePluginProps> = (
7
+ config,
8
+ props
9
+ ) => {
10
+ let newConfig = config;
11
+ newConfig = withSurvicateAndroidManifest(newConfig, props);
12
+ newConfig = withSurvicateAndroidMavenRepository(newConfig);
13
+ newConfig = withSurvicateIosInfoPlist(newConfig, props);
14
+ return newConfig;
15
+ };
16
+
17
+ const configPlugin = (pkg: { name: string; version: string }) =>
18
+ createRunOncePlugin(withSurvicateReactNative, pkg.name, pkg.version);
19
+
20
+ export default configPlugin;