@adadapted/react-native-sdk 3.1.12 → 3.3.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.
- package/android/.project +1 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
- package/android/bin/build.gradle +6 -5
- package/android/bin/gradle.properties +4 -4
- package/android/build.gradle +6 -5
- package/android/gradle.properties +3 -3
- package/android/src/main/AndroidManifest.xml +1 -3
- package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.mock.js +25 -8
- package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiTypes.js +72 -26
- package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
- package/lib/commonjs/components/AdZone.js +200 -129
- package/lib/commonjs/components/AdZone.js.map +1 -1
- package/lib/commonjs/components/ReportAdButton.js +38 -0
- package/lib/commonjs/components/ReportAdButton.js.map +1 -0
- package/lib/commonjs/images/ReportIcon.png +0 -0
- package/lib/commonjs/index.js +162 -78
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +4 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/util.js +13 -0
- package/lib/commonjs/util.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.mock.js +25 -9
- package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/module/api/adadaptedApiTypes.js +70 -24
- package/lib/module/api/adadaptedApiTypes.js.map +1 -1
- package/lib/module/components/AdZone.js +192 -128
- package/lib/module/components/AdZone.js.map +1 -1
- package/lib/module/components/ReportAdButton.js +30 -0
- package/lib/module/components/ReportAdButton.js.map +1 -0
- package/lib/module/images/ReportIcon.png +0 -0
- package/lib/module/index.js +162 -77
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/util.js +14 -2
- package/lib/module/util.js.map +1 -1
- package/lib/typescript/example/index.d.ts +1 -0
- package/lib/typescript/example/index.d.ts.map +1 -0
- package/lib/typescript/example/src/App.d.ts +15 -62
- package/lib/typescript/example/src/App.d.ts.map +1 -0
- package/lib/typescript/example/src/OffScreenAdZone.d.ts +38 -0
- package/lib/typescript/example/src/OffScreenAdZone.d.ts.map +1 -0
- package/lib/typescript/example/src/StandardAdZone.d.ts +38 -0
- package/lib/typescript/example/src/StandardAdZone.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/jest.setup.d.ts +2 -1
- package/lib/typescript/jest.setup.d.ts.map +1 -0
- package/lib/typescript/src/api/adadaptedApiRequests.d.ts +1 -0
- package/lib/typescript/src/api/adadaptedApiRequests.d.ts.map +1 -0
- package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts +1 -0
- package/lib/typescript/src/api/adadaptedApiRequests.mock.d.ts.map +1 -0
- package/lib/typescript/src/api/adadaptedApiTypes.d.ts +9 -0
- package/lib/typescript/src/api/adadaptedApiTypes.d.ts.map +1 -0
- package/lib/typescript/src/components/AdZone.d.ts +9 -80
- package/lib/typescript/src/components/AdZone.d.ts.map +1 -0
- package/lib/typescript/src/components/ReportAdButton.d.ts +19 -0
- package/lib/typescript/src/components/ReportAdButton.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +39 -1
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +3 -2
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/util.d.ts +13 -0
- package/lib/typescript/src/util.d.ts.map +1 -0
- package/package.json +155 -155
- package/src/api/adadaptedApiRequests.mock.ts +25 -9
- package/src/api/adadaptedApiTypes.ts +8 -0
- package/src/components/AdZone.tsx +222 -173
- package/src/components/ReportAdButton.tsx +46 -0
- package/src/images/ReportIcon.png +0 -0
- package/src/index.tsx +160 -56
- package/src/util.ts +13 -0
package/src/index.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
DeviceEventEmitter,
|
|
7
7
|
EmitterSubscription,
|
|
8
8
|
Linking,
|
|
9
9
|
NativeModules,
|
|
@@ -99,7 +99,7 @@ export enum PayloadApiEnv {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* Interface defining inputs to the {@link Sdk.initialize} method.
|
|
102
|
+
* Interface defining inputs to the {@link Sdk.initialize: AdadaptedReactNativeSdk} method.
|
|
103
103
|
*/
|
|
104
104
|
export interface InitializeProps {
|
|
105
105
|
/**
|
|
@@ -140,6 +140,10 @@ export interface InitializeProps {
|
|
|
140
140
|
* @param payloads - All payloads the client must go through.
|
|
141
141
|
*/
|
|
142
142
|
onOutOfAppPayloadAvailable?(payloads: OutOfAppDataPayload[]): void;
|
|
143
|
+
/**
|
|
144
|
+
* Ad zones that contain off-screen ads.
|
|
145
|
+
*/
|
|
146
|
+
offScreenAdZone?: [number];
|
|
143
147
|
}
|
|
144
148
|
|
|
145
149
|
/**
|
|
@@ -267,6 +271,10 @@ export class AdadaptedReactNativeSdk {
|
|
|
267
271
|
* The available ad zones.
|
|
268
272
|
*/
|
|
269
273
|
private adZones: AdZoneInfo[] | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* The available off-screen ad zones.
|
|
276
|
+
*/
|
|
277
|
+
private offScreenAdZones: AdZoneInfo[] = [];
|
|
270
278
|
/**
|
|
271
279
|
* The touch sensitivity of the Ad Zone in both the X and Y directions.
|
|
272
280
|
* This is used to determine the click/press sensitivity when the
|
|
@@ -324,6 +332,14 @@ export class AdadaptedReactNativeSdk {
|
|
|
324
332
|
* AppState event listener.
|
|
325
333
|
*/
|
|
326
334
|
private AppStateOnEventListener: EmitterSubscription | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* Track ad zone visibility for off-screen ads.
|
|
337
|
+
*/
|
|
338
|
+
private isAdZoneVisible: boolean = true;
|
|
339
|
+
/**
|
|
340
|
+
* Ad zones that contain off-screen ads..
|
|
341
|
+
*/
|
|
342
|
+
private offScreenAdZone: [number] | undefined;
|
|
327
343
|
/**
|
|
328
344
|
* Gets the Session ID.
|
|
329
345
|
* @returns the Session ID.
|
|
@@ -348,6 +364,14 @@ export class AdadaptedReactNativeSdk {
|
|
|
348
364
|
return this.adZones;
|
|
349
365
|
}
|
|
350
366
|
|
|
367
|
+
/**
|
|
368
|
+
* Gets the list of available off-screen Ad Zones.
|
|
369
|
+
* @returns all available off-screen ad zones.
|
|
370
|
+
*/
|
|
371
|
+
public getOffScreenAdZones(): AdZoneInfo[] | undefined {
|
|
372
|
+
return this.offScreenAdZones;
|
|
373
|
+
}
|
|
374
|
+
|
|
351
375
|
/**
|
|
352
376
|
* @inheritDoc
|
|
353
377
|
*/
|
|
@@ -396,29 +420,83 @@ export class AdadaptedReactNativeSdk {
|
|
|
396
420
|
|
|
397
421
|
for (const adZoneId in adZones) {
|
|
398
422
|
if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
423
|
+
this.offScreenAdZone?.forEach((zone) => {
|
|
424
|
+
if (Number(adZones[adZoneId].id) !== zone) {
|
|
425
|
+
adZoneInfoList.push({
|
|
426
|
+
zoneId: adZones[adZoneId].id,
|
|
427
|
+
adZone: (
|
|
428
|
+
<AdZone
|
|
429
|
+
key={adZoneId}
|
|
430
|
+
appId={this.appId}
|
|
431
|
+
sessionId={this.sessionId!}
|
|
432
|
+
udid={this.deviceInfo!.udid}
|
|
433
|
+
deviceOs={this.deviceOs!}
|
|
434
|
+
apiEnv={this.apiEnv}
|
|
435
|
+
xyDragDistanceAllowed={
|
|
436
|
+
this.xyAdZoneDragDistanceAllowed || 25
|
|
437
|
+
}
|
|
438
|
+
adZoneData={adZones[adZoneId]}
|
|
439
|
+
onAddToListTriggered={(items) => {
|
|
440
|
+
safeInvoke(
|
|
441
|
+
this.onAddToListTriggered,
|
|
442
|
+
items
|
|
443
|
+
);
|
|
444
|
+
}}
|
|
445
|
+
isAdZoneVisible={true}
|
|
446
|
+
offScreenAdZone={false}
|
|
447
|
+
/>
|
|
448
|
+
),
|
|
449
|
+
});
|
|
450
|
+
}
|
|
418
451
|
});
|
|
419
452
|
}
|
|
420
453
|
}
|
|
454
|
+
return adZoneInfoList;
|
|
455
|
+
}
|
|
421
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Creates all off-screen Ad Zone Info objects based on provided off-screen Ad Zones.
|
|
459
|
+
* @param adZones - The object of available zones.
|
|
460
|
+
* @returns the array of off-screen Ad Zone Info objects.
|
|
461
|
+
*/
|
|
462
|
+
private generateOffScreenAdZones(adZones: {
|
|
463
|
+
[key: number]: Zone;
|
|
464
|
+
}): AdZoneInfo[] {
|
|
465
|
+
const adZoneInfoList: AdZoneInfo[] = [];
|
|
466
|
+
|
|
467
|
+
for (const adZoneId in adZones) {
|
|
468
|
+
if (Object.prototype.hasOwnProperty.call(adZones, adZoneId)) {
|
|
469
|
+
this.offScreenAdZone?.forEach((zone) => {
|
|
470
|
+
if (Number(adZones[adZoneId].id) === zone) {
|
|
471
|
+
adZoneInfoList.push({
|
|
472
|
+
zoneId: adZones[adZoneId].id,
|
|
473
|
+
adZone: (
|
|
474
|
+
<AdZone
|
|
475
|
+
key={adZoneId}
|
|
476
|
+
appId={this.appId}
|
|
477
|
+
sessionId={this.sessionId!}
|
|
478
|
+
udid={this.deviceInfo!.udid}
|
|
479
|
+
deviceOs={this.deviceOs!}
|
|
480
|
+
apiEnv={this.apiEnv}
|
|
481
|
+
xyDragDistanceAllowed={
|
|
482
|
+
this.xyAdZoneDragDistanceAllowed || 25
|
|
483
|
+
}
|
|
484
|
+
adZoneData={adZones[adZoneId]}
|
|
485
|
+
onAddToListTriggered={(items) => {
|
|
486
|
+
safeInvoke(
|
|
487
|
+
this.onAddToListTriggered,
|
|
488
|
+
items
|
|
489
|
+
);
|
|
490
|
+
}}
|
|
491
|
+
isAdZoneVisible={this.isAdZoneVisible}
|
|
492
|
+
offScreenAdZone={true}
|
|
493
|
+
/>
|
|
494
|
+
),
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
422
500
|
return adZoneInfoList;
|
|
423
501
|
}
|
|
424
502
|
|
|
@@ -449,6 +527,9 @@ export class AdadaptedReactNativeSdk {
|
|
|
449
527
|
.then((response) => {
|
|
450
528
|
this.sessionInfo = response.data;
|
|
451
529
|
this.adZones = this.generateAdZones(response.data.zones);
|
|
530
|
+
this.offScreenAdZones = this.generateOffScreenAdZones(
|
|
531
|
+
response.data.zones
|
|
532
|
+
);
|
|
452
533
|
|
|
453
534
|
// Call the user defined callback indicating
|
|
454
535
|
// the session data has been refreshed.
|
|
@@ -484,8 +565,6 @@ export class AdadaptedReactNativeSdk {
|
|
|
484
565
|
)
|
|
485
566
|
.then((response) => {
|
|
486
567
|
this.keywordIntercepts = response.data;
|
|
487
|
-
|
|
488
|
-
this.performKeywordSearch("mil");
|
|
489
568
|
});
|
|
490
569
|
}
|
|
491
570
|
|
|
@@ -561,13 +640,15 @@ export class AdadaptedReactNativeSdk {
|
|
|
561
640
|
*/
|
|
562
641
|
private handleDeepLink(event: any): void {
|
|
563
642
|
const searchStr = "data=";
|
|
564
|
-
const dataIndex: number = event
|
|
643
|
+
const dataIndex: number = event.url.indexOf(searchStr);
|
|
565
644
|
|
|
566
645
|
if (dataIndex !== -1) {
|
|
567
|
-
const encodedData = event.url.substr(
|
|
646
|
+
const encodedData: string = event.url.substr(
|
|
647
|
+
`${dataIndex}${searchStr.length}`
|
|
648
|
+
);
|
|
568
649
|
const payloadData = JSON.parse(base64.decode(encodedData));
|
|
569
|
-
const payloadId = payloadData
|
|
570
|
-
const itemDataList = payloadData
|
|
650
|
+
const payloadId = payloadData.payload_id;
|
|
651
|
+
const itemDataList = payloadData.detailed_list_items;
|
|
571
652
|
|
|
572
653
|
if (itemDataList && itemDataList.length > 0) {
|
|
573
654
|
const finalItemList: OutOfAppDataPayload[] = [];
|
|
@@ -577,13 +658,13 @@ export class AdadaptedReactNativeSdk {
|
|
|
577
658
|
payload_id: payloadId,
|
|
578
659
|
detailed_list_items: [
|
|
579
660
|
{
|
|
580
|
-
product_title: itemData
|
|
581
|
-
product_brand: itemData
|
|
582
|
-
product_category: itemData
|
|
583
|
-
product_barcode: itemData
|
|
584
|
-
product_discount: itemData
|
|
585
|
-
product_image: itemData
|
|
586
|
-
product_sku: itemData
|
|
661
|
+
product_title: itemData.product_title,
|
|
662
|
+
product_brand: itemData.product_brand,
|
|
663
|
+
product_category: itemData.product_category,
|
|
664
|
+
product_barcode: itemData.product_barcode,
|
|
665
|
+
product_discount: itemData.product_discount,
|
|
666
|
+
product_image: itemData.product_image,
|
|
667
|
+
product_sku: itemData.product_sku,
|
|
587
668
|
},
|
|
588
669
|
],
|
|
589
670
|
});
|
|
@@ -627,16 +708,13 @@ export class AdadaptedReactNativeSdk {
|
|
|
627
708
|
payload_id: payload.payload_id,
|
|
628
709
|
detailed_list_items: [
|
|
629
710
|
{
|
|
630
|
-
product_title: itemData
|
|
631
|
-
product_brand: itemData
|
|
632
|
-
product_category:
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
itemData["product_discount"],
|
|
638
|
-
product_image: itemData["product_image"],
|
|
639
|
-
product_sku: itemData["product_sku"],
|
|
711
|
+
product_title: itemData.product_title,
|
|
712
|
+
product_brand: itemData.product_brand,
|
|
713
|
+
product_category: itemData.product_category,
|
|
714
|
+
product_barcode: itemData.product_barcode,
|
|
715
|
+
product_discount: itemData.product_discount,
|
|
716
|
+
product_image: itemData.product_image,
|
|
717
|
+
product_sku: itemData.product_sku,
|
|
640
718
|
},
|
|
641
719
|
],
|
|
642
720
|
});
|
|
@@ -651,6 +729,23 @@ export class AdadaptedReactNativeSdk {
|
|
|
651
729
|
});
|
|
652
730
|
}
|
|
653
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Notify the ad zone of visibility status change for off-screen ads.
|
|
734
|
+
* @param isVisible - Ad Zone visibility tracking.
|
|
735
|
+
*/
|
|
736
|
+
public onAdZoneVisibilityChanged(isVisible: boolean): void {
|
|
737
|
+
this.isAdZoneVisible = isVisible;
|
|
738
|
+
DeviceEventEmitter.emit("visibility-event", isVisible);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Notify the adZone to send ad interaction report.
|
|
743
|
+
* @param itemName - Detailed list item title from ad that was clicked.
|
|
744
|
+
*/
|
|
745
|
+
public acknowledge(itemName: string): void {
|
|
746
|
+
DeviceEventEmitter.emit("acknowledge", itemName);
|
|
747
|
+
}
|
|
748
|
+
|
|
654
749
|
/**
|
|
655
750
|
* Initializes the session for the AdAdapted API and sets up the SDK.
|
|
656
751
|
* @param props - The props used to initialize the SDK.
|
|
@@ -703,6 +798,11 @@ export class AdadaptedReactNativeSdk {
|
|
|
703
798
|
this.onOutOfAppPayloadAvailable = props.onOutOfAppPayloadAvailable;
|
|
704
799
|
}
|
|
705
800
|
|
|
801
|
+
// If provided set any off-screen ad zones.
|
|
802
|
+
if (props.offScreenAdZone) {
|
|
803
|
+
this.offScreenAdZone = props.offScreenAdZone;
|
|
804
|
+
}
|
|
805
|
+
|
|
706
806
|
return new Promise<void>((resolve, reject) => {
|
|
707
807
|
this.getDeviceInformation()
|
|
708
808
|
.then((deviceInfoObj) => {
|
|
@@ -758,6 +858,10 @@ export class AdadaptedReactNativeSdk {
|
|
|
758
858
|
this.adZones = this.generateAdZones(
|
|
759
859
|
response.data.zones
|
|
760
860
|
);
|
|
861
|
+
this.offScreenAdZones =
|
|
862
|
+
this.generateOffScreenAdZones(
|
|
863
|
+
response.data.zones
|
|
864
|
+
);
|
|
761
865
|
|
|
762
866
|
// Start the session data refresh timer.
|
|
763
867
|
this.onRefreshAdZones();
|
|
@@ -783,18 +887,18 @@ export class AdadaptedReactNativeSdk {
|
|
|
783
887
|
this.getPayloadItemData();
|
|
784
888
|
|
|
785
889
|
// Initialize an event listener to intercept deep links while the app is running.
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
// Initialize an event listener to intercept App state changes.
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
);
|
|
890
|
+
this.deepLinkOnEventListener =
|
|
891
|
+
Linking.addEventListener(
|
|
892
|
+
"url",
|
|
893
|
+
this.handleDeepLink
|
|
894
|
+
);
|
|
895
|
+
|
|
896
|
+
// // Initialize an event listener to intercept App state changes.
|
|
897
|
+
// this.AppStateOnEventListener =
|
|
898
|
+
// AppState.addEventListener(
|
|
899
|
+
// "change",
|
|
900
|
+
// this.handleAppStateChange
|
|
901
|
+
// );
|
|
798
902
|
|
|
799
903
|
resolve();
|
|
800
904
|
})
|
package/src/util.ts
CHANGED
|
@@ -14,6 +14,8 @@ export function safeInvoke<R>(func: (() => R) | nil): R | undefined;
|
|
|
14
14
|
* See main definition above.
|
|
15
15
|
* @param func - The function to call.
|
|
16
16
|
* @param arg1 - Function argument.
|
|
17
|
+
* @returns The return value of the executed function, or undefined if
|
|
18
|
+
* the function is null/undefined
|
|
17
19
|
*/
|
|
18
20
|
export function safeInvoke<A1, R>(
|
|
19
21
|
func: ((arg1: A1) => R) | nil,
|
|
@@ -24,6 +26,8 @@ export function safeInvoke<A1, R>(
|
|
|
24
26
|
* @param func - The function to call.
|
|
25
27
|
* @param arg1 - Function argument.
|
|
26
28
|
* @param arg2 - Function argument.
|
|
29
|
+
* @returns The return value of the executed function, or undefined if
|
|
30
|
+
* the function is null/undefined
|
|
27
31
|
*/
|
|
28
32
|
export function safeInvoke<A1, A2, R>(
|
|
29
33
|
func: ((arg1: A1, arg2: A2) => R) | nil,
|
|
@@ -36,6 +40,8 @@ export function safeInvoke<A1, A2, R>(
|
|
|
36
40
|
* @param arg1 - Function argument.
|
|
37
41
|
* @param arg2 - Function argument.
|
|
38
42
|
* @param arg3 - Function argument.
|
|
43
|
+
* @returns The return value of the executed function, or undefined if
|
|
44
|
+
* the function is null/undefined
|
|
39
45
|
*/
|
|
40
46
|
export function safeInvoke<A1, A2, A3, R>(
|
|
41
47
|
func: ((arg1: A1, arg2: A2, arg3: A3) => R) | nil,
|
|
@@ -50,6 +56,8 @@ export function safeInvoke<A1, A2, A3, R>(
|
|
|
50
56
|
* @param arg2 - Function argument.
|
|
51
57
|
* @param arg3 - Function argument.
|
|
52
58
|
* @param arg4 - Function argument.
|
|
59
|
+
* @returns The return value of the executed function, or undefined if
|
|
60
|
+
* the function is null/undefined
|
|
53
61
|
*/
|
|
54
62
|
export function safeInvoke<A1, A2, A3, A4, R>(
|
|
55
63
|
func: ((arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R) | nil,
|
|
@@ -66,6 +74,8 @@ export function safeInvoke<A1, A2, A3, A4, R>(
|
|
|
66
74
|
* @param arg3 - Function argument.
|
|
67
75
|
* @param arg4 - Function argument.
|
|
68
76
|
* @param arg5 - Function argument.
|
|
77
|
+
* @returns The return value of the executed function, or undefined if
|
|
78
|
+
* the function is null/undefined
|
|
69
79
|
*/
|
|
70
80
|
export function safeInvoke<A1, A2, A3, A4, A5, R>(
|
|
71
81
|
func: ((arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R) | nil,
|
|
@@ -84,6 +94,8 @@ export function safeInvoke<A1, A2, A3, A4, A5, R>(
|
|
|
84
94
|
* @param arg4 - Function argument.
|
|
85
95
|
* @param arg5 - Function argument.
|
|
86
96
|
* @param arg6 - Function argument.
|
|
97
|
+
* @returns The return value of the executed function, or undefined if
|
|
98
|
+
* the function is null/undefined
|
|
87
99
|
*/
|
|
88
100
|
export function safeInvoke<A1, A2, A3, A4, A5, A6, R>(
|
|
89
101
|
func:
|
|
@@ -105,6 +117,7 @@ export function safeInvoke<A1, A2, A3, A4, A5, A6, R>(
|
|
|
105
117
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
106
118
|
export function safeInvoke(func: Function | nil, ...args: any[]): any {
|
|
107
119
|
if (func) {
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
108
121
|
return func(...args);
|
|
109
122
|
}
|
|
110
123
|
}
|