Skip to content

Commit

Permalink
fix(analytics): added missing price parameter to the Item structure (#…
Browse files Browse the repository at this point in the history
…5232)

* fix(analytics): added missing price parameter to the Item structure

Co-authored-by: Mike Hardy <github@mikehardy.net>
  • Loading branch information
artemkhalygov and mikehardy committed Apr 29, 2021
1 parent da6b811 commit b972cb6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/analytics/e2e/analytics.e2e.js
Expand Up @@ -368,6 +368,15 @@ describe('analytics()', function () {
it('calls logViewItemList', async function () {
await firebase.analytics().logViewItemList({
item_list_name: 'foo',
items: [
{
item_id: 'foo',
item_name: 'foo',
item_category: 'foo',
item_location_id: 'foo',
price: 123,
},
],
});
});
});
Expand Down
6 changes: 6 additions & 0 deletions packages/analytics/lib/index.d.ts
Expand Up @@ -103,6 +103,12 @@ export namespace FirebaseAnalyticsTypes {
* The Item quantity.
*/
quantity?: number;
/**
* The Item price.
* Note that firebase analytics will display this as an integer with trailing zeros, due to some firebase-internal conversion.
* See https://github.com/invertase/react-native-firebase/issues/4578#issuecomment-771703420 for more information
*/
price?: number;
}

export interface AddPaymentInfoEventParameters {
Expand Down
1 change: 1 addition & 0 deletions packages/analytics/lib/structs.js
Expand Up @@ -29,6 +29,7 @@ const Item = struct({
item_location_id: 'string?',
item_variant: 'string?',
quantity: 'number?',
price: 'number?',
});

export const ScreenView = struct({
Expand Down

1 comment on commit b972cb6

@vercel
Copy link

@vercel vercel bot commented on b972cb6 Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.