leap-capacitor 2.0.1 → 2.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/README.md
CHANGED
|
@@ -14,9 +14,7 @@ npx cap sync
|
|
|
14
14
|
<docgen-index>
|
|
15
15
|
|
|
16
16
|
* [`start(...)`](#start)
|
|
17
|
-
* [`startWithProperties(...)`](#startwithproperties)
|
|
18
17
|
* [`startWithSelfHostedURL(...)`](#startwithselfhostedurl)
|
|
19
|
-
* [`startWithSelfHostedURLAndProperties(...)`](#startwithselfhostedurlandproperties)
|
|
20
18
|
* [`flushProperties(...)`](#flushproperties)
|
|
21
19
|
* [`setUniqueUserId(...)`](#setuniqueuserid)
|
|
22
20
|
* [`startProject(...)`](#startproject)
|
|
@@ -47,19 +45,6 @@ start(options: { apiKey: string; }) => Promise<void>
|
|
|
47
45
|
--------------------
|
|
48
46
|
|
|
49
47
|
|
|
50
|
-
### startWithProperties(...)
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
startWithProperties(options: { apiKey: string; properties: UserProperty; }) => Promise<void>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
| Param | Type |
|
|
57
|
-
| ------------- | -------------------------------------------------------------------------------------- |
|
|
58
|
-
| **`options`** | <code>{ apiKey: string; properties: <a href="#userproperty">UserProperty</a>; }</code> |
|
|
59
|
-
|
|
60
|
-
--------------------
|
|
61
|
-
|
|
62
|
-
|
|
63
48
|
### startWithSelfHostedURL(...)
|
|
64
49
|
|
|
65
50
|
```typescript
|
|
@@ -73,19 +58,6 @@ startWithSelfHostedURL(options: { baseURL: string; }) => Promise<void>
|
|
|
73
58
|
--------------------
|
|
74
59
|
|
|
75
60
|
|
|
76
|
-
### startWithSelfHostedURLAndProperties(...)
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
startWithSelfHostedURLAndProperties(options: { baseURL: string; properties: UserProperty; }) => Promise<void>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
| Param | Type |
|
|
83
|
-
| ------------- | --------------------------------------------------------------------------------------- |
|
|
84
|
-
| **`options`** | <code>{ baseURL: string; properties: <a href="#userproperty">UserProperty</a>; }</code> |
|
|
85
|
-
|
|
86
|
-
--------------------
|
|
87
|
-
|
|
88
|
-
|
|
89
61
|
### flushProperties(...)
|
|
90
62
|
|
|
91
63
|
```typescript
|
|
@@ -81,68 +81,68 @@ public class LeapPlugin extends Plugin {
|
|
|
81
81
|
call.resolve();
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
@PluginMethod
|
|
85
|
-
public void startWithSelfHostedURLAndProperties(PluginCall call) {
|
|
86
|
-
String baseURL = call.getString(SELF_HOSTING_BASE_URL);
|
|
87
|
-
JSObject propsObj = call.getObject(PROPERTIES);
|
|
88
|
-
Leap.Builder builder = Leap.withSelfHostedBuilder()
|
|
89
|
-
.setBaseUrl(baseURL);
|
|
90
|
-
|
|
91
|
-
if(propsObj == null) {
|
|
92
|
-
builder.start();
|
|
93
|
-
call.resolve();
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
startWithProperties(propsObj, builder);
|
|
98
|
-
call.resolve();
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
@PluginMethod
|
|
104
|
-
public void startWithProperties(PluginCall call) {
|
|
105
|
-
String apiKey = call.getString(API_KEY);
|
|
106
|
-
JSObject propsObj = call.getObject(PROPERTIES);
|
|
107
|
-
if(propsObj == null) {
|
|
108
|
-
Leap.start(apiKey);
|
|
109
|
-
call.resolve();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
Leap.Builder leapBuilder = Leap.withBuilder(apiKey);
|
|
113
|
-
startWithProperties(propsObj, leapBuilder);
|
|
114
|
-
call.resolve();
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
private void startWithProperties(JSObject propsObj, Leap.Builder leapBuilder) {
|
|
118
|
-
Iterator<String> iterator = propsObj.keys();
|
|
119
|
-
|
|
120
|
-
while (iterator.hasNext()) {
|
|
121
|
-
String key = iterator.next();
|
|
122
|
-
Object propValue = null;
|
|
123
|
-
try {
|
|
124
|
-
propValue = propsObj.get(key);
|
|
125
|
-
} catch (JSONException e) {
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
if(propValue instanceof String) {
|
|
129
|
-
String valueStr = (String) propValue;
|
|
130
|
-
if (valueStr.startsWith(DATE_TYPE_PREFIX)) {
|
|
131
|
-
String[] split = valueStr.split(DATE_TYPE_PREFIX);
|
|
132
|
-
if (split.length != 2) continue;
|
|
133
|
-
String dateValue = split[1];
|
|
134
|
-
Date date = getDate(dateValue);
|
|
135
|
-
if(date != null) leapBuilder.addProperty(key, date);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
leapBuilder.addProperty(key, String.valueOf(propValue));
|
|
139
|
-
} else if (propValue instanceof Number) {
|
|
140
|
-
leapBuilder.addProperty(key, (long) propValue);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
leapBuilder.start();
|
|
145
|
-
}
|
|
84
|
+
// @PluginMethod
|
|
85
|
+
// public void startWithSelfHostedURLAndProperties(PluginCall call) {
|
|
86
|
+
// String baseURL = call.getString(SELF_HOSTING_BASE_URL);
|
|
87
|
+
// JSObject propsObj = call.getObject(PROPERTIES);
|
|
88
|
+
// Leap.Builder builder = Leap.withSelfHostedBuilder()
|
|
89
|
+
// .setBaseUrl(baseURL);
|
|
90
|
+
//
|
|
91
|
+
// if(propsObj == null) {
|
|
92
|
+
// builder.start();
|
|
93
|
+
// call.resolve();
|
|
94
|
+
// return;
|
|
95
|
+
// }
|
|
96
|
+
//
|
|
97
|
+
// startWithProperties(propsObj, builder);
|
|
98
|
+
// call.resolve();
|
|
99
|
+
// }
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
// @PluginMethod
|
|
104
|
+
// public void startWithProperties(PluginCall call) {
|
|
105
|
+
// String apiKey = call.getString(API_KEY);
|
|
106
|
+
// JSObject propsObj = call.getObject(PROPERTIES);
|
|
107
|
+
// if(propsObj == null) {
|
|
108
|
+
// Leap.start(apiKey);
|
|
109
|
+
// call.resolve();
|
|
110
|
+
// return;
|
|
111
|
+
// }
|
|
112
|
+
// Leap.Builder leapBuilder = Leap.withBuilder(apiKey);
|
|
113
|
+
// startWithProperties(propsObj, leapBuilder);
|
|
114
|
+
// call.resolve();
|
|
115
|
+
// }
|
|
116
|
+
|
|
117
|
+
// private void startWithProperties(JSObject propsObj, Leap.Builder leapBuilder) {
|
|
118
|
+
// Iterator<String> iterator = propsObj.keys();
|
|
119
|
+
//
|
|
120
|
+
// while (iterator.hasNext()) {
|
|
121
|
+
// String key = iterator.next();
|
|
122
|
+
// Object propValue = null;
|
|
123
|
+
// try {
|
|
124
|
+
// propValue = propsObj.get(key);
|
|
125
|
+
// } catch (JSONException e) {
|
|
126
|
+
//
|
|
127
|
+
// }
|
|
128
|
+
// if(propValue instanceof String) {
|
|
129
|
+
// String valueStr = (String) propValue;
|
|
130
|
+
// if (valueStr.startsWith(DATE_TYPE_PREFIX)) {
|
|
131
|
+
// String[] split = valueStr.split(DATE_TYPE_PREFIX);
|
|
132
|
+
// if (split.length != 2) continue;
|
|
133
|
+
// String dateValue = split[1];
|
|
134
|
+
// Date date = getDate(dateValue);
|
|
135
|
+
// if(date != null) leapBuilder.addProperty(key, date);
|
|
136
|
+
// continue;
|
|
137
|
+
// }
|
|
138
|
+
// leapBuilder.addProperty(key, String.valueOf(propValue));
|
|
139
|
+
// } else if (propValue instanceof Number) {
|
|
140
|
+
// leapBuilder.addProperty(key, (long) propValue);
|
|
141
|
+
// }
|
|
142
|
+
//
|
|
143
|
+
// }
|
|
144
|
+
// leapBuilder.start();
|
|
145
|
+
// }
|
|
146
146
|
|
|
147
147
|
@PluginMethod
|
|
148
148
|
public void flushProperties(PluginCall call) {
|
package/dist/docs.json
CHANGED
|
@@ -21,24 +21,6 @@
|
|
|
21
21
|
"complexTypes": [],
|
|
22
22
|
"slug": "start"
|
|
23
23
|
},
|
|
24
|
-
{
|
|
25
|
-
"name": "startWithProperties",
|
|
26
|
-
"signature": "(options: { apiKey: string; properties: UserProperty; }) => Promise<void>",
|
|
27
|
-
"parameters": [
|
|
28
|
-
{
|
|
29
|
-
"name": "options",
|
|
30
|
-
"docs": "",
|
|
31
|
-
"type": "{ apiKey: string; properties: UserProperty; }"
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"returns": "Promise<void>",
|
|
35
|
-
"tags": [],
|
|
36
|
-
"docs": "",
|
|
37
|
-
"complexTypes": [
|
|
38
|
-
"UserProperty"
|
|
39
|
-
],
|
|
40
|
-
"slug": "startwithproperties"
|
|
41
|
-
},
|
|
42
24
|
{
|
|
43
25
|
"name": "startWithSelfHostedURL",
|
|
44
26
|
"signature": "(options: { baseURL: string; }) => Promise<void>",
|
|
@@ -55,24 +37,6 @@
|
|
|
55
37
|
"complexTypes": [],
|
|
56
38
|
"slug": "startwithselfhostedurl"
|
|
57
39
|
},
|
|
58
|
-
{
|
|
59
|
-
"name": "startWithSelfHostedURLAndProperties",
|
|
60
|
-
"signature": "(options: { baseURL: string; properties: UserProperty; }) => Promise<void>",
|
|
61
|
-
"parameters": [
|
|
62
|
-
{
|
|
63
|
-
"name": "options",
|
|
64
|
-
"docs": "",
|
|
65
|
-
"type": "{ baseURL: string; properties: UserProperty; }"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"returns": "Promise<void>",
|
|
69
|
-
"tags": [],
|
|
70
|
-
"docs": "",
|
|
71
|
-
"complexTypes": [
|
|
72
|
-
"UserProperty"
|
|
73
|
-
],
|
|
74
|
-
"slug": "startwithselfhostedurlandproperties"
|
|
75
|
-
},
|
|
76
40
|
{
|
|
77
41
|
"name": "flushProperties",
|
|
78
42
|
"signature": "(options: { properties: UserProperty; }) => Promise<void>",
|
|
@@ -12,17 +12,9 @@ export interface LeapPluginInterface {
|
|
|
12
12
|
start(options: {
|
|
13
13
|
apiKey: string;
|
|
14
14
|
}): Promise<void>;
|
|
15
|
-
startWithProperties(options: {
|
|
16
|
-
apiKey: string;
|
|
17
|
-
properties: UserProperty;
|
|
18
|
-
}): Promise<void>;
|
|
19
15
|
startWithSelfHostedURL(options: {
|
|
20
16
|
baseURL: string;
|
|
21
17
|
}): Promise<void>;
|
|
22
|
-
startWithSelfHostedURLAndProperties(options: {
|
|
23
|
-
baseURL: string;
|
|
24
|
-
properties: UserProperty;
|
|
25
|
-
}): Promise<void>;
|
|
26
18
|
flushProperties(options: {
|
|
27
19
|
properties: UserProperty;
|
|
28
20
|
}): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UserProperty {\n [key: string]: string | number\n}\n\nexport interface LeapCallbacks {\n [key: string]: string\n}\n\nexport interface LeapElementActionCallbacks {\n [key: string]: any\n}\n\nexport interface LeapPluginInterface {\n start(options: { apiKey: string }): Promise<void>;\n startWithProperties(options: { apiKey: string, properties: UserProperty }): Promise<void>;\n startWithSelfHostedURL(options:{baseURL: string}):Promise<void>;\n startWithSelfHostedURLAndProperties(options:{baseURL:string, properties: UserProperty}):Promise<void>;\n flushProperties(options: { properties: UserProperty }): Promise<void>;\n setUniqueUserId(options: { uniqueUserId: string }): Promise<void>;\n startProject(options: { projectId: string, resetProject?: boolean }): Promise<void>;\n embedProject(options: { projectId: string }): Promise<void>;\n offlineSync(options: { projectIds: Array<string> }): Promise<void>;\n disable(): Promise<void>;\n logout(): Promise<void>;\n setAppLocale(options: {localeCode: string}): Promise<void>;\n\n addListener(\n eventName: 'leapCallbacks',\n listenerFunc: (event: LeapCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n addListener(\n eventName: 'leapElementActionCallbacks',\n listenerFunc: (event: LeapElementActionCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["\nimport type { PluginListenerHandle } from '@capacitor/core';\n\nexport interface UserProperty {\n [key: string]: string | number\n}\n\nexport interface LeapCallbacks {\n [key: string]: string\n}\n\nexport interface LeapElementActionCallbacks {\n [key: string]: any\n}\n\nexport interface LeapPluginInterface {\n start(options: { apiKey: string }): Promise<void>;\n // startWithProperties(options: { apiKey: string, properties: UserProperty }): Promise<void>;\n startWithSelfHostedURL(options:{baseURL: string}):Promise<void>;\n // startWithSelfHostedURLAndProperties(options:{baseURL:string, properties: UserProperty}):Promise<void>;\n flushProperties(options: { properties: UserProperty }): Promise<void>;\n setUniqueUserId(options: { uniqueUserId: string }): Promise<void>;\n startProject(options: { projectId: string, resetProject?: boolean }): Promise<void>;\n embedProject(options: { projectId: string }): Promise<void>;\n offlineSync(options: { projectIds: Array<string> }): Promise<void>;\n disable(): Promise<void>;\n logout(): Promise<void>;\n setAppLocale(options: {localeCode: string}): Promise<void>;\n\n addListener(\n eventName: 'leapCallbacks',\n listenerFunc: (event: LeapCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n addListener(\n eventName: 'leapElementActionCallbacks',\n listenerFunc: (event: LeapElementActionCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n\n}\n"]}
|