leap-capacitor 2.0.19 → 2.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.
@@ -15,5 +15,5 @@ Pod::Spec.new do |s|
15
15
  s.dependency 'Capacitor'
16
16
  s.swift_version = '5.1'
17
17
 
18
- s.dependency "LeapSDK", "2.0.21"
18
+ s.dependency "LeapSDK", "2.2.0"
19
19
  end
package/README.md CHANGED
@@ -23,8 +23,10 @@ npx cap sync
23
23
  * [`disable()`](#disable)
24
24
  * [`logout()`](#logout)
25
25
  * [`setAppLocale(...)`](#setapplocale)
26
+ * [`registerExceptionCallback(...)`](#registerexceptioncallback)
26
27
  * [`addListener('leapCallbacks', ...)`](#addlistenerleapcallbacks)
27
28
  * [`addListener('leapElementActionCallbacks', ...)`](#addlistenerleapelementactioncallbacks)
29
+ * [`addListener('leapExceptionCallbacks', ...)`](#addlistenerleapexceptioncallbacks)
28
30
  * [Interfaces](#interfaces)
29
31
 
30
32
  </docgen-index>
@@ -113,7 +115,7 @@ embedProject(options: { projectId: string; }) => Promise<void>
113
115
  ### offlineSync(...)
114
116
 
115
117
  ```typescript
116
- offlineSync(options: { projectIds: Array<string>; }) => Promise<void>
118
+ offlineSync(options: { projectIds: string[]; }) => Promise<void>
117
119
  ```
118
120
 
119
121
  | Param | Type |
@@ -154,6 +156,19 @@ setAppLocale(options: { localeCode: string; }) => Promise<void>
154
156
  --------------------
155
157
 
156
158
 
159
+ ### registerExceptionCallback(...)
160
+
161
+ ```typescript
162
+ registerExceptionCallback(options: { callbackLevels: string[]; }) => Promise<void>
163
+ ```
164
+
165
+ | Param | Type |
166
+ | ------------- | ------------------------------------------ |
167
+ | **`options`** | <code>{ callbackLevels: string[]; }</code> |
168
+
169
+ --------------------
170
+
171
+
157
172
  ### addListener('leapCallbacks', ...)
158
173
 
159
174
  ```typescript
@@ -186,61 +201,26 @@ addListener(eventName: 'leapElementActionCallbacks', listenerFunc: (event: LeapE
186
201
  --------------------
187
202
 
188
203
 
189
- ### Interfaces
204
+ ### addListener('leapExceptionCallbacks', ...)
205
+
206
+ ```typescript
207
+ addListener(eventName: 'leapExceptionCallbacks', listenerFunc: (event: LeapExceptionCallbacks) => void) => Promise<PluginListenerHandle> & PluginListenerHandle
208
+ ```
190
209
 
210
+ | Param | Type |
211
+ | ------------------ | --------------------------------------------------------------------------------------------- |
212
+ | **`eventName`** | <code>'leapExceptionCallbacks'</code> |
213
+ | **`listenerFunc`** | <code>(event: <a href="#leapexceptioncallbacks">LeapExceptionCallbacks</a>) =&gt; void</code> |
191
214
 
192
- #### UserProperty
215
+ **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
216
+
217
+ --------------------
193
218
 
194
219
 
195
- #### Array
196
-
197
- | Prop | Type | Description |
198
- | ------------ | ------------------- | ------------------------------------------------------------------------------------------------------ |
199
- | **`length`** | <code>number</code> | Gets or sets the length of the array. This is a number one higher than the highest index in the array. |
200
-
201
- | Method | Signature | Description |
202
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
203
- | **toString** | () =&gt; string | Returns a string representation of an array. |
204
- | **toLocaleString** | () =&gt; string | Returns a string representation of an array. The elements are converted to string using their toLocalString methods. |
205
- | **pop** | () =&gt; T \| undefined | Removes the last element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. |
206
- | **push** | (...items: T[]) =&gt; number | Appends new elements to the end of an array, and returns the new length of the array. |
207
- | **concat** | (...items: <a href="#concatarray">ConcatArray</a>&lt;T&gt;[]) =&gt; T[] | Combines two or more arrays. This method returns a new array without modifying any existing arrays. |
208
- | **concat** | (...items: (T \| <a href="#concatarray">ConcatArray</a>&lt;T&gt;)[]) =&gt; T[] | Combines two or more arrays. This method returns a new array without modifying any existing arrays. |
209
- | **join** | (separator?: string \| undefined) =&gt; string | Adds all the elements of an array into a string, separated by the specified separator string. |
210
- | **reverse** | () =&gt; T[] | Reverses the elements in an array in place. This method mutates the array and returns a reference to the same array. |
211
- | **shift** | () =&gt; T \| undefined | Removes the first element from an array and returns it. If the array is empty, undefined is returned and the array is not modified. |
212
- | **slice** | (start?: number \| undefined, end?: number \| undefined) =&gt; T[] | Returns a copy of a section of an array. For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array. |
213
- | **sort** | (compareFn?: ((a: T, b: T) =&gt; number) \| undefined) =&gt; this | Sorts an array in place. This method mutates the array and returns a reference to the same array. |
214
- | **splice** | (start: number, deleteCount?: number \| undefined) =&gt; T[] | Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. |
215
- | **splice** | (start: number, deleteCount: number, ...items: T[]) =&gt; T[] | Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. |
216
- | **unshift** | (...items: T[]) =&gt; number | Inserts new elements at the start of an array, and returns the new length of the array. |
217
- | **indexOf** | (searchElement: T, fromIndex?: number \| undefined) =&gt; number | Returns the index of the first occurrence of a value in an array, or -1 if it is not present. |
218
- | **lastIndexOf** | (searchElement: T, fromIndex?: number \| undefined) =&gt; number | Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. |
219
- | **every** | &lt;S extends T&gt;(predicate: (value: T, index: number, array: T[]) =&gt; value is S, thisArg?: any) =&gt; this is S[] | Determines whether all the members of an array satisfy the specified test. |
220
- | **every** | (predicate: (value: T, index: number, array: T[]) =&gt; unknown, thisArg?: any) =&gt; boolean | Determines whether all the members of an array satisfy the specified test. |
221
- | **some** | (predicate: (value: T, index: number, array: T[]) =&gt; unknown, thisArg?: any) =&gt; boolean | Determines whether the specified callback function returns true for any element of an array. |
222
- | **forEach** | (callbackfn: (value: T, index: number, array: T[]) =&gt; void, thisArg?: any) =&gt; void | Performs the specified action for each element in an array. |
223
- | **map** | &lt;U&gt;(callbackfn: (value: T, index: number, array: T[]) =&gt; U, thisArg?: any) =&gt; U[] | Calls a defined callback function on each element of an array, and returns an array that contains the results. |
224
- | **filter** | &lt;S extends T&gt;(predicate: (value: T, index: number, array: T[]) =&gt; value is S, thisArg?: any) =&gt; S[] | Returns the elements of an array that meet the condition specified in a callback function. |
225
- | **filter** | (predicate: (value: T, index: number, array: T[]) =&gt; unknown, thisArg?: any) =&gt; T[] | Returns the elements of an array that meet the condition specified in a callback function. |
226
- | **reduce** | (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) =&gt; T) =&gt; T | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
227
- | **reduce** | (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) =&gt; T, initialValue: T) =&gt; T | |
228
- | **reduce** | &lt;U&gt;(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) =&gt; U, initialValue: U) =&gt; U | Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
229
- | **reduceRight** | (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) =&gt; T) =&gt; T | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
230
- | **reduceRight** | (callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) =&gt; T, initialValue: T) =&gt; T | |
231
- | **reduceRight** | &lt;U&gt;(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) =&gt; U, initialValue: U) =&gt; U | Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. |
232
-
233
-
234
- #### ConcatArray
235
-
236
- | Prop | Type |
237
- | ------------ | ------------------- |
238
- | **`length`** | <code>number</code> |
239
-
240
- | Method | Signature |
241
- | --------- | ------------------------------------------------------------------ |
242
- | **join** | (separator?: string \| undefined) =&gt; string |
243
- | **slice** | (start?: number \| undefined, end?: number \| undefined) =&gt; T[] |
220
+ ### Interfaces
221
+
222
+
223
+ #### UserProperty
244
224
 
245
225
 
246
226
  #### PluginListenerHandle
@@ -255,4 +235,7 @@ addListener(eventName: 'leapElementActionCallbacks', listenerFunc: (event: LeapE
255
235
 
256
236
  #### LeapElementActionCallbacks
257
237
 
238
+
239
+ #### LeapExceptionCallbacks
240
+
258
241
  </docgen-api>
@@ -51,7 +51,7 @@ repositories {
51
51
  dependencies {
52
52
  implementation fileTree(dir: 'libs', include: ['*.jar'])
53
53
  implementation project(':capacitor-android')
54
- implementation 'is.leap.android:sdk:2.0.19'
54
+ implementation 'is.leap.android:sdk:2.2.1'
55
55
  implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
56
56
  testImplementation "junit:junit:$junitVersion"
57
57
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
@@ -10,6 +10,7 @@ import com.getcapacitor.PluginMethod;
10
10
  import com.getcapacitor.annotation.CapacitorPlugin;
11
11
  import com.getcapacitor.annotation.Permission;
12
12
 
13
+ import org.json.JSONArray;
13
14
  import org.json.JSONException;
14
15
  import org.json.JSONObject;
15
16
 
@@ -24,6 +25,7 @@ import java.util.Map;
24
25
  import java.util.TimeZone;
25
26
 
26
27
  import is.leap.android.LeapEventCallbacks;
28
+ import is.leap.android.LeapExceptionCallbackLevel;
27
29
  import is.leap.android.aui.Leap;
28
30
  import is.leap.android.core.LeapElementActionCallbacks;
29
31
 
@@ -50,7 +52,9 @@ public class LeapPlugin extends Plugin {
50
52
  public static final String UNIQUE_USER_ID = "uniqueUserId";
51
53
  public static final String PROJECT_ID = "projectId";
52
54
  public static final String RESET_PROJECT = "resetProject";
55
+ public static final String CALLBACK_LEVELS = "callbackLevels";
53
56
  public static final String LEAP_CALLBACKS = "leapCallbacks";
57
+ public static final String LEAP_EXCEPTION_CALLBACKS = "leapExceptionCallbacks";
54
58
  public static final String LEAP_ELEMENT_ACTION_CALLBACKS = "leapElementActionCallbacks";
55
59
  public static final String PLUGIN_NAME = "LeapPlugin";
56
60
  public static final String INTERNET_PERMISSION_ALIAS = "Internet";
@@ -182,6 +186,34 @@ public class LeapPlugin extends Plugin {
182
186
  call.resolve();
183
187
  }
184
188
 
189
+ @PluginMethod
190
+ public void registerExceptionCallback(PluginCall call) {
191
+ JSONArray levelsArray = call.getArray(CALLBACK_LEVELS);
192
+ if (levelsArray == null) {
193
+ call.reject("Levels are required");
194
+ return;
195
+ }
196
+
197
+ // Convert JSON array to enum list
198
+ LeapExceptionCallbackLevel[] enumLevels = toExceptionCallbackLevelArray(levelsArray);
199
+
200
+ // Register callback with Leap SDK
201
+ Leap.registerExceptionCallback(enumLevels, exception -> {
202
+ if (exception == null) return;
203
+
204
+ JSObject jsObject = null;
205
+ try {
206
+ JSONObject exceptionJson = new JSONObject(exception);
207
+ jsObject = new JSObject(exceptionJson.toString());
208
+ } catch (JSONException ignored) {
209
+
210
+ }
211
+ if(jsObject == null) return;
212
+ notifyListeners(LEAP_EXCEPTION_CALLBACKS, jsObject);
213
+ });
214
+ call.resolve();
215
+ }
216
+
185
217
  public static Date getDate(String dateValue) {
186
218
  SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_SDF, Locale.ENGLISH);
187
219
  sdf.setTimeZone(TimeZone.getTimeZone(TIMEZONE_GMT));
@@ -222,4 +254,16 @@ public class LeapPlugin extends Plugin {
222
254
  Leap.addLeapElementActionCallbacks(eventActionListener);
223
255
  }
224
256
 
257
+ private LeapExceptionCallbackLevel[] toExceptionCallbackLevelArray(JSONArray array) {
258
+ LeapExceptionCallbackLevel[] result = new LeapExceptionCallbackLevel[array.length()];
259
+ for (int i = 0; i < array.length(); i++) {
260
+ try {
261
+ String name = array.getString(i);
262
+ result[i] = LeapExceptionCallbackLevel.valueOf(name);
263
+ } catch (Exception ignore) {
264
+ }
265
+ }
266
+ return result;
267
+ }
268
+
225
269
  }
package/dist/docs.json CHANGED
@@ -105,7 +105,7 @@
105
105
  },
106
106
  {
107
107
  "name": "offlineSync",
108
- "signature": "(options: { projectIds: Array<string>; }) => Promise<void>",
108
+ "signature": "(options: { projectIds: string[]; }) => Promise<void>",
109
109
  "parameters": [
110
110
  {
111
111
  "name": "options",
@@ -116,9 +116,7 @@
116
116
  "returns": "Promise<void>",
117
117
  "tags": [],
118
118
  "docs": "",
119
- "complexTypes": [
120
- "Array"
121
- ],
119
+ "complexTypes": [],
122
120
  "slug": "offlinesync"
123
121
  },
124
122
  {
@@ -157,6 +155,22 @@
157
155
  "complexTypes": [],
158
156
  "slug": "setapplocale"
159
157
  },
158
+ {
159
+ "name": "registerExceptionCallback",
160
+ "signature": "(options: { callbackLevels: string[]; }) => Promise<void>",
161
+ "parameters": [
162
+ {
163
+ "name": "options",
164
+ "docs": "",
165
+ "type": "{ callbackLevels: string[]; }"
166
+ }
167
+ ],
168
+ "returns": "Promise<void>",
169
+ "tags": [],
170
+ "docs": "",
171
+ "complexTypes": [],
172
+ "slug": "registerexceptioncallback"
173
+ },
160
174
  {
161
175
  "name": "addListener",
162
176
  "signature": "(eventName: 'leapCallbacks', listenerFunc: (event: LeapCallbacks) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
@@ -204,6 +218,30 @@
204
218
  "LeapElementActionCallbacks"
205
219
  ],
206
220
  "slug": "addlistenerleapelementactioncallbacks"
221
+ },
222
+ {
223
+ "name": "addListener",
224
+ "signature": "(eventName: 'leapExceptionCallbacks', listenerFunc: (event: LeapExceptionCallbacks) => void) => Promise<PluginListenerHandle> & PluginListenerHandle",
225
+ "parameters": [
226
+ {
227
+ "name": "eventName",
228
+ "docs": "",
229
+ "type": "'leapExceptionCallbacks'"
230
+ },
231
+ {
232
+ "name": "listenerFunc",
233
+ "docs": "",
234
+ "type": "(event: LeapExceptionCallbacks) => void"
235
+ }
236
+ ],
237
+ "returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
238
+ "tags": [],
239
+ "docs": "",
240
+ "complexTypes": [
241
+ "PluginListenerHandle",
242
+ "LeapExceptionCallbacks"
243
+ ],
244
+ "slug": "addlistenerleapexceptioncallbacks"
207
245
  }
208
246
  ],
209
247
  "properties": []
@@ -217,843 +255,6 @@
217
255
  "methods": [],
218
256
  "properties": []
219
257
  },
220
- {
221
- "name": "Array",
222
- "slug": "array",
223
- "docs": "",
224
- "tags": [],
225
- "methods": [
226
- {
227
- "name": "toString",
228
- "signature": "() => string",
229
- "parameters": [],
230
- "returns": "string",
231
- "tags": [],
232
- "docs": "Returns a string representation of an array.",
233
- "complexTypes": [],
234
- "slug": "tostring"
235
- },
236
- {
237
- "name": "toLocaleString",
238
- "signature": "() => string",
239
- "parameters": [],
240
- "returns": "string",
241
- "tags": [],
242
- "docs": "Returns a string representation of an array. The elements are converted to string using their toLocalString methods.",
243
- "complexTypes": [],
244
- "slug": "tolocalestring"
245
- },
246
- {
247
- "name": "pop",
248
- "signature": "() => T | undefined",
249
- "parameters": [],
250
- "returns": "T | undefined",
251
- "tags": [],
252
- "docs": "Removes the last element from an array and returns it.\r\nIf the array is empty, undefined is returned and the array is not modified.",
253
- "complexTypes": [
254
- "T"
255
- ],
256
- "slug": "pop"
257
- },
258
- {
259
- "name": "push",
260
- "signature": "(...items: T[]) => number",
261
- "parameters": [
262
- {
263
- "name": "items",
264
- "docs": "New elements to add to the array.",
265
- "type": "T[]"
266
- }
267
- ],
268
- "returns": "number",
269
- "tags": [
270
- {
271
- "name": "param",
272
- "text": "items New elements to add to the array."
273
- }
274
- ],
275
- "docs": "Appends new elements to the end of an array, and returns the new length of the array.",
276
- "complexTypes": [
277
- "T"
278
- ],
279
- "slug": "push"
280
- },
281
- {
282
- "name": "concat",
283
- "signature": "(...items: ConcatArray<T>[]) => T[]",
284
- "parameters": [
285
- {
286
- "name": "items",
287
- "docs": "Additional arrays and/or items to add to the end of the array.",
288
- "type": "ConcatArray<T>[]"
289
- }
290
- ],
291
- "returns": "T[]",
292
- "tags": [
293
- {
294
- "name": "param",
295
- "text": "items Additional arrays and/or items to add to the end of the array."
296
- }
297
- ],
298
- "docs": "Combines two or more arrays.\r\nThis method returns a new array without modifying any existing arrays.",
299
- "complexTypes": [
300
- "T",
301
- "ConcatArray"
302
- ],
303
- "slug": "concat"
304
- },
305
- {
306
- "name": "concat",
307
- "signature": "(...items: (T | ConcatArray<T>)[]) => T[]",
308
- "parameters": [
309
- {
310
- "name": "items",
311
- "docs": "Additional arrays and/or items to add to the end of the array.",
312
- "type": "(T | ConcatArray<T>)[]"
313
- }
314
- ],
315
- "returns": "T[]",
316
- "tags": [
317
- {
318
- "name": "param",
319
- "text": "items Additional arrays and/or items to add to the end of the array."
320
- }
321
- ],
322
- "docs": "Combines two or more arrays.\r\nThis method returns a new array without modifying any existing arrays.",
323
- "complexTypes": [
324
- "T",
325
- "ConcatArray"
326
- ],
327
- "slug": "concat"
328
- },
329
- {
330
- "name": "join",
331
- "signature": "(separator?: string | undefined) => string",
332
- "parameters": [
333
- {
334
- "name": "separator",
335
- "docs": "A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.",
336
- "type": "string | undefined"
337
- }
338
- ],
339
- "returns": "string",
340
- "tags": [
341
- {
342
- "name": "param",
343
- "text": "separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma."
344
- }
345
- ],
346
- "docs": "Adds all the elements of an array into a string, separated by the specified separator string.",
347
- "complexTypes": [],
348
- "slug": "join"
349
- },
350
- {
351
- "name": "reverse",
352
- "signature": "() => T[]",
353
- "parameters": [],
354
- "returns": "T[]",
355
- "tags": [],
356
- "docs": "Reverses the elements in an array in place.\r\nThis method mutates the array and returns a reference to the same array.",
357
- "complexTypes": [
358
- "T"
359
- ],
360
- "slug": "reverse"
361
- },
362
- {
363
- "name": "shift",
364
- "signature": "() => T | undefined",
365
- "parameters": [],
366
- "returns": "T | undefined",
367
- "tags": [],
368
- "docs": "Removes the first element from an array and returns it.\r\nIf the array is empty, undefined is returned and the array is not modified.",
369
- "complexTypes": [
370
- "T"
371
- ],
372
- "slug": "shift"
373
- },
374
- {
375
- "name": "slice",
376
- "signature": "(start?: number | undefined, end?: number | undefined) => T[]",
377
- "parameters": [
378
- {
379
- "name": "start",
380
- "docs": "The beginning index of the specified portion of the array.\r\nIf start is undefined, then the slice begins at index 0.",
381
- "type": "number | undefined"
382
- },
383
- {
384
- "name": "end",
385
- "docs": "The end index of the specified portion of the array. This is exclusive of the element at the index 'end'.\r\nIf end is undefined, then the slice extends to the end of the array.",
386
- "type": "number | undefined"
387
- }
388
- ],
389
- "returns": "T[]",
390
- "tags": [
391
- {
392
- "name": "param",
393
- "text": "start The beginning index of the specified portion of the array.\r\nIf start is undefined, then the slice begins at index 0."
394
- },
395
- {
396
- "name": "param",
397
- "text": "end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'.\r\nIf end is undefined, then the slice extends to the end of the array."
398
- }
399
- ],
400
- "docs": "Returns a copy of a section of an array.\r\nFor both start and end, a negative index can be used to indicate an offset from the end of the array.\r\nFor example, -2 refers to the second to last element of the array.",
401
- "complexTypes": [
402
- "T"
403
- ],
404
- "slug": "slice"
405
- },
406
- {
407
- "name": "sort",
408
- "signature": "(compareFn?: ((a: T, b: T) => number) | undefined) => this",
409
- "parameters": [
410
- {
411
- "name": "compareFn",
412
- "docs": "Function used to determine the order of the elements. It is expected to return\r\na negative value if first argument is less than second argument, zero if they're equal and a positive\r\nvalue otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r\n```ts\r\n[11,2,22,1].sort((a, b) => a - b)\r\n```",
413
- "type": "((a: T, b: T) => number) | undefined"
414
- }
415
- ],
416
- "returns": "this",
417
- "tags": [
418
- {
419
- "name": "param",
420
- "text": "compareFn Function used to determine the order of the elements. It is expected to return\r\na negative value if first argument is less than second argument, zero if they're equal and a positive\r\nvalue otherwise. If omitted, the elements are sorted in ascending, ASCII character order.\r\n```ts\r\n[11,2,22,1].sort((a, b) => a - b)\r\n```"
421
- }
422
- ],
423
- "docs": "Sorts an array in place.\r\nThis method mutates the array and returns a reference to the same array.",
424
- "complexTypes": [
425
- "T"
426
- ],
427
- "slug": "sort"
428
- },
429
- {
430
- "name": "splice",
431
- "signature": "(start: number, deleteCount?: number | undefined) => T[]",
432
- "parameters": [
433
- {
434
- "name": "start",
435
- "docs": "The zero-based location in the array from which to start removing elements.",
436
- "type": "number"
437
- },
438
- {
439
- "name": "deleteCount",
440
- "docs": "The number of elements to remove.",
441
- "type": "number | undefined"
442
- }
443
- ],
444
- "returns": "T[]",
445
- "tags": [
446
- {
447
- "name": "param",
448
- "text": "start The zero-based location in the array from which to start removing elements."
449
- },
450
- {
451
- "name": "param",
452
- "text": "deleteCount The number of elements to remove."
453
- },
454
- {
455
- "name": "returns",
456
- "text": "An array containing the elements that were deleted."
457
- }
458
- ],
459
- "docs": "Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.",
460
- "complexTypes": [
461
- "T"
462
- ],
463
- "slug": "splice"
464
- },
465
- {
466
- "name": "splice",
467
- "signature": "(start: number, deleteCount: number, ...items: T[]) => T[]",
468
- "parameters": [
469
- {
470
- "name": "start",
471
- "docs": "The zero-based location in the array from which to start removing elements.",
472
- "type": "number"
473
- },
474
- {
475
- "name": "deleteCount",
476
- "docs": "The number of elements to remove.",
477
- "type": "number"
478
- },
479
- {
480
- "name": "items",
481
- "docs": "Elements to insert into the array in place of the deleted elements.",
482
- "type": "T[]"
483
- }
484
- ],
485
- "returns": "T[]",
486
- "tags": [
487
- {
488
- "name": "param",
489
- "text": "start The zero-based location in the array from which to start removing elements."
490
- },
491
- {
492
- "name": "param",
493
- "text": "deleteCount The number of elements to remove."
494
- },
495
- {
496
- "name": "param",
497
- "text": "items Elements to insert into the array in place of the deleted elements."
498
- },
499
- {
500
- "name": "returns",
501
- "text": "An array containing the elements that were deleted."
502
- }
503
- ],
504
- "docs": "Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.",
505
- "complexTypes": [
506
- "T"
507
- ],
508
- "slug": "splice"
509
- },
510
- {
511
- "name": "unshift",
512
- "signature": "(...items: T[]) => number",
513
- "parameters": [
514
- {
515
- "name": "items",
516
- "docs": "Elements to insert at the start of the array.",
517
- "type": "T[]"
518
- }
519
- ],
520
- "returns": "number",
521
- "tags": [
522
- {
523
- "name": "param",
524
- "text": "items Elements to insert at the start of the array."
525
- }
526
- ],
527
- "docs": "Inserts new elements at the start of an array, and returns the new length of the array.",
528
- "complexTypes": [
529
- "T"
530
- ],
531
- "slug": "unshift"
532
- },
533
- {
534
- "name": "indexOf",
535
- "signature": "(searchElement: T, fromIndex?: number | undefined) => number",
536
- "parameters": [
537
- {
538
- "name": "searchElement",
539
- "docs": "The value to locate in the array.",
540
- "type": "T"
541
- },
542
- {
543
- "name": "fromIndex",
544
- "docs": "The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.",
545
- "type": "number | undefined"
546
- }
547
- ],
548
- "returns": "number",
549
- "tags": [
550
- {
551
- "name": "param",
552
- "text": "searchElement The value to locate in the array."
553
- },
554
- {
555
- "name": "param",
556
- "text": "fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0."
557
- }
558
- ],
559
- "docs": "Returns the index of the first occurrence of a value in an array, or -1 if it is not present.",
560
- "complexTypes": [
561
- "T"
562
- ],
563
- "slug": "indexof"
564
- },
565
- {
566
- "name": "lastIndexOf",
567
- "signature": "(searchElement: T, fromIndex?: number | undefined) => number",
568
- "parameters": [
569
- {
570
- "name": "searchElement",
571
- "docs": "The value to locate in the array.",
572
- "type": "T"
573
- },
574
- {
575
- "name": "fromIndex",
576
- "docs": "The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.",
577
- "type": "number | undefined"
578
- }
579
- ],
580
- "returns": "number",
581
- "tags": [
582
- {
583
- "name": "param",
584
- "text": "searchElement The value to locate in the array."
585
- },
586
- {
587
- "name": "param",
588
- "text": "fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array."
589
- }
590
- ],
591
- "docs": "Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.",
592
- "complexTypes": [
593
- "T"
594
- ],
595
- "slug": "lastindexof"
596
- },
597
- {
598
- "name": "every",
599
- "signature": "<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any) => this is S[]",
600
- "parameters": [
601
- {
602
- "name": "predicate",
603
- "docs": "A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array.",
604
- "type": "(value: T, index: number, array: T[]) => value is S"
605
- },
606
- {
607
- "name": "thisArg",
608
- "docs": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.",
609
- "type": "any"
610
- }
611
- ],
612
- "returns": "boolean",
613
- "tags": [
614
- {
615
- "name": "param",
616
- "text": "predicate A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array."
617
- },
618
- {
619
- "name": "param",
620
- "text": "thisArg An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value."
621
- }
622
- ],
623
- "docs": "Determines whether all the members of an array satisfy the specified test.",
624
- "complexTypes": [
625
- "T",
626
- "S"
627
- ],
628
- "slug": "every"
629
- },
630
- {
631
- "name": "every",
632
- "signature": "(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any) => boolean",
633
- "parameters": [
634
- {
635
- "name": "predicate",
636
- "docs": "A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array.",
637
- "type": "(value: T, index: number, array: T[]) => unknown"
638
- },
639
- {
640
- "name": "thisArg",
641
- "docs": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.",
642
- "type": "any"
643
- }
644
- ],
645
- "returns": "boolean",
646
- "tags": [
647
- {
648
- "name": "param",
649
- "text": "predicate A function that accepts up to three arguments. The every method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value false, or until the end of the array."
650
- },
651
- {
652
- "name": "param",
653
- "text": "thisArg An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value."
654
- }
655
- ],
656
- "docs": "Determines whether all the members of an array satisfy the specified test.",
657
- "complexTypes": [
658
- "T"
659
- ],
660
- "slug": "every"
661
- },
662
- {
663
- "name": "some",
664
- "signature": "(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any) => boolean",
665
- "parameters": [
666
- {
667
- "name": "predicate",
668
- "docs": "A function that accepts up to three arguments. The some method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value true, or until the end of the array.",
669
- "type": "(value: T, index: number, array: T[]) => unknown"
670
- },
671
- {
672
- "name": "thisArg",
673
- "docs": "An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value.",
674
- "type": "any"
675
- }
676
- ],
677
- "returns": "boolean",
678
- "tags": [
679
- {
680
- "name": "param",
681
- "text": "predicate A function that accepts up to three arguments. The some method calls\r\nthe predicate function for each element in the array until the predicate returns a value\r\nwhich is coercible to the Boolean value true, or until the end of the array."
682
- },
683
- {
684
- "name": "param",
685
- "text": "thisArg An object to which the this keyword can refer in the predicate function.\r\nIf thisArg is omitted, undefined is used as the this value."
686
- }
687
- ],
688
- "docs": "Determines whether the specified callback function returns true for any element of an array.",
689
- "complexTypes": [
690
- "T"
691
- ],
692
- "slug": "some"
693
- },
694
- {
695
- "name": "forEach",
696
- "signature": "(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any) => void",
697
- "parameters": [
698
- {
699
- "name": "callbackfn",
700
- "docs": "A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.",
701
- "type": "(value: T, index: number, array: T[]) => void"
702
- },
703
- {
704
- "name": "thisArg",
705
- "docs": "An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.",
706
- "type": "any"
707
- }
708
- ],
709
- "returns": "void",
710
- "tags": [
711
- {
712
- "name": "param",
713
- "text": "callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array."
714
- },
715
- {
716
- "name": "param",
717
- "text": "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value."
718
- }
719
- ],
720
- "docs": "Performs the specified action for each element in an array.",
721
- "complexTypes": [
722
- "T"
723
- ],
724
- "slug": "foreach"
725
- },
726
- {
727
- "name": "map",
728
- "signature": "<U>(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any) => U[]",
729
- "parameters": [
730
- {
731
- "name": "callbackfn",
732
- "docs": "A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.",
733
- "type": "(value: T, index: number, array: T[]) => U"
734
- },
735
- {
736
- "name": "thisArg",
737
- "docs": "An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.",
738
- "type": "any"
739
- }
740
- ],
741
- "returns": "U[]",
742
- "tags": [
743
- {
744
- "name": "param",
745
- "text": "callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array."
746
- },
747
- {
748
- "name": "param",
749
- "text": "thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value."
750
- }
751
- ],
752
- "docs": "Calls a defined callback function on each element of an array, and returns an array that contains the results.",
753
- "complexTypes": [
754
- "U",
755
- "T"
756
- ],
757
- "slug": "map"
758
- },
759
- {
760
- "name": "filter",
761
- "signature": "<S extends T>(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any) => S[]",
762
- "parameters": [
763
- {
764
- "name": "predicate",
765
- "docs": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.",
766
- "type": "(value: T, index: number, array: T[]) => value is S"
767
- },
768
- {
769
- "name": "thisArg",
770
- "docs": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.",
771
- "type": "any"
772
- }
773
- ],
774
- "returns": "S[]",
775
- "tags": [
776
- {
777
- "name": "param",
778
- "text": "predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array."
779
- },
780
- {
781
- "name": "param",
782
- "text": "thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value."
783
- }
784
- ],
785
- "docs": "Returns the elements of an array that meet the condition specified in a callback function.",
786
- "complexTypes": [
787
- "S",
788
- "T"
789
- ],
790
- "slug": "filter"
791
- },
792
- {
793
- "name": "filter",
794
- "signature": "(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any) => T[]",
795
- "parameters": [
796
- {
797
- "name": "predicate",
798
- "docs": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.",
799
- "type": "(value: T, index: number, array: T[]) => unknown"
800
- },
801
- {
802
- "name": "thisArg",
803
- "docs": "An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.",
804
- "type": "any"
805
- }
806
- ],
807
- "returns": "T[]",
808
- "tags": [
809
- {
810
- "name": "param",
811
- "text": "predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array."
812
- },
813
- {
814
- "name": "param",
815
- "text": "thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value."
816
- }
817
- ],
818
- "docs": "Returns the elements of an array that meet the condition specified in a callback function.",
819
- "complexTypes": [
820
- "T"
821
- ],
822
- "slug": "filter"
823
- },
824
- {
825
- "name": "reduce",
826
- "signature": "(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T) => T",
827
- "parameters": [
828
- {
829
- "name": "callbackfn",
830
- "docs": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.",
831
- "type": "(previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T"
832
- }
833
- ],
834
- "returns": "T",
835
- "tags": [
836
- {
837
- "name": "param",
838
- "text": "callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array."
839
- },
840
- {
841
- "name": "param",
842
- "text": "initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value."
843
- }
844
- ],
845
- "docs": "Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
846
- "complexTypes": [
847
- "T"
848
- ],
849
- "slug": "reduce"
850
- },
851
- {
852
- "name": "reduce",
853
- "signature": "(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T) => T",
854
- "parameters": [
855
- {
856
- "name": "callbackfn",
857
- "docs": "",
858
- "type": "(previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T"
859
- },
860
- {
861
- "name": "initialValue",
862
- "docs": "",
863
- "type": "T"
864
- }
865
- ],
866
- "returns": "T",
867
- "tags": [],
868
- "docs": "",
869
- "complexTypes": [
870
- "T"
871
- ],
872
- "slug": "reduce"
873
- },
874
- {
875
- "name": "reduce",
876
- "signature": "<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U) => U",
877
- "parameters": [
878
- {
879
- "name": "callbackfn",
880
- "docs": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.",
881
- "type": "(previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U"
882
- },
883
- {
884
- "name": "initialValue",
885
- "docs": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.",
886
- "type": "U"
887
- }
888
- ],
889
- "returns": "U",
890
- "tags": [
891
- {
892
- "name": "param",
893
- "text": "callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array."
894
- },
895
- {
896
- "name": "param",
897
- "text": "initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value."
898
- }
899
- ],
900
- "docs": "Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
901
- "complexTypes": [
902
- "U",
903
- "T"
904
- ],
905
- "slug": "reduce"
906
- },
907
- {
908
- "name": "reduceRight",
909
- "signature": "(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T) => T",
910
- "parameters": [
911
- {
912
- "name": "callbackfn",
913
- "docs": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.",
914
- "type": "(previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T"
915
- }
916
- ],
917
- "returns": "T",
918
- "tags": [
919
- {
920
- "name": "param",
921
- "text": "callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array."
922
- },
923
- {
924
- "name": "param",
925
- "text": "initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value."
926
- }
927
- ],
928
- "docs": "Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
929
- "complexTypes": [
930
- "T"
931
- ],
932
- "slug": "reduceright"
933
- },
934
- {
935
- "name": "reduceRight",
936
- "signature": "(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T) => T",
937
- "parameters": [
938
- {
939
- "name": "callbackfn",
940
- "docs": "",
941
- "type": "(previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T"
942
- },
943
- {
944
- "name": "initialValue",
945
- "docs": "",
946
- "type": "T"
947
- }
948
- ],
949
- "returns": "T",
950
- "tags": [],
951
- "docs": "",
952
- "complexTypes": [
953
- "T"
954
- ],
955
- "slug": "reduceright"
956
- },
957
- {
958
- "name": "reduceRight",
959
- "signature": "<U>(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U) => U",
960
- "parameters": [
961
- {
962
- "name": "callbackfn",
963
- "docs": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.",
964
- "type": "(previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U"
965
- },
966
- {
967
- "name": "initialValue",
968
- "docs": "If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.",
969
- "type": "U"
970
- }
971
- ],
972
- "returns": "U",
973
- "tags": [
974
- {
975
- "name": "param",
976
- "text": "callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array."
977
- },
978
- {
979
- "name": "param",
980
- "text": "initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value."
981
- }
982
- ],
983
- "docs": "Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.",
984
- "complexTypes": [
985
- "U",
986
- "T"
987
- ],
988
- "slug": "reduceright"
989
- }
990
- ],
991
- "properties": [
992
- {
993
- "name": "length",
994
- "tags": [],
995
- "docs": "Gets or sets the length of the array. This is a number one higher than the highest index in the array.",
996
- "complexTypes": [],
997
- "type": "number"
998
- }
999
- ]
1000
- },
1001
- {
1002
- "name": "ConcatArray",
1003
- "slug": "concatarray",
1004
- "docs": "",
1005
- "tags": [],
1006
- "methods": [
1007
- {
1008
- "name": "join",
1009
- "signature": "(separator?: string | undefined) => string",
1010
- "parameters": [
1011
- {
1012
- "name": "separator",
1013
- "docs": "",
1014
- "type": "string | undefined"
1015
- }
1016
- ],
1017
- "returns": "string",
1018
- "tags": [],
1019
- "docs": "",
1020
- "complexTypes": [],
1021
- "slug": "join"
1022
- },
1023
- {
1024
- "name": "slice",
1025
- "signature": "(start?: number | undefined, end?: number | undefined) => T[]",
1026
- "parameters": [
1027
- {
1028
- "name": "start",
1029
- "docs": "",
1030
- "type": "number | undefined"
1031
- },
1032
- {
1033
- "name": "end",
1034
- "docs": "",
1035
- "type": "number | undefined"
1036
- }
1037
- ],
1038
- "returns": "T[]",
1039
- "tags": [],
1040
- "docs": "",
1041
- "complexTypes": [
1042
- "T"
1043
- ],
1044
- "slug": "slice"
1045
- }
1046
- ],
1047
- "properties": [
1048
- {
1049
- "name": "length",
1050
- "tags": [],
1051
- "docs": "",
1052
- "complexTypes": [],
1053
- "type": "number"
1054
- }
1055
- ]
1056
- },
1057
258
  {
1058
259
  "name": "PluginListenerHandle",
1059
260
  "slug": "pluginlistenerhandle",
@@ -1085,6 +286,14 @@
1085
286
  "tags": [],
1086
287
  "methods": [],
1087
288
  "properties": []
289
+ },
290
+ {
291
+ "name": "LeapExceptionCallbacks",
292
+ "slug": "leapexceptioncallbacks",
293
+ "docs": "",
294
+ "tags": [],
295
+ "methods": [],
296
+ "properties": []
1088
297
  }
1089
298
  ],
1090
299
  "enums": [],
@@ -8,6 +8,9 @@ export interface LeapCallbacks {
8
8
  export interface LeapElementActionCallbacks {
9
9
  [key: string]: any;
10
10
  }
11
+ export interface LeapExceptionCallbacks {
12
+ [key: string]: any;
13
+ }
11
14
  export interface LeapPluginInterface {
12
15
  start(options: {
13
16
  apiKey: string;
@@ -30,13 +33,17 @@ export interface LeapPluginInterface {
30
33
  projectId: string;
31
34
  }): Promise<void>;
32
35
  offlineSync(options: {
33
- projectIds: Array<string>;
36
+ projectIds: string[];
34
37
  }): Promise<void>;
35
38
  disable(): Promise<void>;
36
39
  logout(): Promise<void>;
37
40
  setAppLocale(options: {
38
41
  localeCode: string;
39
42
  }): Promise<void>;
43
+ registerExceptionCallback(options: {
44
+ callbackLevels: string[];
45
+ }): Promise<void>;
40
46
  addListener(eventName: 'leapCallbacks', listenerFunc: (event: LeapCallbacks) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
41
47
  addListener(eventName: 'leapElementActionCallbacks', listenerFunc: (event: LeapElementActionCallbacks) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
48
+ addListener(eventName: 'leapExceptionCallbacks', listenerFunc: (event: LeapExceptionCallbacks) => void): Promise<PluginListenerHandle> & PluginListenerHandle;
42
49
  }
@@ -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 startWithSelfHostingEnabled(options:{apiKey: string,baseUrl: string}):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 LeapExceptionCallbacks {\n [key: string]: any\n}\n\nexport interface LeapPluginInterface {\n start(options: { apiKey: string }): Promise<void>;\n startWithSelfHostingEnabled(options:{apiKey: string,baseUrl: string}):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: string[] }): Promise<void>;\n disable(): Promise<void>;\n logout(): Promise<void>;\n setAppLocale(options: {localeCode: string}): Promise<void>;\n registerExceptionCallback(options:{ callbackLevels: 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 addListener(\n eventName: 'leapExceptionCallbacks',\n listenerFunc: (event: LeapExceptionCallbacks) => void,\n ): Promise<PluginListenerHandle> & PluginListenerHandle\n\n // addListener(\n // eventName: 'leapExceptionCallbacks',\n // listenerFunc: (event: LeapExceptionCallbacks) => void,\n // ): Promise<PluginListenerHandle> & PluginListenerHandle\n}\n"]}
@@ -14,4 +14,5 @@ CAP_PLUGIN(LeapPlugin, "LeapPlugin",
14
14
  CAP_PLUGIN_METHOD(offlineSync, CAPPluginReturnPromise);
15
15
  CAP_PLUGIN_METHOD(disable, CAPPluginReturnPromise);
16
16
  CAP_PLUGIN_METHOD(logout, CAPPluginReturnPromise);
17
+ CAP_PLUGIN_METHOD(registerExceptionCallback, CAPPluginReturnPromise);
17
18
  )
@@ -13,7 +13,9 @@ let RESET_PROJECT = "resetProject"
13
13
  let PROJECT_IDS = "projectIds"
14
14
  let DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
15
15
  let DATE_LOCALE = "en_US_POSIX"
16
+ let CALLBACKLEVELS = "callbackLevels"
16
17
  let LEAP_CALLBACKS = "leapCallbacks"
18
+ let LEAP_EXCEPTION_CALLBACKS = "leapExceptionCallbacks"
17
19
 
18
20
  /**
19
21
  * Please read the Capacitor iOS Plugin Development Guide
@@ -23,6 +25,8 @@ let LEAP_CALLBACKS = "leapCallbacks"
23
25
 
24
26
  public class LeapPlugin: CAPPlugin {
25
27
 
28
+ var exceptionCall:CAPPluginCall?
29
+
26
30
  @objc public func start(_ call: CAPPluginCall) {
27
31
  let apiKey = call.getString(API_KEY) ?? ""
28
32
  DispatchQueue.main.async {
@@ -106,6 +110,28 @@ public class LeapPlugin: CAPPlugin {
106
110
  }
107
111
  call.resolve()
108
112
  }
113
+
114
+ @objc public func registerExceptionCallback(_ call: CAPPluginCall) {
115
+ let callbackLevelStrings:[String] = call.getArray(CALLBACKLEVELS) as? [String] ?? []
116
+ let callbackLevels:[LeapExceptionCallBackTypes] = callbackLevelStrings.compactMap { callbackLevelString in
117
+ switch callbackLevelString{
118
+ case "MEMORY":
119
+ return .MEMORY
120
+ case "AUI":
121
+ return .AUI
122
+ case "JS":
123
+ return .JS
124
+ case "CRASH":
125
+ return .CRASH
126
+ case "PUBLIC_METHOD":
127
+ return .PUBLIC_METHOD
128
+ default:
129
+ return nil
130
+ }
131
+ }
132
+ Leap.shared.registerExceptionCallback(self, callbackLevels: callbackLevels.count == 0 ? nil : callbackLevels)
133
+ call.resolve()
134
+ }
109
135
 
110
136
  func addProperties(properties:[String:AnyHashable]) {
111
137
  properties.forEach { key, value in
@@ -142,3 +168,11 @@ extension LeapPlugin: LeapCallback {
142
168
  }
143
169
  }
144
170
  }
171
+
172
+ extension LeapPlugin: LeapExceptionCallBack {
173
+ public func exceptionCallbackEvent(eventInfo: [String: Any], exceptionType: LeapSDK.LeapExceptionCallBackTypes) {
174
+ DispatchQueue.main.async { [weak self] in
175
+ self?.notifyListeners(LEAP_EXCEPTION_CALLBACKS, data: eventInfo)
176
+ }
177
+ }
178
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leap-capacitor",
3
- "version": "2.0.19",
3
+ "version": "2.2.0",
4
4
  "description": "Plugin for Leap",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",