diff --git a/packages/analytics/__tests__/analytics.test.ts b/packages/analytics/__tests__/analytics.test.ts index 86520877b4..1453dc7f8b 100644 --- a/packages/analytics/__tests__/analytics.test.ts +++ b/packages/analytics/__tests__/analytics.test.ts @@ -311,6 +311,12 @@ describe('Analytics', function () { }), ).toThrowError('firebase.analytics().logAddToWishlist(*):'); }); + + it('items accept arbitrary custom event parameters', function () { + expect(() => + firebase.analytics().logAddToWishlist({ items: [{ foo: 'bar' }] }), + ).not.toThrow(); + }); }); describe('logBeginCheckout()', function () { diff --git a/packages/analytics/lib/index.d.ts b/packages/analytics/lib/index.d.ts index 8412780358..3df0145fbd 100644 --- a/packages/analytics/lib/index.d.ts +++ b/packages/analytics/lib/index.d.ts @@ -141,6 +141,11 @@ export namespace FirebaseAnalyticsTypes { * The promotion name associated with the item. */ promotion_name?: string; + /** + * Custom event parameters. The parameter names can be up to 40 characters long and must start with an alphabetic character and contain only alphanumeric characters and underscores. String parameter values can be up to 100 characters long. + * The "firebase_", "google_" and "ga_" prefixes are reserved and should not be used for parameter names. + */ + [key: string]: string | number; } export interface AddPaymentInfoEventParameters { diff --git a/packages/analytics/lib/structs.js b/packages/analytics/lib/structs.js index e0c1acf32f..d5bdb0e2e0 100644 --- a/packages/analytics/lib/structs.js +++ b/packages/analytics/lib/structs.js @@ -15,7 +15,7 @@ */ import struct from '@react-native-firebase/app/lib/common/struct'; -const Item = struct({ +const Item = struct.interface({ item_brand: 'string?', item_id: 'string?', item_name: 'string?',