capacitor-gleap-plugin 8.2.5 → 8.4.1

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.
@@ -13,6 +13,6 @@ Pod::Spec.new do |s|
13
13
  s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14
14
  s.ios.deployment_target = '12.0'
15
15
  s.dependency 'Capacitor'
16
- s.dependency 'Gleap', '8.2.4'
16
+ s.dependency 'Gleap', '8.4.1'
17
17
  s.swift_version = '5.1'
18
18
  end
package/README.md CHANGED
@@ -30,14 +30,20 @@ npx cap sync
30
30
  * [`removeCustomData(...)`](#removecustomdata)
31
31
  * [`clearCustomData()`](#clearcustomdata)
32
32
  * [`trackEvent(...)`](#trackevent)
33
+ * [`trackPage(...)`](#trackpage)
33
34
  * [`setEventCallback(...)`](#seteventcallback)
34
35
  * [`sendSilentCrashReport(...)`](#sendsilentcrashreport)
35
36
  * [`preFillForm(...)`](#prefillform)
36
37
  * [`addAttachment(...)`](#addattachment)
37
38
  * [`removeAllAttachments()`](#removeallattachments)
38
39
  * [`open()`](#open)
39
- * [`openNews()`](#opennews)
40
- * [`openFeatureRequests()`](#openfeaturerequests)
40
+ * [`openNews(...)`](#opennews)
41
+ * [`openNewsArticle(...)`](#opennewsarticle)
42
+ * [`openHelpCenter(...)`](#openhelpcenter)
43
+ * [`openHelpCenterArticle(...)`](#openhelpcenterarticle)
44
+ * [`openHelpCenterCollection(...)`](#openhelpcentercollection)
45
+ * [`searchHelpCenter(...)`](#searchhelpcenter)
46
+ * [`openFeatureRequests(...)`](#openfeaturerequests)
41
47
  * [`close()`](#close)
42
48
  * [`isOpened()`](#isopened)
43
49
  * [`startFeedbackFlow(...)`](#startfeedbackflow)
@@ -74,14 +80,14 @@ Initialize Gleap with an API key
74
80
  ### identify(...)
75
81
 
76
82
  ```typescript
77
- identify(options: { userId: string; userHash?: string; name?: string; email?: string; phone?: string; value?: number; }) => Promise<{ identify: boolean; }>
83
+ identify(options: { userId: string; userHash?: string; name?: string; email?: string; phone?: string; value?: number; customData?: Object; }) => Promise<{ identify: boolean; }>
78
84
  ```
79
85
 
80
86
  Set user identity
81
87
 
82
- | Param | Type |
83
- | ------------- | ------------------------------------------------------------------------------------------------------------------ |
84
- | **`options`** | <code>{ userId: string; userHash?: string; name?: string; email?: string; phone?: string; value?: number; }</code> |
88
+ | Param | Type |
89
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
90
+ | **`options`** | <code>{ userId: string; userHash?: string; name?: string; email?: string; phone?: string; value?: number; customData?: <a href="#object">Object</a>; }</code> |
85
91
 
86
92
  **Returns:** <code>Promise&lt;{ identify: boolean; }&gt;</code>
87
93
 
@@ -245,6 +251,25 @@ Log event to Gleap
245
251
  --------------------
246
252
 
247
253
 
254
+ ### trackPage(...)
255
+
256
+ ```typescript
257
+ trackPage(options: { pageName: string; }) => Promise<{ trackedPage: boolean; }>
258
+ ```
259
+
260
+ Track a page view
261
+
262
+ | Param | Type |
263
+ | ------------- | ---------------------------------- |
264
+ | **`options`** | <code>{ pageName: string; }</code> |
265
+
266
+ **Returns:** <code>Promise&lt;{ trackedPage: boolean; }&gt;</code>
267
+
268
+ **Since:** 8.4.1
269
+
270
+ --------------------
271
+
272
+
248
273
  ### setEventCallback(...)
249
274
 
250
275
  ```typescript
@@ -349,32 +374,135 @@ Open widget
349
374
  --------------------
350
375
 
351
376
 
352
- ### openNews()
377
+ ### openNews(...)
353
378
 
354
379
  ```typescript
355
- openNews() => Promise<{ openedNews: boolean; }>
380
+ openNews(options: { showBackButton?: boolean; }) => Promise<{ openedNews: boolean; }>
356
381
  ```
357
382
 
358
383
  Open news
359
384
 
385
+ | Param | Type |
386
+ | ------------- | ------------------------------------------ |
387
+ | **`options`** | <code>{ showBackButton?: boolean; }</code> |
388
+
360
389
  **Returns:** <code>Promise&lt;{ openedNews: boolean; }&gt;</code>
361
390
 
362
- **Since:** 8.0.4
391
+ **Since:** 8.4.0
392
+
393
+ --------------------
394
+
395
+
396
+ ### openNewsArticle(...)
397
+
398
+ ```typescript
399
+ openNewsArticle(options: { articleId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>
400
+ ```
401
+
402
+ Open news article
403
+
404
+ | Param | Type |
405
+ | ------------- | ------------------------------------------------------------- |
406
+ | **`options`** | <code>{ articleId: string; showBackButton?: boolean; }</code> |
407
+
408
+ **Returns:** <code>Promise&lt;{ opened: boolean; }&gt;</code>
409
+
410
+ **Since:** 8.4.0
411
+
412
+ --------------------
413
+
414
+
415
+ ### openHelpCenter(...)
416
+
417
+ ```typescript
418
+ openHelpCenter(options: { showBackButton?: boolean; }) => Promise<{ opened: boolean; }>
419
+ ```
420
+
421
+ Open help center
422
+
423
+ | Param | Type |
424
+ | ------------- | ------------------------------------------ |
425
+ | **`options`** | <code>{ showBackButton?: boolean; }</code> |
426
+
427
+ **Returns:** <code>Promise&lt;{ opened: boolean; }&gt;</code>
428
+
429
+ **Since:** 8.4.0
430
+
431
+ --------------------
432
+
433
+
434
+ ### openHelpCenterArticle(...)
435
+
436
+ ```typescript
437
+ openHelpCenterArticle(options: { articleId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>
438
+ ```
439
+
440
+ Open help center article
441
+
442
+ | Param | Type |
443
+ | ------------- | ------------------------------------------------------------- |
444
+ | **`options`** | <code>{ articleId: string; showBackButton?: boolean; }</code> |
445
+
446
+ **Returns:** <code>Promise&lt;{ opened: boolean; }&gt;</code>
447
+
448
+ **Since:** 8.4.0
449
+
450
+ --------------------
451
+
452
+
453
+ ### openHelpCenterCollection(...)
454
+
455
+ ```typescript
456
+ openHelpCenterCollection(options: { collectionId: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>
457
+ ```
458
+
459
+ Open help center collection
460
+
461
+ | Param | Type |
462
+ | ------------- | ---------------------------------------------------------------- |
463
+ | **`options`** | <code>{ collectionId: string; showBackButton?: boolean; }</code> |
464
+
465
+ **Returns:** <code>Promise&lt;{ opened: boolean; }&gt;</code>
466
+
467
+ **Since:** 8.4.0
468
+
469
+ --------------------
470
+
471
+
472
+ ### searchHelpCenter(...)
473
+
474
+ ```typescript
475
+ searchHelpCenter(options: { term: string; showBackButton?: boolean; }) => Promise<{ opened: boolean; }>
476
+ ```
477
+
478
+ Search help center
479
+
480
+ | Param | Type |
481
+ | ------------- | -------------------------------------------------------- |
482
+ | **`options`** | <code>{ term: string; showBackButton?: boolean; }</code> |
483
+
484
+ **Returns:** <code>Promise&lt;{ opened: boolean; }&gt;</code>
485
+
486
+ **Since:** 8.4.0
363
487
 
364
488
  --------------------
365
489
 
366
490
 
367
- ### openFeatureRequests()
491
+ ### openFeatureRequests(...)
368
492
 
369
493
  ```typescript
370
- openFeatureRequests() => Promise<{ openedFeatureRequests: boolean; }>
494
+ openFeatureRequests(options: { showBackButton?: boolean; }) => Promise<{ openedFeatureRequests: boolean; }>
371
495
  ```
372
496
 
373
497
  Open feature requests
374
498
 
499
+ | Param | Type |
500
+ | ------------- | ------------------------------------------ |
501
+ | **`options`** | <code>{ showBackButton?: boolean; }</code> |
502
+
375
503
  **Returns:** <code>Promise&lt;{ openedFeatureRequests: boolean; }&gt;</code>
376
504
 
377
- **Since:** 8.0.5
505
+ **Since:** 8.4.0
378
506
 
379
507
  --------------------
380
508
 
@@ -499,6 +627,43 @@ Enable debug console log
499
627
  ### Interfaces
500
628
 
501
629
 
630
+ #### Object
631
+
632
+ Provides functionality common to all JavaScript objects.
633
+
634
+ | Prop | Type | Description |
635
+ | ----------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
636
+ | **`constructor`** | <code><a href="#function">Function</a></code> | The initial value of <a href="#object">Object</a>.prototype.constructor is the standard built-in <a href="#object">Object</a> constructor. |
637
+
638
+ | Method | Signature | Description |
639
+ | ------------------------ | ----------------------------------------------- | ------------------------------------------------------------------------ |
640
+ | **toString** | () =&gt; string | Returns a string representation of an object. |
641
+ | **toLocaleString** | () =&gt; string | Returns a date converted to a string using the current locale. |
642
+ | **valueOf** | () =&gt; <a href="#object">Object</a> | Returns the primitive value of the specified object. |
643
+ | **hasOwnProperty** | (v: PropertyKey) =&gt; boolean | Determines whether an object has a property with the specified name. |
644
+ | **isPrototypeOf** | (v: <a href="#object">Object</a>) =&gt; boolean | Determines whether an object exists in another object's prototype chain. |
645
+ | **propertyIsEnumerable** | (v: PropertyKey) =&gt; boolean | Determines whether a specified property is enumerable. |
646
+
647
+
648
+ #### Function
649
+
650
+ Creates a new function.
651
+
652
+ | Prop | Type |
653
+ | --------------- | --------------------------------------------- |
654
+ | **`prototype`** | <code>any</code> |
655
+ | **`length`** | <code>number</code> |
656
+ | **`arguments`** | <code>any</code> |
657
+ | **`caller`** | <code><a href="#function">Function</a></code> |
658
+
659
+ | Method | Signature | Description |
660
+ | ------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
661
+ | **apply** | (this: <a href="#function">Function</a>, thisArg: any, argArray?: any) =&gt; any | Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. |
662
+ | **call** | (this: <a href="#function">Function</a>, thisArg: any, ...argArray: any[]) =&gt; any | Calls a method of an object, substituting another object for the current object. |
663
+ | **bind** | (this: <a href="#function">Function</a>, thisArg: any, ...argArray: any[]) =&gt; any | For a given function, creates a bound function that has the same body as the original function. The this object of the bound function is associated with the specified object, and has the specified initial parameters. |
664
+ | **toString** | () =&gt; string | Returns a string representation of a function. |
665
+
666
+
502
667
  #### Boolean
503
668
 
504
669
  | Method | Signature | Description |
@@ -53,7 +53,7 @@ dependencies {
53
53
  testImplementation "junit:junit:$junitVersion"
54
54
  androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
55
55
  androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
56
- implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '8.2.3'
56
+ implementation group: 'io.gleap', name: 'gleap-android-sdk', version: '8.4.3'
57
57
  if (rootProject && rootProject.ext) {
58
58
  if (rootProject.ext.targetSdkVersion == 30 || rootProject.ext.compileSdkVersion == 30) {
59
59
  implementation( "androidx.appcompat:appcompat:1.3.0") {
@@ -92,6 +92,9 @@ public class GleapPlugin extends Plugin {
92
92
  if (call.getData().has("userHash")) {
93
93
  userProperties.setHash(call.getString("userHash"));
94
94
  }
95
+ if (call.getData().has("customData")) {
96
+ userProperties.setCustomData(call.getObject("customData"));
97
+ }
95
98
 
96
99
  String userId = call.getString("userId");
97
100
  implementation.identifyUser(userId, userProperties);
@@ -287,6 +290,29 @@ public class GleapPlugin extends Plugin {
287
290
  call.resolve(ret);
288
291
  }
289
292
 
293
+ @PluginMethod()
294
+ public void trackPage(PluginCall call) {
295
+ // If page name is empty, then pass back error
296
+ if (!call.getData().has("pageName")) {
297
+ call.reject("No page name provided");
298
+ return;
299
+ }
300
+
301
+ try {
302
+ String pageName = call.getString("pageName");
303
+ JSONObject eventData = new JSONObject();
304
+ eventData.put("page", pageName);
305
+ implementation.trackEvent("pageView", eventData);
306
+ } catch (Exception ignore) {
307
+
308
+ }
309
+
310
+ // Build Json object and resolve success
311
+ JSObject ret = new JSObject();
312
+ ret.put("trackedPage", true);
313
+ call.resolve(ret);
314
+ }
315
+
290
316
  @PluginMethod()
291
317
  public void addAttachment(PluginCall call) {
292
318
  if (!call.getData().has("base64data")) {
@@ -438,8 +464,9 @@ public class GleapPlugin extends Plugin {
438
464
 
439
465
  @PluginMethod()
440
466
  public void openNews(PluginCall call) throws GleapNotInitialisedException {
441
- // Open news
442
- implementation.openNews();
467
+ boolean showBackButton = call.getBoolean("showBackButton");
468
+
469
+ implementation.openNews(showBackButton);
443
470
 
444
471
  // Build Json object and resolve success
445
472
  JSObject ret = new JSObject();
@@ -448,9 +475,78 @@ public class GleapPlugin extends Plugin {
448
475
  }
449
476
 
450
477
  @PluginMethod()
451
- public void openFeatureRequests(PluginCall call) throws GleapNotInitialisedException {
478
+ public void openNewsArticle(PluginCall call) throws GleapNotInitialisedException {
479
+ String articleId = call.getString("articleId");
480
+ boolean showBackButton = call.getBoolean("showBackButton");
481
+
482
+ implementation.openNewsArticle(articleId, showBackButton);
483
+
484
+ // Build Json object and resolve success
485
+ JSObject ret = new JSObject();
486
+ ret.put("opened", true);
487
+ call.resolve(ret);
488
+ }
489
+
490
+ @PluginMethod()
491
+ public void openHelpCenter(PluginCall call) throws GleapNotInitialisedException {
492
+ boolean showBackButton = call.getBoolean("showBackButton");
493
+
494
+ implementation.openHelpCenter(showBackButton);
495
+
496
+ // Build Json object and resolve success
497
+ JSObject ret = new JSObject();
498
+ ret.put("opened", true);
499
+ call.resolve(ret);
500
+ }
501
+
502
+ @PluginMethod()
503
+ public void openHelpCenterArticle(PluginCall call) throws GleapNotInitialisedException {
504
+ // Open news
505
+ String articleId = call.getString("articleId");
506
+ boolean showBackButton = call.getBoolean("showBackButton");
507
+
508
+ implementation.openHelpCenterArticle(articleId, showBackButton);
509
+
510
+ // Build Json object and resolve success
511
+ JSObject ret = new JSObject();
512
+ ret.put("opened", true);
513
+ call.resolve(ret);
514
+ }
515
+
516
+ @PluginMethod()
517
+ public void openHelpCenterCollection(PluginCall call) throws GleapNotInitialisedException {
518
+ // Open news
519
+ String collectionId = call.getString("collectionId");
520
+ boolean showBackButton = call.getBoolean("showBackButton");
521
+
522
+ implementation.openHelpCenterCollection(collectionId, showBackButton);
523
+
524
+ // Build Json object and resolve success
525
+ JSObject ret = new JSObject();
526
+ ret.put("opened", true);
527
+ call.resolve(ret);
528
+ }
529
+
530
+ @PluginMethod()
531
+ public void searchHelpCenter(PluginCall call) throws GleapNotInitialisedException {
452
532
  // Open news
453
- implementation.openFeatureRequests();
533
+ String term = call.getString("term");
534
+ boolean showBackButton = call.getBoolean("showBackButton");
535
+
536
+ implementation.searchHelpCenter(term, showBackButton);
537
+
538
+ // Build Json object and resolve success
539
+ JSObject ret = new JSObject();
540
+ ret.put("opened", true);
541
+ call.resolve(ret);
542
+ }
543
+
544
+ @PluginMethod()
545
+ public void openFeatureRequests(PluginCall call) throws GleapNotInitialisedException {
546
+ boolean showBackButton = call.getBoolean("showBackButton");
547
+
548
+ // Open feature requests
549
+ implementation.openFeatureRequests(showBackButton);
454
550
 
455
551
  // Build Json object and resolve success
456
552
  JSObject ret = new JSObject();