@types/segment-analytics
Advanced tools
Comparing version 0.0.34 to 0.0.35
@@ -11,84 +11,83 @@ // Type definitions for Segment's analytics.js | ||
declare namespace SegmentAnalytics { | ||
// Generic options object with integrations | ||
interface SegmentOpts { | ||
integrations?: any; | ||
anonymousId?: string | undefined; | ||
context?: object | undefined; | ||
} | ||
// Generic options object with integrations | ||
interface SegmentOpts { | ||
integrations?: any; | ||
anonymousId?: string | undefined; | ||
context?: object | undefined; | ||
} | ||
interface CookieOptions { | ||
maxage?: number | undefined; | ||
domain?: string | undefined; | ||
path?: string | undefined; | ||
secure?: boolean | undefined; | ||
} | ||
interface CookieOptions { | ||
maxage?: number | undefined; | ||
domain?: string | undefined; | ||
path?: string | undefined; | ||
secure?: boolean | undefined; | ||
} | ||
interface MetricsOptions { | ||
host?: string | undefined; | ||
sampleRate?: number | undefined; | ||
flushTimer?: number | undefined; | ||
maxQueueSize?: number | undefined; | ||
} | ||
interface MetricsOptions { | ||
host?: string | undefined; | ||
sampleRate?: number | undefined; | ||
flushTimer?: number | undefined; | ||
maxQueueSize?: number | undefined; | ||
} | ||
interface StoreOptions { | ||
enabled?: boolean | undefined; | ||
} | ||
interface StoreOptions { | ||
enabled?: boolean | undefined; | ||
} | ||
interface UserOptions { | ||
cookie?: { | ||
key: string; | ||
oldKey: string; | ||
} | undefined; | ||
localStorage?: { | ||
key: string; | ||
} | undefined; | ||
persist?: boolean | undefined; | ||
} | ||
interface UserOptions { | ||
cookie?: { | ||
key: string; | ||
oldKey: string; | ||
} | undefined; | ||
localStorage?: { | ||
key: string; | ||
} | undefined; | ||
persist?: boolean | undefined; | ||
} | ||
interface GroupOptions { | ||
cookie?: { | ||
key: string; | ||
} | undefined; | ||
localStorage?: { | ||
key: string; | ||
} | undefined; | ||
persist?: boolean | undefined; | ||
} | ||
interface GroupOptions { | ||
cookie?: { | ||
key: string; | ||
} | undefined; | ||
localStorage?: { | ||
key: string; | ||
} | undefined; | ||
persist?: boolean | undefined; | ||
} | ||
interface InitOptions { | ||
cookie?: CookieOptions | undefined; | ||
metrics?: MetricsOptions | undefined; | ||
localStorage?: StoreOptions | undefined; | ||
user?: UserOptions | undefined; | ||
group?: GroupOptions | undefined; | ||
integrations?: { | ||
All?: boolean | undefined; | ||
[integration: string]: boolean | undefined; | ||
} | undefined; | ||
} | ||
interface InitOptions { | ||
cookie?: CookieOptions | undefined; | ||
metrics?: MetricsOptions | undefined; | ||
localStorage?: StoreOptions | undefined; | ||
user?: UserOptions | undefined; | ||
group?: GroupOptions | undefined; | ||
integrations?: { | ||
All?: boolean | undefined; | ||
[integration: string]: boolean | undefined; | ||
} | undefined; | ||
} | ||
interface IntegrationsSettings { | ||
[key: string]: any; | ||
} | ||
interface IntegrationsSettings { | ||
[key: string]: any; | ||
} | ||
// The actual analytics.js object | ||
interface AnalyticsJS { | ||
/* Use a plugin */ | ||
use(plugin: (analytics: AnalyticsJS) => void): this; | ||
// The actual analytics.js object | ||
interface AnalyticsJS { | ||
/* Use a plugin */ | ||
use(plugin: (analytics: AnalyticsJS) => void): this; | ||
/* Initialize with the given integration `settings` and `options`. */ | ||
init(settings?: IntegrationsSettings, options?: InitOptions): this; | ||
/* Initialize with the given integration `settings` and `options`. */ | ||
init(settings?: IntegrationsSettings, options?: InitOptions): this; | ||
/* Define a new integration */ | ||
addIntegration(integration: (options: any) => void): this; | ||
/* Define a new integration */ | ||
addIntegration(integration: (options: any) => void): this; | ||
/* Set the user's `id`. */ | ||
setAnonymousId(id: string): this; | ||
/* Set the user's `id`. */ | ||
setAnonymousId(id: string): this; | ||
/* Configure Segment with write key */ | ||
load(writeKey: string): void; | ||
/* Configure Segment with write key */ | ||
load(writeKey: string): void; | ||
/* Configure Segment with write key & integration management. | ||
/* Configure Segment with write key & integration management. | ||
The load method can also be modified to take a second argument, | ||
@@ -98,43 +97,35 @@ an object with an integrations dictionary, which used to load | ||
works in version 4.1.0 or higher */ | ||
load(writeKey: string, options?: SegmentOpts): void; | ||
load(writeKey: string, options?: SegmentOpts): void; | ||
/* The identify method is how you tie one of your users and their actions | ||
/* The identify method is how you tie one of your users and their actions | ||
to a recognizable userId and traits. */ | ||
identify(userId: string, traits?: Object, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
identify(userId: string, traits: Object, callback?: () => void): void; | ||
identify(userId: string, callback?: () => void): void; | ||
identify(traits?: Object, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
identify(traits?: Object, callback?: () => void): void; | ||
identify(callback: () => void): void; | ||
identify(userId: string, traits?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
identify(userId: string, traits: Object, callback?: () => void): void; | ||
identify(userId: string, callback?: () => void): void; | ||
identify(traits?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
identify(traits?: Object, callback?: () => void): void; | ||
identify(callback: () => void): void; | ||
/* The track method lets you record any actions your users perform. */ | ||
track(event: string, properties?: Object, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
track(event: string, properties?: Object, | ||
callback?: () => void): void; | ||
track(event: string, callback?: () => void): void; | ||
/* The track method lets you record any actions your users perform. */ | ||
track(event: string, properties?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
track(event: string, properties?: Object, callback?: () => void): void; | ||
track(event: string, callback?: () => void): void; | ||
/* The page method lets you record page views on your website, along with | ||
/* The page method lets you record page views on your website, along with | ||
optional extra information about the page being viewed. */ | ||
page(category?: string, name?: string, properties?: Object, | ||
options?: SegmentOpts, callback?: () => void): void; | ||
page(name?: string, properties?: Object, | ||
options?: SegmentOpts, callback?: () => void): void; | ||
page(name?: string, properties?: Object, callback?: () => void): void; | ||
page(name?: string, callback?: () => void): void; | ||
page(properties?: Object, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
page(callback?: () => void): void; | ||
page(category?: string, name?: string, properties?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
page(name?: string, properties?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
page(name?: string, properties?: Object, callback?: () => void): void; | ||
page(name?: string, callback?: () => void): void; | ||
page(properties?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
page(callback?: () => void): void; | ||
/* The group method associates an individual user with a group. The group | ||
/* The group method associates an individual user with a group. The group | ||
can a company, organization, account, project, team or any other name | ||
you came up with for the same concept. */ | ||
group(groupId: string, traits?: Object, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
group(groupId: string, traits?: Object, callback?: () => void): void; | ||
group(groupId: string, callback?: () => void): void; | ||
group(groupId: string, traits?: Object, options?: SegmentOpts, callback?: () => void): void; | ||
group(groupId: string, traits?: Object, callback?: () => void): void; | ||
group(groupId: string, callback?: () => void): void; | ||
/* The alias method combines two previously unassociated user identities. | ||
/* The alias method combines two previously unassociated user identities. | ||
This comes in handy if the same user visits from two different devices | ||
@@ -146,65 +137,67 @@ and you want to combine their history. | ||
after sign up with their brand new userId. */ | ||
alias(userId: string, previousId?: string, options?: SegmentOpts, | ||
callback?: () => void): void; | ||
alias(userId: string, previousId?: string, callback?: () => void): void; | ||
alias(userId: string, callback?: () => void): void; | ||
alias(userId: string, options?: SegmentOpts, callback?: () => void): void; | ||
alias(userId: string, previousId?: string, options?: SegmentOpts, callback?: () => void): void; | ||
alias(userId: string, previousId?: string, callback?: () => void): void; | ||
alias(userId: string, callback?: () => void): void; | ||
alias(userId: string, options?: SegmentOpts, callback?: () => void): void; | ||
/* trackLink is a helper that binds a track call to whenever a link is | ||
/* trackLink is a helper that binds a track call to whenever a link is | ||
clicked. Usually the page would change before you could call track, but | ||
with trackLink a small timeout is inserted to give the track call enough | ||
time to fire. */ | ||
trackLink(elements: JQuery|Element[]|Element, | ||
event: string|{ (elm: Element): string }, | ||
properties?: Object|{ (elm: Element): Object }): void; | ||
trackLink( | ||
elements: JQuery | Element[] | Element, | ||
event: string | { (elm: Element): string }, | ||
properties?: Object | { (elm: Element): Object }, | ||
): void; | ||
/* trackForm is a helper that binds a track call to a form submission. | ||
/* trackForm is a helper that binds a track call to a form submission. | ||
Usually the page would change before you could call track, but with | ||
trackForm a small timeout is inserted to give the track call enough | ||
time to fire. */ | ||
trackForm(elements: JQuery|Element[]|Element, | ||
event: string|{ (elm: Element): string }, | ||
properties?: Object|{ (elm: Element): Object }): void; | ||
trackForm( | ||
elements: JQuery | Element[] | Element, | ||
event: string | { (elm: Element): string }, | ||
properties?: Object | { (elm: Element): Object }, | ||
): void; | ||
/* The ready method allows you to pass in a callback that will be called as | ||
/* The ready method allows you to pass in a callback that will be called as | ||
soon as all of your enabled integrations have loaded. It’s like jQuery’s | ||
ready method, except for integrations. */ | ||
ready(callback: () => void): void; | ||
ready(callback: () => void): void; | ||
/* If you need to clear the user and group id and traits we’ve added a | ||
/* If you need to clear the user and group id and traits we’ve added a | ||
reset function that is most commonly used when your identified users | ||
logout of your application. */ | ||
reset(): void; | ||
reset(): void; | ||
/* Once Analytics.js loaded, you can retrieve information about the | ||
/* Once Analytics.js loaded, you can retrieve information about the | ||
currently identified user or group like their id and traits. */ | ||
user(): { | ||
id(newId?: string | null): string | null | undefined; | ||
logout(): void; | ||
reset(): void; | ||
anonymousId(newId?: string): string; | ||
traits(newTraits?: Object): void; | ||
} | ||
user(): { | ||
id(newId?: string | null): string | null | undefined; | ||
logout(): void; | ||
reset(): void; | ||
anonymousId(newId?: string): string; | ||
traits(newTraits?: Object): void; | ||
}; | ||
group(): { | ||
id(): string; | ||
traits(newTraits?: Object): void; | ||
} | ||
group(): { | ||
id(): string; | ||
traits(newTraits?: Object): void; | ||
}; | ||
/* Analytics.js has a debug mode that logs helpful messages to the | ||
/* Analytics.js has a debug mode that logs helpful messages to the | ||
console. */ | ||
debug(state?: boolean): void; | ||
debug(state?: boolean): void; | ||
/* The global analytics object emits events whenever you call alias, group, | ||
/* The global analytics object emits events whenever you call alias, group, | ||
identify, track or page. That way you can listen to those events and run | ||
your own custom code. */ | ||
on(event: string, | ||
callback: { | ||
(event: string, properties: Object, options: SegmentOpts): void | ||
}): void; | ||
on(event: string, callback: { | ||
(event: string, properties: Object, options: SegmentOpts): void; | ||
}): void; | ||
/* You can extend the length (in milliseconds) of the method callbacks and | ||
/* You can extend the length (in milliseconds) of the method callbacks and | ||
helpers */ | ||
timeout(milliseconds: number): void; | ||
} | ||
timeout(milliseconds: number): void; | ||
} | ||
} | ||
@@ -214,5 +207,5 @@ | ||
declare module '@segment/analytics.js-core' { | ||
var analytics: SegmentAnalytics.AnalyticsJS; | ||
export default analytics; | ||
declare module "@segment/analytics.js-core" { | ||
var analytics: SegmentAnalytics.AnalyticsJS; | ||
export default analytics; | ||
} |
{ | ||
"name": "@types/segment-analytics", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"description": "TypeScript definitions for Segment's analytics.js", | ||
@@ -28,4 +28,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/segment-analytics", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "30b4de46ee113e485ccc8b38faa2144bf5fb3d953b4c010319850252f9a07b85", | ||
"typeScriptVersion": "3.6" | ||
"typesPublisherContentHash": "1445b86571b655770742411b8e931b6a677aa4432ca76a1b3cde8d748b87de8a", | ||
"typeScriptVersion": "4.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Tue, 06 Jul 2021 16:34:28 GMT | ||
* Last updated: Mon, 25 Sep 2023 13:39:06 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: `analytics` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11140
174