@react-native-firebase/analytics 24.0.0 → 24.1.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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +24 -0
  3. package/android/src/reactnative/java/io/invertase/firebase/analytics/ReactNativeFirebaseAnalyticsModule.java +48 -4
  4. package/app.plugin.js +1 -0
  5. package/dist/module/modular.js +4 -3
  6. package/dist/module/modular.js.map +1 -1
  7. package/dist/module/structs.js +4 -3
  8. package/dist/module/structs.js.map +1 -1
  9. package/dist/module/version.js +1 -1
  10. package/dist/typescript/lib/modular.d.ts +3 -3
  11. package/dist/typescript/lib/modular.d.ts.map +1 -1
  12. package/dist/typescript/lib/structs.d.ts +58 -2
  13. package/dist/typescript/lib/structs.d.ts.map +1 -1
  14. package/dist/typescript/lib/types/analytics.d.ts +1 -1
  15. package/dist/typescript/lib/types/analytics.d.ts.map +1 -1
  16. package/dist/typescript/lib/version.d.ts +1 -1
  17. package/ios/RNFBAnalytics/RNFBAnalyticsModule.m +48 -3
  18. package/lib/modular.ts +4 -3
  19. package/lib/structs.ts +3 -2
  20. package/lib/types/analytics.ts +1 -1
  21. package/lib/version.ts +1 -1
  22. package/package.json +16 -5
  23. package/plugin/build/index.d.ts +4 -0
  24. package/plugin/build/index.js +16 -0
  25. package/plugin/build/ios/index.d.ts +2 -0
  26. package/plugin/build/ios/index.js +6 -0
  27. package/plugin/build/ios/podfile.d.ts +6 -0
  28. package/plugin/build/ios/podfile.js +45 -0
  29. package/plugin/build/pluginConfig.d.ts +10 -0
  30. package/plugin/build/pluginConfig.js +2 -0
  31. package/plugin/src/index.ts +18 -0
  32. package/plugin/src/ios/index.ts +6 -0
  33. package/plugin/src/ios/podfile.ts +72 -0
  34. package/plugin/src/pluginConfig.ts +11 -0
  35. package/plugin/tsconfig.json +9 -0
  36. package/plugin/tsconfig.tsbuildinfo +1 -0
  37. package/typedoc.json +48 -0
package/lib/modular.ts CHANGED
@@ -948,10 +948,10 @@ export function initiateOnDeviceConversionMeasurementWithEmailAddress(
948
948
  * start privacy-sensitive on-device conversion management.
949
949
  * This is iOS-only.
950
950
  * This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
951
+ * {@link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials}
951
952
  *
952
953
  * @param analytics Analytics instance.
953
954
  * @param hashedEmailAddress sha256-hashed of normalized email address, properly formatted complete with domain name e.g, 'user@example.com'
954
- * @link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials
955
955
  */
956
956
  export function initiateOnDeviceConversionMeasurementWithHashedEmailAddress(
957
957
  analytics: Analytics,
@@ -988,10 +988,10 @@ export function initiateOnDeviceConversionMeasurementWithPhoneNumber(
988
988
  * start privacy-sensitive on-device conversion management.
989
989
  * This is iOS-only.
990
990
  * This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
991
+ * {@link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials}
991
992
  *
992
993
  * @param analytics Analytics instance.
993
994
  * @param hashedPhoneNumber sha256-hashed of normalized phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces.
994
- * @link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials
995
995
  */
996
996
  export function initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(
997
997
  analytics: Analytics,
@@ -1031,9 +1031,10 @@ export function setConsent(analytics: Analytics, consentSettings: ConsentSetting
1031
1031
  /**
1032
1032
  * Configures Firebase Analytics to use custom gtag or dataLayer names.
1033
1033
  * Intended to be used if gtag.js script has been installed on this page independently of Firebase Analytics, and is using non-default names for either the gtag function or for dataLayer. Must be called before calling `getAnalytics()` or it won't have any effect. Web only.
1034
- * @param {SettingsOptions} options - See SettingsOptions.
1034
+ * @param {SettingsOptions} _options - See SettingsOptions - currently unused.
1035
1035
  * @returns {void}
1036
1036
  */
1037
+
1037
1038
  export function settings(_options: SettingsOptions): void {
1038
1039
  // Returns nothing until Web implemented.
1039
1040
  }
package/lib/structs.ts CHANGED
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { object, string, number, array, optional, define, type } from 'superstruct';
17
+ import { object, string, number, boolean, array, optional, define, type } from 'superstruct';
18
18
 
19
19
  const ShortDate = define(
20
20
  'ShortDate',
@@ -36,6 +36,7 @@ const Item = type({
36
36
  item_variant: optional(string()),
37
37
  quantity: optional(number()),
38
38
  price: optional(number()),
39
+ index: optional(number()),
39
40
  });
40
41
 
41
42
  export const ScreenView = type({
@@ -104,7 +105,7 @@ export const JoinGroup = object({
104
105
 
105
106
  export const LevelEnd = object({
106
107
  level: number(),
107
- success: optional(string()),
108
+ success: optional(boolean()),
108
109
  });
109
110
 
110
111
  export const LevelStart = object({
@@ -282,7 +282,7 @@ export interface LevelEndEventParameters {
282
282
  /**
283
283
  * The result of an operation.
284
284
  */
285
- success?: string;
285
+ success?: boolean;
286
286
  }
287
287
 
288
288
  export interface LevelStartEventParameters {
package/lib/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '24.0.0';
2
+ export const version = '24.1.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/analytics",
3
- "version": "24.0.0",
3
+ "version": "24.1.1",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The analytics module provides out of the box support with Google Analytics for Firebase. Integration with the Android & iOS allows for in-depth analytical insight reporting, such as device information, location, user actions and more.",
6
6
  "main": "./dist/module/index.js",
@@ -8,8 +8,10 @@
8
8
  "scripts": {
9
9
  "build": "genversion --esm --semi lib/version.ts",
10
10
  "build:clean": "rimraf android/build && rimraf ios/build",
11
+ "build:plugin": "rimraf plugin/build && tsc --build plugin",
12
+ "lint:plugin": "eslint \"plugin/src/**/*.{ts,js}\"",
11
13
  "compile": "bob build",
12
- "prepare": "yarn run build && yarn compile"
14
+ "prepare": "yarn run build && yarn run build:plugin && yarn compile"
13
15
  },
14
16
  "repository": {
15
17
  "type": "git",
@@ -23,7 +25,8 @@
23
25
  "analytics"
24
26
  ],
25
27
  "peerDependencies": {
26
- "@react-native-firebase/app": "24.0.0"
28
+ "@react-native-firebase/app": "24.1.1",
29
+ "expo": ">=47.0.0"
27
30
  },
28
31
  "publishConfig": {
29
32
  "access": "public",
@@ -33,7 +36,14 @@
33
36
  "superstruct": "^2.0.2"
34
37
  },
35
38
  "devDependencies": {
36
- "react-native-builder-bob": "^0.40.17"
39
+ "expo": "^55.0.5",
40
+ "react-native-builder-bob": "^0.40.17",
41
+ "typescript": "^5.9.3"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "expo": {
45
+ "optional": true
46
+ }
37
47
  },
38
48
  "exports": {
39
49
  ".": {
@@ -41,6 +51,7 @@
41
51
  "types": "./dist/typescript/lib/index.d.ts",
42
52
  "default": "./dist/module/index.js"
43
53
  },
54
+ "./app.plugin.js": "./app.plugin.js",
44
55
  "./package.json": "./package.json"
45
56
  },
46
57
  "react-native-builder-bob": {
@@ -65,5 +76,5 @@
65
76
  "node_modules/",
66
77
  "dist/"
67
78
  ],
68
- "gitHead": "46c48499190be2dc9b9792d39c251db29495a607"
79
+ "gitHead": "ea699f0bbcc98d25eebea4bfbe88cf1e9f2d0107"
69
80
  }
@@ -0,0 +1,4 @@
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
+ import { PluginConfigType } from './pluginConfig';
3
+ declare const _default: ConfigPlugin<PluginConfigType>;
4
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_plugins_1 = require("@expo/config-plugins");
4
+ const ios_1 = require("./ios");
5
+ /**
6
+ * A config plugin for configuring `@react-native-firebase/analytics`
7
+ */
8
+ const withRnFirebaseAnalytics = (config, props) => {
9
+ return (0, config_plugins_1.withPlugins)(config, [
10
+ // iOS
11
+ [ios_1.withIosWithoutAdIdSupport, props],
12
+ [ios_1.withIosGoogleAppMeasurementOnDeviceConversion, props],
13
+ ]);
14
+ };
15
+ const pak = require('../../package.json');
16
+ exports.default = (0, config_plugins_1.createRunOncePlugin)(withRnFirebaseAnalytics, pak.name, pak.version);
@@ -0,0 +1,2 @@
1
+ import { withIosWithoutAdIdSupport, withIosGoogleAppMeasurementOnDeviceConversion } from './podfile';
2
+ export { withIosWithoutAdIdSupport, withIosGoogleAppMeasurementOnDeviceConversion };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withIosGoogleAppMeasurementOnDeviceConversion = exports.withIosWithoutAdIdSupport = void 0;
4
+ const podfile_1 = require("./podfile");
5
+ Object.defineProperty(exports, "withIosWithoutAdIdSupport", { enumerable: true, get: function () { return podfile_1.withIosWithoutAdIdSupport; } });
6
+ Object.defineProperty(exports, "withIosGoogleAppMeasurementOnDeviceConversion", { enumerable: true, get: function () { return podfile_1.withIosGoogleAppMeasurementOnDeviceConversion; } });
@@ -0,0 +1,6 @@
1
+ import { ConfigPlugin } from '@expo/config-plugins';
2
+ import { PluginConfigType } from '../pluginConfig';
3
+ export declare function setAnalyticsPodfileWithoutAdIdSupport(src: string, enabled?: boolean): string;
4
+ export declare function setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(src: string, enabled?: boolean): string;
5
+ export declare const withIosGoogleAppMeasurementOnDeviceConversion: ConfigPlugin<PluginConfigType>;
6
+ export declare const withIosWithoutAdIdSupport: ConfigPlugin<PluginConfigType>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withIosWithoutAdIdSupport = exports.withIosGoogleAppMeasurementOnDeviceConversion = void 0;
4
+ exports.setAnalyticsPodfileWithoutAdIdSupport = setAnalyticsPodfileWithoutAdIdSupport;
5
+ exports.setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion;
6
+ const config_plugins_1 = require("@expo/config-plugins");
7
+ const generateCode_1 = require("@expo/config-plugins/build/utils/generateCode");
8
+ const TAG = '@react-native-firebase/analytics-withoutAdIdSupport';
9
+ const ANCHOR = /prepare_react_native_project!/;
10
+ const FLAG = '$RNFirebaseAnalyticsWithoutAdIdSupport = true';
11
+ const TAG_ODM = '@react-native-firebase/analytics-googleAppMeasurementOnDeviceConversion';
12
+ const FLAG_ODM = '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true';
13
+ function setAnalyticsPodfileFlag(src, tag, flag, enabled = false) {
14
+ if (!enabled) {
15
+ return (0, generateCode_1.removeGeneratedContents)(src, tag) ?? src;
16
+ }
17
+ return (0, generateCode_1.mergeContents)({
18
+ src,
19
+ newSrc: flag,
20
+ tag,
21
+ anchor: ANCHOR,
22
+ offset: 1,
23
+ comment: '#',
24
+ }).contents;
25
+ }
26
+ function setAnalyticsPodfileWithoutAdIdSupport(src, enabled = false) {
27
+ return setAnalyticsPodfileFlag(src, TAG, FLAG, enabled);
28
+ }
29
+ function setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(src, enabled = false) {
30
+ return setAnalyticsPodfileFlag(src, TAG_ODM, FLAG_ODM, enabled);
31
+ }
32
+ const withIosGoogleAppMeasurementOnDeviceConversion = (config, props) => {
33
+ return (0, config_plugins_1.withPodfile)(config, config => {
34
+ config.modResults.contents = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(config.modResults.contents, props?.ios?.googleAppMeasurementOnDeviceConversion === true);
35
+ return config;
36
+ });
37
+ };
38
+ exports.withIosGoogleAppMeasurementOnDeviceConversion = withIosGoogleAppMeasurementOnDeviceConversion;
39
+ const withIosWithoutAdIdSupport = (config, props) => {
40
+ return (0, config_plugins_1.withPodfile)(config, config => {
41
+ config.modResults.contents = setAnalyticsPodfileWithoutAdIdSupport(config.modResults.contents, props?.ios?.withoutAdIdSupport === true);
42
+ return config;
43
+ });
44
+ };
45
+ exports.withIosWithoutAdIdSupport = withIosWithoutAdIdSupport;
@@ -0,0 +1,10 @@
1
+ export interface PluginConfigType {
2
+ ios?: PluginConfigTypeIos;
3
+ }
4
+ export interface PluginConfigTypeIos {
5
+ withoutAdIdSupport?: boolean;
6
+ /**
7
+ * @platform ios iOS
8
+ */
9
+ googleAppMeasurementOnDeviceConversion?: boolean;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { ConfigPlugin, withPlugins, createRunOncePlugin } from '@expo/config-plugins';
2
+
3
+ import { withIosWithoutAdIdSupport, withIosGoogleAppMeasurementOnDeviceConversion } from './ios';
4
+ import { PluginConfigType } from './pluginConfig';
5
+
6
+ /**
7
+ * A config plugin for configuring `@react-native-firebase/analytics`
8
+ */
9
+ const withRnFirebaseAnalytics: ConfigPlugin<PluginConfigType> = (config, props) => {
10
+ return withPlugins(config, [
11
+ // iOS
12
+ [withIosWithoutAdIdSupport, props],
13
+ [withIosGoogleAppMeasurementOnDeviceConversion, props],
14
+ ]);
15
+ };
16
+
17
+ const pak = require('../../package.json');
18
+ export default createRunOncePlugin(withRnFirebaseAnalytics, pak.name, pak.version);
@@ -0,0 +1,6 @@
1
+ import {
2
+ withIosWithoutAdIdSupport,
3
+ withIosGoogleAppMeasurementOnDeviceConversion,
4
+ } from './podfile';
5
+
6
+ export { withIosWithoutAdIdSupport, withIosGoogleAppMeasurementOnDeviceConversion };
@@ -0,0 +1,72 @@
1
+ import { ConfigPlugin, withPodfile } from '@expo/config-plugins';
2
+ import {
3
+ mergeContents,
4
+ removeGeneratedContents,
5
+ } from '@expo/config-plugins/build/utils/generateCode';
6
+
7
+ import { PluginConfigType } from '../pluginConfig';
8
+
9
+ const TAG = '@react-native-firebase/analytics-withoutAdIdSupport';
10
+ const ANCHOR = /prepare_react_native_project!/;
11
+ const FLAG = '$RNFirebaseAnalyticsWithoutAdIdSupport = true';
12
+ const TAG_ODM = '@react-native-firebase/analytics-googleAppMeasurementOnDeviceConversion';
13
+ const FLAG_ODM = '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true';
14
+
15
+ function setAnalyticsPodfileFlag(
16
+ src: string,
17
+ tag: string,
18
+ flag: string,
19
+ enabled: boolean = false,
20
+ ): string {
21
+ if (!enabled) {
22
+ return removeGeneratedContents(src, tag) ?? src;
23
+ }
24
+
25
+ return mergeContents({
26
+ src,
27
+ newSrc: flag,
28
+ tag,
29
+ anchor: ANCHOR,
30
+ offset: 1,
31
+ comment: '#',
32
+ }).contents;
33
+ }
34
+
35
+ export function setAnalyticsPodfileWithoutAdIdSupport(
36
+ src: string,
37
+ enabled: boolean = false,
38
+ ): string {
39
+ return setAnalyticsPodfileFlag(src, TAG, FLAG, enabled);
40
+ }
41
+
42
+ export function setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
43
+ src: string,
44
+ enabled: boolean = false,
45
+ ): string {
46
+ return setAnalyticsPodfileFlag(src, TAG_ODM, FLAG_ODM, enabled);
47
+ }
48
+
49
+ export const withIosGoogleAppMeasurementOnDeviceConversion: ConfigPlugin<PluginConfigType> = (
50
+ config,
51
+ props,
52
+ ) => {
53
+ return withPodfile(config, config => {
54
+ config.modResults.contents = setAnalyticsPodfileGoogleAppMeasurementOnDeviceConversion(
55
+ config.modResults.contents,
56
+ props?.ios?.googleAppMeasurementOnDeviceConversion === true,
57
+ );
58
+
59
+ return config;
60
+ });
61
+ };
62
+
63
+ export const withIosWithoutAdIdSupport: ConfigPlugin<PluginConfigType> = (config, props) => {
64
+ return withPodfile(config, config => {
65
+ config.modResults.contents = setAnalyticsPodfileWithoutAdIdSupport(
66
+ config.modResults.contents,
67
+ props?.ios?.withoutAdIdSupport === true,
68
+ );
69
+
70
+ return config;
71
+ });
72
+ };
@@ -0,0 +1,11 @@
1
+ export interface PluginConfigType {
2
+ ios?: PluginConfigTypeIos;
3
+ }
4
+
5
+ export interface PluginConfigTypeIos {
6
+ withoutAdIdSupport?: boolean;
7
+ /**
8
+ * @platform ios iOS
9
+ */
10
+ googleAppMeasurementOnDeviceConversion?: boolean;
11
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@tsconfig/node-lts/tsconfig",
3
+ "compilerOptions": {
4
+ "outDir": "build",
5
+ "rootDir": "src",
6
+ "declaration": true
7
+ },
8
+ "include": ["./src"]
9
+ }
@@ -0,0 +1 @@
1
+ {"root":["./src/index.ts","./src/pluginConfig.ts","./src/ios/index.ts","./src/ios/podfile.ts"],"version":"5.9.3"}
package/typedoc.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "entryPoints": ["lib/modular.ts", "lib/types/analytics.ts"],
4
+ "tsconfig": "tsconfig.json",
5
+ "intentionallyNotExported": [
6
+ "_AddPaymentInfoEventParameters",
7
+ "_AddShippingInfoEventParameters",
8
+ "_AddShippingInfoParameters",
9
+ "_AddToCartEventParameters",
10
+ "_AddToWishlistEventParameters",
11
+ "_AnalyticsCallOptions",
12
+ "_AnalyticsSettings",
13
+ "_BeginCheckoutEventParameters",
14
+ "_CampaignDetailsEventParameters",
15
+ "_ConsentSettings",
16
+ "_EarnVirtualCurrencyEventParameters",
17
+ "_EventParams",
18
+ "_GenerateLeadEventParameters",
19
+ "_GtagConfigParams",
20
+ "_Item",
21
+ "_JoinGroupEventParameters",
22
+ "_LevelEndEventParameters",
23
+ "_LevelStartEventParameters",
24
+ "_LevelUpEventParameters",
25
+ "_LoginEventParameters",
26
+ "_PostScoreEventParameters",
27
+ "_PurchaseEventParameters",
28
+ "_RefundEventParameters",
29
+ "_RemoveFromCartEventParameters",
30
+ "_ScreenViewParameters",
31
+ "_SearchEventParameters",
32
+ "_SelectContentEventParameters",
33
+ "_SelectItemEventParameters",
34
+ "_SelectPromotionEventParameters",
35
+ "_SetCheckoutOptionEventParameters",
36
+ "_SettingsOptions",
37
+ "_ShareEventParameters",
38
+ "_SignUpEventParameters",
39
+ "_SpendVirtualCurrencyEventParameters",
40
+ "_Statics",
41
+ "_UnlockAchievementEventParameters",
42
+ "_ViewCartEventParameters",
43
+ "_ViewItemEventParameters",
44
+ "_ViewItemListEventParameters",
45
+ "_ViewPromotionEventParameters",
46
+ "_ViewSearchResultsParameters"
47
+ ]
48
+ }