|
| 1 | +// The MIT License (MIT) |
| 2 | +// |
| 3 | +// Copyright (c) 2015 Firebase |
| 4 | +// |
| 5 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | +// of this software and associated documentation files (the "Software"), to deal |
| 7 | +// in the Software without restriction, including without limitation the rights |
| 8 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 | +// copies of the Software, and to permit persons to whom the Software is |
| 10 | +// furnished to do so, subject to the following conditions: |
| 11 | +// |
| 12 | +// The above copyright notice and this permission notice shall be included in all |
| 13 | +// copies or substantial portions of the Software. |
| 14 | +// |
| 15 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 | +// SOFTWARE. |
| 22 | + |
| 23 | +/* tslint:disable:max-line-length */ |
| 24 | +import { AnalyticsEvent } from '../../src/providers/analytics'; |
| 25 | + |
| 26 | +// A payload, as it might arrive over the wire. Every possible field is filled out at least once. |
| 27 | +export const fullPayload = JSON.parse(`{ |
| 28 | + "data": { |
| 29 | + "@type": "type.googleapis.com/google.firebase.analytics.functions.v1.AnalyticsEvent", |
| 30 | + "eventDim": |
| 31 | + [ |
| 32 | + { |
| 33 | + "date": "20170202", |
| 34 | + "name": "Loaded_In_Background", |
| 35 | + "params": { |
| 36 | + "build": { |
| 37 | + "stringValue": "1350" |
| 38 | + }, |
| 39 | + "calls_remaining": { |
| 40 | + "intValue": "10" |
| 41 | + }, |
| 42 | + "fraction_calls_dropped": { |
| 43 | + "doubleValue": 0.0123456 |
| 44 | + }, |
| 45 | + "average_call_rating": { |
| 46 | + "floatValue": 4.5 |
| 47 | + } |
| 48 | + }, |
| 49 | + "previousTimestampMicros": "1486076479797000", |
| 50 | + "timestampMicros": "1486076786124987", |
| 51 | + "valueInUsd": 1234.5 |
| 52 | + } |
| 53 | + ], |
| 54 | + "userDim": { |
| 55 | + "userId": "abcdefghijklmnop!", |
| 56 | + "appInfo": { |
| 57 | + "appId": "com.mobileday.MobileDay", |
| 58 | + "appInstanceId": "E3C9939401814B9B954725A740B8C7BC", |
| 59 | + "appPlatform": "IOS", |
| 60 | + "appStore": "iTunes", |
| 61 | + "appVersion": "5.2.0" |
| 62 | + }, |
| 63 | + "trafficSource": { |
| 64 | + "userAcquiredSource": "Pizza Everywhere", |
| 65 | + "userAcquiredCampaign": "Functions launch party", |
| 66 | + "userAcquiredMedium": "Free food" |
| 67 | + }, |
| 68 | + "bundleInfo": { |
| 69 | + "bundleSequenceId":6034, |
| 70 | + "serverTimestampOffsetMicros": "370987" |
| 71 | + }, |
| 72 | + "deviceInfo": { |
| 73 | + "deviceCategory": "mobile", |
| 74 | + "deviceModel": "iPhone7,2", |
| 75 | + "deviceTimeZoneOffsetSeconds":-21600, |
| 76 | + "mobileBrandName": "Apple", |
| 77 | + "mobileMarketingName": "iPhone 6", |
| 78 | + "mobileModelName": "iPhone 6", |
| 79 | + "platformVersion": "10.2.1", |
| 80 | + "userDefaultLanguage": "en-us", |
| 81 | + "deviceId": "599F9C00-92DC-4B5C-9464-7971F01F8370", |
| 82 | + "resettableDeviceId": "599F9C00-92DC-4B5C-9464-7971F01F8370", |
| 83 | + "limitedAdTracking": true |
| 84 | + }, |
| 85 | + "firstOpenTimestampMicros": "1461855635819000", |
| 86 | + "geoInfo": { |
| 87 | + "city": "Plano", |
| 88 | + "continent": "021", |
| 89 | + "country": "United States", |
| 90 | + "region": "Texas" |
| 91 | + }, |
| 92 | + "userProperties": { |
| 93 | + "build": { |
| 94 | + "setTimestampUsec": "1486076786090987", |
| 95 | + "value": { |
| 96 | + "stringValue": "1350" |
| 97 | + }, |
| 98 | + "index": 1 |
| 99 | + }, |
| 100 | + "calls_remaining": { |
| 101 | + "setTimestampUsec": "1486076786094987", |
| 102 | + "value": { |
| 103 | + "stringValue": "10" |
| 104 | + }, |
| 105 | + "index": 2 |
| 106 | + }, |
| 107 | + "version": { |
| 108 | + "setTimestampUsec": "1486076786085987", |
| 109 | + "value": { |
| 110 | + "stringValue": "5.2.0" |
| 111 | + } |
| 112 | + } |
| 113 | + }, |
| 114 | + "ltvInfo": { |
| 115 | + "revenue": 133.7, |
| 116 | + "currency": "USD" |
| 117 | + } |
| 118 | + } |
| 119 | + }, |
| 120 | + "eventId": "1486080145623867projects/analytics-integration-fd82a/events/i_made_this_upproviders/google.firebase.analytics/eventTypes/event.sendprojects/f949d1bb9ef782579-tp/topics/cloud-functions-u54ejabpzs4prfjh7433eklhae", |
| 121 | + "eventType": "providers/google.firebase.analytics/eventTypes/event.send", |
| 122 | + "resource": "projects/analytics-integration-fd82a/events/i_made_this_up", |
| 123 | + "timestamp": "1969-12-31T23:59:59.986371388Z" |
| 124 | +}`); |
| 125 | + |
| 126 | +// The event data that we expect would be constructed if the payload above were to arrive. |
| 127 | +export const fullEventData: AnalyticsEvent = { |
| 128 | + date: '20170202', |
| 129 | + name: 'Loaded_In_Background', |
| 130 | + params: { |
| 131 | + build: '1350', |
| 132 | + calls_remaining: 10, |
| 133 | + fraction_calls_dropped: 0.0123456, |
| 134 | + average_call_rating: 4.5, |
| 135 | + }, |
| 136 | + logTime: '2017-02-02T23:06:26.124Z', |
| 137 | + previousLogTime: '2017-02-02T23:01:19.797Z', |
| 138 | + valueInUSD: 1234.5, |
| 139 | + user: { |
| 140 | + userId: 'abcdefghijklmnop!', |
| 141 | + appInfo: { |
| 142 | + appId: 'com.mobileday.MobileDay', |
| 143 | + appInstanceId: 'E3C9939401814B9B954725A740B8C7BC', |
| 144 | + appPlatform: 'IOS', |
| 145 | + appStore: 'iTunes', |
| 146 | + appVersion: '5.2.0', |
| 147 | + }, |
| 148 | + trafficSource: { |
| 149 | + userAcquiredSource: 'Pizza Everywhere', |
| 150 | + userAcquiredCampaign: 'Functions launch party', |
| 151 | + userAcquiredMedium: 'Free food', |
| 152 | + }, |
| 153 | + bundleInfo: { |
| 154 | + bundleSequenceId: 6034, |
| 155 | + serverTimestampOffset: 371, |
| 156 | + }, |
| 157 | + deviceInfo: { |
| 158 | + deviceCategory: 'mobile', |
| 159 | + deviceModel: 'iPhone7,2', |
| 160 | + deviceTimeZoneOffsetSeconds: -21600, |
| 161 | + mobileBrandName: 'Apple', |
| 162 | + mobileMarketingName: 'iPhone 6', |
| 163 | + mobileModelName: 'iPhone 6', |
| 164 | + platformVersion: '10.2.1', |
| 165 | + userDefaultLanguage: 'en-us', |
| 166 | + deviceId: '599F9C00-92DC-4B5C-9464-7971F01F8370', |
| 167 | + resettableDeviceId: '599F9C00-92DC-4B5C-9464-7971F01F8370', |
| 168 | + limitedAdTracking: true, |
| 169 | + }, |
| 170 | + firstOpenTime: '2016-04-28T15:00:35.819Z', |
| 171 | + geoInfo: { |
| 172 | + city: 'Plano', |
| 173 | + continent: '021', |
| 174 | + country: 'United States', |
| 175 | + region: 'Texas', |
| 176 | + }, |
| 177 | + userProperties: { |
| 178 | + build: { |
| 179 | + setTime: '2017-02-02T23:06:26.090Z', |
| 180 | + value: '1350', |
| 181 | + }, |
| 182 | + calls_remaining: { |
| 183 | + setTime: '2017-02-02T23:06:26.094Z', |
| 184 | + value: '10', |
| 185 | + }, |
| 186 | + version: { |
| 187 | + setTime: '2017-02-02T23:06:26.085Z', |
| 188 | + value: '5.2.0', |
| 189 | + }, |
| 190 | + }, |
| 191 | + ltvInUSD: 133.7, |
| 192 | + }, |
| 193 | +}; |
0 commit comments