@incognia/web-sdk-types 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +13 -0
  2. package/index.d.ts +57 -0
  3. package/package.json +16 -0
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ ![Alt logoImage][logo]
2
+
3
+ # Incognia SDK TypeScript Definitions
4
+
5
+ This package contains TypeScript definitions for the `window.IncogniaWebSdk` global object. It is only necessary if your project:
6
+
7
+ - Uses TypeScript; and
8
+ - Integrates using a `<script>` tag pointing to the Incognia CDN (instead of https://www.npmjs.com/package/@incognia/web-sdk).
9
+
10
+ See our [documentation][docs] for more details.
11
+
12
+ [logo]: https://www.incognia.com/hubfs/US/Brand/Logo/logo-incognia-purple.svg
13
+ [docs]: https://developer.incognia.com/docs/web/v1
package/index.d.ts ADDED
@@ -0,0 +1,57 @@
1
+ type Identity = {
2
+ accountId: string
3
+ }
4
+ /**
5
+ * @deprecated Since v1.2.0 - Use `GenerateRequestTokenParams` instead.
6
+ */
7
+ type GetSessionTokenParams = {
8
+ askForGeolocation: boolean
9
+ }
10
+ type GenerateRequestTokenParams = {
11
+ askForGeolocation: boolean
12
+ }
13
+ type EventProperties = Record<string, string | number | boolean>
14
+ type EventAddress = {
15
+ locale?: string
16
+ countryCode?: string
17
+ countryName?: string
18
+ state?: string
19
+ city?: string
20
+ neighborhood?: string
21
+ number?: string | number
22
+ street?: string
23
+ postalCode?: string | number
24
+ addressLine?: string
25
+ latitude?: number
26
+ longitude?: number
27
+ }
28
+ type CustomEventParams = {
29
+ tag: string
30
+ accountId?: string | number
31
+ externalId?: string | number
32
+ address?: EventAddress
33
+ properties?: EventProperties
34
+ }
35
+ type IncogniaOptions = {
36
+ appId?: string
37
+ logEnabled?: boolean
38
+ }
39
+ type IncogniaWebSdk = {
40
+ init(appIdOrOptions: string | IncogniaOptions): Promise<void>
41
+ setAccountId(accountId: string): Promise<void>
42
+ clearAccountId(): Promise<void>
43
+ /**
44
+ * @deprecated Since v1.2.0 - Use `setAccountId` to set a new account id and `clearAccountId` to clear the account id instead.
45
+ */
46
+ identify(identity: Identity): Promise<void>
47
+ generateRequestToken(
48
+ options?: GenerateRequestTokenParams
49
+ ): Promise<string | undefined>
50
+ /**
51
+ * @deprecated Since v1.2.0 - Use `generateRequestToken` instead.
52
+ */
53
+ getSessionToken(options?: GetSessionTokenParams): Promise<string | undefined>
54
+ sendCustomEvent(params: CustomEventParams): Promise<void>
55
+ }
56
+ // eslint-disable-next-line no-redeclare
57
+ declare var IncogniaWebSdk: IncogniaWebSdk
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@incognia/web-sdk-types",
3
+ "description": "Incognia SDK type definitions",
4
+ "author": "",
5
+ "version": "1.5.0",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "incognia",
9
+ "web",
10
+ "sdk"
11
+ ],
12
+ "types": "index.d.ts",
13
+ "files": [
14
+ "index.d.ts"
15
+ ]
16
+ }