cloudx-react-native 3.4.6 → 3.6.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/build.gradle +1 -1
- package/android/src/main/java/com/cloudxreactnative/CloudXAdEvents.kt +16 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdInfo.kt +14 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdView.kt +238 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdViewEvent.kt +28 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXAdViewManagerImpl.kt +54 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXExtraParameters.kt +101 -0
- package/android/src/main/java/com/cloudxreactnative/CloudXModuleImpl.kt +171 -57
- package/android/src/main/java/com/cloudxreactnative/CloudXPackage.kt +1 -1
- package/android/src/newarch/com/cloudxreactnative/CloudXAdViewManager.kt +52 -0
- package/android/src/newarch/com/cloudxreactnative/CloudXModule.kt +7 -0
- package/android/src/oldarch/com/cloudxreactnative/CloudXAdViewManager.kt +46 -0
- package/android/src/oldarch/com/cloudxreactnative/CloudXModule.kt +7 -0
- package/cloudx-react-native.podspec +3 -3
- package/ios/CloudX.h +2 -2
- package/ios/CloudX.mm +268 -62
- package/ios/CloudXAdView.h +33 -0
- package/ios/CloudXAdView.mm +500 -0
- package/ios/CloudXAdViewManager.h +12 -0
- package/ios/CloudXAdViewManager.mm +38 -0
- package/ios/CloudXExtraParameters.h +27 -0
- package/ios/CloudXExtraParameters.mm +117 -0
- package/lib/commonjs/CloudX.js +5 -1
- package/lib/commonjs/CloudX.js.map +1 -1
- package/lib/commonjs/CloudXAdViewBase.js +250 -0
- package/lib/commonjs/CloudXAdViewBase.js.map +1 -0
- package/lib/commonjs/CloudXAppOpenAd.js +98 -0
- package/lib/commonjs/CloudXAppOpenAd.js.map +1 -0
- package/lib/commonjs/CloudXBannerView.js +27 -0
- package/lib/commonjs/CloudXBannerView.js.map +1 -0
- package/lib/commonjs/CloudXMRECView.js +27 -0
- package/lib/commonjs/CloudXMRECView.js.map +1 -0
- package/lib/commonjs/hooks.js +81 -0
- package/lib/commonjs/hooks.js.map +1 -1
- package/lib/commonjs/index.js +53 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/CloudXAdViewNativeComponent.js +30 -0
- package/lib/commonjs/specs/CloudXAdViewNativeComponent.js.map +1 -0
- package/lib/commonjs/specs/NativeCloudX.js.map +1 -1
- package/lib/commonjs/types/AppOpenAd.js +6 -0
- package/lib/commonjs/types/AppOpenAd.js.map +1 -0
- package/lib/commonjs/types/RevenueData.js +21 -0
- package/lib/commonjs/types/RevenueData.js.map +1 -0
- package/lib/commonjs/types/index.js +17 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/CloudX.js +5 -1
- package/lib/module/CloudX.js.map +1 -1
- package/lib/module/CloudXAdViewBase.js +242 -0
- package/lib/module/CloudXAdViewBase.js.map +1 -0
- package/lib/module/CloudXAppOpenAd.js +91 -0
- package/lib/module/CloudXAppOpenAd.js.map +1 -0
- package/lib/module/CloudXBannerView.js +19 -0
- package/lib/module/CloudXBannerView.js.map +1 -0
- package/lib/module/CloudXMRECView.js +19 -0
- package/lib/module/CloudXMRECView.js.map +1 -0
- package/lib/module/hooks.js +80 -0
- package/lib/module/hooks.js.map +1 -1
- package/lib/module/index.js +10 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/CloudXAdViewNativeComponent.js +27 -0
- package/lib/module/specs/CloudXAdViewNativeComponent.js.map +1 -0
- package/lib/module/specs/NativeCloudX.js.map +1 -1
- package/lib/module/types/AppOpenAd.js +2 -0
- package/lib/module/types/AppOpenAd.js.map +1 -0
- package/lib/module/types/RevenueData.js +15 -0
- package/lib/module/types/RevenueData.js.map +1 -0
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/CloudX.d.ts.map +1 -1
- package/lib/typescript/src/CloudXAdViewBase.d.ts +28 -0
- package/lib/typescript/src/CloudXAdViewBase.d.ts.map +1 -0
- package/lib/typescript/src/CloudXAppOpenAd.d.ts +4 -0
- package/lib/typescript/src/CloudXAppOpenAd.d.ts.map +1 -0
- package/lib/typescript/src/CloudXBannerView.d.ts +16 -0
- package/lib/typescript/src/CloudXBannerView.d.ts.map +1 -0
- package/lib/typescript/src/CloudXMRECView.d.ts +16 -0
- package/lib/typescript/src/CloudXMRECView.d.ts.map +1 -0
- package/lib/typescript/src/hooks.d.ts +14 -0
- package/lib/typescript/src/hooks.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +9 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts +62 -0
- package/lib/typescript/src/specs/CloudXAdViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCloudX.d.ts +13 -0
- package/lib/typescript/src/specs/NativeCloudX.d.ts.map +1 -1
- package/lib/typescript/src/types/AdProps.d.ts +3 -0
- package/lib/typescript/src/types/AdProps.d.ts.map +1 -1
- package/lib/typescript/src/types/AppOpenAd.d.ts +8 -0
- package/lib/typescript/src/types/AppOpenAd.d.ts.map +1 -0
- package/lib/typescript/src/types/CloudX.d.ts +6 -0
- package/lib/typescript/src/types/CloudX.d.ts.map +1 -1
- package/lib/typescript/src/types/RevenueData.d.ts +32 -0
- package/lib/typescript/src/types/RevenueData.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +3 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +6 -2
- package/src/CloudX.ts +6 -0
- package/src/CloudXAdViewBase.tsx +294 -0
- package/src/CloudXAppOpenAd.ts +109 -0
- package/src/CloudXBannerView.tsx +20 -0
- package/src/CloudXMRECView.tsx +20 -0
- package/src/hooks.ts +103 -0
- package/src/index.ts +22 -2
- package/src/specs/CloudXAdViewNativeComponent.ts +84 -0
- package/src/specs/NativeCloudX.ts +22 -0
- package/src/types/AdProps.ts +4 -0
- package/src/types/AppOpenAd.ts +8 -0
- package/src/types/CloudX.ts +7 -0
- package/src/types/RevenueData.ts +39 -0
- package/src/types/index.ts +3 -0
- package/src/version.ts +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CloudXInitializationResult } from './Configuration';
|
|
2
2
|
import type { CloudXArbiterConfiguration, CloudXArbiterResult } from './Arbiter';
|
|
3
|
+
import type { CloudXRevenueData } from './RevenueData';
|
|
3
4
|
export type CloudXLogLevelValue = 'verbose' | 'debug' | 'info' | 'warn' | 'error' | 'none';
|
|
4
5
|
/**
|
|
5
6
|
* Main CloudX SDK module interface.
|
|
@@ -43,5 +44,10 @@ export type CloudXType = {
|
|
|
43
44
|
setDoNotSell(isDoNotSell: boolean | null): void;
|
|
44
45
|
/** Runs CloudX Arbiter using bid data passed through to the native SDK. */
|
|
45
46
|
arbiter(configuration: CloudXArbiterConfiguration): Promise<CloudXArbiterResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Reports publisher-observed revenue data.
|
|
49
|
+
* Resolves false when unsupported, invalid, or rejected.
|
|
50
|
+
*/
|
|
51
|
+
reportRevenueData(data: CloudXRevenueData): Promise<boolean>;
|
|
46
52
|
};
|
|
47
53
|
//# sourceMappingURL=CloudX.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudX.d.ts","sourceRoot":"","sources":["../../../../src/types/CloudX.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"CloudX.d.ts","sourceRoot":"","sources":["../../../../src/types/CloudX.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3F;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB,oDAAoD;IACpD,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAElC,yDAAyD;IACzD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEhE,qDAAqD;IACrD,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE7B,6CAA6C;IAC7C,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9B,yDAAyD;IACzD,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAEjD,2CAA2C;IAC3C,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5C,sDAAsD;IACtD,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAElD,sDAAsD;IACtD,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjD,uCAAuC;IACvC,iBAAiB,IAAI,IAAI,CAAC;IAE1B,iFAAiF;IACjF,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAElD;;;;;;OAMG;IACH,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;IAExD;;;;;;OAMG;IACH,YAAY,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC;IAEhD,2EAA2E;IAC3E,OAAO,CAAC,aAAa,EAAE,0BAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEjF;;;OAGG;IACH,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type CloudXRevenuePlatformValue = string;
|
|
2
|
+
export declare const CloudXRevenuePlatform: {
|
|
3
|
+
readonly ADMOB: "AdMob";
|
|
4
|
+
readonly custom: (name: string) => CloudXRevenuePlatformValue;
|
|
5
|
+
};
|
|
6
|
+
export declare const CloudXRevenuePrecision: {
|
|
7
|
+
readonly EXACT: "exact";
|
|
8
|
+
readonly ESTIMATED: "estimated";
|
|
9
|
+
readonly PUBLISHER_DEFINED: "publisher_defined";
|
|
10
|
+
readonly UNDEFINED: "undefined";
|
|
11
|
+
};
|
|
12
|
+
export type CloudXRevenuePrecisionValue = (typeof CloudXRevenuePrecision)[keyof typeof CloudXRevenuePrecision];
|
|
13
|
+
export type CloudXRevenueData = {
|
|
14
|
+
platform: CloudXRevenuePlatformValue;
|
|
15
|
+
/**
|
|
16
|
+
* Revenue for this impression in `currencyCode` units, not micros.
|
|
17
|
+
*
|
|
18
|
+
* Example: pass `1.234` for USD 1.234, not `1234000`.
|
|
19
|
+
*/
|
|
20
|
+
revenue: number;
|
|
21
|
+
adFormat: string;
|
|
22
|
+
currencyCode?: string | null;
|
|
23
|
+
precision?: CloudXRevenuePrecisionValue | null;
|
|
24
|
+
networkName?: string | null;
|
|
25
|
+
adUnitId?: string | null;
|
|
26
|
+
thirdPartyAdPlacementId?: string | null;
|
|
27
|
+
creativeId?: string | null;
|
|
28
|
+
networkPlacement?: string | null;
|
|
29
|
+
countryCode?: string | null;
|
|
30
|
+
userSegment?: string | null;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=RevenueData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevenueData.d.ts","sourceRoot":"","sources":["../../../../src/types/RevenueData.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAEhD,eAAO,MAAM,qBAAqB;;4BAMf,MAAM,KAAG,0BAA0B;CAC5C,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,OAAO,sBAAsB,CAAC,CAAC;AAE/G,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,0BAA0B,CAAC;IACrC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,2BAA2B,GAAG,IAAI,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uBAAuB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC"}
|
|
@@ -2,8 +2,11 @@ export type { CloudXAdInfo, CloudXAdLoadFailedInfo, CloudXAdDisplayFailedInfo, C
|
|
|
2
2
|
export type { CloudXInitializationResult, CloudXConfiguration } from './Configuration';
|
|
3
3
|
export type { CloudXType, CloudXLogLevelValue } from './CloudX';
|
|
4
4
|
export type { CloudXArbiterBid, CloudXArbiterConfiguration, CloudXArbiterPlatform, CloudXArbiterResult, CloudXSDKArbiterBid, CloudXLevelPlayArbiterBid, CloudXPubMaticArbiterBid, } from './Arbiter';
|
|
5
|
+
export { CloudXRevenuePlatform, CloudXRevenuePrecision } from './RevenueData';
|
|
6
|
+
export type { CloudXRevenueData, CloudXRevenuePlatformValue, CloudXRevenuePrecisionValue } from './RevenueData';
|
|
5
7
|
export type { CloudXFullscreenAdType } from './FullscreenAd';
|
|
6
8
|
export type { CloudXInterstitialAdType } from './InterstitialAd';
|
|
9
|
+
export type { CloudXAppOpenAdType } from './AppOpenAd';
|
|
7
10
|
export type { CloudXRewardedAdType } from './RewardedAd';
|
|
8
11
|
export type { CloudXViewAdType } from './ViewAd';
|
|
9
12
|
export type { CloudXBannerAdType } from './BannerAd';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpH,YAAY,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,GAC3B,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACpH,YAAY,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAChE,YAAY,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,wBAAwB,GAC3B,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC9E,YAAY,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAChH,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC7D,YAAY,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACjE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PLUGIN_VERSION = "3.
|
|
1
|
+
export declare const PLUGIN_VERSION = "3.6.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudx-react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "React Native wrapper for CloudX SDK (iOS & Android)",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
26
|
"prepare": "bob build",
|
|
27
|
-
"typescript": "tsc --noEmit",
|
|
27
|
+
"typescript": "tsc --noEmit -p tsconfig.build.json",
|
|
28
28
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
29
|
+
"release:check": "node scripts/check-release-metadata.mjs && npm run typescript && npm run lint && npm pack --dry-run",
|
|
29
30
|
"clean": "rm -rf lib"
|
|
30
31
|
},
|
|
31
32
|
"keywords": [
|
|
@@ -44,7 +45,10 @@
|
|
|
44
45
|
"react-native": "*"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
48
|
+
"@react-native-community/eslint-config": "^3.2.0",
|
|
47
49
|
"@types/react": "^18.0.0",
|
|
50
|
+
"eslint": "^8.57.0",
|
|
51
|
+
"prettier": "2.8.8",
|
|
48
52
|
"react": "18.3.1",
|
|
49
53
|
"react-native": "0.76.2",
|
|
50
54
|
"react-native-builder-bob": "^0.20.4",
|
package/src/CloudX.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CloudXType, CloudXLogLevelValue } from './types/CloudX';
|
|
2
2
|
import type { CloudXInitializationResult } from './types/Configuration';
|
|
3
3
|
import type { CloudXArbiterConfiguration, CloudXArbiterResult } from './types/Arbiter';
|
|
4
|
+
import type { CloudXRevenueData } from './types/RevenueData';
|
|
4
5
|
import NativeCloudX from './specs/NativeCloudX';
|
|
5
6
|
import { PLUGIN_VERSION } from './version';
|
|
6
7
|
|
|
@@ -56,6 +57,10 @@ const arbiter = (configuration: CloudXArbiterConfiguration): Promise<CloudXArbit
|
|
|
56
57
|
return NativeCloudX.arbiter(configuration) as Promise<CloudXArbiterResult>;
|
|
57
58
|
};
|
|
58
59
|
|
|
60
|
+
const reportRevenueData = (data: CloudXRevenueData): Promise<boolean> => {
|
|
61
|
+
return NativeCloudX.reportRevenueData(data);
|
|
62
|
+
};
|
|
63
|
+
|
|
59
64
|
export const CloudX: CloudXType = {
|
|
60
65
|
isInitialized,
|
|
61
66
|
initialize,
|
|
@@ -70,6 +75,7 @@ export const CloudX: CloudXType = {
|
|
|
70
75
|
setHasUserConsent,
|
|
71
76
|
setDoNotSell,
|
|
72
77
|
arbiter,
|
|
78
|
+
reportRevenueData,
|
|
73
79
|
};
|
|
74
80
|
|
|
75
81
|
export default CloudX;
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { NativeSyntheticEvent, StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
4
|
+
import NativeCloudXAdView from './specs/CloudXAdViewNativeComponent';
|
|
5
|
+
import type {
|
|
6
|
+
CloudXAdInfoEvent,
|
|
7
|
+
CloudXAdLoadFailedEvent,
|
|
8
|
+
NativeExtraParameterEntry,
|
|
9
|
+
} from './specs/CloudXAdViewNativeComponent';
|
|
10
|
+
import NativeCloudX from './specs/NativeCloudX';
|
|
11
|
+
import type { CloudXAdInfo, CloudXAdLoadFailedInfo } from './types/AdInfo';
|
|
12
|
+
import type { CloudXAdProps } from './types/AdProps';
|
|
13
|
+
import type { CloudXErrorCode } from './CloudXErrorCode';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Ad format rendered by the in-tree view component.
|
|
17
|
+
*/
|
|
18
|
+
export type CloudXAdViewFormat = 'BANNER' | 'MREC';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Props shared by CloudXBannerView and CloudXMRECView.
|
|
22
|
+
*/
|
|
23
|
+
export type CloudXAdViewProps = CloudXAdProps & ViewProps;
|
|
24
|
+
|
|
25
|
+
/** Internal props: the shared base additionally needs the concrete ad format. */
|
|
26
|
+
type CloudXAdViewBaseProps = CloudXAdViewProps & {
|
|
27
|
+
adFormat: CloudXAdViewFormat;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const AD_SIZE = {
|
|
31
|
+
banner: { width: 320, height: 50 },
|
|
32
|
+
leader: { width: 728, height: 90 },
|
|
33
|
+
mrec: { width: 300, height: 250 },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Tablet status is a device constant, but NativeCloudX.isTablet() is async.
|
|
38
|
+
* Cache it at module level so only the first banner in a session can flash
|
|
39
|
+
* phone->leader; every later mount reads the resolved value synchronously.
|
|
40
|
+
*/
|
|
41
|
+
let cachedIsTablet: boolean | null = null;
|
|
42
|
+
|
|
43
|
+
/*
|
|
44
|
+
* Once the SDK reports initialized it stays initialized for the JS VM's life,
|
|
45
|
+
* so cache it module-wide: only the first ad view mounted before init has to
|
|
46
|
+
* poll + show a placeholder; every later mount renders the native view
|
|
47
|
+
* immediately. Mirrors cachedIsTablet above.
|
|
48
|
+
*/
|
|
49
|
+
let cachedIsInitialized = false;
|
|
50
|
+
|
|
51
|
+
const parseAdValues = (json?: string | null): Record<string, string> => {
|
|
52
|
+
if (!json) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const parsed = JSON.parse(json);
|
|
57
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
58
|
+
} catch {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const toAdInfo = (event: CloudXAdInfoEvent): CloudXAdInfo => ({
|
|
64
|
+
adUnitId: event.adUnitId,
|
|
65
|
+
adFormat: event.adFormat,
|
|
66
|
+
networkName: event.networkName,
|
|
67
|
+
networkPlacement: event.networkPlacement || null,
|
|
68
|
+
placement: event.placement || null,
|
|
69
|
+
revenue: event.revenue ?? 0,
|
|
70
|
+
adValues: parseAdValues(event.adValuesJson),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const toLoadFailedInfo = (event: CloudXAdLoadFailedEvent): CloudXAdLoadFailedInfo => ({
|
|
74
|
+
adUnitId: event.adUnitId,
|
|
75
|
+
code: event.code as CloudXErrorCode,
|
|
76
|
+
message: event.message || null,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
const warnIgnoredUndefinedExtraParameter = (keyPath: string): void => {
|
|
80
|
+
console.warn(
|
|
81
|
+
`CloudXAdView ignored extra parameter "${keyPath}" because ` +
|
|
82
|
+
'undefined values are not supported. Use null when a value is intentional.'
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const normalizeExtraParameterValue = (
|
|
87
|
+
keyPath: string,
|
|
88
|
+
value: unknown
|
|
89
|
+
): NativeExtraParameterEntry['value'] | undefined => {
|
|
90
|
+
if (value === undefined) {
|
|
91
|
+
warnIgnoredUndefinedExtraParameter(keyPath);
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (Array.isArray(value)) {
|
|
96
|
+
return value.reduce<unknown[]>((items, item, index) => {
|
|
97
|
+
const normalized = normalizeExtraParameterValue(`${keyPath}[${index}]`, item);
|
|
98
|
+
if (normalized !== undefined) {
|
|
99
|
+
items.push(normalized);
|
|
100
|
+
}
|
|
101
|
+
return items;
|
|
102
|
+
}, []);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (value !== null && typeof value === 'object') {
|
|
106
|
+
return Object.entries(value as Record<string, unknown>).reduce<Record<string, unknown>>(
|
|
107
|
+
(object, [childKey, childValue]) => {
|
|
108
|
+
const normalized = normalizeExtraParameterValue(`${keyPath}.${childKey}`, childValue);
|
|
109
|
+
if (normalized !== undefined) {
|
|
110
|
+
object[childKey] = normalized;
|
|
111
|
+
}
|
|
112
|
+
return object;
|
|
113
|
+
},
|
|
114
|
+
{}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return value;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const toNativeExtraParameterEntries = (
|
|
122
|
+
extraParameters?: CloudXAdProps['extraParameters']
|
|
123
|
+
): ReadonlyArray<NativeExtraParameterEntry> => {
|
|
124
|
+
if (!extraParameters) {
|
|
125
|
+
return [];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return Object.entries(extraParameters as Record<string, unknown>).reduce<NativeExtraParameterEntry[]>(
|
|
129
|
+
(entries, [key, value]) => {
|
|
130
|
+
const normalizedValue = normalizeExtraParameterValue(key, value);
|
|
131
|
+
if (normalizedValue === undefined) {
|
|
132
|
+
return entries;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
entries.push({ key, value: normalizedValue });
|
|
136
|
+
return entries;
|
|
137
|
+
},
|
|
138
|
+
[]
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Shared implementation for the in-tree banner/MREC view component. Resolves a
|
|
144
|
+
* default fixed size (overridable via `style`), wires the native per-view direct
|
|
145
|
+
* events to the public CloudXAdProps callbacks, and hosts the native ad view.
|
|
146
|
+
*
|
|
147
|
+
* Note: overriding `style` with a non-IAB size resizes the host frame, not the
|
|
148
|
+
* creative — iOS pins the ad view to the host bounds and Android measures the
|
|
149
|
+
* creative from the host, so the served creative keeps its own standard
|
|
150
|
+
* dimensions inside the resized frame.
|
|
151
|
+
*/
|
|
152
|
+
export const CloudXAdViewBase: React.FC<CloudXAdViewBaseProps> = ({
|
|
153
|
+
adFormat,
|
|
154
|
+
adUnitId,
|
|
155
|
+
placement,
|
|
156
|
+
customData,
|
|
157
|
+
extraParameters,
|
|
158
|
+
onAdLoaded,
|
|
159
|
+
onAdLoadFailed,
|
|
160
|
+
onAdClicked,
|
|
161
|
+
onAdRevenuePaid,
|
|
162
|
+
style,
|
|
163
|
+
...viewProps
|
|
164
|
+
}) => {
|
|
165
|
+
const [isTablet, setIsTablet] = useState(cachedIsTablet ?? false);
|
|
166
|
+
const nativeViewProps = { ...viewProps } as ViewProps & {
|
|
167
|
+
onAdExpanded?: unknown;
|
|
168
|
+
onAdCollapsed?: unknown;
|
|
169
|
+
};
|
|
170
|
+
delete nativeViewProps.onAdExpanded;
|
|
171
|
+
delete nativeViewProps.onAdCollapsed;
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* Gate native ad-view creation on SDK initialization. A view mounted before
|
|
175
|
+
* CloudX.initialize() completes would create the ad against an uninitialized
|
|
176
|
+
* SDK — on iOS createBannerWithAdUnitId: returns nil and the view is
|
|
177
|
+
* permanently dead (no retry, no load-failed event). There is no init event
|
|
178
|
+
* to subscribe to, so poll isInitialized() until ready, then mount the
|
|
179
|
+
* native view (which is what delivers adUnitId/adFormat and triggers create).
|
|
180
|
+
* Mirrors CloudXNativeAdView. Cached module-wide so only the first pre-init
|
|
181
|
+
* mount pays the placeholder + poll.
|
|
182
|
+
*/
|
|
183
|
+
const [isInitialized, setIsInitialized] = useState(cachedIsInitialized);
|
|
184
|
+
|
|
185
|
+
useEffect(() => {
|
|
186
|
+
if (cachedIsInitialized) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
let cancelled = false;
|
|
190
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
191
|
+
let warnedOnce = false;
|
|
192
|
+
const check = () => {
|
|
193
|
+
NativeCloudX.isInitialized()
|
|
194
|
+
.then((ready) => {
|
|
195
|
+
if (cancelled) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (ready) {
|
|
199
|
+
cachedIsInitialized = true;
|
|
200
|
+
setIsInitialized(true);
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (!warnedOnce) {
|
|
204
|
+
warnedOnce = true;
|
|
205
|
+
console.warn(
|
|
206
|
+
'CloudXAdView mounted before CloudX SDK initialization; will render once initialize() completes.'
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
timer = setTimeout(check, 1000);
|
|
210
|
+
})
|
|
211
|
+
.catch((error) => {
|
|
212
|
+
if (cancelled) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
console.warn('CloudXAdView failed to read initialization state:', error);
|
|
216
|
+
timer = setTimeout(check, 1000);
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
check();
|
|
220
|
+
return () => {
|
|
221
|
+
cancelled = true;
|
|
222
|
+
if (timer) {
|
|
223
|
+
clearTimeout(timer);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}, []);
|
|
227
|
+
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (adFormat !== 'BANNER' || cachedIsTablet !== null) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
let cancelled = false;
|
|
233
|
+
NativeCloudX.isTablet()
|
|
234
|
+
.then((tablet) => {
|
|
235
|
+
cachedIsTablet = tablet;
|
|
236
|
+
if (!cancelled) {
|
|
237
|
+
setIsTablet(tablet);
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
.catch(() => {
|
|
241
|
+
/* keep phone default on failure */
|
|
242
|
+
});
|
|
243
|
+
return () => {
|
|
244
|
+
cancelled = true;
|
|
245
|
+
};
|
|
246
|
+
}, [adFormat]);
|
|
247
|
+
|
|
248
|
+
const defaultSize = useMemo<ViewStyle>(() => {
|
|
249
|
+
if (adFormat === 'MREC') {
|
|
250
|
+
return AD_SIZE.mrec;
|
|
251
|
+
}
|
|
252
|
+
return isTablet ? AD_SIZE.leader : AD_SIZE.banner;
|
|
253
|
+
}, [adFormat, isTablet]);
|
|
254
|
+
|
|
255
|
+
const resolvedStyle = useMemo<StyleProp<ViewStyle>>(
|
|
256
|
+
() => [defaultSize, style],
|
|
257
|
+
[defaultSize, style]
|
|
258
|
+
);
|
|
259
|
+
const nativeExtraParameters = useMemo(
|
|
260
|
+
() => toNativeExtraParameterEntries(extraParameters),
|
|
261
|
+
[extraParameters]
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
// Until the SDK is initialized, render a sized placeholder that reserves the
|
|
265
|
+
// ad slot's layout but does NOT mount the native view (so no pre-init
|
|
266
|
+
// create). Swaps to the real ad view once isInitialized flips true.
|
|
267
|
+
if (!isInitialized) {
|
|
268
|
+
return <View style={resolvedStyle} {...nativeViewProps} />;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return (
|
|
272
|
+
<NativeCloudXAdView
|
|
273
|
+
{...nativeViewProps}
|
|
274
|
+
style={resolvedStyle}
|
|
275
|
+
adUnitId={adUnitId}
|
|
276
|
+
adFormat={adFormat}
|
|
277
|
+
placement={placement ?? null}
|
|
278
|
+
customData={customData ?? null}
|
|
279
|
+
extraParameters={nativeExtraParameters}
|
|
280
|
+
onAdLoadedEvent={(e: NativeSyntheticEvent<CloudXAdInfoEvent>) =>
|
|
281
|
+
onAdLoaded?.(toAdInfo(e.nativeEvent))
|
|
282
|
+
}
|
|
283
|
+
onAdLoadFailedEvent={(e: NativeSyntheticEvent<CloudXAdLoadFailedEvent>) =>
|
|
284
|
+
onAdLoadFailed?.(toLoadFailedInfo(e.nativeEvent))
|
|
285
|
+
}
|
|
286
|
+
onAdClickedEvent={(e: NativeSyntheticEvent<CloudXAdInfoEvent>) =>
|
|
287
|
+
onAdClicked?.(toAdInfo(e.nativeEvent))
|
|
288
|
+
}
|
|
289
|
+
onAdRevenuePaidEvent={(e: NativeSyntheticEvent<CloudXAdInfoEvent>) =>
|
|
290
|
+
onAdRevenuePaid?.(toAdInfo(e.nativeEvent))
|
|
291
|
+
}
|
|
292
|
+
/>
|
|
293
|
+
);
|
|
294
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { addEventListener, removeEventListener } from './EventEmitter';
|
|
2
|
+
import type { CloudXAdDisplayFailedInfo, CloudXAdInfo, CloudXAdLoadFailedInfo } from './types/AdInfo';
|
|
3
|
+
import type { CloudXExtraParameters } from './types/ExtraParameters';
|
|
4
|
+
import type { CloudXFullscreenAdType } from './types/FullscreenAd';
|
|
5
|
+
import NativeCloudX from './specs/NativeCloudX';
|
|
6
|
+
|
|
7
|
+
const {
|
|
8
|
+
ON_APPOPEN_LOADED_EVENT,
|
|
9
|
+
ON_APPOPEN_LOAD_FAILED_EVENT,
|
|
10
|
+
ON_APPOPEN_CLICKED_EVENT,
|
|
11
|
+
ON_APPOPEN_DISPLAYED_EVENT,
|
|
12
|
+
ON_APPOPEN_DISPLAY_FAILED_EVENT,
|
|
13
|
+
ON_APPOPEN_HIDDEN_EVENT,
|
|
14
|
+
ON_APPOPEN_AD_REVENUE_PAID,
|
|
15
|
+
} = NativeCloudX.getConstants();
|
|
16
|
+
|
|
17
|
+
const isAdReady = (adUnitId: string): Promise<boolean> => {
|
|
18
|
+
return NativeCloudX.isAppOpenReady(adUnitId);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const loadAd = (adUnitId: string): void => {
|
|
22
|
+
NativeCloudX.loadAppOpen(adUnitId);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const setExtraParameters = (adUnitId: string, extraParameters: CloudXExtraParameters): void => {
|
|
26
|
+
NativeCloudX.setAppOpenExtraParameters(adUnitId, extraParameters);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const showAd = (adUnitId: string, placement?: string | null, customData?: string | null): void => {
|
|
30
|
+
NativeCloudX.showAppOpen(adUnitId, placement ?? undefined, customData ?? undefined);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const destroyAd = (adUnitId: string): void => {
|
|
34
|
+
NativeCloudX.destroyAppOpen(adUnitId);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const addAdLoadedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
|
|
38
|
+
addEventListener(ON_APPOPEN_LOADED_EVENT, listener);
|
|
39
|
+
};
|
|
40
|
+
const removeAdLoadedEventListener = (): void => {
|
|
41
|
+
removeEventListener(ON_APPOPEN_LOADED_EVENT);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const addAdLoadFailedEventListener = (listener: (errorInfo: CloudXAdLoadFailedInfo) => void): void => {
|
|
45
|
+
addEventListener(ON_APPOPEN_LOAD_FAILED_EVENT, listener);
|
|
46
|
+
};
|
|
47
|
+
const removeAdLoadFailedEventListener = (): void => {
|
|
48
|
+
removeEventListener(ON_APPOPEN_LOAD_FAILED_EVENT);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const addAdClickedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
|
|
52
|
+
addEventListener(ON_APPOPEN_CLICKED_EVENT, listener);
|
|
53
|
+
};
|
|
54
|
+
const removeAdClickedEventListener = (): void => {
|
|
55
|
+
removeEventListener(ON_APPOPEN_CLICKED_EVENT);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const addAdDisplayedEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
|
|
59
|
+
addEventListener(ON_APPOPEN_DISPLAYED_EVENT, listener);
|
|
60
|
+
};
|
|
61
|
+
const removeAdDisplayedEventListener = (): void => {
|
|
62
|
+
removeEventListener(ON_APPOPEN_DISPLAYED_EVENT);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const addAdFailedToDisplayEventListener = (listener: (errorInfo: CloudXAdDisplayFailedInfo) => void): void => {
|
|
66
|
+
addEventListener(ON_APPOPEN_DISPLAY_FAILED_EVENT, listener);
|
|
67
|
+
};
|
|
68
|
+
const removeAdFailedToDisplayEventListener = (): void => {
|
|
69
|
+
removeEventListener(ON_APPOPEN_DISPLAY_FAILED_EVENT);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const addAdHiddenEventListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
|
|
73
|
+
addEventListener(ON_APPOPEN_HIDDEN_EVENT, listener);
|
|
74
|
+
};
|
|
75
|
+
const removeAdHiddenEventListener = (): void => {
|
|
76
|
+
removeEventListener(ON_APPOPEN_HIDDEN_EVENT);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const addAdRevenuePaidListener = (listener: (adInfo: CloudXAdInfo) => void): void => {
|
|
80
|
+
addEventListener(ON_APPOPEN_AD_REVENUE_PAID, listener);
|
|
81
|
+
};
|
|
82
|
+
const removeAdRevenuePaidListener = (): void => {
|
|
83
|
+
removeEventListener(ON_APPOPEN_AD_REVENUE_PAID);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const CloudXAppOpenAd: CloudXFullscreenAdType = {
|
|
87
|
+
isAdReady,
|
|
88
|
+
loadAd,
|
|
89
|
+
setExtraParameters,
|
|
90
|
+
showAd,
|
|
91
|
+
destroyAd,
|
|
92
|
+
|
|
93
|
+
addAdLoadedEventListener,
|
|
94
|
+
removeAdLoadedEventListener,
|
|
95
|
+
addAdLoadFailedEventListener,
|
|
96
|
+
removeAdLoadFailedEventListener,
|
|
97
|
+
addAdClickedEventListener,
|
|
98
|
+
removeAdClickedEventListener,
|
|
99
|
+
addAdDisplayedEventListener,
|
|
100
|
+
removeAdDisplayedEventListener,
|
|
101
|
+
addAdFailedToDisplayEventListener,
|
|
102
|
+
removeAdFailedToDisplayEventListener,
|
|
103
|
+
addAdHiddenEventListener,
|
|
104
|
+
removeAdHiddenEventListener,
|
|
105
|
+
addAdRevenuePaidListener,
|
|
106
|
+
removeAdRevenuePaidListener,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export default CloudXAppOpenAd;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CloudXAdViewBase } from './CloudXAdViewBase';
|
|
3
|
+
import type { CloudXAdViewProps } from './CloudXAdViewBase';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* In-tree banner ad component.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the imperative `CloudXBannerAd` API (a native overlay above the whole
|
|
9
|
+
* RN view tree), this renders the banner as an ordinary React Native view, so
|
|
10
|
+
* app overlays such as toasts layer above it via normal RN z-ordering.
|
|
11
|
+
*
|
|
12
|
+
* Defaults to 320×50 on phones and 728×90 on tablets; override via `style`.
|
|
13
|
+
* Overriding `style` to a non-standard size resizes the host frame, not the
|
|
14
|
+
* creative — the served banner keeps its own IAB dimensions inside that frame.
|
|
15
|
+
*/
|
|
16
|
+
export const CloudXBannerView: React.FC<CloudXAdViewProps> = (props) => (
|
|
17
|
+
<CloudXAdViewBase adFormat="BANNER" {...props} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default CloudXBannerView;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CloudXAdViewBase } from './CloudXAdViewBase';
|
|
3
|
+
import type { CloudXAdViewProps } from './CloudXAdViewBase';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* In-tree MREC ad component.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the imperative `CloudXMRECAd` API (a native overlay above the whole RN
|
|
9
|
+
* view tree), this renders the MREC as an ordinary React Native view, so app
|
|
10
|
+
* overlays such as toasts layer above it via normal RN z-ordering.
|
|
11
|
+
*
|
|
12
|
+
* Fixed size of 300×250; override via `style`.
|
|
13
|
+
* Overriding `style` to a non-standard size resizes the host frame, not the
|
|
14
|
+
* creative — the served MREC keeps its own dimensions inside that frame.
|
|
15
|
+
*/
|
|
16
|
+
export const CloudXMRECView: React.FC<CloudXAdViewProps> = (props) => (
|
|
17
|
+
<CloudXAdViewBase adFormat="MREC" {...props} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default CloudXMRECView;
|