@vizbeetv/homesso-sdk-qa 1.0.1
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.
- package/README.md +319 -0
- package/es5/index.cjs +1821 -0
- package/es5/index.mjs +1811 -0
- package/es6/index.cjs +1722 -0
- package/es6/index.mjs +1712 -0
- package/package.json +36 -0
- package/types/VizbeeHomeSSOManager.d.ts +186 -0
- package/types/VizbeeSignInStatusCallback.d.ts +34 -0
- package/types/index.d.ts +63 -0
- package/types/metrics/IVizbeeAttributesProvider.d.ts +3 -0
- package/types/metrics/VizbeeMetricsConstants.d.ts +27 -0
- package/types/metrics/VizbeeMetricsManager.d.ts +15 -0
- package/types/model/VizbeeSenderSignInInfo.d.ts +20 -0
- package/types/model/VizbeeSignInInfo.d.ts +11 -0
- package/types/model/VizbeeSignInStatus.d.ts +31 -0
- package/types/types.d.ts +77 -0
- package/types/ui/VizbeeHomeSSOUIConfig.d.ts +156 -0
- package/types/ui/VizbeeHomeSSOUIManager.d.ts +105 -0
- package/types/ui/VizbeeSnackBar.d.ts +100 -0
- package/types/utils/Logger.d.ts +208 -0
- package/types/utils/constants.d.ts +27 -0
- package/types/utils/http-client.d.ts +114 -0
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vizbeetv/homesso-sdk-qa",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "TV app authentication library (QA)",
|
|
5
|
+
"main": "./es5/index.cjs",
|
|
6
|
+
"module": "./es5/index.mjs",
|
|
7
|
+
"types": "./types/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./types/index.d.ts",
|
|
11
|
+
"import": "./es5/index.mjs",
|
|
12
|
+
"require": "./es5/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./es5": {
|
|
15
|
+
"types": "./types/index.d.ts",
|
|
16
|
+
"import": "./es5/index.mjs",
|
|
17
|
+
"require": "./es5/index.cjs"
|
|
18
|
+
},
|
|
19
|
+
"./es6": {
|
|
20
|
+
"types": "./types/index.d.ts",
|
|
21
|
+
"import": "./es6/index.mjs",
|
|
22
|
+
"require": "./es6/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"tv",
|
|
28
|
+
"authentication",
|
|
29
|
+
"sso"
|
|
30
|
+
],
|
|
31
|
+
"author": "",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { VizbeeSignInInfo } from './model/VizbeeSignInInfo';
|
|
2
|
+
import { FailureStatus, ProgressStatus, SuccessStatus } from './model/VizbeeSignInStatus';
|
|
3
|
+
import { MessagePayload, VizbeeModalPreferences, VizbeeSignInStatusCallback } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Manages Single Sign-On (SSO) functionality between mobile and TV devices in the Vizbee ecosystem.
|
|
6
|
+
* Implements singleton pattern for global state management.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* This class serves as the central manager for SSO operations, handling:
|
|
10
|
+
* - Communication between mobile and TV devices
|
|
11
|
+
* - Sign-in status management and updates
|
|
12
|
+
* - UI state management
|
|
13
|
+
* - Analytics and metrics tracking
|
|
14
|
+
*
|
|
15
|
+
* @class VizbeeHomeSSOManager
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare class VizbeeHomeSSOManager implements VizbeeSignInStatusCallback {
|
|
19
|
+
/** @internal Singleton instance of the manager */
|
|
20
|
+
private static instance;
|
|
21
|
+
/** @internal Vizbee session instance for managing communication */
|
|
22
|
+
private vizbeeSession;
|
|
23
|
+
/** @internal Client for handling messaging between devices */
|
|
24
|
+
private vizbeeMessagingClient;
|
|
25
|
+
/** @internal Callback function to retrieve sign-in information */
|
|
26
|
+
private getSignInInfo;
|
|
27
|
+
/** @internal List of sign-in information for different services */
|
|
28
|
+
private signInInfoList;
|
|
29
|
+
/** @internal Tracks if remote device is signed in */
|
|
30
|
+
private isRemoteSignedIn;
|
|
31
|
+
/** @internal Tracks if screen device is signed in */
|
|
32
|
+
private isScreenSignedIn;
|
|
33
|
+
/** @internal Tracks if sign-in process is currently active */
|
|
34
|
+
private isSignInInProgress;
|
|
35
|
+
/** @internal UI manager instance for handling SSO-related displays */
|
|
36
|
+
private vizbeeHomeSSOUIManager;
|
|
37
|
+
/** @internal Snackbar instance for showing notifications */
|
|
38
|
+
private readonly snackbar;
|
|
39
|
+
/** @internal Information about the sender device */
|
|
40
|
+
private senderInfo;
|
|
41
|
+
/** @internal Manager for handling metrics and analytics */
|
|
42
|
+
private readonly vizbeeMetricsManager;
|
|
43
|
+
private signInHandler;
|
|
44
|
+
/**
|
|
45
|
+
* Modal display preferences for the SSO UI
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
modalPreferences: VizbeeModalPreferences;
|
|
49
|
+
/**
|
|
50
|
+
* Private constructor to enforce singleton pattern
|
|
51
|
+
* Initializes necessary components and sets up default handlers
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
private constructor();
|
|
56
|
+
/**
|
|
57
|
+
* Gets the singleton instance of VizbeeHomeSSOManager
|
|
58
|
+
* Creates a new instance if one doesn't exist
|
|
59
|
+
*
|
|
60
|
+
* @returns The singleton instance of the SSO manager
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
static getInstance(): VizbeeHomeSSOManager;
|
|
64
|
+
init(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Sets up a handler for processing sign-in events from mobile devices
|
|
67
|
+
*
|
|
68
|
+
* @param handler - Callback function to process sign-in information and provide status updates
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
setSignInHandler(handler: (signInInfo: MessagePayload, statusCallback: (signInStatus: ProgressStatus | SuccessStatus | FailureStatus) => void) => void): void;
|
|
72
|
+
/**
|
|
73
|
+
* Sets the callback for retrieving sign-in information
|
|
74
|
+
*
|
|
75
|
+
* @param getSignInInfo - Async callback that provides the list of sign-in information
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
setSignInInfoGetter(getSignInInfo: () => Promise<VizbeeSignInInfo[]>): void;
|
|
79
|
+
/**
|
|
80
|
+
* Handles sign-in progress updates
|
|
81
|
+
* Updates UI, sends status to mobile device, and logs metrics
|
|
82
|
+
*
|
|
83
|
+
* @param progressStatus - Current progress status of the sign-in process
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
onProgress(progressStatus: ProgressStatus): void;
|
|
87
|
+
/**
|
|
88
|
+
* Handles successful sign-in completion
|
|
89
|
+
* Updates UI, sends success status to mobile device, and logs metrics
|
|
90
|
+
*
|
|
91
|
+
* @param successStatus - Success status details
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
onSuccess(successStatus: SuccessStatus): void;
|
|
95
|
+
/**
|
|
96
|
+
* Handles sign-in failures
|
|
97
|
+
* Updates UI and sends failure status to mobile device
|
|
98
|
+
*
|
|
99
|
+
* @param failureStatus - Failure status details
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
onFailure(failureStatus: FailureStatus): void;
|
|
103
|
+
/**
|
|
104
|
+
* Adds custom attributes for metrics tracking
|
|
105
|
+
*
|
|
106
|
+
* @param customEventAttributes - Dictionary of custom attributes to track
|
|
107
|
+
* @public
|
|
108
|
+
*/
|
|
109
|
+
addCustomEventAttributes(customEventAttributes: Record<string, unknown>): void;
|
|
110
|
+
/**
|
|
111
|
+
* Initializes Vizbee session and messaging client
|
|
112
|
+
*
|
|
113
|
+
* @throws Error if initialization fails
|
|
114
|
+
* @internal
|
|
115
|
+
*/
|
|
116
|
+
private initializeVizbeeSession;
|
|
117
|
+
/**
|
|
118
|
+
* Processes incoming sign-in requests
|
|
119
|
+
* Validates request and triggers appropriate handler
|
|
120
|
+
*
|
|
121
|
+
* @param payload - Sign-in request payload
|
|
122
|
+
* @param handler - Callback to handle the sign-in request
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
private handleSignInRequest;
|
|
126
|
+
/**
|
|
127
|
+
* Determines if a sign-in request should be ignored
|
|
128
|
+
* Checks various conditions like existing sign-in state
|
|
129
|
+
*
|
|
130
|
+
* @returns Promise<boolean> indicating if request should be ignored
|
|
131
|
+
* @internal
|
|
132
|
+
*/
|
|
133
|
+
private shouldIgnoreSignInRequest;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if user is already signed in for a specific sign-in type
|
|
136
|
+
*
|
|
137
|
+
* @param signInType - Type of sign-in to check
|
|
138
|
+
* @returns Promise<boolean> indicating if user is signed in
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
private isUserAlreadySignedIn;
|
|
142
|
+
/**
|
|
143
|
+
* Handles sign-in status updates
|
|
144
|
+
* Routes status updates to appropriate handlers
|
|
145
|
+
*
|
|
146
|
+
* @param status - Current status of the sign-in process
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
private handleSignInStatus;
|
|
150
|
+
/**
|
|
151
|
+
* Sends status updates to mobile device
|
|
152
|
+
*
|
|
153
|
+
* @param status - Status to send to mobile device
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
private sendStatusToSender;
|
|
157
|
+
/**
|
|
158
|
+
* Serializes status objects for transmission to mobile device
|
|
159
|
+
*
|
|
160
|
+
* @param status - Status object to serialize
|
|
161
|
+
* @returns Serialized status object or null if invalid status type
|
|
162
|
+
* @internal
|
|
163
|
+
*/
|
|
164
|
+
private serializeStatus;
|
|
165
|
+
/**
|
|
166
|
+
* Updates UI for sign-in progress state
|
|
167
|
+
* Shows appropriate modal based on remote sign-in status
|
|
168
|
+
*
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
private updateProgressUI;
|
|
172
|
+
/**
|
|
173
|
+
* Updates UI for successful sign-in
|
|
174
|
+
* Shows success modal with appropriate message
|
|
175
|
+
*
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
private updateSuccessUI;
|
|
179
|
+
/**
|
|
180
|
+
* Updates UI for failed sign-in
|
|
181
|
+
* Hides any active modals
|
|
182
|
+
*
|
|
183
|
+
* @internal
|
|
184
|
+
*/
|
|
185
|
+
private updateFailureUI;
|
|
186
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
interface VizbeeSignInStatusBase {
|
|
2
|
+
provider: string;
|
|
3
|
+
}
|
|
4
|
+
interface VizbeeSignInProgressStatus extends VizbeeSignInStatusBase {
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
interface VizbeeSignInSuccessStatus extends VizbeeSignInStatusBase {
|
|
8
|
+
userId: string;
|
|
9
|
+
}
|
|
10
|
+
interface VizbeeSignInFailureStatus extends VizbeeSignInStatusBase {
|
|
11
|
+
error: string;
|
|
12
|
+
isCancelled: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface VizbeeSignInStatusCallback {
|
|
15
|
+
/**
|
|
16
|
+
* Called as soon as registration code is generated
|
|
17
|
+
* @param progress - Contains provider and progress data including registration code
|
|
18
|
+
* @example callback.onProgress({ provider: "mvpd", data: { regcode: "123456" } })
|
|
19
|
+
*/
|
|
20
|
+
onProgress(progress: VizbeeSignInProgressStatus): void;
|
|
21
|
+
/**
|
|
22
|
+
* Called as soon as the polling succeeds
|
|
23
|
+
* @param success - Contains provider and user ID
|
|
24
|
+
* @example callback.onSuccess({ provider: "mvpd", userId: "user123" })
|
|
25
|
+
*/
|
|
26
|
+
onSuccess(success: VizbeeSignInSuccessStatus): void;
|
|
27
|
+
/**
|
|
28
|
+
* Called as soon as the polling fails or user cancels the sign-in
|
|
29
|
+
* @param failure - Contains provider, error message, and cancellation status
|
|
30
|
+
* @example callback.onFailure({ provider: "mvpd", error: "xyz", isCancelled: false })
|
|
31
|
+
*/
|
|
32
|
+
onFailure(failure: VizbeeSignInFailureStatus): void;
|
|
33
|
+
}
|
|
34
|
+
export type { VizbeeSignInStatusCallback, VizbeeSignInProgressStatus, VizbeeSignInSuccessStatus, VizbeeSignInFailureStatus, };
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { VizbeeHomeSSOManager } from './VizbeeHomeSSOManager';
|
|
2
|
+
import { ProgressStatus, SuccessStatus, FailureStatus } from './model/VizbeeSignInStatus';
|
|
3
|
+
import { IVizbeeAnalyticsProvider, IVizbeeXMessages } from './types';
|
|
4
|
+
import { VizbeeHomeSSOUIManager } from './ui/VizbeeHomeSSOUIManager';
|
|
5
|
+
import { LogLevel } from './utils/Logger';
|
|
6
|
+
/**
|
|
7
|
+
* @class HomeSSOContext
|
|
8
|
+
* @description Context provider for Vizbee Home SSO functionality
|
|
9
|
+
*/
|
|
10
|
+
declare class HomeSSOContext {
|
|
11
|
+
private static instance;
|
|
12
|
+
private homeSSOUIManager;
|
|
13
|
+
private constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Gets the singleton instance of HomeSSOContext
|
|
16
|
+
* @returns The singleton instance of HomeSSOContext
|
|
17
|
+
*/
|
|
18
|
+
static getInstance(): HomeSSOContext;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the HomeSSOManager instance
|
|
21
|
+
* @returns The singleton instance of VizbeeHomeSSOManager
|
|
22
|
+
*/
|
|
23
|
+
getHomeSSOManager(): VizbeeHomeSSOManager;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the HomeSSOUIManager instance
|
|
26
|
+
* @param config Optional UI configuration including theme settings
|
|
27
|
+
* @returns The singleton instance of VizbeeHomeSSOUIManager
|
|
28
|
+
*/
|
|
29
|
+
getHomeSSOUIManager(): VizbeeHomeSSOUIManager;
|
|
30
|
+
enableLogger(enable: boolean): void;
|
|
31
|
+
setLoggerLevel(level: LogLevel): void;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface Window {
|
|
35
|
+
vizbee: {
|
|
36
|
+
continuity?: {
|
|
37
|
+
xmessages: IVizbeeXMessages;
|
|
38
|
+
analytics: {
|
|
39
|
+
AnalyticsProvider: new () => IVizbeeAnalyticsProvider;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
homesso: {
|
|
43
|
+
HomeSSOContext: typeof HomeSSOContext;
|
|
44
|
+
messages: {
|
|
45
|
+
ProgressStatus: typeof ProgressStatus;
|
|
46
|
+
SuccessStatus: typeof SuccessStatus;
|
|
47
|
+
FailureStatus: typeof FailureStatus;
|
|
48
|
+
};
|
|
49
|
+
LoggerLevel: typeof LogLevel;
|
|
50
|
+
VERSION: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export { HomeSSOContext };
|
|
56
|
+
export { ProgressStatus, SuccessStatus, FailureStatus } from './model/VizbeeSignInStatus';
|
|
57
|
+
export { LogLevel } from './utils/Logger';
|
|
58
|
+
export { VizbeeHomeSSOManager } from './VizbeeHomeSSOManager';
|
|
59
|
+
export { VizbeeHomeSSOUIManager } from './ui/VizbeeHomeSSOUIManager';
|
|
60
|
+
export { UNKNOWN_VALUE } from './model/VizbeeSignInInfo';
|
|
61
|
+
export type { VizbeeSignInInfo } from './model/VizbeeSignInInfo';
|
|
62
|
+
export type { VizbeeSignInStatusCallback, IVizbeeAnalyticsProvider, IVizbeeXMessages, IVizbeeMessagingClient, IVizbeeSession, IVizbeeBicastSessionManager, ISessionStateListener, MessagePayload, VizbeeSenderDevice, } from './types';
|
|
63
|
+
export type { VizbeeHomeSSOTheme, CommonModalPreferenceOptions, InformationalSignInPreferenceOptions, ProgressSignInPreferenceOptions, SuccessSignInPreferenceOptions, } from './ui/VizbeeHomeSSOUIConfig';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @const VizbeeConstants
|
|
3
|
+
* @description Metrics Constants used throughout the Vizbee Home SSO implementation
|
|
4
|
+
*/
|
|
5
|
+
export declare const VizbeeMetricsConstants: {
|
|
6
|
+
METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_RECEIVED: string;
|
|
7
|
+
METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_STATUS: string;
|
|
8
|
+
METRICS_ATTR_SCREEN_HOMESSO_SDK_VERSION: string;
|
|
9
|
+
METRICS_ATTR_IS_SCREEN_SIGNED_IN: string;
|
|
10
|
+
METRICS_ATTR_IS_REMOTE_SIGNED_IN: string;
|
|
11
|
+
METRICS_ATTR_IS_SCREEN_SIGN_IN_STATUS: string;
|
|
12
|
+
METRICS_ATTR_SCREEN_HOMESSO_USER_ID: string;
|
|
13
|
+
METRICS_ATTR_SCREEN_HOMESSO_USER_INFO: string;
|
|
14
|
+
METRICS_ATTR_HOMESSO_SIGN_IN_TYPE: string;
|
|
15
|
+
METRICS_ATTR_REMOTE_DEVICE_ID: string;
|
|
16
|
+
METRICS_ATTR_REMOTE_DEVICE_TYPE: string;
|
|
17
|
+
METRICS_ATTR_REMOTE_FRIENDLY_NAME: string;
|
|
18
|
+
METRICS_ATTR_REMOTE_NETWORK_SESSION_ID: string;
|
|
19
|
+
METRICS_ATTR_USER_LOGIN_TYPE: string;
|
|
20
|
+
METRICS_ATTR_USER_IS_SIGNED_IN: string;
|
|
21
|
+
METRICS_ATTR_USER_LOGIN: string;
|
|
22
|
+
METRICS_ATTR_USER_NAME: string;
|
|
23
|
+
METRICS_ATTR_USER_SUBSCRIPTION_TYPE: string;
|
|
24
|
+
METRICS_ATTR_USER_SUBSCRIPTION_VALUE: string;
|
|
25
|
+
METRICS_ATTR_USER_SUBSCRIPTION_RENEWAL_TYPE: string;
|
|
26
|
+
METRICS_ATTR_USER_ADDITIONAL_INFO: string;
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SenderInfo } from '../model/VizbeeSenderSignInInfo';
|
|
2
|
+
import { VizbeeSignInInfo } from '../model/VizbeeSignInInfo';
|
|
3
|
+
import { IVizbeeAttributesProvider } from './IVizbeeAttributesProvider';
|
|
4
|
+
export declare class VizbeeMetricsManager implements IVizbeeAttributesProvider {
|
|
5
|
+
private metricsManager;
|
|
6
|
+
senderInfo: SenderInfo | null;
|
|
7
|
+
getSignInInfo: () => Promise<VizbeeSignInInfo[]>;
|
|
8
|
+
constructor();
|
|
9
|
+
log(event: string, attributes: Record<string, any>, bypassAttributeProviders?: boolean): void;
|
|
10
|
+
setCustomAttributes(customAttributes: Record<string, any>): void;
|
|
11
|
+
getAttributes(): Promise<Record<string, any>>;
|
|
12
|
+
private createAttributesJson;
|
|
13
|
+
private createUserInfoObject;
|
|
14
|
+
private addDefaultAttributes;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @interface SenderInfo
|
|
3
|
+
* @description Contains information about the sender device/user
|
|
4
|
+
*/
|
|
5
|
+
export interface SenderInfo {
|
|
6
|
+
friendlyName: string;
|
|
7
|
+
deviceId: string;
|
|
8
|
+
deviceType: string;
|
|
9
|
+
networkSessionId: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @interface VizbeeSenderSignInInfo
|
|
13
|
+
* @description Represents the sign-in information from a sender device
|
|
14
|
+
*/
|
|
15
|
+
export interface VizbeeSenderSignInInfo {
|
|
16
|
+
isSignedIn: boolean;
|
|
17
|
+
signInType: string;
|
|
18
|
+
customData: Record<string, any>;
|
|
19
|
+
senderInfo: SenderInfo | null;
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const UNKNOWN_VALUE = "UNKNOWN";
|
|
2
|
+
export interface VizbeeSignInInfo {
|
|
3
|
+
userLoginType: string;
|
|
4
|
+
isSignedIn: boolean;
|
|
5
|
+
userLogin: string;
|
|
6
|
+
userName?: string;
|
|
7
|
+
userSubscriptionType?: string;
|
|
8
|
+
userSubscriptionValue?: string;
|
|
9
|
+
userSubscriptionRenewalType?: string;
|
|
10
|
+
userAdditionalInfo?: Record<string, any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { VizbeeSignInState } from '../utils/constants';
|
|
2
|
+
declare abstract class VizbeeSignInStatus {
|
|
3
|
+
readonly signInType: string;
|
|
4
|
+
readonly customData: Record<string, any> | null;
|
|
5
|
+
protected constructor(signInType: string, customData: Record<string, any> | null);
|
|
6
|
+
abstract getState(): VizbeeSignInState;
|
|
7
|
+
serialize(): Record<string, any>;
|
|
8
|
+
}
|
|
9
|
+
export declare class ProgressStatus extends VizbeeSignInStatus {
|
|
10
|
+
readonly signInType: string;
|
|
11
|
+
readonly customData: Record<string, any> | null;
|
|
12
|
+
constructor(signInType: string, customData?: Record<string, any> | null);
|
|
13
|
+
getState(): VizbeeSignInState;
|
|
14
|
+
}
|
|
15
|
+
export declare class SuccessStatus extends VizbeeSignInStatus {
|
|
16
|
+
readonly signInType: string;
|
|
17
|
+
readonly userId: string | null;
|
|
18
|
+
readonly customData: Record<string, any> | null;
|
|
19
|
+
constructor(signInType: string, userId?: string | null, customData?: Record<string, any> | null);
|
|
20
|
+
getState(): VizbeeSignInState;
|
|
21
|
+
}
|
|
22
|
+
export declare class FailureStatus extends VizbeeSignInStatus {
|
|
23
|
+
readonly signInType: string;
|
|
24
|
+
readonly isCancelled: boolean;
|
|
25
|
+
readonly reason: string | null;
|
|
26
|
+
readonly exception: Error | null;
|
|
27
|
+
readonly customData: Record<string, any> | null;
|
|
28
|
+
constructor(signInType: string, isCancelled: boolean, reason?: string | null, exception?: Error | null, customData?: Record<string, any> | null);
|
|
29
|
+
getState(): VizbeeSignInState;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ProgressStatus, SuccessStatus, FailureStatus } from './model/VizbeeSignInStatus';
|
|
2
|
+
import { VizbeeSignInState } from './utils/constants';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the structure of messages passed between devices
|
|
5
|
+
*/
|
|
6
|
+
export interface MessagePayload {
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents a device that can send messages in the Vizbee ecosystem
|
|
11
|
+
*/
|
|
12
|
+
export interface VizbeeSenderDevice {
|
|
13
|
+
friendlyName: string;
|
|
14
|
+
deviceId: string;
|
|
15
|
+
deviceType: string;
|
|
16
|
+
networkSessionId: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Core messaging interface for communication between devices
|
|
20
|
+
*/
|
|
21
|
+
export interface IVizbeeMessagingClient {
|
|
22
|
+
addReceiver(namespace: string, callback: (payload: MessagePayload, namespace: string, device: VizbeeSenderDevice) => void): void;
|
|
23
|
+
send(payload: Record<string, any>, namespace: string, callback?: (error?: Error) => void): void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Manages a communication session and provides access to messaging capabilities
|
|
27
|
+
*/
|
|
28
|
+
export interface IVizbeeSession {
|
|
29
|
+
getMessagingClient(): IVizbeeMessagingClient;
|
|
30
|
+
}
|
|
31
|
+
export interface ISessionStateListener {
|
|
32
|
+
onSessionStateChanged(state: number): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Manages bidirectional communication sessions between devices
|
|
36
|
+
*/
|
|
37
|
+
export interface IVizbeeBicastSessionManager {
|
|
38
|
+
addSessionStateListener(listener: ISessionStateListener): void;
|
|
39
|
+
removeSessionStateListener(listener: ISessionStateListener): void;
|
|
40
|
+
getSession(): IVizbeeSession;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Top-level interface for the Vizbee messaging system
|
|
44
|
+
*/
|
|
45
|
+
export interface IVizbeeXMessages {
|
|
46
|
+
VizbeeSession: IVizbeeSession;
|
|
47
|
+
VizbeeMessagingClient: IVizbeeMessagingClient;
|
|
48
|
+
VizbeeBicastSessionManager: {
|
|
49
|
+
new (): IVizbeeBicastSessionManager;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Interface for sign-in status callbacks
|
|
54
|
+
*/
|
|
55
|
+
export interface VizbeeSignInStatusCallback {
|
|
56
|
+
onProgress(progress: ProgressStatus): void;
|
|
57
|
+
onSuccess(success: SuccessStatus): void;
|
|
58
|
+
onFailure(failure: FailureStatus): void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Interface for modal preferences
|
|
62
|
+
*/
|
|
63
|
+
export interface VizbeeModalPreferences {
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Interface for sign-in modal manager
|
|
67
|
+
*/
|
|
68
|
+
export interface ISignInModalManager {
|
|
69
|
+
updateSignInStatus(state: VizbeeSignInState, preferences: VizbeeModalPreferences, isRemoteSignedIn: boolean): void;
|
|
70
|
+
}
|
|
71
|
+
export interface IVizbeeAnalyticsProvider {
|
|
72
|
+
logMetrics(eventName: string, properties: Record<string, any>): void;
|
|
73
|
+
setCustomAttributes(customAttributes: Record<string, any>): void;
|
|
74
|
+
}
|
|
75
|
+
export interface IVizbeeAttributesProvider {
|
|
76
|
+
getAttributes(): Promise<Record<string, any>>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Configuration and type definitions for Vizbee Home SSO UI components
|
|
3
|
+
* Defines interfaces and default configurations for various modal states and themes
|
|
4
|
+
*/
|
|
5
|
+
import { ModalDirection, SnackbarPosition } from './VizbeeSnackBar';
|
|
6
|
+
/**
|
|
7
|
+
* Enum defining the different types of sign-in modals available in the system
|
|
8
|
+
*/
|
|
9
|
+
export declare enum SignInModalType {
|
|
10
|
+
INFORMATION = "information",
|
|
11
|
+
PROGRESS = "progress",
|
|
12
|
+
SUCCESS = "success"
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Interface defining the theme configuration for the Home SSO UI
|
|
16
|
+
* Controls colors and fonts across all modal types
|
|
17
|
+
*/
|
|
18
|
+
export interface VizbeeHomeSSOTheme {
|
|
19
|
+
primaryColor: string;
|
|
20
|
+
secondaryColor: string;
|
|
21
|
+
tertiaryColor: string;
|
|
22
|
+
subTextColor: string | undefined;
|
|
23
|
+
primaryFont: string | undefined;
|
|
24
|
+
secondaryFont: string | undefined;
|
|
25
|
+
direction: ModalDirection | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Base interface for common modal preferences
|
|
29
|
+
* Defines properties shared across all modal types
|
|
30
|
+
*/
|
|
31
|
+
export interface CommonModalPreferenceOptions {
|
|
32
|
+
direction: ModalDirection | undefined;
|
|
33
|
+
width: string | undefined;
|
|
34
|
+
height: string | undefined;
|
|
35
|
+
minHeight: string | undefined;
|
|
36
|
+
padding: string | undefined;
|
|
37
|
+
borderRadius: string | undefined;
|
|
38
|
+
backgroundColor: string | undefined;
|
|
39
|
+
borderColor: string | undefined;
|
|
40
|
+
borderWidth: string | undefined;
|
|
41
|
+
boxShadow: string | undefined;
|
|
42
|
+
edgeMargin: string | undefined;
|
|
43
|
+
marginTop: string | undefined;
|
|
44
|
+
marginRight: string | undefined;
|
|
45
|
+
marginBottom: string | undefined;
|
|
46
|
+
marginLeft: string | undefined;
|
|
47
|
+
iconBase64String: string | undefined;
|
|
48
|
+
iconWidth: string | undefined;
|
|
49
|
+
iconHeight: string | undefined;
|
|
50
|
+
iconMarginRight: string | undefined;
|
|
51
|
+
titleTextFontFamily: string | undefined;
|
|
52
|
+
titleTextFontColor: string | undefined;
|
|
53
|
+
titleTextFontSize: string | undefined;
|
|
54
|
+
titleTextFontWeight: string | undefined;
|
|
55
|
+
titleTextLineHeight: string | undefined;
|
|
56
|
+
titleMarginBottom: string | undefined;
|
|
57
|
+
descriptionTextFontFamily: string | undefined;
|
|
58
|
+
descriptionTextFontColor: string | undefined;
|
|
59
|
+
descriptionTextFontSize: string | undefined;
|
|
60
|
+
descriptionTextFontWeight: string | undefined;
|
|
61
|
+
descriptionTextLineHeight: string | undefined;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Interface for informational sign-in modal preferences
|
|
65
|
+
* Extends common modal options with specific properties for information state
|
|
66
|
+
*/
|
|
67
|
+
export interface InformationalSignInPreferenceOptions extends CommonModalPreferenceOptions {
|
|
68
|
+
titleText: string | undefined;
|
|
69
|
+
descriptionText: string;
|
|
70
|
+
position: SnackbarPosition;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Interface for progress sign-in modal preferences
|
|
74
|
+
* Extends common modal options with specific properties for progress state
|
|
75
|
+
*/
|
|
76
|
+
export interface ProgressSignInPreferenceOptions extends CommonModalPreferenceOptions {
|
|
77
|
+
titleText: string | undefined;
|
|
78
|
+
descriptionText: string;
|
|
79
|
+
iconBase64Strings: Array<string> | undefined;
|
|
80
|
+
position: SnackbarPosition;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Interface for success sign-in modal preferences
|
|
84
|
+
* Extends common modal options with specific properties for success state
|
|
85
|
+
*/
|
|
86
|
+
export interface SuccessSignInPreferenceOptions extends CommonModalPreferenceOptions {
|
|
87
|
+
titleText: string | undefined;
|
|
88
|
+
descriptionText: string;
|
|
89
|
+
duration: number;
|
|
90
|
+
position: SnackbarPosition;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Interface for success preferences
|
|
94
|
+
* Simplified version of success modal preferences
|
|
95
|
+
*/
|
|
96
|
+
export interface SuccessPreferenceOptions extends CommonModalPreferenceOptions {
|
|
97
|
+
duration: number;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Base interface for preference configuration
|
|
101
|
+
* Includes enable flag and common modal options
|
|
102
|
+
*/
|
|
103
|
+
export interface PreferenceConfig {
|
|
104
|
+
enable: boolean;
|
|
105
|
+
options: CommonModalPreferenceOptions;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Configuration interface for informational sign-in modal
|
|
109
|
+
*/
|
|
110
|
+
export interface InformationalSignInPreferenceConfig {
|
|
111
|
+
enable: boolean;
|
|
112
|
+
options: InformationalSignInPreferenceOptions;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Configuration interface for progress sign-in modal
|
|
116
|
+
*/
|
|
117
|
+
export interface ProgressSignInPreferenceConfig {
|
|
118
|
+
enable: boolean;
|
|
119
|
+
options: ProgressSignInPreferenceOptions;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Configuration interface for success sign-in modal
|
|
123
|
+
*/
|
|
124
|
+
export interface SuccessSignInPreferenceConfig {
|
|
125
|
+
enable: boolean;
|
|
126
|
+
options: SuccessSignInPreferenceOptions;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Main configuration interface combining all UI components
|
|
130
|
+
*/
|
|
131
|
+
export interface VizbeeHomeSSOUIConfig {
|
|
132
|
+
theme: VizbeeHomeSSOTheme;
|
|
133
|
+
modalConfig: CommonModalPreferenceOptions;
|
|
134
|
+
informationalSignInModalConfig: InformationalSignInPreferenceOptions;
|
|
135
|
+
progressSignInModalConfig: ProgressSignInPreferenceOptions;
|
|
136
|
+
successSignInModalConfig: SuccessSignInPreferenceOptions;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Default theme configuration with basic color scheme
|
|
140
|
+
*/
|
|
141
|
+
export declare const defaultTheme: VizbeeHomeSSOTheme;
|
|
142
|
+
/**
|
|
143
|
+
* Default configuration for informational sign-in modal
|
|
144
|
+
* Shown when initial sign-in process starts
|
|
145
|
+
*/
|
|
146
|
+
export declare const defaultInformationalModalConfig: InformationalSignInPreferenceConfig;
|
|
147
|
+
/**
|
|
148
|
+
* Default configuration for progress sign-in modal
|
|
149
|
+
* Shown while sign-in is in progress
|
|
150
|
+
*/
|
|
151
|
+
export declare const defaultProgressModalConfig: ProgressSignInPreferenceConfig;
|
|
152
|
+
/**
|
|
153
|
+
* Default configuration for success sign-in modal
|
|
154
|
+
* Shown when sign-in process completes successfully
|
|
155
|
+
*/
|
|
156
|
+
export declare const defaultSuccessModalConfig: SuccessSignInPreferenceConfig;
|