-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
import type { ZarazContext } from '.'; | ||
|
||
describe('enrichment', async () => { | ||
it('should export type ZarazContext', async () => { | ||
const contextObject = {} as ZarazContext; | ||
expect(contextObject).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Client } from '@managed-components/types'; | ||
|
||
/** | ||
* System Object Type. | ||
* Contains the page, cookies, device, consent, clientKV, and misc objects. | ||
* @since 2024-08-30 | ||
* @version 0.1.0 | ||
* @author mackenly | ||
* @see https://developers.cloudflare.com/zaraz/reference/context/ | ||
*/ | ||
interface System { | ||
page: { | ||
query: Object | any; | ||
title: string; | ||
url: URL; | ||
referrer: string; | ||
encoding: string; | ||
}, | ||
cookies: Object | any; | ||
device: { | ||
ip: string; | ||
resolution: string; | ||
viewport: string; | ||
language: string; | ||
location: Object | any; | ||
'user-agent': { | ||
ua: string; | ||
browser: { | ||
name: string; | ||
version: string; | ||
}; | ||
engine: { | ||
name: string; | ||
version: string; | ||
}; | ||
os: { | ||
name: string; | ||
version: string; | ||
}; | ||
device: string; | ||
cpu: string; | ||
}; | ||
}, | ||
consent: Object | any; | ||
clientKV: Object | any; | ||
misc: { | ||
random: number; | ||
timestamp: number; | ||
timestampMilliseconds: number; | ||
} | ||
} | ||
|
||
/** | ||
* Zaraz Context Enricher Type. | ||
* Contains the system and client objects. | ||
* @since 2024-08-30 | ||
* @version 0.1.0 | ||
* @author mackenly | ||
* @see https://developers.cloudflare.com/zaraz/advanced/context-enricher/ | ||
*/ | ||
export interface ZarazContext { | ||
system: System; | ||
client: Client; | ||
} |