@dashx/react-native 0.1.25 → 1.0.2
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/android/build.gradle +22 -148
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -2
- package/android/gradlew +34 -21
- package/android/gradlew.bat +24 -19
- package/android/src/main/AndroidManifest.xml +2 -7
- package/android/src/main/java/com/dashx/rn/sdk/DashXReactNativeModule.kt +250 -0
- package/android/src/main/java/com/dashx/rn/sdk/{DashXPackage.kt → DashXReactNativePackage.kt} +2 -1
- package/android/src/main/java/com/dashx/rn/sdk/util/ArrayUtil.java +163 -0
- package/android/src/main/java/com/dashx/rn/sdk/util/MapUtil.java +168 -0
- package/android/src/main/java/com/dashx/rn/sdk/{Utils.kt → util/Utils.kt} +5 -5
- package/index.js +54 -74
- package/ios/DashX.swift +101 -93
- package/ios/DashXReactNative-Bridging-Header.h +4 -0
- package/ios/DashXReactNative.m +24 -0
- package/ios/DashXReactNative.xcodeproj/project.pbxproj +280 -0
- package/ios/{DashX.xcworkspace → DashXReactNative.xcworkspace}/contents.xcworkspacedata +1 -1
- package/ios/{DashX.xcworkspace → DashXReactNative.xcworkspace}/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- package/package.json +4 -13
- package/DashX.podspec +0 -27
- package/android/README.md +0 -23
- package/android/src/main/java/com/dashx/rn/sdk/DashXActivityLifecycleCallbacks.kt +0 -93
- package/android/src/main/java/com/dashx/rn/sdk/DashXClientInterceptor.kt +0 -66
- package/android/src/main/java/com/dashx/rn/sdk/DashXExceptionHandler.kt +0 -28
- package/android/src/main/java/com/dashx/rn/sdk/DashXMessagingService.kt +0 -176
- package/android/src/main/java/com/dashx/rn/sdk/DashXModule.kt +0 -193
- package/android/src/main/java/com/dashx/rn/sdk/NotificationReceiver.kt +0 -17
- package/ios/API.swift +0 -2420
- package/ios/Constants.swift +0 -14
- package/ios/DashX.m +0 -17
- package/ios/DashX.xcodeproj/project.pbxproj +0 -356
- package/ios/DashX.xcodeproj/xcshareddata/xcschemes/DashX.xcscheme +0 -67
- package/ios/DashXAppDelegate.swift +0 -73
- package/ios/DashXApplicationLifecycleCallbacks.swift +0 -65
- package/ios/DashXClient.swift +0 -319
- package/ios/DashXData.swift +0 -19
- package/ios/DashXLog.swift +0 -44
- package/ios/DashXUIViewController.swift +0 -15
- package/ios/Network.swift +0 -74
- package/ios/README.md +0 -80
- package/ios/Utils.swift +0 -13
- package/ios/graphql/AddContent.graphql +0 -8
- package/ios/graphql/AddItemToCart.graphql +0 -33
- package/ios/graphql/EditContent.graphql +0 -8
- package/ios/graphql/FetchCart.graphql +0 -33
- package/ios/graphql/FetchContent.graphql +0 -3
- package/ios/graphql/IdentifyAccount.graphql +0 -5
- package/ios/graphql/SearchContent.graphql +0 -3
- package/ios/graphql/SubscribeContact.graphql +0 -6
- package/ios/graphql/TrackEvent.graphql +0 -5
- package/ios/schema.json +0 -37038
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
ArrayUtil exposes a set of helper methods for working with
|
|
4
|
+
ReadableArray (by React Native), Object[], and JSONArray.
|
|
5
|
+
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2020 Marc Mendiola
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
package com.dashx.rn.sdk.util;
|
|
30
|
+
|
|
31
|
+
import com.facebook.react.bridge.Arguments;
|
|
32
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
33
|
+
import com.facebook.react.bridge.ReadableType;
|
|
34
|
+
import com.facebook.react.bridge.WritableArray;
|
|
35
|
+
|
|
36
|
+
import java.util.ArrayList;
|
|
37
|
+
import java.util.Arrays;
|
|
38
|
+
import java.util.List;
|
|
39
|
+
import java.util.Map;
|
|
40
|
+
|
|
41
|
+
import org.json.JSONArray;
|
|
42
|
+
import org.json.JSONObject;
|
|
43
|
+
import org.json.JSONException;
|
|
44
|
+
|
|
45
|
+
public class ArrayUtil {
|
|
46
|
+
|
|
47
|
+
public static JSONArray toJSONArray(ReadableArray readableArray) throws JSONException {
|
|
48
|
+
JSONArray jsonArray = new JSONArray();
|
|
49
|
+
|
|
50
|
+
for (int i = 0; i < readableArray.size(); i++) {
|
|
51
|
+
ReadableType type = readableArray.getType(i);
|
|
52
|
+
|
|
53
|
+
switch (type) {
|
|
54
|
+
case Null:
|
|
55
|
+
jsonArray.put(i, null);
|
|
56
|
+
break;
|
|
57
|
+
case Boolean:
|
|
58
|
+
jsonArray.put(i, readableArray.getBoolean(i));
|
|
59
|
+
break;
|
|
60
|
+
case Number:
|
|
61
|
+
jsonArray.put(i, readableArray.getDouble(i));
|
|
62
|
+
break;
|
|
63
|
+
case String:
|
|
64
|
+
jsonArray.put(i, readableArray.getString(i));
|
|
65
|
+
break;
|
|
66
|
+
case Map:
|
|
67
|
+
jsonArray.put(i, MapUtil.toJSONObject(readableArray.getMap(i)));
|
|
68
|
+
break;
|
|
69
|
+
case Array:
|
|
70
|
+
jsonArray.put(i, ArrayUtil.toJSONArray(readableArray.getArray(i)));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return jsonArray;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public static Object[] toArray(JSONArray jsonArray) throws JSONException {
|
|
79
|
+
Object[] array = new Object[jsonArray.length()];
|
|
80
|
+
|
|
81
|
+
for (int i = 0; i < jsonArray.length(); i++) {
|
|
82
|
+
Object value = jsonArray.get(i);
|
|
83
|
+
|
|
84
|
+
if (value instanceof JSONObject) {
|
|
85
|
+
value = MapUtil.toMap((JSONObject) value);
|
|
86
|
+
}
|
|
87
|
+
if (value instanceof JSONArray) {
|
|
88
|
+
value = ArrayUtil.toArray((JSONArray) value);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
array[i] = value;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return array;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public static Object[] toArray(ReadableArray readableArray) {
|
|
98
|
+
Object[] array = new Object[readableArray.size()];
|
|
99
|
+
|
|
100
|
+
for (int i = 0; i < readableArray.size(); i++) {
|
|
101
|
+
ReadableType type = readableArray.getType(i);
|
|
102
|
+
|
|
103
|
+
switch (type) {
|
|
104
|
+
case Null:
|
|
105
|
+
array[i] = null;
|
|
106
|
+
break;
|
|
107
|
+
case Boolean:
|
|
108
|
+
array[i] = readableArray.getBoolean(i);
|
|
109
|
+
break;
|
|
110
|
+
case Number:
|
|
111
|
+
array[i] = readableArray.getDouble(i);
|
|
112
|
+
break;
|
|
113
|
+
case String:
|
|
114
|
+
array[i] = readableArray.getString(i);
|
|
115
|
+
break;
|
|
116
|
+
case Map:
|
|
117
|
+
array[i] = MapUtil.toMap(readableArray.getMap(i));
|
|
118
|
+
break;
|
|
119
|
+
case Array:
|
|
120
|
+
array[i] = ArrayUtil.toArray(readableArray.getArray(i));
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return array;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public static List<Object> toList(ReadableArray readableArray) {
|
|
129
|
+
return Arrays.asList(toArray(readableArray));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
public static WritableArray toWritableArray(Object[] array) {
|
|
133
|
+
WritableArray writableArray = Arguments.createArray();
|
|
134
|
+
|
|
135
|
+
for (int i = 0; i < array.length; i++) {
|
|
136
|
+
Object value = array[i];
|
|
137
|
+
|
|
138
|
+
if (value == null) {
|
|
139
|
+
writableArray.pushNull();
|
|
140
|
+
}
|
|
141
|
+
if (value instanceof Boolean) {
|
|
142
|
+
writableArray.pushBoolean((Boolean) value);
|
|
143
|
+
}
|
|
144
|
+
if (value instanceof Double) {
|
|
145
|
+
writableArray.pushDouble((Double) value);
|
|
146
|
+
}
|
|
147
|
+
if (value instanceof Integer) {
|
|
148
|
+
writableArray.pushInt((Integer) value);
|
|
149
|
+
}
|
|
150
|
+
if (value instanceof String) {
|
|
151
|
+
writableArray.pushString((String) value);
|
|
152
|
+
}
|
|
153
|
+
if (value instanceof Map) {
|
|
154
|
+
writableArray.pushMap(MapUtil.toWritableMap((Map<String, Object>) value));
|
|
155
|
+
}
|
|
156
|
+
if (value.getClass().isArray()) {
|
|
157
|
+
writableArray.pushArray(ArrayUtil.toWritableArray((Object[]) value));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return writableArray;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*
|
|
2
|
+
MapUtil exposes a set of helper methods for working with
|
|
3
|
+
ReadableMap (by React Native), Map<String, Object>, and JSONObject.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2020 Marc Mendiola
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
package com.dashx.rn.sdk.util;
|
|
29
|
+
|
|
30
|
+
import com.facebook.react.bridge.Arguments;
|
|
31
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
32
|
+
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
33
|
+
import com.facebook.react.bridge.ReadableType;
|
|
34
|
+
import com.facebook.react.bridge.WritableMap;
|
|
35
|
+
|
|
36
|
+
import java.util.Map;
|
|
37
|
+
import java.util.HashMap;
|
|
38
|
+
import java.util.Iterator;
|
|
39
|
+
|
|
40
|
+
import org.json.JSONArray;
|
|
41
|
+
import org.json.JSONObject;
|
|
42
|
+
import org.json.JSONException;
|
|
43
|
+
|
|
44
|
+
public class MapUtil {
|
|
45
|
+
|
|
46
|
+
public static JSONObject toJSONObject(ReadableMap readableMap) throws JSONException {
|
|
47
|
+
JSONObject jsonObject = new JSONObject();
|
|
48
|
+
|
|
49
|
+
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
|
|
50
|
+
|
|
51
|
+
while (iterator.hasNextKey()) {
|
|
52
|
+
String key = iterator.nextKey();
|
|
53
|
+
ReadableType type = readableMap.getType(key);
|
|
54
|
+
|
|
55
|
+
switch (type) {
|
|
56
|
+
case Null:
|
|
57
|
+
jsonObject.put(key, null);
|
|
58
|
+
break;
|
|
59
|
+
case Boolean:
|
|
60
|
+
jsonObject.put(key, readableMap.getBoolean(key));
|
|
61
|
+
break;
|
|
62
|
+
case Number:
|
|
63
|
+
jsonObject.put(key, readableMap.getDouble(key));
|
|
64
|
+
break;
|
|
65
|
+
case String:
|
|
66
|
+
jsonObject.put(key, readableMap.getString(key));
|
|
67
|
+
break;
|
|
68
|
+
case Map:
|
|
69
|
+
jsonObject.put(key, MapUtil.toJSONObject(readableMap.getMap(key)));
|
|
70
|
+
break;
|
|
71
|
+
case Array:
|
|
72
|
+
jsonObject.put(key, ArrayUtil.toJSONArray(readableMap.getArray(key)));
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return jsonObject;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static Map<String, Object> toMap(JSONObject jsonObject) throws JSONException {
|
|
81
|
+
Map<String, Object> map = new HashMap<>();
|
|
82
|
+
Iterator<String> iterator = jsonObject.keys();
|
|
83
|
+
|
|
84
|
+
while (iterator.hasNext()) {
|
|
85
|
+
String key = iterator.next();
|
|
86
|
+
Object value = jsonObject.get(key);
|
|
87
|
+
|
|
88
|
+
if (value instanceof JSONObject) {
|
|
89
|
+
value = MapUtil.toMap((JSONObject) value);
|
|
90
|
+
}
|
|
91
|
+
if (value instanceof JSONArray) {
|
|
92
|
+
value = ArrayUtil.toArray((JSONArray) value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
map.put(key, value);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return map;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
public static Map<String, Object> toMap(ReadableMap readableMap) {
|
|
102
|
+
Map<String, Object> map = new HashMap<>();
|
|
103
|
+
|
|
104
|
+
if(readableMap == null) {
|
|
105
|
+
return map;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
|
|
109
|
+
|
|
110
|
+
while (iterator.hasNextKey()) {
|
|
111
|
+
String key = iterator.nextKey();
|
|
112
|
+
ReadableType type = readableMap.getType(key);
|
|
113
|
+
|
|
114
|
+
switch (type) {
|
|
115
|
+
case Null:
|
|
116
|
+
map.put(key, null);
|
|
117
|
+
break;
|
|
118
|
+
case Boolean:
|
|
119
|
+
map.put(key, readableMap.getBoolean(key));
|
|
120
|
+
break;
|
|
121
|
+
case Number:
|
|
122
|
+
map.put(key, readableMap.getDouble(key));
|
|
123
|
+
break;
|
|
124
|
+
case String:
|
|
125
|
+
map.put(key, readableMap.getString(key));
|
|
126
|
+
break;
|
|
127
|
+
case Map:
|
|
128
|
+
map.put(key, MapUtil.toMap(readableMap.getMap(key)));
|
|
129
|
+
break;
|
|
130
|
+
case Array:
|
|
131
|
+
map.put(key, ArrayUtil.toArray(readableMap.getArray(key)));
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return map;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public static WritableMap toWritableMap(Map<String, Object> map) {
|
|
140
|
+
WritableMap writableMap = Arguments.createMap();
|
|
141
|
+
Iterator iterator = map.entrySet().iterator();
|
|
142
|
+
|
|
143
|
+
while (iterator.hasNext()) {
|
|
144
|
+
Map.Entry pair = (Map.Entry)iterator.next();
|
|
145
|
+
Object value = pair.getValue();
|
|
146
|
+
|
|
147
|
+
if (value == null) {
|
|
148
|
+
writableMap.putNull((String) pair.getKey());
|
|
149
|
+
} else if (value instanceof Boolean) {
|
|
150
|
+
writableMap.putBoolean((String) pair.getKey(), (Boolean) value);
|
|
151
|
+
} else if (value instanceof Double) {
|
|
152
|
+
writableMap.putDouble((String) pair.getKey(), (Double) value);
|
|
153
|
+
} else if (value instanceof Integer) {
|
|
154
|
+
writableMap.putInt((String) pair.getKey(), (Integer) value);
|
|
155
|
+
} else if (value instanceof String) {
|
|
156
|
+
writableMap.putString((String) pair.getKey(), (String) value);
|
|
157
|
+
} else if (value instanceof Map) {
|
|
158
|
+
writableMap.putMap((String) pair.getKey(), MapUtil.toWritableMap((Map<String, Object>) value));
|
|
159
|
+
} else if (value.getClass() != null && value.getClass().isArray()) {
|
|
160
|
+
writableMap.putArray((String) pair.getKey(), ArrayUtil.toWritableArray((Object[]) value));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
iterator.remove();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return writableMap;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@file:JvmName("Utils")
|
|
2
2
|
|
|
3
|
-
package com.dashx.rn.sdk
|
|
3
|
+
package com.dashx.rn.sdk.util
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.bridge.*
|
|
6
6
|
import com.google.gson.JsonArray
|
|
@@ -45,8 +45,8 @@ fun convertArrayToJson(readableArray: ReadableArray?): JsonArray {
|
|
|
45
45
|
@JvmOverloads
|
|
46
46
|
@Throws(Exception::class)
|
|
47
47
|
fun convertToWritableMap(
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
map: Map<*, *>,
|
|
49
|
+
blacklist: List<String> = emptyList<String>()
|
|
50
50
|
): WritableMap {
|
|
51
51
|
val writableMap: WritableMap = WritableNativeMap()
|
|
52
52
|
val iterator: Iterator<String> = map.keys.iterator() as Iterator<String>
|
|
@@ -54,7 +54,7 @@ fun convertToWritableMap(
|
|
|
54
54
|
val key = iterator.next()
|
|
55
55
|
|
|
56
56
|
if (blacklist.contains(key)) {
|
|
57
|
-
continue
|
|
57
|
+
continue
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
when (val value = map[key]) {
|
|
@@ -128,4 +128,4 @@ fun ReadableMap.getStringIfPresent(key: String): String? {
|
|
|
128
128
|
|
|
129
129
|
fun ReadableMap.getBooleanIfPresent(key: String): Boolean? {
|
|
130
130
|
return if (this.hasKey(key)) this.getBoolean(key) else null
|
|
131
|
-
}
|
|
131
|
+
}
|
package/index.js
CHANGED
|
@@ -1,89 +1,69 @@
|
|
|
1
|
-
import { NativeEventEmitter, NativeModules } from
|
|
2
|
-
import { parseFilterObject, toContentSingleton } from
|
|
3
|
-
import {
|
|
4
|
-
prepareExternalAsset,
|
|
5
|
-
queryExternalAsset,
|
|
6
|
-
uploadExternalAsset,
|
|
7
|
-
} from './utils/RestAPIClient'
|
|
1
|
+
import { NativeEventEmitter, NativeModules } from "react-native";
|
|
2
|
+
import { parseFilterObject, toContentSingleton } from "./utils";
|
|
8
3
|
|
|
9
|
-
import ContentOptionsBuilder from
|
|
4
|
+
import ContentOptionsBuilder from "./ContentOptionsBuilder";
|
|
10
5
|
|
|
11
|
-
const { DashX } = NativeModules
|
|
12
|
-
const dashXEventEmitter = new NativeEventEmitter(DashX)
|
|
6
|
+
const { DashXReactNative: DashX } = NativeModules;
|
|
13
7
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
const dashXEventEmitter = new NativeEventEmitter(DashX);
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
identify,
|
|
12
|
+
setIdentity,
|
|
13
|
+
track,
|
|
14
|
+
fetchContent,
|
|
15
|
+
searchContent,
|
|
16
|
+
uploadExternalAsset,
|
|
17
|
+
prepareExternalAsset,
|
|
18
|
+
externalAsset,
|
|
19
|
+
} = DashX;
|
|
17
20
|
|
|
18
|
-
// Handle overloads at JS, because Native modules doesn't allow that
|
|
19
|
-
// https://github.com/facebook/react-native/issues/19116
|
|
20
21
|
DashX.identify = (options) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} else {
|
|
24
|
-
return identify(null, options)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
22
|
+
return identify(options);
|
|
23
|
+
};
|
|
27
24
|
|
|
28
|
-
DashX.
|
|
25
|
+
DashX.setIdentity = (uid, token) => {
|
|
26
|
+
return setIdentity(uid, token);
|
|
27
|
+
};
|
|
29
28
|
|
|
30
|
-
DashX.
|
|
31
|
-
return getConnectionConfig()
|
|
32
|
-
}
|
|
29
|
+
DashX.track = (event, data) => track(event, data || null);
|
|
33
30
|
|
|
34
31
|
DashX.searchContent = (contentType, options) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
if (!options) {
|
|
33
|
+
return new ContentOptionsBuilder((wrappedOptions) =>
|
|
34
|
+
searchContent(contentType, wrappedOptions)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
const filter = parseFilterObject(options.filter);
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
const result = searchContent(contentType, { ...options, filter });
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
if (options.returnType === "all") {
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
}
|
|
46
|
+
return result.then(toContentSingleton);
|
|
47
|
+
};
|
|
51
48
|
|
|
52
49
|
DashX.fetchContent = (contentType, options) => {
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
DashX.uploadExternalAsset =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return new Promise((resolve, reject) => {
|
|
74
|
-
prepareExternalAsset(externalColumnId, connectionConfig, resolve, reject)
|
|
75
|
-
})
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
DashX.externalAsset = async (assetId) => {
|
|
79
|
-
const connectionConfig = await getConnectionConfig()
|
|
80
|
-
|
|
81
|
-
return new Promise((resolve, reject) => {
|
|
82
|
-
queryExternalAsset(assetId, connectionConfig, resolve, reject)
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
DashX.onMessageReceived = (callback) =>
|
|
87
|
-
dashXEventEmitter.addListener('messageReceived', callback)
|
|
88
|
-
|
|
89
|
-
export default DashX
|
|
50
|
+
return fetchContent(contentType, options);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
DashX.uploadExternalAsset = (file, externalColumnId) => {
|
|
54
|
+
return uploadExternalAsset(file, externalColumnId);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
DashX.prepareExternalAsset = (externalColumnId) => {
|
|
58
|
+
return prepareExternalAsset(externalColumnId);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
DashX.externalAsset = (assetId) => {
|
|
62
|
+
return externalAsset(assetId);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
DashX.onMessageReceived = (callback) => {
|
|
66
|
+
dashXEventEmitter.addListener("messageReceived", callback);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default DashX;
|