@jolibox/implement 1.1.4-beta.8 → 1.1.4-beta.9

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.
@@ -4,7 +4,7 @@
4
4
  "packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
5
5
  "packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
6
6
  "packages/implement/esbuild.config.js": "a55a01edf7475b868f9a946b93eb05b6b1bf756a",
7
- "packages/implement/package.json": "def60c329f019f7938972f129e36f3aed78606f7",
7
+ "packages/implement/package.json": "812fd76552e265afbc28b7fe1104b30d8b89022e",
8
8
  "packages/implement/src/common/api-factory/index.ts": "b1c4018f18db700c80826d70465c79f0adf10a8c",
9
9
  "packages/implement/src/common/api-factory/validator/__tests__/validate/any.test.ts": "6e225e09fce401b374221ad2e4fe33bc91df4152",
10
10
  "packages/implement/src/common/api-factory/validator/__tests__/validate/array.test.ts": "8a9cc32be03e952f1176a970fea033d597c176cb",
@@ -44,7 +44,7 @@
44
44
  "packages/implement/src/common/report/types.ts": "2f2db0fb5bff6d2d4436f2ed9dda9f0bce5677a9",
45
45
  "packages/implement/src/h5/ads/ads-action-detection.ts": "ad06449b7471e27b505c8688c0dd014b9e0a6a0f",
46
46
  "packages/implement/src/h5/ads/anti-cheating.ts": "9e7ce7d02b897865337e1e1ce9282c9d6dc36303",
47
- "packages/implement/src/h5/ads/index.ts": "06bb47e093b0c758eb992e932bc8e36fac2da2ff",
47
+ "packages/implement/src/h5/ads/index.ts": "e12fc0158593d38ebfb35476615f7cf48631da66",
48
48
  "packages/implement/src/h5/api/base.ts": "ead2c3cdcbe174b0e725c31a3885c7985bd8f667",
49
49
  "packages/implement/src/h5/api/get-system-info.ts": "ff081a1a6639bf63b021ce8be47a3141a3b1882a",
50
50
  "packages/implement/src/h5/api/index.ts": "863e3461d4c4db39fc7828ec7114d72ea225aa4e",
package/dist/index.js CHANGED
@@ -2700,7 +2700,7 @@ var getPlatform = () => {
2700
2700
  return "PC";
2701
2701
  }
2702
2702
  };
2703
- var jssdkVersion = "1.1.4-beta.8";
2703
+ var jssdkVersion = "1.1.4-beta.9";
2704
2704
  var getAppVersion = () => {
2705
2705
  return jssdkVersion;
2706
2706
  };
@@ -4944,22 +4944,41 @@ var JoliboxAdsImpl = class {
4944
4944
  if (style) {
4945
4945
  ins.setAttribute("style", style);
4946
4946
  }
4947
- el.appendChild(ins);
4948
- const mutationObserver = new MutationObserver((mutations) => {
4949
- mutations.forEach((mutation) => {
4950
- if (mutation.type === "attributes" && mutation.attributeName === "data-ad-status") {
4951
- const status = ins.getAttribute("data-ad-status");
4952
- track("AdSenseUnitStatusChanged", {
4953
- status: status ?? "null"
4954
- });
4955
- }
4947
+ const testAdsMode = this.getTestAdsMode() ?? false;
4948
+ if (testAdsMode) {
4949
+ const testAdsElement = document.createElement("div");
4950
+ testAdsElement.style.position = "absolute";
4951
+ testAdsElement.style.top = "0";
4952
+ testAdsElement.style.left = "0";
4953
+ testAdsElement.style.width = "100%";
4954
+ testAdsElement.style.height = "100%";
4955
+ testAdsElement.style.display = "flex";
4956
+ testAdsElement.style.justifyContent = "center";
4957
+ testAdsElement.style.alignItems = "center";
4958
+ testAdsElement.style.backgroundColor = "rgba(0, 0, 0, 0.5)";
4959
+ testAdsElement.style.color = "white";
4960
+ testAdsElement.innerHTML = "Test Ad";
4961
+ ins.style.position = "relative";
4962
+ el.appendChild(ins);
4963
+ ins.appendChild(testAdsElement);
4964
+ } else {
4965
+ el.appendChild(ins);
4966
+ const mutationObserver = new MutationObserver((mutations) => {
4967
+ mutations.forEach((mutation) => {
4968
+ if (mutation.type === "attributes" && mutation.attributeName === "data-ad-status") {
4969
+ const status = ins.getAttribute("data-ad-status");
4970
+ track("AdSenseUnitStatusChanged", {
4971
+ status: status ?? "null"
4972
+ });
4973
+ }
4974
+ });
4956
4975
  });
4957
- });
4958
- mutationObserver.observe(ins, {
4959
- attributes: true,
4960
- attributeFilter: ["data-ad-status"]
4961
- });
4962
- this.push({});
4976
+ mutationObserver.observe(ins, {
4977
+ attributes: true,
4978
+ attributeFilter: ["data-ad-status"]
4979
+ });
4980
+ this.push({});
4981
+ }
4963
4982
  };
4964
4983
  this.antiCheating = new AdsAntiCheating(
4965
4984
  /*context*/
@@ -1384,7 +1384,7 @@ var init_xua = __esm({
1384
1384
  return "PC";
1385
1385
  }
1386
1386
  };
1387
- jssdkVersion = "1.1.4-beta.8";
1387
+ jssdkVersion = "1.1.4-beta.9";
1388
1388
  getAppVersion = () => {
1389
1389
  return jssdkVersion;
1390
1390
  };
@@ -1,9 +1,9 @@
1
1
  Invoking: npm run clean && npm run build:esm && tsc
2
2
 
3
- > @jolibox/implement@1.1.4-beta.8 clean
3
+ > @jolibox/implement@1.1.4-beta.9 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.4-beta.8 build:esm
7
+ > @jolibox/implement@1.1.4-beta.9 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.4-beta.8",
4
+ "version": "1.1.4-beta.9",
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.4-beta.8",
10
- "@jolibox/types": "1.1.4-beta.8",
9
+ "@jolibox/common": "1.1.4-beta.9",
10
+ "@jolibox/types": "1.1.4-beta.9",
11
11
  "localforage": "1.10.0"
12
12
  },
13
13
  "devDependencies": {
@@ -598,25 +598,42 @@ export class JoliboxAdsImpl {
598
598
  ins.setAttribute('style', style);
599
599
  }
600
600
 
601
- el.appendChild(ins);
602
-
603
- const mutationObserver = new MutationObserver((mutations) => {
604
- mutations.forEach((mutation) => {
605
- if (mutation.type === 'attributes' && mutation.attributeName === 'data-ad-status') {
606
- const status = ins.getAttribute('data-ad-status');
607
- track('AdSenseUnitStatusChanged', {
608
- status: status ?? 'null'
609
- });
610
- }
601
+ const testAdsMode = this.getTestAdsMode() ?? false;
602
+ if (testAdsMode) {
603
+ const testAdsElement = document.createElement('div');
604
+ testAdsElement.style.position = 'absolute';
605
+ testAdsElement.style.top = '0';
606
+ testAdsElement.style.left = '0';
607
+ testAdsElement.style.width = '100%';
608
+ testAdsElement.style.height = '100%';
609
+ testAdsElement.style.display = 'flex';
610
+ testAdsElement.style.justifyContent = 'center';
611
+ testAdsElement.style.alignItems = 'center';
612
+ testAdsElement.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
613
+ testAdsElement.style.color = 'white';
614
+ testAdsElement.innerHTML = 'Test Ad';
615
+ ins.style.position = 'relative';
616
+ el.appendChild(ins);
617
+ ins.appendChild(testAdsElement);
618
+ } else {
619
+ el.appendChild(ins);
620
+ const mutationObserver = new MutationObserver((mutations) => {
621
+ mutations.forEach((mutation) => {
622
+ if (mutation.type === 'attributes' && mutation.attributeName === 'data-ad-status') {
623
+ const status = ins.getAttribute('data-ad-status');
624
+ track('AdSenseUnitStatusChanged', {
625
+ status: status ?? 'null'
626
+ });
627
+ }
628
+ });
611
629
  });
612
- });
613
630
 
614
- mutationObserver.observe(ins, {
615
- attributes: true,
616
- attributeFilter: ['data-ad-status']
617
- });
618
-
619
- this.push({});
631
+ mutationObserver.observe(ins, {
632
+ attributes: true,
633
+ attributeFilter: ['data-ad-status']
634
+ });
635
+ this.push({});
636
+ }
620
637
  };
621
638
  }
622
639