@jolibox/implement 1.1.40 → 1.1.41

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.
@@ -1,9 +1,9 @@
1
1
  Invoking: npm run clean && npm run build:esm && tsc
2
2
 
3
- > @jolibox/implement@1.1.40 clean
3
+ > @jolibox/implement@1.1.41 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.40 build:esm
7
+ > @jolibox/implement@1.1.41 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,15 +1,15 @@
1
1
  {
2
2
  "name": "@jolibox/implement",
3
3
  "description": "This project is Jolibox JS-SDk implement for Native && H5",
4
- "version": "1.1.40",
4
+ "version": "1.1.41",
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.40",
10
- "@jolibox/types": "1.1.40",
11
- "@jolibox/native-bridge": "1.1.40",
12
- "@jolibox/ads": "1.1.40",
9
+ "@jolibox/common": "1.1.41",
10
+ "@jolibox/types": "1.1.41",
11
+ "@jolibox/native-bridge": "1.1.41",
12
+ "@jolibox/ads": "1.1.41",
13
13
  "localforage": "1.10.0",
14
14
  "@jolibox/ui": "1.0.0",
15
15
  "web-vitals": "4.2.4"
@@ -75,6 +75,9 @@ const wrapContext = () => {
75
75
  let shouldInterupt = payloadJson?.__shouldInterupt;
76
76
 
77
77
  return {
78
+ get startTime(): number {
79
+ return performance.timeOrigin ?? performance.timing.navigationStart;
80
+ },
78
81
  get testMode(): boolean {
79
82
  return testMode; // TODO: true test mode
80
83
  },
@@ -13,7 +13,7 @@ export default class DlightekAdsHandler implements IAdsHandler {
13
13
  }
14
14
 
15
15
  adConfig(params: IAdConfigParams): void {
16
- this.ads.adConfig(params);
16
+ this.ads?.adConfig?.(params);
17
17
  }
18
18
 
19
19
  adBreak(params: IAdBreakParams): void {
@@ -79,7 +79,7 @@ export default class HuaweiQuickAdsHandler implements IAdsHandler {
79
79
  console.log(`HuaweiQuickAdsHandler,event => ${event}`);
80
80
  if (event.origin != window.location.origin) return;
81
81
 
82
- console.log(`data => ${event.data}`);
82
+ // console.log(`data => ${event.data}`);
83
83
 
84
84
  if (event.data && event.data.type == null) {
85
85
  const data = JSON.parse(event.data);
@@ -120,19 +120,25 @@ export default class HuaweiQuickAdsHandler implements IAdsHandler {
120
120
  case 'viewed':
121
121
  adsRes = 'viewed';
122
122
  callbacks?.adViewed?.();
123
- isBreakDone = true;
123
+ isBreakDone = false;
124
124
  break;
125
125
  case 'dismissed':
126
126
  adsRes = 'dismissed';
127
127
  callbacks?.adDismissed?.();
128
- isBreakDone = true;
128
+ isBreakDone = false;
129
129
  break;
130
+ case 'notReady':
131
+ case 'timeout':
130
132
  case 'error':
131
- adsRes = 'error';
133
+ case 'noAdPreloaded':
134
+ case 'frequencyCapped':
135
+ case 'ignored':
136
+ case 'other':
137
+ adsRes = data.adsRes;
132
138
  isBreakDone = true;
133
139
  break;
134
- case 'other':
135
- adsRes = 'other';
140
+ case 'breakDone':
141
+ adsRes = data.params;
136
142
  isBreakDone = true;
137
143
  break;
138
144
 
@@ -1,9 +1,14 @@
1
1
  import { createCommands } from '@jolibox/common';
2
+ import { track } from '../report';
3
+ import { context } from '@/common/context';
2
4
 
3
5
  const commands = createCommands();
4
6
 
5
7
  commands.registerCommand('RuntimeSDK.loadFinishedEvent', () => {
6
- console.log('RuntimeSDK.loadFinishedEvent');
8
+ const duration = performance.now();
9
+ track('loadFinished', {
10
+ duration
11
+ });
7
12
  });
8
13
 
9
14
  commands.registerCommand('RuntimeSDK.loadProgressEvent', (progress) => {
@@ -2,12 +2,16 @@ import { createCommands } from '@jolibox/common';
2
2
  import { t, createSyncAPI } from './base';
3
3
  import { emitNative } from '@jolibox/native-bridge';
4
4
  import { context } from '@/common/context';
5
+ import { track } from '../report';
5
6
 
6
7
  const commands = createCommands();
7
8
 
8
9
  const onLoadFinished = createSyncAPI('onLoadFinished', {
9
10
  implement: () => {
10
11
  emitNative('cpLoadFinishEvent', {}, context.webviewId, true);
12
+ track('loadFinished', {
13
+ duration: performance.now()
14
+ });
11
15
  }
12
16
  });
13
17