@jolibox/implement 1.1.13-beta.2 → 1.1.13-beta.3
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/.rush/temp/package-deps_build.json +2 -2
- package/dist/index.js +3 -3
- package/dist/index.native.js +5 -5
- package/implement.build.log +2 -2
- package/package.json +3 -3
- package/src/common/ads/index.ts +51 -33
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.13-beta.
|
|
3
|
+
> @jolibox/implement@1.1.13-beta.3 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.13-beta.
|
|
7
|
+
> @jolibox/implement@1.1.13-beta.3 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.13-beta.
|
|
4
|
+
"version": "1.1.13-beta.3",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.13-beta.
|
|
10
|
-
"@jolibox/types": "1.1.13-beta.
|
|
9
|
+
"@jolibox/common": "1.1.13-beta.3",
|
|
10
|
+
"@jolibox/types": "1.1.13-beta.3",
|
|
11
11
|
"@jolibox/native-bridge": "1.0.0",
|
|
12
12
|
"localforage": "1.10.0",
|
|
13
13
|
"@jolibox/ui": "1.0.0",
|
package/src/common/ads/index.ts
CHANGED
|
@@ -377,6 +377,55 @@ export class JoliboxAdsImpl {
|
|
|
377
377
|
* @returns IAdBreakParams
|
|
378
378
|
*/
|
|
379
379
|
private wrapAdBreakParams = (params: IAdBreakParams): IAdBreakParams => {
|
|
380
|
+
let googleHasResponse = false;
|
|
381
|
+
|
|
382
|
+
/* hook adBreakDone to track adBreakDone event -- start */
|
|
383
|
+
const originAdBreakDone = params.adBreakDone;
|
|
384
|
+
const adBreakDone = (placementInfo: IPlacementInfo) => {
|
|
385
|
+
googleHasResponse = true;
|
|
386
|
+
this.adsActionDetection.adBreakIsShowing = false;
|
|
387
|
+
this.track('CallAdBreakDone', {
|
|
388
|
+
breakType: placementInfo.breakType,
|
|
389
|
+
breakName: placementInfo.breakName ?? '',
|
|
390
|
+
breakFormat: placementInfo.breakFormat,
|
|
391
|
+
breakStatus: placementInfo.breakStatus
|
|
392
|
+
});
|
|
393
|
+
if (originAdBreakDone) {
|
|
394
|
+
originAdBreakDone(placementInfo);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
params.adBreakDone = adBreakDone;
|
|
398
|
+
/* hook adBreakDone to track adBreakDone event -- end */
|
|
399
|
+
|
|
400
|
+
/* hook for reward -- start */
|
|
401
|
+
if (params.type === 'reward') {
|
|
402
|
+
const originBeforeReward = params.beforeReward;
|
|
403
|
+
const wrapShowAdFn = (originShowAdFn: () => void) => () => {
|
|
404
|
+
this.track('CallShowAdFn', null);
|
|
405
|
+
originShowAdFn();
|
|
406
|
+
};
|
|
407
|
+
const beforeReward = (originShowAdFn: () => void) => {
|
|
408
|
+
googleHasResponse = true;
|
|
409
|
+
if (originBeforeReward) {
|
|
410
|
+
originBeforeReward(wrapShowAdFn(originShowAdFn));
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
params.beforeReward = beforeReward;
|
|
414
|
+
|
|
415
|
+
window.setTimeout(() => {
|
|
416
|
+
if (!googleHasResponse) {
|
|
417
|
+
this.track('CallAdBreakTimeout', { type: params.type });
|
|
418
|
+
params.adBreakDone?.({
|
|
419
|
+
breakType: params.type,
|
|
420
|
+
breakName: params.name ?? '',
|
|
421
|
+
breakFormat: 'reward',
|
|
422
|
+
breakStatus: 'timeout'
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}, 10000); // Timeout duration in milliseconds, 10 seconds
|
|
426
|
+
}
|
|
427
|
+
/* hook for reward -- end */
|
|
428
|
+
|
|
380
429
|
const isPreroll = (params: IAdBreakParams): params is IPrerollParams => {
|
|
381
430
|
return params.type === 'preroll';
|
|
382
431
|
};
|
|
@@ -396,6 +445,7 @@ export class JoliboxAdsImpl {
|
|
|
396
445
|
const originAfterAd = params.afterAd;
|
|
397
446
|
|
|
398
447
|
const beforeAd = () => {
|
|
448
|
+
googleHasResponse = true;
|
|
399
449
|
adEventEmitter.emit('isAdShowing', true);
|
|
400
450
|
this.track('CallBeforeAd', {
|
|
401
451
|
type: params.type,
|
|
@@ -407,6 +457,7 @@ export class JoliboxAdsImpl {
|
|
|
407
457
|
};
|
|
408
458
|
|
|
409
459
|
const afterAd = () => {
|
|
460
|
+
googleHasResponse = true;
|
|
410
461
|
adEventEmitter.emit('isAdShowing', false);
|
|
411
462
|
this.track('CallAfterAd', {
|
|
412
463
|
type: params.type,
|
|
@@ -529,39 +580,6 @@ export class JoliboxAdsImpl {
|
|
|
529
580
|
|
|
530
581
|
const type = params.type;
|
|
531
582
|
|
|
532
|
-
/* hook adBreakDone to track adBreakDone event -- start */
|
|
533
|
-
const originAdBreakDone = params.adBreakDone;
|
|
534
|
-
const adBreakDone = (placementInfo: IPlacementInfo) => {
|
|
535
|
-
this.adsActionDetection.adBreakIsShowing = false;
|
|
536
|
-
this.track('CallAdBreakDone', {
|
|
537
|
-
breakType: placementInfo.breakType,
|
|
538
|
-
breakName: placementInfo.breakName ?? '',
|
|
539
|
-
breakFormat: placementInfo.breakFormat,
|
|
540
|
-
breakStatus: placementInfo.breakStatus
|
|
541
|
-
});
|
|
542
|
-
if (originAdBreakDone) {
|
|
543
|
-
originAdBreakDone(placementInfo);
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
params.adBreakDone = adBreakDone;
|
|
547
|
-
/* hook adBreakDone to track adBreakDone event -- end */
|
|
548
|
-
|
|
549
|
-
/* hook beforeAd to track beforeAd event -- start */
|
|
550
|
-
if (params.type === 'reward') {
|
|
551
|
-
const originBeforeReward = params.beforeReward;
|
|
552
|
-
const wrapShowAdFn = (originShowAdFn: () => void) => () => {
|
|
553
|
-
this.track('CallShowAdFn', null);
|
|
554
|
-
originShowAdFn();
|
|
555
|
-
};
|
|
556
|
-
const beforeReward = (originShowAdFn: () => void) => {
|
|
557
|
-
if (originBeforeReward) {
|
|
558
|
-
originBeforeReward(wrapShowAdFn(originShowAdFn));
|
|
559
|
-
}
|
|
560
|
-
};
|
|
561
|
-
params.beforeReward = beforeReward;
|
|
562
|
-
}
|
|
563
|
-
/* hook beforeAd to track beforeAd event -- end */
|
|
564
|
-
|
|
565
583
|
let paramsToTrack;
|
|
566
584
|
switch (type) {
|
|
567
585
|
case 'preroll':
|