Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
c4ebf23
refactor(analytics): move to TypeScript
russellwheatley Aug 12, 2025
e342029
chore: make index.ts modular and reexport namespaced from there
russellwheatley Aug 12, 2025
d88a41a
chore: remove modular folder
russellwheatley Aug 12, 2025
9f5c8a0
chore: RN bob builder setup + package.json updates
russellwheatley Aug 12, 2025
90520fc
tsconfig.json update to find app package
russellwheatley Aug 12, 2025
104b66d
chore(app): validate.d.ts
russellwheatley Aug 12, 2025
e28011e
refactor: convert codebase to TypeScript
russellwheatley Aug 12, 2025
19d9ff3
chore: resolve index.d.ts issue
russellwheatley Aug 12, 2025
f76e392
chore(analytics): fix types for index.ts
russellwheatley Aug 12, 2025
e6acc0c
fix(analytics): RNFBAnalyticsModule make it modular export
russellwheatley Aug 12, 2025
cb1e987
fix: analytics with structs
russellwheatley Aug 12, 2025
823531d
chore: remove import
russellwheatley Aug 12, 2025
3dcc0d9
chore: rename to web types
russellwheatley Aug 12, 2025
338a149
fix: analytics types
russellwheatley Aug 12, 2025
8cbec39
chore: moved types to analytics types
russellwheatley Aug 12, 2025
89b17d6
chore: fix export types
russellwheatley Aug 13, 2025
1c1ef8a
chore: use correct type return + extend getApp()
russellwheatley Aug 13, 2025
79c3724
fix: export just the type
russellwheatley Aug 13, 2025
654f1a3
use TS from root package
russellwheatley Aug 13, 2025
e6ed251
yarn.lock
russellwheatley Aug 13, 2025
a6f18c3
chore: rm unneeded type
russellwheatley Aug 13, 2025
bc697d0
test: update unit test import
russellwheatley Aug 13, 2025
66c6291
chore: write type declaration files for web
russellwheatley Aug 13, 2025
2d61357
chore: move types/ dir and remove re-export of analytics
russellwheatley Aug 13, 2025
8ca9883
rm unneeded Ts declaration file
russellwheatley Aug 13, 2025
a7c6098
fix internal types
russellwheatley Aug 13, 2025
450995a
split modular and namespaced. import into index
russellwheatley Aug 13, 2025
96bbdf8
fix index.ts
russellwheatley Aug 13, 2025
bd74ce4
attempt at fixing type test problem
russellwheatley Aug 13, 2025
43ef781
use default
russellwheatley Aug 13, 2025
dad67bf
fix web api types
russellwheatley Aug 13, 2025
224872b
fix SDK_VERSION problem
russellwheatley Aug 13, 2025
2bf7b0f
chore: update example app with analytics
russellwheatley Aug 13, 2025
fd9bf11
tests: move tests to jest
russellwheatley Aug 19, 2025
0ee3d2e
test: remove import
russellwheatley Aug 19, 2025
41dff99
fix: types when using `analytics()` default export
russellwheatley Aug 19, 2025
04d7c6d
chore: testing analytics types
russellwheatley Aug 19, 2025
60794b8
yarn.lock
russellwheatley Aug 19, 2025
d3dea04
podfile.lock
russellwheatley Aug 19, 2025
358e460
chore: allow DOM types for web api
russellwheatley Aug 19, 2025
084d3e5
chore: update example for testing
russellwheatley Aug 19, 2025
ba3e954
chore: format
russellwheatley Aug 26, 2025
41b3aba
lock files
russellwheatley Dec 2, 2025
b9d7faf
chore: add types.d.ts for types from app package not yet moved over
russellwheatley Dec 2, 2025
fcbcdb2
chore: further type updates
russellwheatley Dec 2, 2025
75c0a02
fix: analytics typing
russellwheatley Dec 2, 2025
bb2caa4
fix: further type updates
russellwheatley Dec 2, 2025
1359900
fix: tsconfig.json
russellwheatley Dec 2, 2025
6f159f7
refactor: first step to TS, package.json
russellwheatley Dec 2, 2025
ef7a849
refactor: move from JS to TS
russellwheatley Dec 2, 2025
3e4ae10
refactor: further internal TS changes
russellwheatley Dec 2, 2025
4260203
refactor: internal TS implementation
russellwheatley Dec 2, 2025
44f6938
yarn.lock
russellwheatley Dec 2, 2025
5b86a43
fix: keep internal types internal
russellwheatley Dec 2, 2025
0a65c76
fix: other package TS config causing TS to output in app lib/ directory
russellwheatley Dec 3, 2025
4c3e646
fix: use types for app native module
russellwheatley Dec 3, 2025
00ea0aa
fix: FirebaseModule types
russellwheatley Dec 3, 2025
aae82fe
fix: FirebaseApp types
russellwheatley Dec 3, 2025
7011f96
fix: NativeModules types
russellwheatley Dec 3, 2025
b0e0b9e
fix: registry/nativeModule types
russellwheatley Dec 3, 2025
b5db4e7
fix: update namespace types
russellwheatley Dec 3, 2025
62537d4
fix: native module types
russellwheatley Dec 3, 2025
991187d
fix: improve native module types
russellwheatley Dec 3, 2025
adb2d09
refactor: ensure internals are on internal path
russellwheatley Dec 3, 2025
944a86f
refactor: move to modular.ts
russellwheatley Dec 3, 2025
8d572ae
fix: remove incorrect imports
russellwheatley Dec 4, 2025
69c7f02
chore: remove internal types
russellwheatley Dec 4, 2025
7e09a6f
fix: update export paths from app
russellwheatley Dec 4, 2025
42ba5af
chore: fix test import
russellwheatley Dec 4, 2025
e5bc3e4
chore: delete index.d.ts
russellwheatley Dec 5, 2025
02b54e3
chore: remove unneeded types
russellwheatley Dec 5, 2025
db74504
chore: remove import
russellwheatley Dec 5, 2025
379c197
refactor: remove types and create internal types
russellwheatley Dec 5, 2025
1bd6683
chore: ignore dist/ for linting
russellwheatley Dec 8, 2025
78a1709
chore: format
russellwheatley Dec 8, 2025
cdad3a8
test: fix paths in types.d.ts
russellwheatley Dec 8, 2025
377f79d
chore: consice default export
russellwheatley Dec 9, 2025
5832467
test: type exports
russellwheatley Dec 9, 2025
3e1f499
chore: remove unneeded file
russellwheatley Dec 9, 2025
22dd39a
yarn
russellwheatley Dec 9, 2025
f154b28
yarn.lock
russellwheatley Dec 9, 2025
20cff54
chore: update TS packages with correct paths
russellwheatley Dec 9, 2025
cad7af6
fix: export FirebaseApp from app package
russellwheatley Dec 9, 2025
624f1ce
refactor: rename type file to "app" and remove imports from namespaced
russellwheatley Dec 9, 2025
47565d3
refactor: exporting types
russellwheatley Dec 9, 2025
1fd0046
test: update jest mocks
russellwheatley Dec 9, 2025
046abff
test: more jest setup
russellwheatley Dec 9, 2025
f565629
refactor: update app types and import/exports
russellwheatley Dec 9, 2025
09048d9
fix: firebase app types
russellwheatley Dec 9, 2025
82c0391
test: update jest.setup with more mocks
russellwheatley Dec 10, 2025
773ae92
test(database) fix broken mocks
russellwheatley Dec 10, 2025
3ca012c
test: jest cleanup
russellwheatley Dec 10, 2025
49cdaa9
chore: further type updates
russellwheatley Dec 10, 2025
b28b68d
chore: format
russellwheatley Dec 10, 2025
f66133e
fix: bring logic back
russellwheatley Dec 10, 2025
881bf5b
refactor: app web JS files to TS files
russellwheatley Dec 10, 2025
97453e0
fix: remove unused directive
russellwheatley Dec 10, 2025
a3cbcb1
refactor: move to types/ directory
russellwheatley Dec 10, 2025
fb33cd7
chore: remove redundant declaration files
russellwheatley Dec 11, 2025
3c5dfae
chore: remove any type
russellwheatley Dec 11, 2025
7fa12ab
chore: document ts error expected for modular deprecation argument
russellwheatley Dec 11, 2025
bde3d6e
chore: type improvements
russellwheatley Dec 11, 2025
9f278d1
chore: remove unneeded exports
russellwheatley Dec 11, 2025
a92079c
fix: test-types for app
russellwheatley Dec 11, 2025
bb83571
fix: use root like previous for type-test
russellwheatley Dec 11, 2025
1e8c161
chore: reinstate type-test for functions
russellwheatley Dec 11, 2025
b9c899f
refactor: remove types.d.ts file from functions
russellwheatley Dec 11, 2025
4ca7eef
refactor(functions): in light of app package refactor
russellwheatley Dec 11, 2025
4b4c329
fix(functions): types for type-test
russellwheatley Dec 11, 2025
338428f
refactor: functions types to remove duplication
russellwheatley Dec 11, 2025
16ad77c
fix: type tests were not working, fixed for functions
russellwheatley Dec 12, 2025
18a1066
test: include app type test
russellwheatley Dec 12, 2025
e387a6c
test: update root tsconfig.json for jest tests
russellwheatley Dec 12, 2025
d7c0d99
fix: remove globals
russellwheatley Dec 12, 2025
e7fb747
fix(other): ensure use getReactNativeModule to get app native module
russellwheatley Dec 15, 2025
14a5e8d
fix: errors for web
russellwheatley Dec 15, 2025
bae03c2
fix(app-check): fix test types
russellwheatley Dec 15, 2025
17b6c87
fix(app-check): add app property
russellwheatley Dec 15, 2025
aa2e02f
fix(auth): update types and test types
russellwheatley Dec 15, 2025
dd26b13
fix(crashlytics): update types and test-type file
russellwheatley Dec 15, 2025
88c30c5
fix(database): fix types and type tests
russellwheatley Dec 15, 2025
4810b01
fix(firestore): fix types and type test file
russellwheatley Dec 15, 2025
39fda8c
fix(in-app-messaging): fix types and type test file
russellwheatley Dec 15, 2025
49fd9e0
fix(installations): fix types and type tests
russellwheatley Dec 15, 2025
9a405d3
fix(messaging): fix types and test-type file
russellwheatley Dec 15, 2025
550a1ba
fix(ml): fix types and type test file
russellwheatley Dec 15, 2025
da859a0
fix(perf): fix types and type tests
russellwheatley Dec 15, 2025
ee41b41
fix(remote-config): fix types and type test
russellwheatley Dec 15, 2025
f9895e5
fix: remote config type test
russellwheatley Dec 15, 2025
7252481
fix(storage): types and type test
russellwheatley Dec 15, 2025
4f42b19
fix(analytics): fix types and type-test
russellwheatley Dec 15, 2025
d218a16
fix: remove eslint warning about empty object
russellwheatley Dec 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export default [
'**/app.playground.js',
'**/type-test.ts',
'packages/**/modular/dist/**/*',
'packages/**/dist/**/*',
'src/version.js',
'packages/**/node_modules/**/*',
'packages/**/plugin/build/**/*',
Expand All @@ -42,7 +41,6 @@ export default [
'packages/**/modular/dist/**/*',
'packages/ai/__tests__/test-utils',
'packages/**/dist/**/*',
'packages/vertexai/__tests__/test-utils',
],
},
...compat
Expand Down
115 changes: 109 additions & 6 deletions packages/analytics/__tests__/analytics.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { jest, afterAll, beforeAll, describe, expect, it, xit, beforeEach } from '@jest/globals';

// @ts-ignore test
import FirebaseModule from '../../app/lib/internal/FirebaseModule';
import FirebaseModule from '@react-native-firebase/app/lib/internal/FirebaseModule';

import {
import analytics, {
firebase,
getAnalytics,
initializeAnalytics,
Expand Down Expand Up @@ -61,11 +61,10 @@ import {
setConsent,
settings,
} from '../lib';
import '../lib/types.d.ts';

import {
createCheckV9Deprecation,
CheckV9DeprecationFunction,
} from '../../app/lib/common/unitTestUtils';
import { createCheckV9Deprecation } from '@react-native-firebase/app/lib/common/unitTestUtils';
import type { CheckV9DeprecationFunction } from '@react-native-firebase/app/lib/common/unitTestUtils';

describe('Analytics', function () {
describe('namespace', function () {
Expand Down Expand Up @@ -707,6 +706,49 @@ describe('Analytics', function () {
);
});
});

describe('TypeScript migration maintains existing `analytics()` exports', function () {
it('`analytics()` is properly exposed to end user', function () {
expect(analytics().logAddToCart).toBeDefined();
expect(analytics().logAddPaymentInfo).toBeDefined();
expect(analytics().logAddShippingInfo).toBeDefined();
expect(analytics().logAddToWishlist).toBeDefined();
expect(analytics().logAppOpen).toBeDefined();
expect(analytics().logBeginCheckout).toBeDefined();
expect(analytics().logCampaignDetails).toBeDefined();
expect(analytics().logEarnVirtualCurrency).toBeDefined();
expect(analytics().logEvent).toBeDefined();
expect(analytics().logGenerateLead).toBeDefined();
expect(analytics().logJoinGroup).toBeDefined();
expect(analytics().logLevelEnd).toBeDefined();
expect(analytics().logLevelStart).toBeDefined();
expect(analytics().logLevelUp).toBeDefined();
expect(analytics().logLogin).toBeDefined();
expect(analytics().logPostScore).toBeDefined();
expect(analytics().logSelectContent).toBeDefined();
expect(analytics().logSetCheckoutOption).toBeDefined();
expect(analytics().logShare).toBeDefined();
expect(analytics().logSignUp).toBeDefined();
expect(analytics().logSpendVirtualCurrency).toBeDefined();
expect(analytics().logTutorialBegin).toBeDefined();
expect(analytics().logTutorialComplete).toBeDefined();
expect(analytics().logUnlockAchievement).toBeDefined();
expect(analytics().logViewItem).toBeDefined();
expect(analytics().logViewItemList).toBeDefined();
expect(analytics().resetAnalyticsData).toBeDefined();
expect(analytics().logViewCart).toBeDefined();
expect(analytics().setAnalyticsCollectionEnabled).toBeDefined();
expect(analytics().logSelectPromotion).toBeDefined();
expect(analytics().logScreenView).toBeDefined();
expect(analytics().logViewPromotion).toBeDefined();
expect(analytics().setSessionTimeoutDuration).toBeDefined();
expect(analytics().setUserId).toBeDefined();
expect(analytics().setUserProperties).toBeDefined();
expect(analytics().logViewSearchResults).toBeDefined();
expect(analytics().setUserProperty).toBeDefined();
expect(analytics().setConsent).toBeDefined();
});
});
});

describe('modular', function () {
Expand Down Expand Up @@ -946,6 +988,67 @@ describe('Analytics', function () {
it('`settings` function is properly exposed to end user', function () {
expect(settings).toBeDefined();
});

describe('TypeScript types are properly exported to end user', function () {
it('should allow importing type definitions', function () {
// This test verifies that types can be imported from the package
// If types are not properly exported, TypeScript compilation will fail

// Import types to verify they're accessible
// @ts-ignore - intentionally unused, we're only testing that types can be imported
type _TestImports = {
Item: import('../lib').Item;
Currency: import('../lib').Currency;
ConsentStatusString: import('../lib').ConsentStatusString;
Promotion: import('../lib').Promotion;
AddPaymentInfoEventParameters: import('../lib').AddPaymentInfoEventParameters;
AddShippingInfoEventParameters: import('../lib').AddShippingInfoEventParameters;
AddToCartEventParameters: import('../lib').AddToCartEventParameters;
AddToWishlistEventParameters: import('../lib').AddToWishlistEventParameters;
BeginCheckoutEventParameters: import('../lib').BeginCheckoutEventParameters;
CampaignDetailsEventParameters: import('../lib').CampaignDetailsEventParameters;
EarnVirtualCurrencyEventParameters: import('../lib').EarnVirtualCurrencyEventParameters;
GenerateLeadEventParameters: import('../lib').GenerateLeadEventParameters;
JoinGroupEventParameters: import('../lib').JoinGroupEventParameters;
LevelEndEventParameters: import('../lib').LevelEndEventParameters;
LevelStartEventParameters: import('../lib').LevelStartEventParameters;
LevelUpEventParameters: import('../lib').LevelUpEventParameters;
LoginEventParameters: import('../lib').LoginEventParameters;
PostScoreEventParameters: import('../lib').PostScoreEventParameters;
PurchaseEventParameters: import('../lib').PurchaseEventParameters;
ScreenViewParameters: import('../lib').ScreenViewParameters;
RefundEventParameters: import('../lib').RefundEventParameters;
RemoveFromCartEventParameters: import('../lib').RemoveFromCartEventParameters;
SearchEventParameters: import('../lib').SearchEventParameters;
SelectContentEventParameters: import('../lib').SelectContentEventParameters;
SelectItemEventParameters: import('../lib').SelectItemEventParameters;
SetCheckoutOptionEventParameters: import('../lib').SetCheckoutOptionEventParameters;
SelectPromotionEventParameters: import('../lib').SelectPromotionEventParameters;
ShareEventParameters: import('../lib').ShareEventParameters;
SignUpEventParameters: import('../lib').SignUpEventParameters;
SpendVirtualCurrencyEventParameters: import('../lib').SpendVirtualCurrencyEventParameters;
UnlockAchievementEventParameters: import('../lib').UnlockAchievementEventParameters;
ViewCartEventParameters: import('../lib').ViewCartEventParameters;
ViewItemEventParameters: import('../lib').ViewItemEventParameters;
ViewSearchResultsParameters: import('../lib').ViewSearchResultsParameters;
ViewItemListEventParameters: import('../lib').ViewItemListEventParameters;
ViewPromotionEventParameters: import('../lib').ViewPromotionEventParameters;
AddShippingInfoParameters: import('../lib').AddShippingInfoParameters;
EventParams: import('../lib').EventParams;
Statics: import('../lib').Statics;
AnalyticsSettings: import('../lib').AnalyticsSettings;
AnalyticsCallOptions: import('../lib').AnalyticsCallOptions;
GtagConfigParams: import('../lib').GtagConfigParams;
ConsentSettings: import('../lib').ConsentSettings;
SettingsOptions: import('../lib').SettingsOptions;
CustomEventName: import('../lib').CustomEventName<'custom'>;
EventNameString: import('../lib').EventNameString;
};

// If we got here without TypeScript compilation errors, the types are properly exported
expect(true).toBe(true);
});
});
});

describe('test `console.warn` is called for RNFB v8 API & not called for v9 API', function () {
Expand Down
Loading
Loading