-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Create Identity and User Interfaces for TypeScript (#883)
- Loading branch information
1 parent
7e9eb0c
commit 31569ed
Showing
20 changed files
with
635 additions
and
193 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
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
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 { | ||
AllUserAttributes, | ||
IdentityCallback, | ||
Product, | ||
User, | ||
} from '@mparticle/web-sdk'; | ||
import { SDKIdentityTypeEnum } from './identity.interfaces'; | ||
import { MessageType } from './types.interfaces'; | ||
import { BaseEvent } from './sdkRuntimeModels'; | ||
|
||
// https://go.mparticle.com/work/SQDSDKS-5033 | ||
// https://go.mparticle.com/work/SQDSDKS-6354 | ||
export interface IMParticleUser extends User { | ||
getAllUserAttributes(): any; | ||
setUserTag(tagName: string, value?: any): void; | ||
setUserAttribute(key: string, value: any): void; | ||
getUserAudiences?(callback?: IdentityCallback): void; | ||
} | ||
|
||
export interface ISDKUserIdentity { | ||
Identity: string; | ||
Type: number; | ||
} | ||
|
||
export interface ISDKUserIdentityChanges { | ||
New: ISDKUserIdentityChangeData; | ||
Old: ISDKUserIdentityChangeData; | ||
} | ||
|
||
export interface ISDKUserIdentityChangeData { | ||
IdentityType: SDKIdentityTypeEnum; | ||
Identity: string; | ||
CreatedThisBatch: boolean; | ||
// https://go.mparticle.com/work/SQDSDKS-6438 | ||
Timestamp?: number; | ||
} | ||
|
||
export interface IUserIdentityChangeEvent extends BaseEvent { | ||
messageType: MessageType.UserIdentityChange; | ||
userIdentityChanges: ISDKUserIdentityChanges; | ||
} | ||
|
||
export interface ISDKUserAttributeChangeData { | ||
UserAttributeName: string; | ||
New: string; | ||
Old: string; | ||
Deleted: boolean; | ||
IsNewAttribute: boolean; | ||
} | ||
|
||
export interface IUserAttributeChangeEvent extends BaseEvent { | ||
messageType: MessageType.UserAttributeChange; | ||
userAttributeChanges: ISDKUserAttributeChangeData; | ||
} | ||
|
||
export interface mParticleUserCart { | ||
add(product: Product, logEvent: boolean): void; | ||
remove(product: Product, logEvent: boolean): void; | ||
clear(): void; | ||
getCartProducts(): Product[]; | ||
} | ||
|
||
// https://go.mparticle.com/work/SQDSDKS-5196 | ||
export type UserAttributes = AllUserAttributes; |
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
Oops, something went wrong.