diff --git a/packages/destination-actions/src/destinations/app-fit/__tests__/__snapshots__/snapshot.test.ts.snap b/packages/destination-actions/src/destinations/app-fit/__tests__/__snapshots__/snapshot.test.ts.snap index 91c320392b..9451a47a03 100644 --- a/packages/destination-actions/src/destinations/app-fit/__tests__/__snapshots__/snapshot.test.ts.snap +++ b/packages/destination-actions/src/destinations/app-fit/__tests__/__snapshots__/snapshot.test.ts.snap @@ -6,15 +6,27 @@ Object { "occurredAt": "2021-02-01T00:00:00.000Z", "payload": Object { "anonymousId": "m]^ldlwPRQruDQ&OXR1", - "deviceId": "m]^ldlwPRQruDQ&OXR1", - "deviceType": "m]^ldlwPRQruDQ&OXR1", - "eventId": "m]^ldlwPRQruDQ&OXR1", - "name": "m]^ldlwPRQruDQ&OXR1", - "osName": "m]^ldlwPRQruDQ&OXR1", + "eventName": "m]^ldlwPRQruDQ&OXR1", "properties": Object { "testType": "m]^ldlwPRQruDQ&OXR1", }, + "sourceEventId": "m]^ldlwPRQruDQ&OXR1", + "systemProperties": Object { + "appVersion": "m]^ldlwPRQruDQ&OXR1", + "device": Object { + "advertisingId": "m]^ldlwPRQruDQ&OXR1", + "id": "m]^ldlwPRQruDQ&OXR1", + "manufacturer": "m]^ldlwPRQruDQ&OXR1", + "model": "m]^ldlwPRQruDQ&OXR1", + }, + "ipAddress": "m]^ldlwPRQruDQ&OXR1", + "os": Object { + "name": "m]^ldlwPRQruDQ&OXR1", + "version": "m]^ldlwPRQruDQ&OXR1", + }, + }, "userId": "m]^ldlwPRQruDQ&OXR1", + "version": "2", }, } `; @@ -24,8 +36,13 @@ Object { "eventSource": "segment", "occurredAt": "2021-02-01T00:00:00.000Z", "payload": Object { - "eventId": "m]^ldlwPRQruDQ&OXR1", - "name": "m]^ldlwPRQruDQ&OXR1", + "eventName": "m]^ldlwPRQruDQ&OXR1", + "sourceEventId": "m]^ldlwPRQruDQ&OXR1", + "systemProperties": Object { + "device": Object {}, + "os": Object {}, + }, + "version": "2", }, } `; diff --git a/packages/destination-actions/src/destinations/app-fit/track/__tests__/__snapshots__/snapshot.test.ts.snap b/packages/destination-actions/src/destinations/app-fit/track/__tests__/__snapshots__/snapshot.test.ts.snap index 6d5134ace4..2d202e7e9d 100644 --- a/packages/destination-actions/src/destinations/app-fit/track/__tests__/__snapshots__/snapshot.test.ts.snap +++ b/packages/destination-actions/src/destinations/app-fit/track/__tests__/__snapshots__/snapshot.test.ts.snap @@ -6,15 +6,27 @@ Object { "occurredAt": "2021-02-01T00:00:00.000Z", "payload": Object { "anonymousId": "M$xwt#p", - "deviceId": "M$xwt#p", - "deviceType": "M$xwt#p", - "eventId": "M$xwt#p", - "name": "M$xwt#p", - "osName": "M$xwt#p", + "eventName": "M$xwt#p", "properties": Object { "testType": "M$xwt#p", }, + "sourceEventId": "M$xwt#p", + "systemProperties": Object { + "appVersion": "M$xwt#p", + "device": Object { + "advertisingId": "M$xwt#p", + "id": "M$xwt#p", + "manufacturer": "M$xwt#p", + "model": "M$xwt#p", + }, + "ipAddress": "M$xwt#p", + "os": Object { + "name": "M$xwt#p", + "version": "M$xwt#p", + }, + }, "userId": "M$xwt#p", + "version": "2", }, } `; @@ -24,8 +36,13 @@ Object { "eventSource": "segment", "occurredAt": "2021-02-01T00:00:00.000Z", "payload": Object { - "eventId": "M$xwt#p", - "name": "M$xwt#p", + "eventName": "M$xwt#p", + "sourceEventId": "M$xwt#p", + "systemProperties": Object { + "device": Object {}, + "os": Object {}, + }, + "version": "2", }, } `; diff --git a/packages/destination-actions/src/destinations/app-fit/track/__tests__/index.test.ts b/packages/destination-actions/src/destinations/app-fit/track/__tests__/index.test.ts index 1ce6845338..aab9508159 100644 --- a/packages/destination-actions/src/destinations/app-fit/track/__tests__/index.test.ts +++ b/packages/destination-actions/src/destinations/app-fit/track/__tests__/index.test.ts @@ -9,11 +9,16 @@ describe('AppFit.track', () => { it('should create an event', async () => { const timestamp = new Date().toISOString() const event = createTestEvent({ - name: 'Segment Test Event Name', + event: 'Segment Test Event Name', messageId: '12345', userId: 'userId1', timestamp, - context: { device: { id: 'device1234', type: 'ios' }, os: { name: 'iPhone OS' } }, + context: { + ip: '8.8.8.8', + app: { version: '1.0.0' }, + device: { id: 'device1234', advertisingId: 'adId1234', type: 'ios', model: 'iPhone7,2', manufacturer: 'Apple' }, + os: { name: 'iPhone OS', version: '10.1' } + }, properties: { foo: 'bar' } }) @@ -28,7 +33,7 @@ describe('AppFit.track', () => { expect(responses[0].status).toBe(200) expect(responses[0].data).toMatchObject({}) expect(responses[0].options.body).toBe( - `{"eventSource":"segment","occurredAt":"${timestamp}","payload":{"eventId":"12345","userId":"userId1","anonymousId":"anonId1234","name":"Test Event","properties":{"foo":"bar"},"deviceId":"device1234","deviceType":"ios","osName":"iPhone OS"}}` + `{"eventSource":"segment","occurredAt":"${timestamp}","payload":{"version":"2","sourceEventId":"12345","eventName":"Segment Test Event Name","userId":"userId1","anonymousId":"anonId1234","properties":{"foo":"bar"},"systemProperties":{"appVersion":"1.0.0","ipAddress":"8.8.8.8","os":{"name":"iPhone OS","version":"10.1"},"device":{"id":"device1234","advertisingId":"adId1234","manufacturer":"Apple","model":"iPhone7,2"}}}}` ) }) }) diff --git a/packages/destination-actions/src/destinations/app-fit/track/generated-types.ts b/packages/destination-actions/src/destinations/app-fit/track/generated-types.ts index cc2087b012..3f407245a3 100644 --- a/packages/destination-actions/src/destinations/app-fit/track/generated-types.ts +++ b/packages/destination-actions/src/destinations/app-fit/track/generated-types.ts @@ -23,6 +23,10 @@ export interface Payload { properties?: { [k: string]: unknown } + /** + * The app version + */ + appVersion?: string /** * The device ID of the user */ @@ -31,10 +35,30 @@ export interface Payload { * The device type */ deviceType?: string + /** + * The device manufacturer + */ + deviceManufacturer?: string + /** + * The device model + */ + deviceModel?: string + /** + * The device advertising ID + */ + deviceAdvertisingId?: string + /** + * The IP address of the client + */ + ipAddress?: string /** * The name of the operating system */ osName?: string + /** + * The version of the operating system + */ + osVersion?: string /** * The event ID */ diff --git a/packages/destination-actions/src/destinations/app-fit/track/index.ts b/packages/destination-actions/src/destinations/app-fit/track/index.ts index dab147b26c..86b3ed6bd4 100644 --- a/packages/destination-actions/src/destinations/app-fit/track/index.ts +++ b/packages/destination-actions/src/destinations/app-fit/track/index.ts @@ -49,6 +49,14 @@ const action: ActionDefinition = { '@path': '$.properties' } }, + appVersion: { + label: 'App Version', + description: 'The app version', + type: 'string', + default: { + '@path': '$.context.app.version' + } + }, deviceId: { label: 'Device ID', description: 'The device ID of the user', @@ -65,6 +73,38 @@ const action: ActionDefinition = { '@path': '$.context.device.type' } }, + deviceManufacturer: { + label: 'Device Manufacturer', + description: 'The device manufacturer', + type: 'string', + default: { + '@path': '$.context.device.manufacturer' + } + }, + deviceModel: { + label: 'Device Model', + description: 'The device model', + type: 'string', + default: { + '@path': '$.context.device.model' + } + }, + deviceAdvertisingId: { + label: 'Device Advertising ID', + description: 'The device advertising ID', + type: 'string', + default: { + '@path': '$.context.device.advertisingId' + } + }, + ipAddress: { + label: 'IP Address', + description: 'The IP address of the client', + type: 'string', + default: { + '@path': '$.context.ip' + } + }, osName: { label: 'OS Name', description: 'The name of the operating system', @@ -73,6 +113,14 @@ const action: ActionDefinition = { '@path': '$.context.os.name' } }, + osVersion: { + label: 'OS Version', + description: 'The version of the operating system', + type: 'string', + default: { + '@path': '$.context.os.version' + } + }, eventId: { label: 'Event ID', description: 'The event ID', @@ -92,14 +140,26 @@ const action: ActionDefinition = { eventSource: 'segment', occurredAt: payload.occurredAt, payload: { - eventId: payload.eventId, + version: '2', + sourceEventId: payload.eventId, + eventName: payload.name, userId: payload.userId, anonymousId: payload.anonymousId, - name: payload.name, properties: payload.properties, - deviceId: payload.deviceId, - deviceType: payload.deviceType, - osName: payload.osName + systemProperties: { + appVersion: payload.appVersion, + ipAddress: payload.ipAddress, + os: { + name: payload.osName, + version: payload.osVersion + }, + device: { + id: payload.deviceId, + advertisingId: payload.deviceAdvertisingId, + manufacturer: payload.deviceManufacturer, + model: payload.deviceModel + } + } } } })