@capacitor-community/admob 8.2.0-beta.pr484.shaa6be63853bbd → 8.2.1

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.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/android/src/main/java/com/getcapacitor/community/admob/AdMob.java +73 -0
  3. package/android/src/main/java/com/getcapacitor/community/admob/nativeads/NativeAdExecutor.kt +378 -0
  4. package/android/src/main/java/com/getcapacitor/community/admob/nativeads/NativeAdFeedSessions.kt +35 -0
  5. package/android/src/main/java/com/getcapacitor/community/admob/nativeads/NativeAdPlacementValue.kt +44 -0
  6. package/android/src/main/java/com/getcapacitor/community/admob/nativeads/NativeAdPluginEvents.kt +11 -0
  7. package/android/src/main/java/com/getcapacitor/community/admob/nativeads/PluginNativeAdView.kt +187 -0
  8. package/dist/esm/index.d.ts +1 -0
  9. package/dist/esm/index.js +5 -1
  10. package/dist/esm/index.js.map +1 -1
  11. package/dist/esm/native-ads/index.d.ts +6 -0
  12. package/dist/esm/native-ads/index.js +4 -0
  13. package/dist/esm/native-ads/index.js.map +1 -0
  14. package/dist/esm/native-ads/native-ad-definitions.interface.d.ts +14 -0
  15. package/dist/esm/native-ads/native-ad-definitions.interface.js +2 -0
  16. package/dist/esm/native-ads/native-ad-definitions.interface.js.map +1 -0
  17. package/dist/esm/native-ads/native-ad-element.d.ts +9 -0
  18. package/dist/esm/native-ads/native-ad-element.js +53 -0
  19. package/dist/esm/native-ads/native-ad-element.js.map +1 -0
  20. package/dist/esm/native-ads/native-ad-event.interface.d.ts +5 -0
  21. package/dist/esm/native-ads/native-ad-event.interface.js +2 -0
  22. package/dist/esm/native-ads/native-ad-event.interface.js.map +1 -0
  23. package/dist/esm/native-ads/native-ad-feed.d.ts +72 -0
  24. package/dist/esm/native-ads/native-ad-feed.js +568 -0
  25. package/dist/esm/native-ads/native-ad-feed.js.map +1 -0
  26. package/dist/esm/native-ads/native-ad-geometry.d.ts +8 -0
  27. package/dist/esm/native-ads/native-ad-geometry.js +91 -0
  28. package/dist/esm/native-ads/native-ad-geometry.js.map +1 -0
  29. package/dist/esm/native-ads/native-ad-options.interface.d.ts +36 -0
  30. package/dist/esm/native-ads/native-ad-options.interface.js +2 -0
  31. package/dist/esm/native-ads/native-ad-options.interface.js.map +1 -0
  32. package/dist/esm/native-ads/native-ad-placement.interface.d.ts +26 -0
  33. package/dist/esm/native-ads/native-ad-placement.interface.js +2 -0
  34. package/dist/esm/native-ads/native-ad-placement.interface.js.map +1 -0
  35. package/dist/esm/native-ads/native-ad-plugin-events.enum.d.ts +9 -0
  36. package/dist/esm/native-ads/native-ad-plugin-events.enum.js +11 -0
  37. package/dist/esm/native-ads/native-ad-plugin-events.enum.js.map +1 -0
  38. package/dist/esm/native-ads/native-ad-style.interface.d.ts +30 -0
  39. package/dist/esm/native-ads/native-ad-style.interface.js +2 -0
  40. package/dist/esm/native-ads/native-ad-style.interface.js.map +1 -0
  41. package/dist/esm/native-ads/native-ad-template.enum.d.ts +11 -0
  42. package/dist/esm/native-ads/native-ad-template.enum.js +13 -0
  43. package/dist/esm/native-ads/native-ad-template.enum.js.map +1 -0
  44. package/dist/esm/web.d.ts +9 -1
  45. package/dist/esm/web.js +15 -0
  46. package/dist/esm/web.js.map +1 -1
  47. package/dist/plugin.cjs.js +751 -1
  48. package/dist/plugin.cjs.js.map +1 -1
  49. package/dist/plugin.js +751 -1
  50. package/dist/plugin.js.map +1 -1
  51. package/docs/native-ads.md +161 -0
  52. package/ios/Sources/AdMobPlugin/AdMobPlugin.swift +76 -44
  53. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdExecutor.swift +354 -0
  54. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdFeedSessions.swift +34 -0
  55. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdPlacementValue.swift +50 -0
  56. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdPluginEvents.swift +11 -0
  57. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdScrollTracker.swift +66 -0
  58. package/ios/Sources/AdMobPlugin/NativeAds/NativeAdValues.swift +27 -0
  59. package/ios/Sources/AdMobPlugin/NativeAds/PluginNativeAdView.swift +187 -0
  60. package/ios/Tests/AdMobPluginTests/AdMobPluginTests.swift +37 -0
  61. package/ios/Tests/AdMobPluginTests/NativeAdScrollTrackerTests.swift +47 -0
  62. package/package.json +1 -1
@@ -0,0 +1,187 @@
1
+ package com.getcapacitor.community.admob.nativeads
2
+
3
+ import android.content.Context
4
+ import android.graphics.Color
5
+ import android.graphics.drawable.GradientDrawable
6
+ import android.view.Gravity
7
+ import android.view.View
8
+ import android.view.ViewGroup
9
+ import android.widget.Button
10
+ import android.widget.FrameLayout
11
+ import android.widget.ImageView
12
+ import android.widget.LinearLayout
13
+ import android.widget.TextView
14
+ import com.getcapacitor.JSObject
15
+ import com.google.android.gms.ads.nativead.AdChoicesView
16
+ import com.google.android.gms.ads.nativead.MediaView
17
+ import com.google.android.gms.ads.nativead.NativeAd
18
+ import com.google.android.gms.ads.nativead.NativeAdView
19
+ import kotlin.math.max
20
+ import kotlin.math.min
21
+ import kotlin.math.roundToInt
22
+
23
+ /** Builds the plugin-owned layout around the final Next-Gen SDK [NativeAdView]. */
24
+ internal class PluginNativeAdView private constructor(
25
+ private val context: Context,
26
+ nativeAd: NativeAd,
27
+ template: String,
28
+ private val style: JSObject,
29
+ ) {
30
+ private val density = context.resources.displayMetrics.density
31
+ private val view = NativeAdView(context)
32
+
33
+ init {
34
+ view.layoutParams = FrameLayout.LayoutParams(
35
+ ViewGroup.LayoutParams.MATCH_PARENT,
36
+ ViewGroup.LayoutParams.MATCH_PARENT,
37
+ )
38
+ applyBackground()
39
+ bindAssets(nativeAd, template == "small")
40
+ view.setNativeAd(nativeAd)
41
+ }
42
+
43
+ private fun bindAssets(nativeAd: NativeAd, isSmall: Boolean) {
44
+ val content = LinearLayout(context).apply {
45
+ orientation = LinearLayout.VERTICAL
46
+ setPadding(pixels(12), pixels(12), pixels(12), pixels(12))
47
+ }
48
+ view.addView(
49
+ content,
50
+ FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT),
51
+ )
52
+
53
+ if (!isSmall) {
54
+ val media = MediaView(context).apply { minimumHeight = pixels(120) }
55
+ content.addView(media, LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f))
56
+ view.mediaView = media
57
+ }
58
+
59
+ val details = LinearLayout(context).apply {
60
+ orientation = LinearLayout.VERTICAL
61
+ setPadding(0, pixels(if (isSmall) 0 else 8), 0, 0)
62
+ }
63
+ content.addView(
64
+ details,
65
+ LinearLayout.LayoutParams(
66
+ ViewGroup.LayoutParams.MATCH_PARENT,
67
+ if (isSmall) ViewGroup.LayoutParams.MATCH_PARENT else ViewGroup.LayoutParams.WRAP_CONTENT,
68
+ ),
69
+ )
70
+
71
+ addAttribution(details)
72
+ bindTextAssets(details, nativeAd, isSmall)
73
+ bindFooter(details, nativeAd, isSmall)
74
+
75
+ val adChoices = AdChoicesView(context)
76
+ view.addView(adChoices, FrameLayout.LayoutParams(pixels(24), pixels(24), Gravity.TOP or Gravity.END))
77
+ view.adChoicesView = adChoices
78
+ }
79
+
80
+ private fun addAttribution(parent: LinearLayout) {
81
+ val attribution = TextView(context).apply {
82
+ text = "Ad"
83
+ textSize = 10f
84
+ setTextColor(Color.WHITE)
85
+ setBackgroundColor(Color.DKGRAY)
86
+ gravity = Gravity.CENTER
87
+ }
88
+ parent.addView(attribution, LinearLayout.LayoutParams(pixels(28), pixels(20)))
89
+ }
90
+
91
+ private fun bindTextAssets(parent: LinearLayout, nativeAd: NativeAd, isSmall: Boolean) {
92
+ val headline = TextView(context).apply {
93
+ text = nativeAd.headline
94
+ textSize = fontStyle("headlineFontSize", 16f, 12f, 24f)
95
+ setTextColor(colorStyle("headlineColor", Color.BLACK))
96
+ maxLines = 2
97
+ }
98
+ parent.addView(headline)
99
+ view.headlineView = headline
100
+
101
+ val body = TextView(context).apply {
102
+ text = nativeAd.body
103
+ textSize = fontStyle("bodyFontSize", 13f, 10f, 18f)
104
+ setTextColor(colorStyle("bodyColor", Color.DKGRAY))
105
+ maxLines = if (isSmall) 1 else 2
106
+ visibility = if (isSmall || nativeAd.body == null) View.GONE else View.VISIBLE
107
+ }
108
+ parent.addView(body)
109
+ view.bodyView = body
110
+ }
111
+
112
+ private fun bindFooter(parent: LinearLayout, nativeAd: NativeAd, isSmall: Boolean) {
113
+ val footer = LinearLayout(context).apply { gravity = Gravity.CENTER_VERTICAL }
114
+ parent.addView(
115
+ footer,
116
+ LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT),
117
+ )
118
+
119
+ val icon = ImageView(context).apply {
120
+ scaleType = ImageView.ScaleType.CENTER_CROP
121
+ nativeAd.icon?.drawable?.let(::setImageDrawable) ?: run { visibility = View.GONE }
122
+ }
123
+ val iconSize = pixels(if (isSmall) 28 else 32)
124
+ footer.addView(icon, LinearLayout.LayoutParams(iconSize, iconSize))
125
+ view.iconView = icon
126
+
127
+ val advertiser = TextView(context).apply {
128
+ text = nativeAd.advertiser
129
+ textSize = 11f
130
+ maxLines = 1
131
+ visibility = if (nativeAd.advertiser == null) View.GONE else View.VISIBLE
132
+ }
133
+ footer.addView(advertiser, LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f))
134
+ view.advertiserView = advertiser
135
+
136
+ val callToAction = Button(context).apply {
137
+ text = nativeAd.callToAction
138
+ textSize = fontStyle("callToActionFontSize", 13f, 12f, 18f)
139
+ setTextColor(colorStyle("callToActionTextColor", Color.WHITE))
140
+ setBackgroundColor(colorStyle("callToActionBackgroundColor", Color.rgb(33, 150, 243)))
141
+ visibility = if (nativeAd.callToAction == null) View.GONE else View.VISIBLE
142
+ }
143
+ footer.addView(
144
+ callToAction,
145
+ LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, pixels(if (isSmall) 32 else 40)),
146
+ )
147
+ view.callToActionView = callToAction
148
+ }
149
+
150
+ private fun applyBackground() {
151
+ val drawable = GradientDrawable().apply {
152
+ setColor(colorStyle("backgroundColor", Color.WHITE))
153
+ cornerRadius = pixels(floatStyle("cornerRadius", 0f)).toFloat()
154
+ val borderWidth = pixels(floatStyle("borderWidth", 0f))
155
+ if (borderWidth > 0) setStroke(borderWidth, colorStyle("borderColor", Color.TRANSPARENT))
156
+ }
157
+ view.background = drawable
158
+ }
159
+
160
+ private fun pixels(logicalPixels: Number): Int = (logicalPixels.toDouble() * density).roundToInt()
161
+
162
+ private fun colorStyle(key: String, fallback: Int): Int {
163
+ val hex = style.getString(key)?.trim()?.removePrefix("#") ?: return fallback
164
+ val rgba = hex.toLongOrNull(16) ?: return fallback
165
+ return when (hex.length) {
166
+ 6 -> Color.rgb((rgba shr 16).toInt() and 0xff, (rgba shr 8).toInt() and 0xff, rgba.toInt() and 0xff)
167
+ 8 -> Color.argb(
168
+ rgba.toInt() and 0xff,
169
+ (rgba shr 24).toInt() and 0xff,
170
+ (rgba shr 16).toInt() and 0xff,
171
+ (rgba shr 8).toInt() and 0xff,
172
+ )
173
+ else -> fallback
174
+ }
175
+ }
176
+
177
+ private fun floatStyle(key: String, fallback: Float): Float =
178
+ if (style.has(key)) max(0f, style.optDouble(key, fallback.toDouble()).toFloat()) else fallback
179
+
180
+ private fun fontStyle(key: String, fallback: Float, minimum: Float, maximum: Float): Float =
181
+ min(maximum, max(minimum, floatStyle(key, fallback)))
182
+
183
+ companion object {
184
+ fun create(context: Context, nativeAd: NativeAd, template: String, style: JSObject): NativeAdView =
185
+ PluginNativeAdView(context, nativeAd, template, style).view
186
+ }
187
+ }
@@ -8,4 +8,5 @@ export * from './reward/index';
8
8
  export * from './consent/index';
9
9
  export * from './shared/index';
10
10
  export * from './app-open/index';
11
+ export * from './native-ads/index';
11
12
  export { AdMob };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { registerPlugin } from '@capacitor/core';
2
- const AdMob = registerPlugin('AdMob', {
2
+ import { configureNativeAdBridge } from './native-ads/native-ad-feed';
3
+ const nativeAdBridge = registerPlugin('AdMob', {
3
4
  web: () => import('./web').then((m) => new m.AdMobWeb()),
4
5
  });
6
+ const AdMob = nativeAdBridge;
7
+ configureNativeAdBridge(nativeAdBridge);
5
8
  export * from './definitions';
6
9
  export * from './banner/index';
7
10
  export * from './interstitial/index';
@@ -10,5 +13,6 @@ export * from './reward/index';
10
13
  export * from './consent/index';
11
14
  export * from './shared/index';
12
15
  export * from './app-open/index';
16
+ export * from './native-ads/index';
13
17
  export { AdMob };
14
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,KAAK,GAAG,cAAc,CAAc,OAAO,EAAE;IACjD,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;CACzD,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,cAAc,GAAG,cAAc,CAAoC,OAAO,EAAE;IAChF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAuC,CAAC;CAC9F,CAAC,CAAC;AACH,MAAM,KAAK,GAAgB,cAAc,CAAC;AAE1C,uBAAuB,CAAC,cAAc,CAAC,CAAC;AAExC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { NativeAdErrorEvent, NativeAdEvent, NativeAdRevenueEvent } from './native-ad-event.interface';
2
+ export { NativeAdFeed } from './native-ad-feed';
3
+ export type { NativeAdFeedOptions } from './native-ad-options.interface';
4
+ export * from './native-ad-plugin-events.enum';
5
+ export type { NativeAdStyle } from './native-ad-style.interface';
6
+ export * from './native-ad-template.enum';
@@ -0,0 +1,4 @@
1
+ export { NativeAdFeed } from './native-ad-feed';
2
+ export * from './native-ad-plugin-events.enum';
3
+ export * from './native-ad-template.enum';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/native-ads/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,cAAc,gCAAgC,CAAC;AAE/C,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { NativeAdEvent, NativeAdErrorEvent, NativeAdRevenueEvent } from './native-ad-event.interface';
3
+ import type { NativeAdCommandIdentity, NativeAdFeedSession, NativeAdLoadOptions } from './native-ad-options.interface';
4
+ import type { NativeAdPlacementBatch } from './native-ad-placement.interface';
5
+ import type { NativeAdPluginEvents } from './native-ad-plugin-events.enum';
6
+ /** Low-level native bridge used by {@link NativeAdFeed}. */
7
+ export interface NativeAdDefinitions {
8
+ startNativeAdFeed(options: NativeAdFeedSession): Promise<void>;
9
+ destroyNativeAdFeed(options: NativeAdFeedSession): Promise<void>;
10
+ loadNativeAd(options: NativeAdLoadOptions): Promise<void>;
11
+ updateNativeAdPlacements(options: NativeAdPlacementBatch): Promise<void>;
12
+ removeNativeAd(options: NativeAdCommandIdentity): Promise<void>;
13
+ addListener(eventName: NativeAdPluginEvents, listenerFunc: (info: (NativeAdEvent | NativeAdErrorEvent | NativeAdRevenueEvent) & NativeAdFeedSession) => void): Promise<PluginListenerHandle>;
14
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=native-ad-definitions.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-ad-definitions.interface.js","sourceRoot":"","sources":["../../../src/native-ads/native-ad-definitions.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare const NATIVE_AD_ELEMENT_NAME = "capacitor-admob-native";
2
+ interface NativeAdElementFeed {
3
+ attach(slotKey: string, element: HTMLElement): void;
4
+ detach(element: HTMLElement): void;
5
+ }
6
+ type NativeAdFeedLookup = (feedId: string) => NativeAdElementFeed | undefined;
7
+ export declare const defineNativeAdElement: (findFeed: NativeAdFeedLookup) => void;
8
+ export declare const connectNativeAdElements: () => void;
9
+ export {};
@@ -0,0 +1,53 @@
1
+ export const NATIVE_AD_ELEMENT_NAME = 'capacitor-admob-native';
2
+ export const defineNativeAdElement = (findFeed) => {
3
+ const runtime = globalThis;
4
+ runtime.__capacitorAdMobNativeFeedLookup = findFeed;
5
+ if (typeof customElements === 'undefined' || customElements.get(NATIVE_AD_ELEMENT_NAME)) {
6
+ return;
7
+ }
8
+ customElements.define(NATIVE_AD_ELEMENT_NAME, class extends HTMLElement {
9
+ static get observedAttributes() {
10
+ return ['feed-id', 'slot-key'];
11
+ }
12
+ connectedCallback() {
13
+ this.connectToFeed();
14
+ }
15
+ disconnectedCallback() {
16
+ this.disconnectFromFeed();
17
+ }
18
+ attributeChangedCallback() {
19
+ if (!this.isConnected) {
20
+ return;
21
+ }
22
+ this.disconnectFromFeed();
23
+ this.connectToFeed();
24
+ }
25
+ connectToFeed() {
26
+ var _a, _b, _c;
27
+ const feedId = (_a = this.getAttribute('feed-id')) === null || _a === void 0 ? void 0 : _a.trim();
28
+ const slotKey = (_b = this.getAttribute('slot-key')) === null || _b === void 0 ? void 0 : _b.trim();
29
+ const feed = feedId ? (_c = runtime.__capacitorAdMobNativeFeedLookup) === null || _c === void 0 ? void 0 : _c.call(runtime, feedId) : undefined;
30
+ if (!feed || !slotKey) {
31
+ return;
32
+ }
33
+ try {
34
+ feed.attach(slotKey, this);
35
+ this.attachedFeed = feed;
36
+ }
37
+ catch (error) {
38
+ this.dispatchEvent(new CustomEvent('nativeAdError', { bubbles: true, detail: error }));
39
+ }
40
+ }
41
+ disconnectFromFeed() {
42
+ var _a;
43
+ (_a = this.attachedFeed) === null || _a === void 0 ? void 0 : _a.detach(this);
44
+ this.attachedFeed = undefined;
45
+ }
46
+ });
47
+ };
48
+ export const connectNativeAdElements = () => {
49
+ document
50
+ .querySelectorAll(NATIVE_AD_ELEMENT_NAME)
51
+ .forEach((element) => { var _a, _b; return (_b = (_a = element).connectToFeed) === null || _b === void 0 ? void 0 : _b.call(_a); });
52
+ };
53
+ //# sourceMappingURL=native-ad-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-ad-element.js","sourceRoot":"","sources":["../../../src/native-ads/native-ad-element.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAW/D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAA4B,EAAQ,EAAE;IAC1E,MAAM,OAAO,GAAG,UAAoC,CAAC;IACrD,OAAO,CAAC,gCAAgC,GAAG,QAAQ,CAAC;IACpD,IAAI,OAAO,cAAc,KAAK,WAAW,IAAI,cAAc,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;QACxF,OAAO;IACT,CAAC;IAED,cAAc,CAAC,MAAM,CACnB,sBAAsB,EACtB,KAAM,SAAQ,WAAW;QAGvB,MAAM,KAAK,kBAAkB;YAC3B,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;QACjC,CAAC;QAED,iBAAiB;YACf,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;QAED,oBAAoB;YAClB,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,CAAC;QAED,wBAAwB;YACtB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC1B,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;QAED,aAAa;;YACX,MAAM,MAAM,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,0CAAE,IAAI,EAAE,CAAC;YACpD,MAAM,OAAO,GAAG,MAAA,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,0CAAE,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,gCAAgC,wDAAG,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACrF,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YACD,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;gBAC3B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACzF,CAAC;QACH,CAAC;QAEO,kBAAkB;;YACxB,MAAA,IAAI,CAAC,YAAY,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAChC,CAAC;KACF,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAS,EAAE;IAChD,QAAQ;SACL,gBAAgB,CAAc,sBAAsB,CAAC;SACrD,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,eAAC,OAAA,MAAA,MAAC,OAA2B,EAAC,aAAa,kDAAI,CAAA,EAAA,CAAC,CAAC;AAC1E,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { AdMobError, AdMobRevenueData } from '../shared';
2
+ import type { NativeAdIdentity } from './native-ad-options.interface';
3
+ export type NativeAdErrorEvent = NativeAdIdentity & AdMobError;
4
+ export type NativeAdRevenueEvent = NativeAdIdentity & AdMobRevenueData;
5
+ export type NativeAdEvent = NativeAdIdentity;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=native-ad-event.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-ad-event.interface.js","sourceRoot":"","sources":["../../../src/native-ads/native-ad-event.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ import type { NativeAdDefinitions } from './native-ad-definitions.interface';
3
+ import type { NativeAdEvent, NativeAdErrorEvent, NativeAdRevenueEvent } from './native-ad-event.interface';
4
+ import type { NativeAdFeedOptions } from './native-ad-options.interface';
5
+ import type { NativeAdPluginEvents } from './native-ad-plugin-events.enum';
6
+ /**
7
+ * Experimental manager for native-ad integration research.
8
+ *
9
+ * A stable `slotKey`, rather than the element or array index, owns the native
10
+ * ad lifecycle. Virtual-scroller compatibility has not yet been validated.
11
+ *
12
+ * @experimental Native overlay gesture routing is still being validated on devices.
13
+ */
14
+ export declare class NativeAdFeed {
15
+ private readonly options;
16
+ private readonly nativeScrollElement?;
17
+ private readonly sessionId;
18
+ private readonly slots;
19
+ private readonly elementSlots;
20
+ private readonly scrollRoots;
21
+ private readonly intersectionObserver?;
22
+ private readonly resizeObserver?;
23
+ private destroyed;
24
+ private nativeStarted;
25
+ private paused;
26
+ private layoutInvalidated;
27
+ private placementFrame?;
28
+ private lastPlacements?;
29
+ private lastPlacementWasDirect;
30
+ private placementAcknowledgementRequired;
31
+ private settleTimer?;
32
+ private placementUpdateTask?;
33
+ private operationTask;
34
+ private destroyTask?;
35
+ private updateDirty;
36
+ private placementSequence;
37
+ private readonly listenerHandles;
38
+ private constructor();
39
+ static create(options: NativeAdFeedOptions): Promise<NativeAdFeed>;
40
+ get feedId(): string;
41
+ addListener(eventName: NativeAdPluginEvents.Loaded | NativeAdPluginEvents.Clicked | NativeAdPluginEvents.AdImpression | NativeAdPluginEvents.Opened | NativeAdPluginEvents.Closed, listener: (event: NativeAdEvent) => void): Promise<PluginListenerHandle>;
42
+ addListener(eventName: NativeAdPluginEvents.FailedToLoad, listener: (event: NativeAdErrorEvent) => void): Promise<PluginListenerHandle>;
43
+ addListener(eventName: NativeAdPluginEvents.AdPaid, listener: (event: NativeAdRevenueEvent) => void): Promise<PluginListenerHandle>;
44
+ attach(slotKey: string, element: HTMLElement): void;
45
+ detach(element: HTMLElement): void;
46
+ reload(slotKey: string): Promise<void>;
47
+ /** Immediately hides this feed's overlays until {@link resume} is called. */
48
+ pause(): Promise<void>;
49
+ /** Re-evaluates slots and restores eligible overlays after the viewport settles. */
50
+ resume(): void;
51
+ /** Hides stale overlays and remeasures after an application-driven layout change. */
52
+ invalidateLayout(): Promise<void>;
53
+ destroy(): Promise<void>;
54
+ private readonly handleViewportMotion;
55
+ private schedulePlacementUpdate;
56
+ private updateScrollRoots;
57
+ private readonly handleVisibilityChange;
58
+ private scheduleEvaluation;
59
+ private evaluate;
60
+ private loadState;
61
+ private evictUnusedAds;
62
+ private occupiesNativeAd;
63
+ private getVisibleStates;
64
+ private isSupportedSize;
65
+ private removeStateAd;
66
+ private runOperation;
67
+ private destroyResources;
68
+ private requestPlacementUpdate;
69
+ private flushPlacementUpdates;
70
+ private assertActive;
71
+ }
72
+ export declare const configureNativeAdBridge: (adMobBridge: NativeAdDefinitions) => void;