@screeb/react-native 2.1.5 → 2.1.6

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.
@@ -123,6 +123,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
123
123
  dependencies {
124
124
  // noinspection GradleDynamicVersion
125
125
  api 'com.facebook.react:react-native:+'
126
- implementation "app.screeb.sdk:survey:2.1.2"
126
+ implementation "app.screeb.sdk:survey:2.1.8"
127
127
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22"
128
128
  }
@@ -26,7 +26,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
26
26
  }
27
27
 
28
28
  @ReactMethod
29
- fun initSdk(channelId: String, userId: String?, properties: ReadableMap?, hooks: ReadableMap?, initOptions: ReadableMap?) {
29
+ fun initSdk(channelId: String, userId: String?, properties: ReadableMap?, hooks: ReadableMap?, initOptions: ReadableMap?, language: String?) {
30
30
  Log.d("ScreebModule", "Called initSdk : $userId")
31
31
  Screeb.setSecondarySDK("react-native", "2.1.5")
32
32
  var map: HashMap<String, Any?>? = null
@@ -52,7 +52,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
52
52
  }
53
53
 
54
54
  Handler(Looper.getMainLooper()).post {
55
- Screeb.pluginInit(channelId, userId, map, mapHooks)
55
+ Screeb.pluginInit(channelId, userId, map, mapHooks, language)
56
56
  }
57
57
  }
58
58
 
@@ -133,7 +133,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
133
133
  }
134
134
 
135
135
  @ReactMethod
136
- fun startSurvey(surveyId: String, allowMultipleResponses: Boolean? = true, hiddenFields: ReadableMap? = null, ignoreSurveyStatus: Boolean? = true, hooks: ReadableMap? = null) {
136
+ fun startSurvey(surveyId: String, allowMultipleResponses: Boolean? = true, hiddenFields: ReadableMap? = null, ignoreSurveyStatus: Boolean? = true, hooks: ReadableMap? = null, language: String? = null) {
137
137
  Log.e("ScreebModule", "Called startSurvey : $surveyId")
138
138
  var map: HashMap<String, Any>? = null
139
139
  if (hiddenFields != null) {
@@ -157,7 +157,7 @@ class ScreebModuleModule(reactContext: ReactApplicationContext) :
157
157
  }
158
158
  }
159
159
  Handler(Looper.getMainLooper()).post {
160
- Screeb.startSurvey(surveyId, allowMultipleResponses ?: true, map, ignoreSurveyStatus ?: true, mapHooks)
160
+ Screeb.startSurvey(surveyId, allowMultipleResponses ?: true, map, ignoreSurveyStatus ?: true, mapHooks, language)
161
161
  }
162
162
  }
163
163
 
@@ -3,14 +3,14 @@
3
3
 
4
4
  @interface RCT_EXTERN_MODULE(ScreebModule, RCTEventEmitter)
5
5
 
6
- RCT_EXTERN_METHOD(initSdk:(NSString *)channelId userId:(NSString *)userId_ properties:(NSDictionary<NSString *, id> *)properties_ hooks:(NSDictionary<NSString *, id> *)hooks_ initOptions:(NSDictionary<NSString *, id> *)initOptions_)
6
+ RCT_EXTERN_METHOD(initSdk:(NSString *)channelId userId:(NSString *)userId_ properties:(NSDictionary<NSString *, id> *)properties_ hooks:(NSDictionary<NSString *, id> *)hooks_ initOptions:(NSDictionary<NSString *, id> *)initOptions_ language:(NSString *)language_)
7
7
  RCT_EXTERN_METHOD(setIdentity:(NSString *)userId properties:(NSDictionary<NSString *, id> *)properties_)
8
8
  RCT_EXTERN_METHOD(setProperties:(NSDictionary<NSString *, id> *)properties)
9
9
  RCT_EXTERN_METHOD(assignGroup:(NSString *)type name:(NSString *)name_ properties:(NSDictionary<NSString *, id> *)properties_)
10
10
  RCT_EXTERN_METHOD(unassignGroup:(NSString *)type name:(NSString *)name_ properties:(NSDictionary<NSString *, id> *)properties_)
11
11
  RCT_EXTERN_METHOD(trackEvent:(NSString *)eventId properties:(NSDictionary<NSString *, id> *)properties_)
12
12
  RCT_EXTERN_METHOD(trackScreen:(NSString *)screen properties:(NSDictionary<NSString *, id> *)properties_)
13
- RCT_EXTERN_METHOD(startSurvey:(NSString *)surveyId allowMultipleResponses:(BOOL)allowMultipleResponses_ hiddenFields:(NSDictionary<NSString *, id> *)hiddenFields_ ignoreSurveyStatus:(BOOL)ignoreSurveyStatus_ hooks:(NSDictionary<NSString *, id> *)hooks_)
13
+ RCT_EXTERN_METHOD(startSurvey:(NSString *)surveyId allowMultipleResponses:(BOOL)allowMultipleResponses_ hiddenFields:(NSDictionary<NSString *, id> *)hiddenFields_ ignoreSurveyStatus:(BOOL)ignoreSurveyStatus_ hooks:(NSDictionary<NSString *, id> *)hooks_ language:(NSString *)language_)
14
14
  RCT_EXTERN_METHOD(onHookResult:(NSString *)hookId payload:(NSDictionary<NSString *, id> *)payload_)
15
15
  RCT_EXTERN_METHOD(debug)
16
16
  RCT_EXTERN_METHOD(debugTargeting)
@@ -4,13 +4,15 @@ import Foundation
4
4
 
5
5
  @objc(ScreebModule)
6
6
  class ScreebModule: RCTEventEmitter {
7
- @objc(initSdk:userId:properties:hooks:initOptions:)
7
+ @objc(initSdk:userId:properties:hooks:initOptions:language:)
8
8
  func initSdk(
9
9
  _ channelId: String,
10
10
  userId userId_: String?,
11
11
  properties properties_: [String: Any]?,
12
12
  hooks hooks_: [String: Any]?,
13
- initOptions initOptions_: [String: Any]?) {
13
+ initOptions initOptions_: [String: Any]?,
14
+ language language_: String?
15
+ ) {
14
16
  Screeb.setSecondarySDK(name: "react-native", version: "2.1.5")
15
17
  var map: [String: AnyEncodable?] = [:]
16
18
  if (properties_ != nil) {
@@ -43,7 +45,7 @@ class ScreebModule: RCTEventEmitter {
43
45
  }
44
46
 
45
47
  DispatchQueue.main.async {
46
- Screeb.initSdk(context: nil, channelId: channelId, identity: userId_, visitorProperty: map, initOptions: initOptions, hooks: mapHooks)
48
+ Screeb.initSdk(context: nil, channelId: channelId, identity: userId_, visitorProperty: map, initOptions: initOptions, hooks: mapHooks, language: language_)
47
49
  }
48
50
  }
49
51
 
@@ -85,7 +87,7 @@ class ScreebModule: RCTEventEmitter {
85
87
  }
86
88
  }
87
89
 
88
- @objc func startSurvey(_ surveyId: String, allowMultipleResponses allowMultipleResponses_: Bool, hiddenFields hiddenFields_: [String: Any]?,ignoreSurveyStatus ignoreSurveyStatus_: Bool, hooks hooks_: [String: Any]?) {
90
+ @objc func startSurvey(_ surveyId: String, allowMultipleResponses allowMultipleResponses_: Bool, hiddenFields hiddenFields_: [String: Any]?,ignoreSurveyStatus ignoreSurveyStatus_: Bool, hooks hooks_: [String: Any]?, language language_: String?) {
89
91
  var map: [String: AnyEncodable] = [:]
90
92
  if (hiddenFields_ != nil) {
91
93
  map = self.mapToAnyEncodable(map: hiddenFields_!).filter({ $0.value != nil }).mapValues({ $0! })
@@ -109,7 +111,7 @@ class ScreebModule: RCTEventEmitter {
109
111
  }
110
112
  }
111
113
  DispatchQueue.main.async {
112
- Screeb.startSurvey(surveyId: surveyId, allowMultipleResponses: allowMultipleResponses_, hiddenFields: map, ignoreSurveyStatus: ignoreSurveyStatus_, hooks: mapHooks)
114
+ Screeb.startSurvey(surveyId: surveyId, allowMultipleResponses: allowMultipleResponses_, hiddenFields: map, ignoreSurveyStatus: ignoreSurveyStatus_, hooks: mapHooks, language: language_)
113
115
  }
114
116
  }
115
117
 
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,14 @@
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>SchemeUserState</key>
6
+ <dict>
7
+ <key>ScreebModule.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -1,6 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.closeSurvey = exports.closeSdk = exports.resetIdentity = exports.debugTargeting = exports.debug = exports.startSurvey = exports.trackScreen = exports.trackEvent = exports.unassignGroup = exports.assignGroup = exports.setProperties = exports.setIdentity = exports.initSdk = void 0;
3
+ exports.initSdk = initSdk;
4
+ exports.setIdentity = setIdentity;
5
+ exports.setProperties = setProperties;
6
+ exports.assignGroup = assignGroup;
7
+ exports.unassignGroup = unassignGroup;
8
+ exports.trackEvent = trackEvent;
9
+ exports.trackScreen = trackScreen;
10
+ exports.startSurvey = startSurvey;
11
+ exports.debug = debug;
12
+ exports.debugTargeting = debugTargeting;
13
+ exports.resetIdentity = resetIdentity;
14
+ exports.closeSdk = closeSdk;
15
+ exports.closeSurvey = closeSurvey;
4
16
  const react_native_1 = require("react-native");
5
17
  const LINKING_ERROR = `The package '@screeb/react-native' doesn't seem to be linked. Make sure: \n\n` +
6
18
  react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: "" }) +
@@ -14,7 +26,7 @@ const ScreebModule = react_native_1.NativeModules.ScreebModule
14
26
  },
15
27
  });
16
28
  let hooksRegistry = new Map();
17
- function initSdk(androidChannelId, iosChannelId, userId, properties, hooks, isDebugMode) {
29
+ function initSdk(androidChannelId, iosChannelId, userId, properties, hooks, isDebugMode, language) {
18
30
  const emitter = react_native_1.Platform.OS === "ios"
19
31
  ? new react_native_1.NativeEventEmitter(react_native_1.NativeModules.ScreebModule)
20
32
  : react_native_1.DeviceEventEmitter;
@@ -34,38 +46,31 @@ function initSdk(androidChannelId, iosChannelId, userId, properties, hooks, isDe
34
46
  });
35
47
  }
36
48
  if (react_native_1.Platform.OS === "ios") {
37
- return ScreebModule.initSdk(iosChannelId, userId, properties, mapHooksId, isDebugMode);
49
+ return ScreebModule.initSdk(iosChannelId, userId, properties, mapHooksId, isDebugMode, language);
38
50
  }
39
51
  else {
40
- return ScreebModule.initSdk(androidChannelId, userId, properties, mapHooksId, isDebugMode);
52
+ return ScreebModule.initSdk(androidChannelId, userId, properties, mapHooksId, isDebugMode, language);
41
53
  }
42
54
  }
43
- exports.initSdk = initSdk;
44
55
  function setIdentity(userId, properties) {
45
56
  return ScreebModule.setIdentity(userId, properties);
46
57
  }
47
- exports.setIdentity = setIdentity;
48
58
  function setProperties(properties) {
49
59
  return ScreebModule.setProperties(properties);
50
60
  }
51
- exports.setProperties = setProperties;
52
61
  function assignGroup(type, name, properties) {
53
62
  return ScreebModule.assignGroup(type, name, properties);
54
63
  }
55
- exports.assignGroup = assignGroup;
56
64
  function unassignGroup(type, name, properties) {
57
65
  return ScreebModule.unassignGroup(type, name, properties);
58
66
  }
59
- exports.unassignGroup = unassignGroup;
60
67
  function trackEvent(name, properties) {
61
68
  return ScreebModule.trackEvent(name, properties);
62
69
  }
63
- exports.trackEvent = trackEvent;
64
70
  function trackScreen(name, properties) {
65
71
  return ScreebModule.trackScreen(name, properties);
66
72
  }
67
- exports.trackScreen = trackScreen;
68
- function startSurvey(surveyId, allowMultipleResponses, hiddenFields, ignoreSurveyStatus, hooks) {
73
+ function startSurvey(surveyId, allowMultipleResponses, hiddenFields, ignoreSurveyStatus, hooks, language) {
69
74
  let mapHooksId = undefined;
70
75
  if (hooks != undefined) {
71
76
  mapHooksId = new Object();
@@ -80,29 +85,23 @@ function startSurvey(surveyId, allowMultipleResponses, hiddenFields, ignoreSurve
80
85
  }
81
86
  });
82
87
  }
83
- return ScreebModule.startSurvey(surveyId, allowMultipleResponses ?? true, hiddenFields, ignoreSurveyStatus ?? true, mapHooksId);
88
+ return ScreebModule.startSurvey(surveyId, allowMultipleResponses ?? true, hiddenFields, ignoreSurveyStatus ?? true, mapHooksId, language);
84
89
  }
85
- exports.startSurvey = startSurvey;
86
90
  function debug() {
87
91
  return ScreebModule.debug();
88
92
  }
89
- exports.debug = debug;
90
93
  function debugTargeting() {
91
94
  return ScreebModule.debugTargeting();
92
95
  }
93
- exports.debugTargeting = debugTargeting;
94
96
  function resetIdentity() {
95
97
  return ScreebModule.resetIdentity();
96
98
  }
97
- exports.resetIdentity = resetIdentity;
98
99
  function closeSdk() {
99
100
  return ScreebModule.closeSdk();
100
101
  }
101
- exports.closeSdk = closeSdk;
102
102
  function closeSurvey() {
103
103
  return ScreebModule.closeSurvey();
104
104
  }
105
- exports.closeSurvey = closeSurvey;
106
105
  function handleEvent(event) {
107
106
  if (event?.hookId != null) {
108
107
  let hook = hooksRegistry.get(event.hookId);
@@ -11,7 +11,7 @@ const ScreebModule = NativeModules.ScreebModule
11
11
  },
12
12
  });
13
13
  let hooksRegistry = new Map();
14
- export function initSdk(androidChannelId, iosChannelId, userId, properties, hooks, isDebugMode) {
14
+ export function initSdk(androidChannelId, iosChannelId, userId, properties, hooks, isDebugMode, language) {
15
15
  const emitter = Platform.OS === "ios"
16
16
  ? new NativeEventEmitter(NativeModules.ScreebModule)
17
17
  : DeviceEventEmitter;
@@ -31,10 +31,10 @@ export function initSdk(androidChannelId, iosChannelId, userId, properties, hook
31
31
  });
32
32
  }
33
33
  if (Platform.OS === "ios") {
34
- return ScreebModule.initSdk(iosChannelId, userId, properties, mapHooksId, isDebugMode);
34
+ return ScreebModule.initSdk(iosChannelId, userId, properties, mapHooksId, isDebugMode, language);
35
35
  }
36
36
  else {
37
- return ScreebModule.initSdk(androidChannelId, userId, properties, mapHooksId, isDebugMode);
37
+ return ScreebModule.initSdk(androidChannelId, userId, properties, mapHooksId, isDebugMode, language);
38
38
  }
39
39
  }
40
40
  export function setIdentity(userId, properties) {
@@ -55,7 +55,7 @@ export function trackEvent(name, properties) {
55
55
  export function trackScreen(name, properties) {
56
56
  return ScreebModule.trackScreen(name, properties);
57
57
  }
58
- export function startSurvey(surveyId, allowMultipleResponses, hiddenFields, ignoreSurveyStatus, hooks) {
58
+ export function startSurvey(surveyId, allowMultipleResponses, hiddenFields, ignoreSurveyStatus, hooks, language) {
59
59
  let mapHooksId = undefined;
60
60
  if (hooks != undefined) {
61
61
  mapHooksId = new Object();
@@ -70,7 +70,7 @@ export function startSurvey(surveyId, allowMultipleResponses, hiddenFields, igno
70
70
  }
71
71
  });
72
72
  }
73
- return ScreebModule.startSurvey(surveyId, allowMultipleResponses ?? true, hiddenFields, ignoreSurveyStatus ?? true, mapHooksId);
73
+ return ScreebModule.startSurvey(surveyId, allowMultipleResponses ?? true, hiddenFields, ignoreSurveyStatus ?? true, mapHooksId, language);
74
74
  }
75
75
  export function debug() {
76
76
  return ScreebModule.debug();
@@ -1,11 +1,11 @@
1
- export declare function initSdk(androidChannelId: string, iosChannelId: string, userId?: string, properties?: Map<string, any>, hooks?: any, isDebugMode?: boolean): any;
1
+ export declare function initSdk(androidChannelId: string, iosChannelId: string, userId?: string, properties?: Map<string, any>, hooks?: any, isDebugMode?: boolean, language?: string): any;
2
2
  export declare function setIdentity(userId: string, properties?: Map<string, any>): any;
3
3
  export declare function setProperties(properties?: Map<string, any>): any;
4
4
  export declare function assignGroup(type: string | null, name: string, properties?: Map<string, any>): any;
5
5
  export declare function unassignGroup(type: string | null, name: string, properties?: Map<string, any>): any;
6
6
  export declare function trackEvent(name: string, properties?: Map<string, any>): any;
7
7
  export declare function trackScreen(name: string, properties?: Map<string, any>): any;
8
- export declare function startSurvey(surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: Map<string, any>, ignoreSurveyStatus?: boolean, hooks?: any): any;
8
+ export declare function startSurvey(surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: Map<string, any>, ignoreSurveyStatus?: boolean, hooks?: any, language?: string): any;
9
9
  export declare function debug(): any;
10
10
  export declare function debugTargeting(): any;
11
11
  export declare function resetIdentity(): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/react-native",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Continuous Product Discovery",
5
5
  "scripts": {
6
6
  "clean": "rm -rf lib/",
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
17
 
18
18
  s.dependency "React-Core"
19
- s.dependency "Screeb", '~> 2.1.6'
19
+ s.dependency "Screeb", '~> 2.1.7'
20
20
  end
package/src/index.tsx CHANGED
@@ -30,7 +30,8 @@ export function initSdk(
30
30
  userId?: string,
31
31
  properties?: Map<string, any>,
32
32
  hooks?: any,
33
- isDebugMode?: boolean
33
+ isDebugMode?: boolean,
34
+ language?: string
34
35
  ) {
35
36
  const emitter =
36
37
  Platform.OS === "ios"
@@ -56,7 +57,8 @@ export function initSdk(
56
57
  userId,
57
58
  properties,
58
59
  mapHooksId,
59
- isDebugMode
60
+ isDebugMode,
61
+ language
60
62
  );
61
63
  } else {
62
64
  return ScreebModule.initSdk(
@@ -64,7 +66,8 @@ export function initSdk(
64
66
  userId,
65
67
  properties,
66
68
  mapHooksId,
67
- isDebugMode
69
+ isDebugMode,
70
+ language
68
71
  );
69
72
  }
70
73
  }
@@ -99,7 +102,8 @@ export function startSurvey(
99
102
  allowMultipleResponses?: boolean,
100
103
  hiddenFields?: Map<string, any>,
101
104
  ignoreSurveyStatus?: boolean,
102
- hooks?: any
105
+ hooks?: any,
106
+ language?: string
103
107
  ) {
104
108
  let mapHooksId: any = undefined;
105
109
  if (hooks != undefined) {
@@ -119,7 +123,8 @@ export function startSurvey(
119
123
  allowMultipleResponses ?? true,
120
124
  hiddenFields,
121
125
  ignoreSurveyStatus ?? true,
122
- mapHooksId
126
+ mapHooksId,
127
+ language
123
128
  );
124
129
  }
125
130
  export function debug() {