@sentiance-react-native/core 6.0.0-beta.13 → 6.0.0-beta.16

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.
package/lib/core.js CHANGED
@@ -7,6 +7,7 @@ const SDK_USER_LINK_EVENT = "SENTIANCE_USER_LINK_EVENT";
7
7
  const SDK_USER_ACTIVITY_UPDATE_EVENT = "SENTIANCE_USER_ACTIVITY_UPDATE_EVENT";
8
8
  const SDK_ON_TRIP_TIMED_OUT_EVENT = "SENTIANCE_ON_TRIP_TIMED_OUT_EVENT";
9
9
 
10
+ let coreModule = {};
10
11
  if (!SentianceCore) {
11
12
  const nativeModuleName = varToString({SentianceCore});
12
13
  console.error(`Could not locate the native ${nativeModuleName} module.
@@ -51,6 +52,7 @@ if (!SentianceCore) {
51
52
  SentianceCore._addUserLinkListener = _addUserLinkListener;
52
53
  SentianceCore._addSdkUserActivityUpdateListener = _addSdkUserActivityUpdateListener;
53
54
  SentianceCore._addTripTimeoutListener = _addTripTimeoutListener;
55
+ coreModule = SentianceCore;
54
56
  }
55
57
 
56
- export default SentianceCore;
58
+ module.exports = coreModule;
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import core from './core';
2
- import Platform from 'react-native';
1
+ const core = require('./core');
2
+ const {Platform} = require('react-native');
3
3
 
4
4
  const enableDetections = () => core.enableDetections();
5
5
  const enableDetectionsWithExpiryDate = (expiryTime) => core.enableDetectionsWithExpiryDate(expiryTime);
@@ -43,8 +43,7 @@ if (Platform.OS === 'ios') {
43
43
  stopTrip = () => core.stopTripNewApi();
44
44
  submitDetections = () => core.submitDetectionsNewApi();
45
45
  reset = () => core.resetNewApi();
46
- }
47
- else {
46
+ } else {
48
47
  startTrip = (metadata, hint) => core.startTrip(metadata, hint);
49
48
  stopTrip = () => core.stopTrip();
50
49
  submitDetections = () => core.submitDetections();
@@ -81,7 +80,7 @@ const linkUser = async (linker) => {
81
80
  * }
82
81
  *
83
82
  * createUser(userCreationOptions);
84
- *
83
+ *
85
84
  * Or unlinked user with appId / appSecret (Not recommended)
86
85
  *
87
86
  * const userCreationOptions = {
@@ -118,7 +117,7 @@ const linkUser = async (linker) => {
118
117
  * }
119
118
  *
120
119
  * createUser(userCreationOptions);
121
- *
120
+ *
122
121
  * Or unlinked user with appId / appSecret (Not recommended)
123
122
  *
124
123
  * const userCreationOptions = {
@@ -143,16 +142,14 @@ const createUser = async (userCreationOptions) => {
143
142
 
144
143
  if (authCode) {
145
144
  return core.createLinkedUserWithAuthCode(authCode, platformUrl);
146
- }
147
- else if (linker) {
145
+ } else if (linker) {
148
146
  if (linker === NO_OP_LINKER) {
149
147
  return core.createUnlinkedUser(appId, appSecret, platformUrl);
150
148
  } else {
151
149
  await core._addUserLinkListener(linker);
152
150
  return core.createLinkedUser(appId, appSecret, platformUrl);
153
151
  }
154
- }
155
- else {
152
+ } else {
156
153
  return Promise.reject('Invalid userCreationOptions passed, no authcode or linker specified.');
157
154
  }
158
155
  }
package/lib/utils.js CHANGED
@@ -1 +1,3 @@
1
- export const varToString = varObj => Object.keys(varObj)[0];
1
+ module.exports.varToString = function (varObj) {
2
+ return Object.keys(varObj)[0];
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentiance-react-native/core",
3
- "version": "6.0.0-beta.13",
3
+ "version": "6.0.0-beta.16",
4
4
  "description": "React Native Sentiance core library",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",