@thealteroffice/react-native-adgeist 0.0.34 → 0.0.35-beta
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/README.md +122 -12
- package/android/build.gradle +1 -22
- package/android/src/main/java/com/adgeist/components/HTML5AdViewManagerImpl.kt +42 -30
- package/android/src/main/java/com/adgeist/components/ReactAdView.kt +21 -0
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +15 -2
- package/android/src/main/java/com/adgeist/utils/CreativeExtensions.kt +21 -28
- package/android/src/newarch/java/com/Adgeist.kt +1 -2
- package/android/src/newarch/java/com/HTML5AdViewManager.kt +12 -10
- package/android/src/oldarch/java/com/Adgeist.kt +1 -2
- package/android/src/oldarch/java/com/HTML5AdViewManager.kt +12 -10
- package/lib/module/components/HTML5AdView.js +57 -26
- package/lib/module/components/HTML5AdView.js.map +1 -1
- package/lib/module/constants.js +1 -7
- package/lib/module/constants.js.map +1 -1
- package/lib/module/env.js +2 -2
- package/lib/module/env.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/HTML5AdNativeComponent.ts +12 -3
- package/lib/module/utilities.js +1 -0
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/HTML5AdView.d.ts.map +1 -1
- package/lib/typescript/src/constants.d.ts +1 -7
- package/lib/typescript/src/constants.d.ts.map +1 -1
- package/lib/typescript/src/env.d.ts +2 -2
- package/lib/typescript/src/env.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts +10 -2
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/types/FixedAdResponse.d.ts +4 -27
- package/lib/typescript/src/types/FixedAdResponse.d.ts.map +1 -1
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts +5 -2
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts.map +1 -1
- package/lib/typescript/src/utilities.d.ts +1 -0
- package/lib/typescript/src/utilities.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/HTML5AdView.tsx +76 -20
- package/src/constants.ts +1 -5
- package/src/env.ts +2 -2
- package/src/index.tsx +0 -2
- package/src/specs/HTML5AdNativeComponent.ts +12 -3
- package/src/types/FixedAdResponse.ts +5 -31
- package/src/types/HTML5AdNativeComponentProps.ts +6 -2
- package/src/utilities.ts +5 -0
- package/lib/module/types/AdType.js +0 -16
- package/lib/module/types/AdType.js.map +0 -1
- package/lib/typescript/src/types/AdType.d.ts +0 -14
- package/lib/typescript/src/types/AdType.d.ts.map +0 -1
- package/src/types/AdType.ts +0 -16
|
@@ -2,33 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
import { useRef, useCallback, useImperativeHandle, forwardRef, useEffect, useState, useMemo } from 'react';
|
|
4
4
|
import HTML5AdNativeComponent, { AdCommands } from '../specs/HTML5AdNativeComponent';
|
|
5
|
-
import {
|
|
5
|
+
import { toAdSizeAxis } from "../utilities.js";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
8
8
|
adUnitID,
|
|
9
9
|
adIsResponsive,
|
|
10
10
|
adSize,
|
|
11
|
-
|
|
11
|
+
reserveSpace,
|
|
12
12
|
onAdLoaded,
|
|
13
13
|
onAdFailedToLoad,
|
|
14
14
|
onAdOpened,
|
|
15
15
|
onAdClosed,
|
|
16
|
-
onAdClicked
|
|
16
|
+
onAdClicked,
|
|
17
|
+
onAdWarning
|
|
17
18
|
}, ref) => {
|
|
18
19
|
const nativeRef = useRef(null);
|
|
19
20
|
const [isViewReady, setIsViewReady] = useState(false);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
|
|
21
|
+
const [resolvedSize, setResolvedSize] = useState(null);
|
|
22
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
23
|
+
const collapsesOnFailure = reserveSpace === false;
|
|
24
|
+
const width = toAdSizeAxis(adSize?.width);
|
|
25
|
+
const height = toAdSizeAxis(adSize?.height);
|
|
26
|
+
const resolvedAdSize = useMemo(() => {
|
|
27
|
+
const dimensions = {};
|
|
28
|
+
if (width !== undefined) {
|
|
29
|
+
dimensions.width = width;
|
|
30
|
+
}
|
|
31
|
+
if (height !== undefined) {
|
|
32
|
+
dimensions.height = height;
|
|
33
|
+
}
|
|
34
|
+
return dimensions;
|
|
35
|
+
}, [width, height]);
|
|
36
|
+
const nativeSize = adIsResponsive ? null : resolvedSize;
|
|
28
37
|
const containerStyle = useMemo(() => ({
|
|
29
|
-
width:
|
|
30
|
-
height:
|
|
31
|
-
}), [
|
|
38
|
+
width: nativeSize?.width ?? width ?? '100%',
|
|
39
|
+
height: nativeSize?.height ?? height ?? '100%'
|
|
40
|
+
}), [width, height, nativeSize]);
|
|
41
|
+
const handleAdSizeChanged = useCallback(event => {
|
|
42
|
+
const {
|
|
43
|
+
width: nativeWidth,
|
|
44
|
+
height: nativeHeight
|
|
45
|
+
} = event.nativeEvent;
|
|
46
|
+
if (nativeWidth <= 0 || nativeHeight <= 0) return;
|
|
47
|
+
setResolvedSize(current => current?.width === nativeWidth && current?.height === nativeHeight ? current : {
|
|
48
|
+
width: nativeWidth,
|
|
49
|
+
height: nativeHeight
|
|
50
|
+
});
|
|
51
|
+
}, []);
|
|
52
|
+
const handleAdFailedToLoad = useCallback(event => {
|
|
53
|
+
onAdFailedToLoad?.(event);
|
|
54
|
+
if (collapsesOnFailure) {
|
|
55
|
+
setHasFailed(true);
|
|
56
|
+
}
|
|
57
|
+
}, [onAdFailedToLoad, collapsesOnFailure]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
setResolvedSize(null);
|
|
60
|
+
setHasFailed(false);
|
|
61
|
+
}, [adUnitID]);
|
|
32
62
|
const loadAdInternal = useCallback(() => {
|
|
33
63
|
if (!nativeRef.current) {
|
|
34
64
|
console.warn('HTML5AdView: Cannot load ad, native view not ready');
|
|
@@ -60,6 +90,10 @@ export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
|
60
90
|
}, [isViewReady, adUnitID, loadAdInternal]);
|
|
61
91
|
useImperativeHandle(ref, () => ({
|
|
62
92
|
loadAd: () => {
|
|
93
|
+
if (hasFailed) {
|
|
94
|
+
setHasFailed(false);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
63
97
|
if (isViewReady && nativeRef.current) {
|
|
64
98
|
loadAdInternal();
|
|
65
99
|
}
|
|
@@ -73,14 +107,9 @@ export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
|
73
107
|
}
|
|
74
108
|
}
|
|
75
109
|
}
|
|
76
|
-
}), [isViewReady, loadAdInternal]);
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
adUnitID,
|
|
80
|
-
adSize,
|
|
81
|
-
adType,
|
|
82
|
-
isViewReady
|
|
83
|
-
});
|
|
110
|
+
}), [isViewReady, loadAdInternal, hasFailed]);
|
|
111
|
+
if (hasFailed && collapsesOnFailure) {
|
|
112
|
+
return null;
|
|
84
113
|
}
|
|
85
114
|
return /*#__PURE__*/_jsx(HTML5AdNativeComponent, {
|
|
86
115
|
ref: handleNativeRef,
|
|
@@ -88,16 +117,18 @@ export const HTML5AdView = /*#__PURE__*/forwardRef(({
|
|
|
88
117
|
// Required Props, it will take values from React Component props
|
|
89
118
|
,
|
|
90
119
|
adUnitID: adUnitID,
|
|
91
|
-
adSize: adIsResponsive ? AdSizes.Responsive : adSize,
|
|
92
120
|
adIsResponsive: adIsResponsive,
|
|
93
|
-
|
|
121
|
+
adSize: resolvedAdSize,
|
|
122
|
+
reserveSpace: reserveSpace
|
|
94
123
|
// Required Event Callbacks
|
|
95
124
|
,
|
|
96
125
|
onAdLoaded: onAdLoaded,
|
|
97
|
-
onAdFailedToLoad:
|
|
126
|
+
onAdFailedToLoad: handleAdFailedToLoad,
|
|
98
127
|
onAdOpened: onAdOpened,
|
|
99
128
|
onAdClosed: onAdClosed,
|
|
100
|
-
onAdClicked: onAdClicked
|
|
129
|
+
onAdClicked: onAdClicked,
|
|
130
|
+
onAdWarning: onAdWarning,
|
|
131
|
+
onAdSizeChanged: handleAdSizeChanged
|
|
101
132
|
});
|
|
102
133
|
});
|
|
103
134
|
HTML5AdView.displayName = 'HTML5AdView';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useCallback","useImperativeHandle","forwardRef","useEffect","useState","useMemo","HTML5AdNativeComponent","AdCommands","
|
|
1
|
+
{"version":3,"names":["useRef","useCallback","useImperativeHandle","forwardRef","useEffect","useState","useMemo","HTML5AdNativeComponent","AdCommands","toAdSizeAxis","jsx","_jsx","HTML5AdView","adUnitID","adIsResponsive","adSize","reserveSpace","onAdLoaded","onAdFailedToLoad","onAdOpened","onAdClosed","onAdClicked","onAdWarning","ref","nativeRef","isViewReady","setIsViewReady","resolvedSize","setResolvedSize","hasFailed","setHasFailed","collapsesOnFailure","width","height","resolvedAdSize","dimensions","undefined","nativeSize","containerStyle","handleAdSizeChanged","event","nativeWidth","nativeHeight","nativeEvent","current","handleAdFailedToLoad","loadAdInternal","console","warn","loadAd","error","__DEV__","handleNativeRef","requestAnimationFrame","destroy","e","style","onAdSizeChanged","displayName"],"sourceRoot":"../../../src","sources":["components/HTML5AdView.tsx"],"mappings":";;AAAA,SACEA,MAAM,EACNC,WAAW,EACXC,mBAAmB,EACnBC,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,OAAO,QACF,OAAO;AAGd,OAAOC,sBAAsB,IAC3BC,UAAU,QAGL,iCAAiC;AAMxC,SAASC,YAAY,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,OAAO,MAAMC,WAAW,gBAAGT,UAAU,CAInC,CACE;EACEU,QAAQ;EACRC,cAAc;EACdC,MAAM;E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U,EAAEA,UAAW;IACvBC,gBAAgB,EAAE2B,oBAAqB;IACvC1B,UAAU,EAAEA,UAAW;IACvBC,UAAU,EAAEA,UAAW;IACvBC,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBmC,eAAe,EAAElB;EAAoB,CACtC,CAAC;AAEN,CACF,CAAC;AAED3B,WAAW,CAAC8C,WAAW,GAAG,aAAa","ignoreList":[]}
|
package/lib/module/constants.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export const PACKAGE_VERSION_TAG = 'RN';
|
|
4
|
-
export const PACKAGE_VERSION = '0.0.
|
|
5
|
-
export const AdSizes = {
|
|
6
|
-
Responsive: {
|
|
7
|
-
width: -1,
|
|
8
|
-
height: -1
|
|
9
|
-
}
|
|
10
|
-
};
|
|
4
|
+
export const PACKAGE_VERSION = '0.0.35';
|
|
11
5
|
export const HTML_5_AD_NATIVE_COMPONENT_NAME = 'HTML5AdNativeComponent';
|
|
12
6
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PACKAGE_VERSION_TAG","PACKAGE_VERSION","
|
|
1
|
+
{"version":3,"names":["PACKAGE_VERSION_TAG","PACKAGE_VERSION","HTML_5_AD_NATIVE_COMPONENT_NAME"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,mBAAmB,GAAG,IAAI;AACvC,OAAO,MAAMC,eAAe,GAAG,QAAQ;AAEvC,OAAO,MAAMC,+BAA+B,GAAG,wBAAwB","ignoreList":[]}
|
package/lib/module/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const PACKAGE_SUFFIX = '';
|
|
4
|
-
export const BACKEND_DOMAIN = 'https://
|
|
3
|
+
export const PACKAGE_SUFFIX = '-beta';
|
|
4
|
+
export const BACKEND_DOMAIN = 'https://beta.v2.bg-services.adgeist.ai';
|
|
5
5
|
//# sourceMappingURL=env.js.map
|
package/lib/module/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PACKAGE_SUFFIX","BACKEND_DOMAIN"],"sourceRoot":"../../src","sources":["env.ts"],"mappings":";;AAAA,OAAO,MAAMA,cAAc,GAAG,
|
|
1
|
+
{"version":3,"names":["PACKAGE_SUFFIX","BACKEND_DOMAIN"],"sourceRoot":"../../src","sources":["env.ts"],"mappings":";;AAAA,OAAO,MAAMA,cAAc,GAAG,OAAO;AAErC,OAAO,MAAMC,cAAc,GAAG,wCAAwC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,gCAA6B;AAE3C,cAAc,6BAA0B;AAExC,cAAc,sBAAmB
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,gCAA6B;AAE3C,cAAc,6BAA0B;AAExC,cAAc,sBAAmB","ignoreList":[]}
|
|
@@ -14,23 +14,32 @@ export interface AdSize {
|
|
|
14
14
|
height?: Double;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export type AdType = 'BANNER' | 'DISPLAY' | 'COMPANION';
|
|
18
|
-
|
|
19
17
|
export interface AdFailedToLoadEvent {
|
|
20
18
|
error: string;
|
|
21
19
|
}
|
|
22
20
|
|
|
21
|
+
export interface AdWarningEvent {
|
|
22
|
+
warning: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface AdSizeChangedEvent {
|
|
26
|
+
width: Double;
|
|
27
|
+
height: Double;
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
export interface NativeProps extends ViewProps {
|
|
24
31
|
adUnitID: string;
|
|
25
32
|
adIsResponsive?: boolean;
|
|
26
33
|
adSize?: AdSize;
|
|
27
|
-
|
|
34
|
+
reserveSpace?: WithDefault<boolean, true>;
|
|
28
35
|
|
|
29
36
|
onAdLoaded?: DirectEventHandler<null>;
|
|
30
37
|
onAdFailedToLoad?: DirectEventHandler<AdFailedToLoadEvent>;
|
|
31
38
|
onAdOpened?: DirectEventHandler<null>;
|
|
32
39
|
onAdClosed?: DirectEventHandler<null>;
|
|
33
40
|
onAdClicked?: DirectEventHandler<null>;
|
|
41
|
+
onAdWarning?: DirectEventHandler<AdWarningEvent>;
|
|
42
|
+
onAdSizeChanged?: DirectEventHandler<AdSizeChangedEvent>;
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
interface NativeCommands {
|
package/lib/module/utilities.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["normalizeUrl","url","startsWith","match"],"sourceRoot":"../../src","sources":["utilities.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,GAAW,IAAK;EAC3C,IAAI,CAACA,GAAG,EAAE,OAAOA,GAAG;EACpB,IAAIA,GAAG,CAACC,UAAU,CAAC,MAAM,CAAC,EAAE;IAC1B,OAAO,WAAWD,GAAG,EAAE;EACzB;EACA,IAAI,CAACA,GAAG,CAACE,KAAK,CAAC,iBAAiB,CAAC,EAAE;IACjC,OAAO,WAAWF,GAAG,EAAE;EACzB;EACA,OAAOA,GAAG;AACZ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["normalizeUrl","url","startsWith","match","toAdSizeAxis","value","Number","isFinite","undefined"],"sourceRoot":"../../src","sources":["utilities.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAIC,GAAW,IAAK;EAC3C,IAAI,CAACA,GAAG,EAAE,OAAOA,GAAG;EACpB,IAAIA,GAAG,CAACC,UAAU,CAAC,MAAM,CAAC,EAAE;IAC1B,OAAO,WAAWD,GAAG,EAAE;EACzB;EACA,IAAI,CAACA,GAAG,CAACE,KAAK,CAAC,iBAAiB,CAAC,EAAE;IACjC,OAAO,WAAWF,GAAG,EAAE;EACzB;EACA,OAAOA,GAAG;AACZ,CAAC;AAED,OAAO,MAAMG,YAAY,GAAIC,KAAc,IACzC,OAAOA,KAAK,KAAK,QAAQ,IAAIC,MAAM,CAACC,QAAQ,CAACF,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,GAC5DA,KAAK,GACLG,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML5AdView.d.ts","sourceRoot":"","sources":["../../../../src/components/HTML5AdView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HTML5AdView.d.ts","sourceRoot":"","sources":["../../../../src/components/HTML5AdView.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAEV,2BAA2B,EAC3B,cAAc,EACf,MAAM,sCAAsC,CAAC;AAG9C,eAAO,MAAM,WAAW,wHAwKvB,CAAC"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
export declare const PACKAGE_VERSION_TAG = "RN";
|
|
2
|
-
export declare const PACKAGE_VERSION = "0.0.
|
|
3
|
-
export declare const AdSizes: {
|
|
4
|
-
Responsive: {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.0.35";
|
|
9
3
|
export declare const HTML_5_AD_NATIVE_COMPONENT_NAME = "HTML5AdNativeComponent";
|
|
10
4
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC,eAAO,MAAM
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC,eAAO,MAAM,+BAA+B,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const PACKAGE_SUFFIX = "";
|
|
2
|
-
export declare const BACKEND_DOMAIN = "https://
|
|
1
|
+
export declare const PACKAGE_SUFFIX = "-beta";
|
|
2
|
+
export declare const BACKEND_DOMAIN = "https://beta.v2.bg-services.adgeist.ai";
|
|
3
3
|
//# sourceMappingURL=env.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/env.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/env.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,eAAO,MAAM,cAAc,2CAA2C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAE5C,cAAc,0BAA0B,CAAC;AAEzC,cAAc,mBAAmB,CAAC"}
|
|
@@ -5,20 +5,28 @@ export interface AdSize {
|
|
|
5
5
|
width?: Double;
|
|
6
6
|
height?: Double;
|
|
7
7
|
}
|
|
8
|
-
export type AdType = 'BANNER' | 'DISPLAY' | 'COMPANION';
|
|
9
8
|
export interface AdFailedToLoadEvent {
|
|
10
9
|
error: string;
|
|
11
10
|
}
|
|
11
|
+
export interface AdWarningEvent {
|
|
12
|
+
warning: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AdSizeChangedEvent {
|
|
15
|
+
width: Double;
|
|
16
|
+
height: Double;
|
|
17
|
+
}
|
|
12
18
|
export interface NativeProps extends ViewProps {
|
|
13
19
|
adUnitID: string;
|
|
14
20
|
adIsResponsive?: boolean;
|
|
15
21
|
adSize?: AdSize;
|
|
16
|
-
|
|
22
|
+
reserveSpace?: WithDefault<boolean, true>;
|
|
17
23
|
onAdLoaded?: DirectEventHandler<null>;
|
|
18
24
|
onAdFailedToLoad?: DirectEventHandler<AdFailedToLoadEvent>;
|
|
19
25
|
onAdOpened?: DirectEventHandler<null>;
|
|
20
26
|
onAdClosed?: DirectEventHandler<null>;
|
|
21
27
|
onAdClicked?: DirectEventHandler<null>;
|
|
28
|
+
onAdWarning?: DirectEventHandler<AdWarningEvent>;
|
|
29
|
+
onAdSizeChanged?: DirectEventHandler<AdSizeChangedEvent>;
|
|
22
30
|
}
|
|
23
31
|
interface NativeCommands {
|
|
24
32
|
loadAd: (viewRef: React.ElementRef<HostComponent<NativeProps>>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML5AdNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/HTML5AdNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EACV,kBAAkB,EAClB,MAAM,EACN,WAAW,EACZ,MAAM,2CAA2C,CAAC;AAGnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"HTML5AdNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/specs/HTML5AdNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;CAC1E;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;wBAIE,aAAa,CAAC,WAAW,CAAC;AAF/B,wBAEgC;AAIhC,eAAO,MAAM,UAAU;+BACH,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;gCAe3C,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;CAcvD,CAAC"}
|
|
@@ -3,18 +3,17 @@ export interface FIXEDADRESPONSE {
|
|
|
3
3
|
metaData: string;
|
|
4
4
|
id: string;
|
|
5
5
|
generatedAt?: string;
|
|
6
|
-
signature?: string;
|
|
7
6
|
campaignId?: string;
|
|
8
7
|
advertiser?: Advertiser;
|
|
9
8
|
type?: string;
|
|
9
|
+
adSpaceType: AdSpaceType;
|
|
10
10
|
loadType?: string;
|
|
11
11
|
campaignValidity?: CampaignValidity;
|
|
12
|
-
creatives: Creative[];
|
|
13
12
|
creativesV1: CreativeV1[];
|
|
14
13
|
displayOptions?: DisplayOptions;
|
|
15
14
|
frontendCacheDurationSeconds?: number;
|
|
16
|
-
impressionRequirements?: ImpressionRequirements;
|
|
17
15
|
}
|
|
16
|
+
type AdSpaceType = 'banner' | 'display' | 'companion';
|
|
18
17
|
interface Advertiser {
|
|
19
18
|
id?: string;
|
|
20
19
|
name?: string;
|
|
@@ -24,19 +23,6 @@ interface CampaignValidity {
|
|
|
24
23
|
startTime?: string;
|
|
25
24
|
endTime?: string;
|
|
26
25
|
}
|
|
27
|
-
interface Creative {
|
|
28
|
-
contentModerationResult?: MongoIdWrapper;
|
|
29
|
-
createdAt?: MongoDateWrapper;
|
|
30
|
-
ctaUrl?: string;
|
|
31
|
-
description?: string;
|
|
32
|
-
fileName?: string;
|
|
33
|
-
fileSize?: number;
|
|
34
|
-
fileUrl?: string;
|
|
35
|
-
thumbnailUrl?: string;
|
|
36
|
-
title?: string;
|
|
37
|
-
type?: string;
|
|
38
|
-
updatedAt?: MongoDateWrapper;
|
|
39
|
-
}
|
|
40
26
|
interface CreativeV1 {
|
|
41
27
|
title?: string;
|
|
42
28
|
description?: string;
|
|
@@ -51,14 +37,9 @@ interface MediaItem {
|
|
|
51
37
|
fileUrl?: string;
|
|
52
38
|
thumbnailUrl?: string;
|
|
53
39
|
}
|
|
54
|
-
interface MongoIdWrapper {
|
|
55
|
-
$oid?: string;
|
|
56
|
-
}
|
|
57
|
-
interface MongoDateWrapper {
|
|
58
|
-
$date?: number;
|
|
59
|
-
}
|
|
60
40
|
interface DisplayOptions {
|
|
61
|
-
|
|
41
|
+
primaryFormats?: string[];
|
|
42
|
+
companionFormats?: string[];
|
|
62
43
|
dimensions?: Dimensions;
|
|
63
44
|
isResponsive?: boolean;
|
|
64
45
|
responsiveType?: string;
|
|
@@ -72,9 +53,5 @@ interface StyleOptions {
|
|
|
72
53
|
fontColor?: string;
|
|
73
54
|
fontFamily?: string;
|
|
74
55
|
}
|
|
75
|
-
interface ImpressionRequirements {
|
|
76
|
-
impressionType?: string[];
|
|
77
|
-
minViewDurationSeconds?: number;
|
|
78
|
-
}
|
|
79
56
|
export {};
|
|
80
57
|
//# sourceMappingURL=FixedAdResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixedAdResponse.d.ts","sourceRoot":"","sources":["../../../../src/types/FixedAdResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,
|
|
1
|
+
{"version":3,"file":"FixedAdResponse.d.ts","sourceRoot":"","sources":["../../../../src/types/FixedAdResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,SA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gB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import type { NativeSyntheticEvent } from 'react-native';
|
|
2
2
|
import type { AdSize } from './AdSize';
|
|
3
|
-
import type { AdType } from './AdType';
|
|
4
3
|
export interface HTML5AdNativeComponentProps {
|
|
5
4
|
adUnitID: string;
|
|
6
5
|
adIsResponsive?: boolean;
|
|
7
6
|
adSize?: AdSize;
|
|
8
|
-
|
|
7
|
+
reserveSpace?: boolean;
|
|
9
8
|
onAdLoaded?: () => void;
|
|
10
9
|
onAdFailedToLoad?: (event: NativeSyntheticEvent<AdFailedToLoadEvent>) => void;
|
|
11
10
|
onAdOpened?: () => void;
|
|
12
11
|
onAdClosed?: () => void;
|
|
13
12
|
onAdClicked?: () => void;
|
|
13
|
+
onAdWarning?: (event: NativeSyntheticEvent<AdWarningEvent>) => void;
|
|
14
14
|
}
|
|
15
15
|
export interface AdFailedToLoadEvent {
|
|
16
16
|
error: string;
|
|
17
17
|
}
|
|
18
|
+
export interface AdWarningEvent {
|
|
19
|
+
warning: string;
|
|
20
|
+
}
|
|
18
21
|
export interface HTML5AdViewRef {
|
|
19
22
|
loadAd: () => void;
|
|
20
23
|
destroy: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTML5AdNativeComponentProps.d.ts","sourceRoot":"","sources":["../../../../src/types/HTML5AdNativeComponentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"HTML5AdNativeComponentProps.d.ts","sourceRoot":"","sources":["../../../../src/types/HTML5AdNativeComponentProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC9E,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;CACrE;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,WASvC,CAAC"}
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../src/utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,WASvC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAAM,GAAG,SAGxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thealteroffice/react-native-adgeist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35-beta",
|
|
4
4
|
"description": "Publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -7,16 +7,19 @@ import {
|
|
|
7
7
|
useState,
|
|
8
8
|
useMemo,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import type {
|
|
10
|
+
import type { NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
11
11
|
|
|
12
12
|
import HTML5AdNativeComponent, {
|
|
13
13
|
AdCommands,
|
|
14
|
+
type AdSize,
|
|
15
|
+
type AdSizeChangedEvent,
|
|
14
16
|
} from '../specs/HTML5AdNativeComponent';
|
|
15
17
|
import type {
|
|
18
|
+
AdFailedToLoadEvent,
|
|
16
19
|
HTML5AdNativeComponentProps,
|
|
17
20
|
HTML5AdViewRef,
|
|
18
21
|
} from '../types/HTML5AdNativeComponentProps';
|
|
19
|
-
import {
|
|
22
|
+
import { toAdSizeAxis } from '../utilities';
|
|
20
23
|
|
|
21
24
|
export const HTML5AdView = forwardRef<
|
|
22
25
|
HTML5AdViewRef,
|
|
@@ -27,35 +30,81 @@ export const HTML5AdView = forwardRef<
|
|
|
27
30
|
adUnitID,
|
|
28
31
|
adIsResponsive,
|
|
29
32
|
adSize,
|
|
30
|
-
|
|
33
|
+
reserveSpace,
|
|
31
34
|
onAdLoaded,
|
|
32
35
|
onAdFailedToLoad,
|
|
33
36
|
onAdOpened,
|
|
34
37
|
onAdClosed,
|
|
35
38
|
onAdClicked,
|
|
39
|
+
onAdWarning,
|
|
36
40
|
},
|
|
37
41
|
ref
|
|
38
42
|
) => {
|
|
39
43
|
const nativeRef = useRef<any>(null);
|
|
40
44
|
const [isViewReady, setIsViewReady] = useState(false);
|
|
45
|
+
const [resolvedSize, setResolvedSize] = useState<AdSize | null>(null);
|
|
46
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
41
47
|
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const collapsesOnFailure = reserveSpace === false;
|
|
49
|
+
|
|
50
|
+
const width = toAdSizeAxis(adSize?.width);
|
|
51
|
+
const height = toAdSizeAxis(adSize?.height);
|
|
52
|
+
|
|
53
|
+
const resolvedAdSize = useMemo<AdSize>(() => {
|
|
54
|
+
const dimensions: AdSize = {};
|
|
55
|
+
|
|
56
|
+
if (width !== undefined) {
|
|
57
|
+
dimensions.width = width;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (height !== undefined) {
|
|
61
|
+
dimensions.height = height;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return dimensions;
|
|
65
|
+
}, [width, height]);
|
|
66
|
+
|
|
67
|
+
const nativeSize = adIsResponsive ? null : resolvedSize;
|
|
50
68
|
|
|
51
69
|
const containerStyle = useMemo<ViewStyle>(
|
|
52
70
|
() => ({
|
|
53
|
-
width:
|
|
54
|
-
height:
|
|
71
|
+
width: nativeSize?.width ?? width ?? '100%',
|
|
72
|
+
height: nativeSize?.height ?? height ?? '100%',
|
|
55
73
|
}),
|
|
56
|
-
[
|
|
74
|
+
[width, height, nativeSize]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const handleAdSizeChanged = useCallback(
|
|
78
|
+
(event: NativeSyntheticEvent<AdSizeChangedEvent>) => {
|
|
79
|
+
const { width: nativeWidth, height: nativeHeight } = event.nativeEvent;
|
|
80
|
+
|
|
81
|
+
if (nativeWidth <= 0 || nativeHeight <= 0) return;
|
|
82
|
+
|
|
83
|
+
setResolvedSize((current) =>
|
|
84
|
+
current?.width === nativeWidth && current?.height === nativeHeight
|
|
85
|
+
? current
|
|
86
|
+
: { width: nativeWidth, height: nativeHeight }
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
[]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const handleAdFailedToLoad = useCallback(
|
|
93
|
+
(event: NativeSyntheticEvent<AdFailedToLoadEvent>) => {
|
|
94
|
+
onAdFailedToLoad?.(event);
|
|
95
|
+
|
|
96
|
+
if (collapsesOnFailure) {
|
|
97
|
+
setHasFailed(true);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
[onAdFailedToLoad, collapsesOnFailure]
|
|
57
101
|
);
|
|
58
102
|
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setResolvedSize(null);
|
|
105
|
+
setHasFailed(false);
|
|
106
|
+
}, [adUnitID]);
|
|
107
|
+
|
|
59
108
|
const loadAdInternal = useCallback(() => {
|
|
60
109
|
if (!nativeRef.current) {
|
|
61
110
|
console.warn('HTML5AdView: Cannot load ad, native view not ready');
|
|
@@ -94,6 +143,11 @@ export const HTML5AdView = forwardRef<
|
|
|
94
143
|
ref,
|
|
95
144
|
() => ({
|
|
96
145
|
loadAd: () => {
|
|
146
|
+
if (hasFailed) {
|
|
147
|
+
setHasFailed(false);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
97
151
|
if (isViewReady && nativeRef.current) {
|
|
98
152
|
loadAdInternal();
|
|
99
153
|
}
|
|
@@ -108,11 +162,11 @@ export const HTML5AdView = forwardRef<
|
|
|
108
162
|
}
|
|
109
163
|
},
|
|
110
164
|
}),
|
|
111
|
-
[isViewReady, loadAdInternal]
|
|
165
|
+
[isViewReady, loadAdInternal, hasFailed]
|
|
112
166
|
);
|
|
113
167
|
|
|
114
|
-
if (
|
|
115
|
-
|
|
168
|
+
if (hasFailed && collapsesOnFailure) {
|
|
169
|
+
return null;
|
|
116
170
|
}
|
|
117
171
|
|
|
118
172
|
return (
|
|
@@ -121,15 +175,17 @@ export const HTML5AdView = forwardRef<
|
|
|
121
175
|
style={containerStyle}
|
|
122
176
|
// Required Props, it will take values from React Component props
|
|
123
177
|
adUnitID={adUnitID}
|
|
124
|
-
adSize={adIsResponsive ? AdSizes.Responsive : adSize}
|
|
125
178
|
adIsResponsive={adIsResponsive}
|
|
126
|
-
|
|
179
|
+
adSize={resolvedAdSize}
|
|
180
|
+
reserveSpace={reserveSpace}
|
|
127
181
|
// Required Event Callbacks
|
|
128
182
|
onAdLoaded={onAdLoaded}
|
|
129
|
-
onAdFailedToLoad={
|
|
183
|
+
onAdFailedToLoad={handleAdFailedToLoad}
|
|
130
184
|
onAdOpened={onAdOpened}
|
|
131
185
|
onAdClosed={onAdClosed}
|
|
132
186
|
onAdClicked={onAdClicked}
|
|
187
|
+
onAdWarning={onAdWarning}
|
|
188
|
+
onAdSizeChanged={handleAdSizeChanged}
|
|
133
189
|
/>
|
|
134
190
|
);
|
|
135
191
|
}
|