react-native-applovin-max 7.0.1 → 7.1.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 (35) hide show
  1. package/android/build.gradle +3 -3
  2. package/android/src/main/java/com/applovin/reactnative/AppLovinMAXModule.java +59 -508
  3. package/ios/AppLovinMAX.m +55 -468
  4. package/lib/commonjs/AppLovinMAX.js +19 -3
  5. package/lib/commonjs/AppLovinMAX.js.map +1 -1
  6. package/lib/commonjs/index.js +0 -22
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/module/AppLovinMAX.js +19 -3
  9. package/lib/module/AppLovinMAX.js.map +1 -1
  10. package/lib/module/index.js +0 -1
  11. package/lib/module/index.js.map +1 -1
  12. package/lib/typescript/src/AppLovinMAX.d.ts.map +1 -1
  13. package/lib/typescript/src/index.d.ts +0 -1
  14. package/lib/typescript/src/index.d.ts.map +1 -1
  15. package/lib/typescript/src/types/AppLovinMAX.d.ts +18 -6
  16. package/lib/typescript/src/types/AppLovinMAX.d.ts.map +1 -1
  17. package/package.json +1 -1
  18. package/react-native-applovin-max.podspec +2 -2
  19. package/src/AppLovinMAX.ts +24 -3
  20. package/src/index.ts +0 -1
  21. package/src/types/AppLovinMAX.ts +20 -7
  22. package/lib/commonjs/TargetingData.js +0 -179
  23. package/lib/commonjs/TargetingData.js.map +0 -1
  24. package/lib/commonjs/types/TargetingData.js +0 -6
  25. package/lib/commonjs/types/TargetingData.js.map +0 -1
  26. package/lib/module/TargetingData.js +0 -175
  27. package/lib/module/TargetingData.js.map +0 -1
  28. package/lib/module/types/TargetingData.js +0 -2
  29. package/lib/module/types/TargetingData.js.map +0 -1
  30. package/lib/typescript/src/TargetingData.d.ts +0 -26
  31. package/lib/typescript/src/TargetingData.d.ts.map +0 -1
  32. package/lib/typescript/src/types/TargetingData.d.ts +0 -43
  33. package/lib/typescript/src/types/TargetingData.d.ts.map +0 -1
  34. package/src/TargetingData.ts +0 -212
  35. package/src/types/TargetingData.ts +0 -50
@@ -1,175 +0,0 @@
1
- import { NativeModules } from 'react-native';
2
- const {
3
- AppLovinMAX
4
- } = NativeModules;
5
- const nativeMethods = AppLovinMAX;
6
-
7
- /**
8
- * This enumeration represents content ratings for the ads shown to users.
9
- */
10
- export let AdContentRating = /*#__PURE__*/function (AdContentRating) {
11
- AdContentRating[AdContentRating["NONE"] = 0] = "NONE";
12
- AdContentRating[AdContentRating["ALL_AUDIENCES"] = 1] = "ALL_AUDIENCES";
13
- AdContentRating[AdContentRating["EVERYONE_OVER_TWELVE"] = 2] = "EVERYONE_OVER_TWELVE";
14
- AdContentRating[AdContentRating["MATURE_AUDIENCES"] = 3] = "MATURE_AUDIENCES";
15
- return AdContentRating;
16
- }({});
17
-
18
- /**
19
- * This enumeration represents gender.
20
- */
21
- export let UserGender = /*#__PURE__*/function (UserGender) {
22
- UserGender["UNKNOWN"] = "U";
23
- UserGender["FEMALE"] = "F";
24
- UserGender["MALE"] = "M";
25
- UserGender["OTHER"] = "O";
26
- return UserGender;
27
- }({});
28
-
29
- /**
30
- * Defines additional data for the publisher to send to AppLovin.
31
- *
32
- * @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
33
- */
34
- export const TargetingData = {
35
- /**
36
- * Sets the year of birth of the user. Set this to 0 to clear this value.
37
- */
38
- set yearOfBirth(value) {
39
- if (typeof value === 'number') {
40
- nativeMethods.setTargetingDataYearOfBirth(value);
41
- } else {
42
- printError('TargetingData.yearOfBirth', 'number', typeof value);
43
- }
44
- },
45
- /**
46
- * Gets the year of birth of the user.
47
- */
48
- get yearOfBirth() {
49
- return nativeMethods.getTargetingDataYearOfBirth();
50
- },
51
- /**
52
- * Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
53
- */
54
- set gender(value) {
55
- if (value === UserGender.UNKNOWN || value === UserGender.FEMALE || value === UserGender.MALE || value === UserGender.OTHER) {
56
- nativeMethods.setTargetingDataGender(value);
57
- } else {
58
- printError('TargetingData.gender', 'UserGender', typeof value);
59
- }
60
- },
61
- /**
62
- * Gets the gender of the user.
63
- */
64
- get gender() {
65
- return nativeMethods.getTargetingDataGender().then(value => {
66
- return value;
67
- });
68
- },
69
- /**
70
- * Sets the maximum ad content rating shown to the user. The levels are based on IQG Media
71
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
72
- * Set this to {@link AdContentRating.None} to clear this value.
73
- */
74
- set maximumAdContentRating(value) {
75
- if (value === AdContentRating.NONE || value === AdContentRating.ALL_AUDIENCES || value === AdContentRating.EVERYONE_OVER_TWELVE || value === AdContentRating.MATURE_AUDIENCES) {
76
- nativeMethods.setTargetingDataMaximumAdContentRating(value);
77
- } else {
78
- printError('TargetingData.maximumAdContentRating', 'AdContentRating', typeof value);
79
- }
80
- },
81
- /**
82
- * Gets the maximum ad content rating shown to the user. The levels are based on IQG Media
83
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
84
- */
85
- get maximumAdContentRating() {
86
- return nativeMethods.getTargetingDataMaximumAdContentRating().then(value => {
87
- return value;
88
- });
89
- },
90
- /**
91
- * Sets the email of the user. Set this to null to clear this value.
92
- */
93
- set email(value) {
94
- if (value === null) {
95
- nativeMethods.setTargetingDataEmail(null);
96
- } else if (typeof value === 'string') {
97
- nativeMethods.setTargetingDataEmail(value);
98
- } else {
99
- printError('TargetingData.email', 'string or null', typeof value);
100
- }
101
- },
102
- /**
103
- * Gets the email of the user.
104
- */
105
- get email() {
106
- return nativeMethods.getTargetingDataEmail();
107
- },
108
- /**
109
- * Sets the phone number of the user. Set this to null to clear this value.
110
- */
111
- set phoneNumber(value) {
112
- if (value === null) {
113
- nativeMethods.setTargetingDataPhoneNumber(null);
114
- } else if (typeof value === 'string') {
115
- nativeMethods.setTargetingDataPhoneNumber(value);
116
- } else {
117
- printError('TargetingData.phoneNumber', 'string or null', typeof value);
118
- }
119
- },
120
- /**
121
- * Gets the phone number of the user.
122
- */
123
- get phoneNumber() {
124
- return nativeMethods.getTargetingDataPhoneNumber();
125
- },
126
- /**
127
- * Sets the keywords describing the application. Set this to null to clear this value.
128
- */
129
- set keywords(value) {
130
- if (value === null) {
131
- nativeMethods.setTargetingDataKeywords(null);
132
- } else if (isStringArray(value)) {
133
- nativeMethods.setTargetingDataKeywords(value);
134
- } else {
135
- printError('TargetingData.keywords', 'string[] or null', typeof value);
136
- }
137
- },
138
- /**
139
- * Gets the keywords describing the application.
140
- */
141
- get keywords() {
142
- return nativeMethods.getTargetingDataKeywords();
143
- },
144
- /**
145
- * Sets the interests of the user. Set this to null to clear this value.
146
- */
147
- set interests(value) {
148
- if (value === null) {
149
- nativeMethods.setTargetingDataInterests(null);
150
- } else if (isStringArray(value)) {
151
- nativeMethods.setTargetingDataInterests(value);
152
- } else {
153
- printError('TargetingData.interests', 'string[] or null', typeof value);
154
- }
155
- },
156
- /**
157
- * Gets the interests of the user.
158
- */
159
- get interests() {
160
- return nativeMethods.getTargetingDataInterests();
161
- },
162
- /**
163
- * Clears all saved data from this class.
164
- */
165
- clearAll() {
166
- nativeMethods.clearAllTargetingData();
167
- }
168
- };
169
- const isStringArray = strs => {
170
- return Array.isArray(strs) && strs.every(value => typeof value === 'string');
171
- };
172
- const printError = (fieldName, correctType, wrongType) => {
173
- console.error('Cannot set value to ' + fieldName + ' with unsupported type: ' + wrongType + '. Value has to be of type ' + correctType + '.');
174
- };
175
- //# sourceMappingURL=TargetingData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","AppLovinMAX","nativeMethods","AdContentRating","UserGender","TargetingData","yearOfBirth","value","setTargetingDataYearOfBirth","printError","getTargetingDataYearOfBirth","gender","UNKNOWN","FEMALE","MALE","OTHER","setTargetingDataGender","getTargetingDataGender","then","maximumAdContentRating","NONE","ALL_AUDIENCES","EVERYONE_OVER_TWELVE","MATURE_AUDIENCES","setTargetingDataMaximumAdContentRating","getTargetingDataMaximumAdContentRating","email","setTargetingDataEmail","getTargetingDataEmail","phoneNumber","setTargetingDataPhoneNumber","getTargetingDataPhoneNumber","keywords","setTargetingDataKeywords","isStringArray","getTargetingDataKeywords","interests","setTargetingDataInterests","getTargetingDataInterests","clearAll","clearAllTargetingData","strs","Array","isArray","every","fieldName","correctType","wrongType","console","error"],"sourceRoot":"../../src","sources":["TargetingData.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAG5C,MAAM;EAAEC;AAAY,CAAC,GAAGD,aAAa;AAoBrC,MAAME,aAAsC,GAAGD,WAAW;;AAE1D;AACA;AACA;AACA,WAAYE,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;;AAO3B;AACA;AACA;AACA,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;;AAOtB;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAgC,GAAG;EAC5C;AACJ;AACA;EACI,IAAIC,WAAWA,CAACC,KAA+B,EAAE;IAC7C,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC3BL,aAAa,CAACM,2BAA2B,CAACD,KAAK,CAAC;IACpD,CAAC,MAAM;MACHE,UAAU,CAAC,2BAA2B,EAAE,QAAQ,EAAE,OAAOF,KAAK,CAAC;IACnE;EACJ,CAAC;EAED;AACJ;AACA;EACI,IAAID,WAAWA,CAAA,EAA6B;IACxC,OAAOJ,aAAa,CAACQ,2BAA2B,CAAC,CAAC;EACtD,CAAC;EAED;AACJ;AACA;EACI,IAAIC,MAAMA,CAACJ,KAAuC,EAAE;IAChD,IAAIA,KAAK,KAAKH,UAAU,CAACQ,OAAO,IAAIL,KAAK,KAAKH,UAAU,CAACS,MAAM,IAAIN,KAAK,KAAKH,UAAU,CAACU,IAAI,IAAIP,KAAK,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AAC;IACjD,CAAC,MAAM,IAAIH,aAAa,CAAC3B,KAAK,CAAC,EAAE;MAC7BL,aAAa,CAACmC,yBAAyB,CAAC9B,KAAiB,CAAC;IAC9D,CAAC,MAAM;MACHE,UAAU,CAAC,yBAAyB,EAAE,kBAAkB,EAAE,OAAOF,KAAK,CAAC;IAC3E;EACJ,CAAC;EAED;AACJ;AACA;EACI,IAAI6B,SAASA,CAAA,EAA+C;IACxD,OAAOlC,aAAa,CAACoC,yBAAyB,CAAC,CAAC;EACpD,CAAC;EAED;AACJ;AACA;EACIC,QAAQA,CAAA,EAAS;IACbrC,aAAa,CAACsC,qBAAqB,CAAC,CAAC;EACzC;AACJ,CAAC;AAED,MAAMN,aAAa,GAAIO,IAAY,IAAc;EAC7C,OAAOC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,IAAIA,IAAI,CAACG,KAAK,CAAErC,KAAK,IAAK,OAAOA,KAAK,KAAK,QAAQ,CAAC;AAClF,CAAC;AAED,MAAME,UAAU,GAAGA,CAACoC,SAAiB,EAAEC,WAAmB,EAAEC,SAAiB,KAAK;EAC9EC,OAAO,CAACC,KAAK,CAAC,sBAAsB,GAAGJ,SAAS,GAAG,0BAA0B,GAAGE,SAAS,GAAG,6BAA6B,GAAGD,WAAW,GAAG,GAAG,CAAC;AAClJ,CAAC","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=TargetingData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/TargetingData.ts"],"mappings":"","ignoreList":[]}
@@ -1,26 +0,0 @@
1
- import type { TargetingDataType } from './types/TargetingData';
2
- /**
3
- * This enumeration represents content ratings for the ads shown to users.
4
- */
5
- export declare enum AdContentRating {
6
- NONE = 0,
7
- ALL_AUDIENCES = 1,
8
- EVERYONE_OVER_TWELVE = 2,
9
- MATURE_AUDIENCES = 3
10
- }
11
- /**
12
- * This enumeration represents gender.
13
- */
14
- export declare enum UserGender {
15
- UNKNOWN = "U",
16
- FEMALE = "F",
17
- MALE = "M",
18
- OTHER = "O"
19
- }
20
- /**
21
- * Defines additional data for the publisher to send to AppLovin.
22
- *
23
- * @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
24
- */
25
- export declare const TargetingData: TargetingDataType;
26
- //# sourceMappingURL=TargetingData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TargetingData.d.ts","sourceRoot":"","sources":["../../../src/TargetingData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAwB/D;;GAEG;AACH,oBAAY,eAAe;IACvB,IAAI,IAAI;IACR,aAAa,IAAI;IACjB,oBAAoB,IAAI;IACxB,gBAAgB,IAAI;CACvB;AAED;;GAEG;AACH,oBAAY,UAAU;IAClB,OAAO,MAAM;IACb,MAAM,MAAM;IACZ,IAAI,MAAM;IACV,KAAK,MAAM;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,iBAyJ3B,CAAC"}
@@ -1,43 +0,0 @@
1
- import type { AdContentRating, UserGender } from '../TargetingData';
2
- /**
3
- * Defines additional data for the publisher to send to AppLovin.
4
- *
5
- * @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
6
- */
7
- export type TargetingDataType = {
8
- /**
9
- * Sets the year of birth of the user. Set this to 0 to clear this value.
10
- */
11
- yearOfBirth: number | Promise<number>;
12
- /**
13
- * Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
14
- */
15
- gender: UserGender | Promise<UserGender>;
16
- /**
17
- * Sets the maximum ad content rating shown to the user. The levels are based on IQG Media
18
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
19
- * Set this to {@link AdContentRating.None} to clear this value.
20
- */
21
- maximumAdContentRating: AdContentRating | Promise<AdContentRating>;
22
- /**
23
- * Sets the email of the user. Set this to null to clear this value.
24
- */
25
- email: string | null | Promise<string | null>;
26
- /**
27
- * Sets the phone number of the user. Set this to null to clear this value.
28
- */
29
- phoneNumber: string | null | Promise<string | null>;
30
- /**
31
- * Sets the keywords describing the application. Set this to null to clear this value.
32
- */
33
- keywords: string[] | null | Promise<string[] | null>;
34
- /**
35
- * Sets the interests of the user. Set this to null to clear this value.
36
- */
37
- interests: string[] | null | Promise<string[] | null>;
38
- /**
39
- * Clears all saved data from this class.
40
- */
41
- clearAll(): void;
42
- };
43
- //# sourceMappingURL=TargetingData.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TargetingData.d.ts","sourceRoot":"","sources":["../../../../src/types/TargetingData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtC;;OAEG;IACH,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzC;;;;OAIG;IACH,sBAAsB,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAEnE;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAE9C;;OAEG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEpD;;OAEG;IACH,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAErD;;OAEG;IACH,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAEtD;;OAEG;IACH,QAAQ,IAAI,IAAI,CAAC;CACpB,CAAC"}
@@ -1,212 +0,0 @@
1
- import { NativeModules } from 'react-native';
2
- import type { TargetingDataType } from './types/TargetingData';
3
-
4
- const { AppLovinMAX } = NativeModules;
5
-
6
- type NativeTargetingDataType = {
7
- setTargetingDataYearOfBirth(value: number): void;
8
- getTargetingDataYearOfBirth(): Promise<number>;
9
- setTargetingDataGender(value: string): void;
10
- getTargetingDataGender(): Promise<string>;
11
- setTargetingDataMaximumAdContentRating(value: number): void;
12
- getTargetingDataMaximumAdContentRating(): Promise<number>;
13
- setTargetingDataEmail(value: string | null): void;
14
- getTargetingDataEmail(): Promise<string | null>;
15
- setTargetingDataPhoneNumber(value: string | null): void;
16
- getTargetingDataPhoneNumber(): Promise<string | null>;
17
- setTargetingDataKeywords(value: string[] | null): void;
18
- getTargetingDataKeywords(): Promise<string[] | null>;
19
- setTargetingDataInterests(value: string[] | null): void;
20
- getTargetingDataInterests(): Promise<string[] | null>;
21
- clearAllTargetingData(): void;
22
- };
23
-
24
- const nativeMethods: NativeTargetingDataType = AppLovinMAX;
25
-
26
- /**
27
- * This enumeration represents content ratings for the ads shown to users.
28
- */
29
- export enum AdContentRating {
30
- NONE = 0,
31
- ALL_AUDIENCES = 1,
32
- EVERYONE_OVER_TWELVE = 2,
33
- MATURE_AUDIENCES = 3,
34
- }
35
-
36
- /**
37
- * This enumeration represents gender.
38
- */
39
- export enum UserGender {
40
- UNKNOWN = 'U',
41
- FEMALE = 'F',
42
- MALE = 'M',
43
- OTHER = 'O',
44
- }
45
-
46
- /**
47
- * Defines additional data for the publisher to send to AppLovin.
48
- *
49
- * @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
50
- */
51
- export const TargetingData: TargetingDataType = {
52
- /**
53
- * Sets the year of birth of the user. Set this to 0 to clear this value.
54
- */
55
- set yearOfBirth(value: number | Promise<number>) {
56
- if (typeof value === 'number') {
57
- nativeMethods.setTargetingDataYearOfBirth(value);
58
- } else {
59
- printError('TargetingData.yearOfBirth', 'number', typeof value);
60
- }
61
- },
62
-
63
- /**
64
- * Gets the year of birth of the user.
65
- */
66
- get yearOfBirth(): number | Promise<number> {
67
- return nativeMethods.getTargetingDataYearOfBirth();
68
- },
69
-
70
- /**
71
- * Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
72
- */
73
- set gender(value: UserGender | Promise<UserGender>) {
74
- if (value === UserGender.UNKNOWN || value === UserGender.FEMALE || value === UserGender.MALE || value === UserGender.OTHER) {
75
- nativeMethods.setTargetingDataGender(value);
76
- } else {
77
- printError('TargetingData.gender', 'UserGender', typeof value);
78
- }
79
- },
80
-
81
- /**
82
- * Gets the gender of the user.
83
- */
84
- get gender(): UserGender | Promise<UserGender> {
85
- return nativeMethods.getTargetingDataGender().then((value: string) => {
86
- return value as UserGender;
87
- });
88
- },
89
-
90
- /**
91
- * Sets the maximum ad content rating shown to the user. The levels are based on IQG Media
92
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
93
- * Set this to {@link AdContentRating.None} to clear this value.
94
- */
95
- set maximumAdContentRating(value: AdContentRating | Promise<AdContentRating>) {
96
- if (
97
- value === AdContentRating.NONE ||
98
- value === AdContentRating.ALL_AUDIENCES ||
99
- value === AdContentRating.EVERYONE_OVER_TWELVE ||
100
- value === AdContentRating.MATURE_AUDIENCES
101
- ) {
102
- nativeMethods.setTargetingDataMaximumAdContentRating(value);
103
- } else {
104
- printError('TargetingData.maximumAdContentRating', 'AdContentRating', typeof value);
105
- }
106
- },
107
-
108
- /**
109
- * Gets the maximum ad content rating shown to the user. The levels are based on IQG Media
110
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
111
- */
112
- get maximumAdContentRating(): AdContentRating | Promise<AdContentRating> {
113
- return nativeMethods.getTargetingDataMaximumAdContentRating().then((value: number) => {
114
- return value as AdContentRating;
115
- });
116
- },
117
-
118
- /**
119
- * Sets the email of the user. Set this to null to clear this value.
120
- */
121
- set email(value: string | null | Promise<string | null>) {
122
- if (value === null) {
123
- nativeMethods.setTargetingDataEmail(null);
124
- } else if (typeof value === 'string') {
125
- nativeMethods.setTargetingDataEmail(value as string);
126
- } else {
127
- printError('TargetingData.email', 'string or null', typeof value);
128
- }
129
- },
130
-
131
- /**
132
- * Gets the email of the user.
133
- */
134
- get email(): string | null | Promise<string | null> {
135
- return nativeMethods.getTargetingDataEmail();
136
- },
137
-
138
- /**
139
- * Sets the phone number of the user. Set this to null to clear this value.
140
- */
141
- set phoneNumber(value: string | null | Promise<string | null>) {
142
- if (value === null) {
143
- nativeMethods.setTargetingDataPhoneNumber(null);
144
- } else if (typeof value === 'string') {
145
- nativeMethods.setTargetingDataPhoneNumber(value as string);
146
- } else {
147
- printError('TargetingData.phoneNumber', 'string or null', typeof value);
148
- }
149
- },
150
-
151
- /**
152
- * Gets the phone number of the user.
153
- */
154
- get phoneNumber(): string | null | Promise<string | null> {
155
- return nativeMethods.getTargetingDataPhoneNumber();
156
- },
157
-
158
- /**
159
- * Sets the keywords describing the application. Set this to null to clear this value.
160
- */
161
- set keywords(value: string[] | null | Promise<string[] | null>) {
162
- if (value === null) {
163
- nativeMethods.setTargetingDataKeywords(null);
164
- } else if (isStringArray(value)) {
165
- nativeMethods.setTargetingDataKeywords(value as string[]);
166
- } else {
167
- printError('TargetingData.keywords', 'string[] or null', typeof value);
168
- }
169
- },
170
-
171
- /**
172
- * Gets the keywords describing the application.
173
- */
174
- get keywords(): string[] | null | Promise<string[] | null> {
175
- return nativeMethods.getTargetingDataKeywords();
176
- },
177
-
178
- /**
179
- * Sets the interests of the user. Set this to null to clear this value.
180
- */
181
- set interests(value: string[] | null | Promise<string[] | null>) {
182
- if (value === null) {
183
- nativeMethods.setTargetingDataInterests(null);
184
- } else if (isStringArray(value)) {
185
- nativeMethods.setTargetingDataInterests(value as string[]);
186
- } else {
187
- printError('TargetingData.interests', 'string[] or null', typeof value);
188
- }
189
- },
190
-
191
- /**
192
- * Gets the interests of the user.
193
- */
194
- get interests(): string[] | null | Promise<string[] | null> {
195
- return nativeMethods.getTargetingDataInterests();
196
- },
197
-
198
- /**
199
- * Clears all saved data from this class.
200
- */
201
- clearAll(): void {
202
- nativeMethods.clearAllTargetingData();
203
- },
204
- };
205
-
206
- const isStringArray = (strs: object): boolean => {
207
- return Array.isArray(strs) && strs.every((value) => typeof value === 'string');
208
- };
209
-
210
- const printError = (fieldName: string, correctType: string, wrongType: string) => {
211
- console.error('Cannot set value to ' + fieldName + ' with unsupported type: ' + wrongType + '. Value has to be of type ' + correctType + '.');
212
- };
@@ -1,50 +0,0 @@
1
- import type { AdContentRating, UserGender } from '../TargetingData';
2
-
3
- /**
4
- * Defines additional data for the publisher to send to AppLovin.
5
- *
6
- * @see {@link https://support.applovin.com/hc/en-us/articles/13964925614733-Data-and-Keyword-Passing}
7
- */
8
- export type TargetingDataType = {
9
- /**
10
- * Sets the year of birth of the user. Set this to 0 to clear this value.
11
- */
12
- yearOfBirth: number | Promise<number>;
13
-
14
- /**
15
- * Sets the gender of the user. Set this to {@link UserGender.Unknown} to clear this value.
16
- */
17
- gender: UserGender | Promise<UserGender>;
18
-
19
- /**
20
- * Sets the maximum ad content rating shown to the user. The levels are based on IQG Media
21
- * Ratings: 1=All Audiences, 2=Everyone Over 12, 3=Mature Audiences.
22
- * Set this to {@link AdContentRating.None} to clear this value.
23
- */
24
- maximumAdContentRating: AdContentRating | Promise<AdContentRating>;
25
-
26
- /**
27
- * Sets the email of the user. Set this to null to clear this value.
28
- */
29
- email: string | null | Promise<string | null>;
30
-
31
- /**
32
- * Sets the phone number of the user. Set this to null to clear this value.
33
- */
34
- phoneNumber: string | null | Promise<string | null>;
35
-
36
- /**
37
- * Sets the keywords describing the application. Set this to null to clear this value.
38
- */
39
- keywords: string[] | null | Promise<string[] | null>;
40
-
41
- /**
42
- * Sets the interests of the user. Set this to null to clear this value.
43
- */
44
- interests: string[] | null | Promise<string[] | null>;
45
-
46
- /**
47
- * Clears all saved data from this class.
48
- */
49
- clearAll(): void;
50
- };