react-native-empower-mobile-ads 1.0.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.
Files changed (69) hide show
  1. package/README.md +149 -0
  2. package/ios/EmpowerAdsModule.m +21 -0
  3. package/ios/EmpowerAdsModule.swift +111 -0
  4. package/ios/EmpowerAppOpenModule.m +16 -0
  5. package/ios/EmpowerAppOpenModule.swift +55 -0
  6. package/ios/EmpowerBannerViewManager.m +14 -0
  7. package/ios/EmpowerBannerViewManager.swift +121 -0
  8. package/ios/EmpowerInterstitialModule.m +18 -0
  9. package/ios/EmpowerInterstitialModule.swift +62 -0
  10. package/ios/EmpowerRewardedModule.m +18 -0
  11. package/ios/EmpowerRewardedModule.swift +70 -0
  12. package/lib/commonjs/AppOpenAd.js +40 -0
  13. package/lib/commonjs/AppOpenAd.js.map +1 -0
  14. package/lib/commonjs/BannerAd.js +69 -0
  15. package/lib/commonjs/BannerAd.js.map +1 -0
  16. package/lib/commonjs/EmpowerAds.js +62 -0
  17. package/lib/commonjs/EmpowerAds.js.map +1 -0
  18. package/lib/commonjs/InterstitialAd.js +40 -0
  19. package/lib/commonjs/InterstitialAd.js.map +1 -0
  20. package/lib/commonjs/RewardedAd.js +41 -0
  21. package/lib/commonjs/RewardedAd.js.map +1 -0
  22. package/lib/commonjs/StickyAd.js +71 -0
  23. package/lib/commonjs/StickyAd.js.map +1 -0
  24. package/lib/commonjs/index.js +61 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/commonjs/types.js +34 -0
  27. package/lib/commonjs/types.js.map +1 -0
  28. package/lib/module/AppOpenAd.js +34 -0
  29. package/lib/module/AppOpenAd.js.map +1 -0
  30. package/lib/module/BannerAd.js +61 -0
  31. package/lib/module/BannerAd.js.map +1 -0
  32. package/lib/module/EmpowerAds.js +56 -0
  33. package/lib/module/EmpowerAds.js.map +1 -0
  34. package/lib/module/InterstitialAd.js +34 -0
  35. package/lib/module/InterstitialAd.js.map +1 -0
  36. package/lib/module/RewardedAd.js +35 -0
  37. package/lib/module/RewardedAd.js.map +1 -0
  38. package/lib/module/StickyAd.js +63 -0
  39. package/lib/module/StickyAd.js.map +1 -0
  40. package/lib/module/index.js +15 -0
  41. package/lib/module/index.js.map +1 -0
  42. package/lib/module/types.js +37 -0
  43. package/lib/module/types.js.map +1 -0
  44. package/lib/typescript/AppOpenAd.d.ts +21 -0
  45. package/lib/typescript/AppOpenAd.d.ts.map +1 -0
  46. package/lib/typescript/BannerAd.d.ts +4 -0
  47. package/lib/typescript/BannerAd.d.ts.map +1 -0
  48. package/lib/typescript/EmpowerAds.d.ts +37 -0
  49. package/lib/typescript/EmpowerAds.d.ts.map +1 -0
  50. package/lib/typescript/InterstitialAd.d.ts +24 -0
  51. package/lib/typescript/InterstitialAd.d.ts.map +1 -0
  52. package/lib/typescript/RewardedAd.d.ts +25 -0
  53. package/lib/typescript/RewardedAd.d.ts.map +1 -0
  54. package/lib/typescript/StickyAd.d.ts +4 -0
  55. package/lib/typescript/StickyAd.d.ts.map +1 -0
  56. package/lib/typescript/index.d.ts +8 -0
  57. package/lib/typescript/index.d.ts.map +1 -0
  58. package/lib/typescript/types.d.ts +80 -0
  59. package/lib/typescript/types.d.ts.map +1 -0
  60. package/package.json +63 -0
  61. package/react-native-empower-mobile-ads.podspec +27 -0
  62. package/src/AppOpenAd.ts +43 -0
  63. package/src/BannerAd.tsx +81 -0
  64. package/src/EmpowerAds.ts +63 -0
  65. package/src/InterstitialAd.ts +50 -0
  66. package/src/RewardedAd.ts +51 -0
  67. package/src/StickyAd.tsx +84 -0
  68. package/src/index.ts +23 -0
  69. package/src/types.ts +95 -0
@@ -0,0 +1,34 @@
1
+ import { NativeModules, NativeEventEmitter } from 'react-native';
2
+ const {
3
+ EmpowerInterstitialModule
4
+ } = NativeModules;
5
+ const emitter = new NativeEventEmitter(EmpowerInterstitialModule);
6
+ export const InterstitialAd = {
7
+ /**
8
+ * Load an interstitial ad for the given zone.
9
+ */
10
+ load(zoneId, options) {
11
+ return EmpowerInterstitialModule.load(zoneId ?? null, options?.keywords ?? null, options?.customParameters ?? null);
12
+ },
13
+ /**
14
+ * Check if an interstitial ad is ready to show.
15
+ */
16
+ isReady() {
17
+ return EmpowerInterstitialModule.isReady();
18
+ },
19
+ /**
20
+ * Show the loaded interstitial ad.
21
+ */
22
+ show() {
23
+ return EmpowerInterstitialModule.show();
24
+ },
25
+ /**
26
+ * Listen for interstitial ad status changes.
27
+ * Returns a function to remove the listener.
28
+ */
29
+ addEventListener(event, callback) {
30
+ const subscription = emitter.addListener('onInterstitialStatusChanged', callback);
31
+ return () => subscription.remove();
32
+ }
33
+ };
34
+ //# sourceMappingURL=InterstitialAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","EmpowerInterstitialModule","emitter","InterstitialAd","load","zoneId","options","keywords","customParameters","isReady","show","addEventListener","event","callback","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["InterstitialAd.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAGhE,MAAM;EAAEC;AAA0B,CAAC,GAAGF,aAAa;AACnD,MAAMG,OAAO,GAAG,IAAIF,kBAAkB,CAACC,yBAAyB,CAAC;AAEjE,OAAO,MAAME,cAAc,GAAG;EAC5B;AACF;AACA;EACEC,IAAIA,CACFC,MAAe,EACfC,OAA4E,EAC7D;IACf,OAAOL,yBAAyB,CAACG,IAAI,CACnCC,MAAM,IAAI,IAAI,EACdC,OAAO,EAAEC,QAAQ,IAAI,IAAI,EACzBD,OAAO,EAAEE,gBAAgB,IAAI,IAC/B,CAAC;EACH,CAAC;EAED;AACF;AACA;EACEC,OAAOA,CAAA,EAAqB;IAC1B,OAAOR,yBAAyB,CAACQ,OAAO,CAAC,CAAC;EAC5C,CAAC;EAED;AACF;AACA;EACEC,IAAIA,CAAA,EAAkB;IACpB,OAAOT,yBAAyB,CAACS,IAAI,CAAC,CAAC;EACzC,CAAC;EAED;AACF;AACA;AACA;EACEC,gBAAgBA,CACdC,KAAsB,EACtBC,QAA6C,EACjC;IACZ,MAAMC,YAAY,GAAGZ,OAAO,CAACa,WAAW,CACtC,6BAA6B,EAC7BF,QACF,CAAC;IACD,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,35 @@
1
+ import { NativeModules, NativeEventEmitter } from 'react-native';
2
+ const {
3
+ EmpowerRewardedModule
4
+ } = NativeModules;
5
+ const emitter = new NativeEventEmitter(EmpowerRewardedModule);
6
+ export const RewardedAd = {
7
+ /**
8
+ * Load a rewarded ad for the given zone.
9
+ */
10
+ load(zoneId, options) {
11
+ return EmpowerRewardedModule.load(zoneId ?? null, options?.keywords ?? null, options?.customParameters ?? null);
12
+ },
13
+ /**
14
+ * Check if a rewarded ad is ready to show.
15
+ */
16
+ isReady() {
17
+ return EmpowerRewardedModule.isReady();
18
+ },
19
+ /**
20
+ * Show the loaded rewarded ad.
21
+ */
22
+ show() {
23
+ return EmpowerRewardedModule.show();
24
+ },
25
+ /**
26
+ * Listen for rewarded ad status changes.
27
+ * Use 'rewarded' event to grant the user their reward.
28
+ * Returns a function to remove the listener.
29
+ */
30
+ addEventListener(event, callback) {
31
+ const subscription = emitter.addListener('onRewardedStatusChanged', callback);
32
+ return () => subscription.remove();
33
+ }
34
+ };
35
+ //# sourceMappingURL=RewardedAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","NativeEventEmitter","EmpowerRewardedModule","emitter","RewardedAd","load","zoneId","options","keywords","customParameters","isReady","show","addEventListener","event","callback","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["RewardedAd.ts"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAGhE,MAAM;EAAEC;AAAsB,CAAC,GAAGF,aAAa;AAC/C,MAAMG,OAAO,GAAG,IAAIF,kBAAkB,CAACC,qBAAqB,CAAC;AAE7D,OAAO,MAAME,UAAU,GAAG;EACxB;AACF;AACA;EACEC,IAAIA,CACFC,MAAe,EACfC,OAA4E,EAC7D;IACf,OAAOL,qBAAqB,CAACG,IAAI,CAC/BC,MAAM,IAAI,IAAI,EACdC,OAAO,EAAEC,QAAQ,IAAI,IAAI,EACzBD,OAAO,EAAEE,gBAAgB,IAAI,IAC/B,CAAC;EACH,CAAC;EAED;AACF;AACA;EACEC,OAAOA,CAAA,EAAqB;IAC1B,OAAOR,qBAAqB,CAACQ,OAAO,CAAC,CAAC;EACxC,CAAC;EAED;AACF;AACA;EACEC,IAAIA,CAAA,EAAkB;IACpB,OAAOT,qBAAqB,CAACS,IAAI,CAAC,CAAC;EACrC,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,gBAAgBA,CACdC,KAAsB,EACtBC,QAAyC,EAC7B;IACZ,MAAMC,YAAY,GAAGZ,OAAO,CAACa,WAAW,CACtC,yBAAyB,EACzBF,QACF,CAAC;IACD,OAAO,MAAMC,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,63 @@
1
+ import React, { useCallback, useState } from 'react';
2
+ import { requireNativeComponent, StyleSheet } from 'react-native';
3
+ const NativeBannerView = requireNativeComponent('EmpowerBannerView');
4
+ export const StickyAd = ({
5
+ zoneId,
6
+ style,
7
+ keywords,
8
+ customParameters,
9
+ onAdLoaded,
10
+ onAdFailed,
11
+ onAdClicked,
12
+ onSizeChanged
13
+ }) => {
14
+ const [adSize, setAdSize] = useState(null);
15
+ const handleAdLoaded = useCallback(() => {
16
+ onAdLoaded?.();
17
+ }, [onAdLoaded]);
18
+ const handleAdFailed = useCallback(event => {
19
+ onAdFailed?.(event.nativeEvent.error);
20
+ }, [onAdFailed]);
21
+ const handleAdClicked = useCallback(() => {
22
+ onAdClicked?.();
23
+ }, [onAdClicked]);
24
+ const handleSizeChanged = useCallback(event => {
25
+ const {
26
+ width,
27
+ height
28
+ } = event.nativeEvent;
29
+ setAdSize({
30
+ width,
31
+ height
32
+ });
33
+ onSizeChanged?.({
34
+ width,
35
+ height
36
+ });
37
+ }, [onSizeChanged]);
38
+ const dynamicStyle = adSize ? {
39
+ width: adSize.width,
40
+ height: adSize.height
41
+ } : {};
42
+ return /*#__PURE__*/React.createElement(NativeBannerView, {
43
+ style: [styles.sticky, style, dynamicStyle],
44
+ zoneId: zoneId,
45
+ adType: "sticky",
46
+ keywords: keywords,
47
+ customParameters: customParameters,
48
+ onAdLoaded: handleAdLoaded,
49
+ onAdFailed: handleAdFailed,
50
+ onAdClicked: handleAdClicked,
51
+ onSizeChanged: handleSizeChanged
52
+ });
53
+ };
54
+ const styles = StyleSheet.create({
55
+ sticky: {
56
+ position: 'absolute',
57
+ bottom: 0,
58
+ left: 0,
59
+ right: 0,
60
+ overflow: 'hidden'
61
+ }
62
+ });
63
+ //# sourceMappingURL=StickyAd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","useCallback","useState","requireNativeComponent","StyleSheet","NativeBannerView","StickyAd","zoneId","style","keywords","customParameters","onAdLoaded","onAdFailed","onAdClicked","onSizeChanged","adSize","setAdSize","handleAdLoaded","handleAdFailed","event","nativeEvent","error","handleAdClicked","handleSizeChanged","width","height","dynamicStyle","createElement","styles","sticky","adType","create","position","bottom","left","right","overflow"],"sourceRoot":"../../src","sources":["StickyAd.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACpD,SACEC,sBAAsB,EAGtBC,UAAU,QACL,cAAc;AAYrB,MAAMC,gBAAgB,GAAGF,sBAAsB,CAAM,mBAAmB,CAAC;AAEzE,OAAO,MAAMG,QAAiC,GAAGA,CAAC;EAChDC,MAAM;EACNC,KAAK;EACLC,QAAQ;EACRC,gBAAgB;EAChBC,UAAU;EACVC,UAAU;EACVC,WAAW;EACXC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAGd,QAAQ,CA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,CAAC2B,MAAM,CAAC;EAC/BF,MAAM,EAAE;IACNG,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ // SDK initialization & settings
2
+ export { EmpowerAds } from './EmpowerAds';
3
+
4
+ // UI components
5
+ export { BannerAd } from './BannerAd';
6
+ export { StickyAd } from './StickyAd';
7
+
8
+ // Ad modules
9
+ export { InterstitialAd } from './InterstitialAd';
10
+ export { RewardedAd } from './RewardedAd';
11
+ export { AppOpenAd } from './AppOpenAd';
12
+
13
+ // Types
14
+ export { AdStatus, LogLevel } from './types';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EmpowerAds","BannerAd","StickyAd","InterstitialAd","RewardedAd","AppOpenAd","AdStatus","LogLevel"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA,SAASA,UAAU,QAAQ,cAAc;;AAEzC;AACA,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,QAAQ,QAAQ,YAAY;;AAErC;AACA,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;;AAEvC;AACA,SACEC,QAAQ,EACRC,QAAQ,QAOH,SAAS","ignoreList":[]}
@@ -0,0 +1,37 @@
1
+ // ─── Ad Status ───────────────────────────────────────────────
2
+ export let AdStatus = /*#__PURE__*/function (AdStatus) {
3
+ AdStatus["Undefined"] = "undefined";
4
+ AdStatus["Initializing"] = "initializing";
5
+ AdStatus["Ready"] = "ready";
6
+ AdStatus["Failed"] = "failed";
7
+ AdStatus["WillLeave"] = "willLeave";
8
+ AdStatus["WillPresent"] = "willPresent";
9
+ AdStatus["Used"] = "used";
10
+ AdStatus["Present"] = "present";
11
+ AdStatus["CompletePlaying"] = "completePlaying";
12
+ AdStatus["Rewarded"] = "rewarded";
13
+ AdStatus["Active"] = "active";
14
+ AdStatus["Paused"] = "paused";
15
+ return AdStatus;
16
+ }({});
17
+
18
+ // ─── Log Level ───────────────────────────────────────────────
19
+ export let LogLevel = /*#__PURE__*/function (LogLevel) {
20
+ LogLevel["None"] = "none";
21
+ LogLevel["Error"] = "error";
22
+ LogLevel["All"] = "all";
23
+ return LogLevel;
24
+ }({});
25
+
26
+ // ─── SDK Init Options ────────────────────────────────────────
27
+
28
+ // ─── Banner ──────────────────────────────────────────────────
29
+
30
+ // ─── Interstitial ────────────────────────────────────────────
31
+
32
+ // ─── Rewarded ────────────────────────────────────────────────
33
+
34
+ // ─── App Open ────────────────────────────────────────────────
35
+
36
+ // ─── Native Module Interfaces ────────────────────────────────
37
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AdStatus","LogLevel"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":"AAEA;AACA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAepB;AACA,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAMpB;;AASA;;AAcA;;AAMA;;AAMA;;AAMA","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ import type { AppOpenAdEvent } from './types';
2
+ export declare const AppOpenAd: {
3
+ /**
4
+ * Load an app open ad for the given zone.
5
+ */
6
+ load(zoneId: string): Promise<void>;
7
+ /**
8
+ * Check if an app open ad is ready to show.
9
+ */
10
+ isReady(): Promise<boolean>;
11
+ /**
12
+ * Show the loaded app open ad.
13
+ */
14
+ show(): Promise<void>;
15
+ /**
16
+ * Listen for app open ad status changes.
17
+ * Returns a function to remove the listener.
18
+ */
19
+ addEventListener(event: "statusChanged", callback: (data: AppOpenAdEvent) => void): () => void;
20
+ };
21
+ //# sourceMappingURL=AppOpenAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppOpenAd.d.ts","sourceRoot":"","sources":["../../src/AppOpenAd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C,eAAO,MAAM,SAAS;IACpB;;OAEG;iBACU,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInC;;OAEG;eACQ,OAAO,CAAC,OAAO,CAAC;IAI3B;;OAEG;YACK,OAAO,CAAC,IAAI,CAAC;IAIrB;;;OAGG;4BAEM,eAAe,YACZ,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,GACvC,MAAM,IAAI;CAOd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { BannerAdProps } from './types';
3
+ export declare const BannerAd: React.FC<BannerAdProps>;
4
+ //# sourceMappingURL=BannerAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BannerAd.d.ts","sourceRoot":"","sources":["../../src/BannerAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAsD5C,CAAC"}
@@ -0,0 +1,37 @@
1
+ import type { EmpowerAdsConfig } from './types';
2
+ export declare const EmpowerAds: {
3
+ /**
4
+ * Initialize the EmpowerMobileAds SDK.
5
+ * Must be called before loading any ads.
6
+ */
7
+ initialize(appId: string, options?: EmpowerAdsConfig): Promise<void>;
8
+ /**
9
+ * Set the content page URL for ad targeting.
10
+ */
11
+ setContentPage(url: string): void;
12
+ /**
13
+ * Set global targeting parameters that apply to all ad requests.
14
+ */
15
+ setGlobalTargeting(targeting: Record<string, string[]>): void;
16
+ /**
17
+ * Set user segments for ad targeting.
18
+ */
19
+ setSegments(segments: string[]): void;
20
+ /**
21
+ * Enable/disable non-personalized ads (GDPR compliance).
22
+ */
23
+ setNonPersonalized(value: boolean): void;
24
+ /**
25
+ * Enable/disable all ads globally.
26
+ */
27
+ setAdsDisabled(value: boolean): void;
28
+ /**
29
+ * Show/hide the remove ads button on banner ads.
30
+ */
31
+ setShowRemoveAdsButton(value: boolean): void;
32
+ /**
33
+ * Get the Nokta user identifier.
34
+ */
35
+ getNoktaId(): Promise<string>;
36
+ };
37
+ //# sourceMappingURL=EmpowerAds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmpowerAds.d.ts","sourceRoot":"","sources":["../../src/EmpowerAds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,eAAO,MAAM,UAAU;IACrB;;;OAGG;sBACe,MAAM,YAAW,gBAAgB,GAAQ,OAAO,CAAC,IAAI,CAAC;IAIxE;;OAEG;wBACiB,MAAM,GAAG,IAAI;IAIjC;;OAEG;kCAC2B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAI7D;;OAEG;0BACmB,MAAM,EAAE,GAAG,IAAI;IAIrC;;OAEG;8BACuB,OAAO,GAAG,IAAI;IAIxC;;OAEG;0BACmB,OAAO,GAAG,IAAI;IAIpC;;OAEG;kCAC2B,OAAO,GAAG,IAAI;IAI5C;;OAEG;kBACW,OAAO,CAAC,MAAM,CAAC;CAG9B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { InterstitialAdEvent } from './types';
2
+ export declare const InterstitialAd: {
3
+ /**
4
+ * Load an interstitial ad for the given zone.
5
+ */
6
+ load(zoneId?: string, options?: {
7
+ keywords?: string;
8
+ customParameters?: Record<string, string[]>;
9
+ }): Promise<void>;
10
+ /**
11
+ * Check if an interstitial ad is ready to show.
12
+ */
13
+ isReady(): Promise<boolean>;
14
+ /**
15
+ * Show the loaded interstitial ad.
16
+ */
17
+ show(): Promise<void>;
18
+ /**
19
+ * Listen for interstitial ad status changes.
20
+ * Returns a function to remove the listener.
21
+ */
22
+ addEventListener(event: "statusChanged", callback: (data: InterstitialAdEvent) => void): () => void;
23
+ };
24
+ //# sourceMappingURL=InterstitialAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InterstitialAd.d.ts","sourceRoot":"","sources":["../../src/InterstitialAd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAKnD,eAAO,MAAM,cAAc;IACzB;;OAEG;kBAEQ,MAAM,YACL;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;KAAE,GAC3E,OAAO,CAAC,IAAI,CAAC;IAQhB;;OAEG;eACQ,OAAO,CAAC,OAAO,CAAC;IAI3B;;OAEG;YACK,OAAO,CAAC,IAAI,CAAC;IAIrB;;;OAGG;4BAEM,eAAe,YACZ,CAAC,IAAI,EAAE,mBAAmB,KAAK,IAAI,GAC5C,MAAM,IAAI;CAOd,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { RewardedAdEvent } from './types';
2
+ export declare const RewardedAd: {
3
+ /**
4
+ * Load a rewarded ad for the given zone.
5
+ */
6
+ load(zoneId?: string, options?: {
7
+ keywords?: string;
8
+ customParameters?: Record<string, string[]>;
9
+ }): Promise<void>;
10
+ /**
11
+ * Check if a rewarded ad is ready to show.
12
+ */
13
+ isReady(): Promise<boolean>;
14
+ /**
15
+ * Show the loaded rewarded ad.
16
+ */
17
+ show(): Promise<void>;
18
+ /**
19
+ * Listen for rewarded ad status changes.
20
+ * Use 'rewarded' event to grant the user their reward.
21
+ * Returns a function to remove the listener.
22
+ */
23
+ addEventListener(event: "statusChanged", callback: (data: RewardedAdEvent) => void): () => void;
24
+ };
25
+ //# sourceMappingURL=RewardedAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RewardedAd.d.ts","sourceRoot":"","sources":["../../src/RewardedAd.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAK/C,eAAO,MAAM,UAAU;IACrB;;OAEG;kBAEQ,MAAM,YACL;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;KAAE,GAC3E,OAAO,CAAC,IAAI,CAAC;IAQhB;;OAEG;eACQ,OAAO,CAAC,OAAO,CAAC;IAI3B;;OAEG;YACK,OAAO,CAAC,IAAI,CAAC;IAIrB;;;;OAIG;4BAEM,eAAe,YACZ,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,GACxC,MAAM,IAAI;CAOd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { StickyAdProps } from './types';
3
+ export declare const StickyAd: React.FC<StickyAdProps>;
4
+ //# sourceMappingURL=StickyAd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyAd.d.ts","sourceRoot":"","sources":["../../src/StickyAd.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAC;AAOrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAqD5C,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { EmpowerAds } from './EmpowerAds';
2
+ export { BannerAd } from './BannerAd';
3
+ export { StickyAd } from './StickyAd';
4
+ export { InterstitialAd } from './InterstitialAd';
5
+ export { RewardedAd } from './RewardedAd';
6
+ export { AppOpenAd } from './AppOpenAd';
7
+ export { AdStatus, LogLevel, type EmpowerAdsConfig, type BannerAdProps, type StickyAdProps, type InterstitialAdEvent, type RewardedAdEvent, type AppOpenAdEvent, } from './types';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { ViewStyle } from 'react-native';
2
+ export declare enum AdStatus {
3
+ Undefined = "undefined",
4
+ Initializing = "initializing",
5
+ Ready = "ready",
6
+ Failed = "failed",
7
+ WillLeave = "willLeave",
8
+ WillPresent = "willPresent",
9
+ Used = "used",
10
+ Present = "present",
11
+ CompletePlaying = "completePlaying",
12
+ Rewarded = "rewarded",
13
+ Active = "active",
14
+ Paused = "paused"
15
+ }
16
+ export declare enum LogLevel {
17
+ None = "none",
18
+ Error = "error",
19
+ All = "all"
20
+ }
21
+ export interface EmpowerAdsConfig {
22
+ appVersion?: string;
23
+ testMode?: boolean;
24
+ logLevel?: LogLevel;
25
+ nonPersonalized?: boolean;
26
+ vParam?: string;
27
+ }
28
+ export interface BannerAdProps {
29
+ zoneId: string;
30
+ style?: ViewStyle;
31
+ keywords?: string;
32
+ customParameters?: Record<string, string[]>;
33
+ onAdLoaded?: () => void;
34
+ onAdFailed?: (error: string) => void;
35
+ onAdClicked?: () => void;
36
+ onSizeChanged?: (size: {
37
+ width: number;
38
+ height: number;
39
+ }) => void;
40
+ }
41
+ export interface StickyAdProps extends BannerAdProps {
42
+ }
43
+ export interface InterstitialAdEvent {
44
+ status: AdStatus;
45
+ zoneId?: string;
46
+ }
47
+ export interface RewardedAdEvent {
48
+ status: AdStatus;
49
+ zoneId?: string;
50
+ }
51
+ export interface AppOpenAdEvent {
52
+ status: AdStatus;
53
+ zoneId?: string;
54
+ }
55
+ export interface EmpowerAdsModuleInterface {
56
+ initialize(appId: string, options?: EmpowerAdsConfig): Promise<void>;
57
+ setContentPage(url: string): void;
58
+ setGlobalTargeting(targeting: Record<string, string[]>): void;
59
+ setSegments(segments: string[]): void;
60
+ setNonPersonalized(value: boolean): void;
61
+ setAdsDisabled(value: boolean): void;
62
+ setShowRemoveAdsButton(value: boolean): void;
63
+ getNoktaId(): Promise<string>;
64
+ }
65
+ export interface InterstitialModuleInterface {
66
+ load(zoneId?: string, keywords?: string, customParameters?: Record<string, string[]>): Promise<void>;
67
+ isReady(): Promise<boolean>;
68
+ show(): Promise<void>;
69
+ }
70
+ export interface RewardedModuleInterface {
71
+ load(zoneId?: string, keywords?: string, customParameters?: Record<string, string[]>): Promise<void>;
72
+ isReady(): Promise<boolean>;
73
+ show(): Promise<void>;
74
+ }
75
+ export interface AppOpenModuleInterface {
76
+ load(zoneId: string): Promise<void>;
77
+ isReady(): Promise<boolean>;
78
+ show(): Promise<void>;
79
+ }
80
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,oBAAY,QAAQ;IAClB,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,MAAM,WA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AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "react-native-empower-mobile-ads",
3
+ "version": "1.0.0",
4
+ "description": "React Native bridge for EmpowerMobileAds SDK",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "ios",
14
+ "react-native-empower-mobile-ads.podspec",
15
+ "!**/__tests__"
16
+ ],
17
+ "scripts": {
18
+ "build": "bob build",
19
+ "typescript": "tsc --noEmit",
20
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
21
+ "prepare": "bob build"
22
+ },
23
+ "keywords": [
24
+ "react-native",
25
+ "ios",
26
+ "ads",
27
+ "empower",
28
+ "banner",
29
+ "interstitial",
30
+ "rewarded"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/empowernet/react-native-empower-mobile-ads.git"
35
+ },
36
+ "license": "MIT",
37
+ "peerDependencies": {
38
+ "react": "*",
39
+ "react-native": "*"
40
+ },
41
+ "devDependencies": {
42
+ "@types/react": "^18.0.0",
43
+ "@types/react-native": "^0.72.0",
44
+ "react": "^18.2.0",
45
+ "react-native": "^0.73.0",
46
+ "react-native-builder-bob": "^0.23.0",
47
+ "typescript": "^5.0.0"
48
+ },
49
+ "react-native-builder-bob": {
50
+ "source": "src",
51
+ "output": "lib",
52
+ "targets": [
53
+ "commonjs",
54
+ "module",
55
+ [
56
+ "typescript",
57
+ {
58
+ "project": "tsconfig.build.json"
59
+ }
60
+ ]
61
+ ]
62
+ }
63
+ }
@@ -0,0 +1,27 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "react-native-empower-mobile-ads"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["repository"]["url"]
10
+ s.license = package["license"]
11
+ s.authors = { "Empower" => "dev@nokta.com" }
12
+ s.platforms = { :ios => "13.0" }
13
+ s.source = { :git => package["repository"]["url"], :tag => s.version }
14
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
15
+ s.swift_version = "5.0"
16
+
17
+ # React Native dependency
18
+ if respond_to?(:install_modules_dependencies, true)
19
+ install_modules_dependencies(s)
20
+ else
21
+ s.dependency "React-Core"
22
+ end
23
+
24
+ # Native SDK - requires private spec repo in Podfile:
25
+ # source 'https://github.com/empowernet/specs.git'
26
+ s.dependency "EmpowerMobileAds"
27
+ end
@@ -0,0 +1,43 @@
1
+ import { NativeModules, NativeEventEmitter } from 'react-native';
2
+ import type { AppOpenAdEvent } from './types';
3
+
4
+ const { EmpowerAppOpenModule } = NativeModules;
5
+ const emitter = new NativeEventEmitter(EmpowerAppOpenModule);
6
+
7
+ export const AppOpenAd = {
8
+ /**
9
+ * Load an app open ad for the given zone.
10
+ */
11
+ load(zoneId: string): Promise<void> {
12
+ return EmpowerAppOpenModule.load(zoneId);
13
+ },
14
+
15
+ /**
16
+ * Check if an app open ad is ready to show.
17
+ */
18
+ isReady(): Promise<boolean> {
19
+ return EmpowerAppOpenModule.isReady();
20
+ },
21
+
22
+ /**
23
+ * Show the loaded app open ad.
24
+ */
25
+ show(): Promise<void> {
26
+ return EmpowerAppOpenModule.show();
27
+ },
28
+
29
+ /**
30
+ * Listen for app open ad status changes.
31
+ * Returns a function to remove the listener.
32
+ */
33
+ addEventListener(
34
+ event: 'statusChanged',
35
+ callback: (data: AppOpenAdEvent) => void
36
+ ): () => void {
37
+ const subscription = emitter.addListener(
38
+ 'onAppOpenStatusChanged',
39
+ callback
40
+ );
41
+ return () => subscription.remove();
42
+ },
43
+ };