@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/es5/index.cjs ADDED
@@ -0,0 +1,1821 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /******************************************************************************
6
+ Copyright (c) Microsoft Corporation.
7
+
8
+ Permission to use, copy, modify, and/or distribute this software for any
9
+ purpose with or without fee is hereby granted.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
16
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17
+ PERFORMANCE OF THIS SOFTWARE.
18
+ ***************************************************************************** */
19
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
20
+
21
+ var extendStatics = function(d, b) {
22
+ extendStatics = Object.setPrototypeOf ||
23
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
25
+ return extendStatics(d, b);
26
+ };
27
+
28
+ function __extends(d, b) {
29
+ if (typeof b !== "function" && b !== null)
30
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
31
+ extendStatics(d, b);
32
+ function __() { this.constructor = d; }
33
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
+ }
35
+
36
+ var __assign = function() {
37
+ __assign = Object.assign || function __assign(t) {
38
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
39
+ s = arguments[i];
40
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
+ }
42
+ return t;
43
+ };
44
+ return __assign.apply(this, arguments);
45
+ };
46
+
47
+ function __awaiter(thisArg, _arguments, P, generator) {
48
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
49
+ return new (P || (P = Promise))(function (resolve, reject) {
50
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
51
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
52
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
53
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
54
+ });
55
+ }
56
+
57
+ function __generator(thisArg, body) {
58
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
59
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
60
+ function verb(n) { return function (v) { return step([n, v]); }; }
61
+ function step(op) {
62
+ if (f) throw new TypeError("Generator is already executing.");
63
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
64
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
65
+ if (y = 0, t) op = [op[0] & 2, t.value];
66
+ switch (op[0]) {
67
+ case 0: case 1: t = op; break;
68
+ case 4: _.label++; return { value: op[1], done: false };
69
+ case 5: _.label++; y = op[1]; op = [0]; continue;
70
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
71
+ default:
72
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
73
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
74
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
75
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
76
+ if (t[2]) _.ops.pop();
77
+ _.trys.pop(); continue;
78
+ }
79
+ op = body.call(thisArg, _);
80
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
81
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
82
+ }
83
+ }
84
+
85
+ function __spreadArray(to, from, pack) {
86
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
87
+ if (ar || !(i in from)) {
88
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
89
+ ar[i] = from[i];
90
+ }
91
+ }
92
+ return to.concat(ar || Array.prototype.slice.call(from));
93
+ }
94
+
95
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
96
+ var e = new Error(message);
97
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
98
+ };
99
+
100
+ /**
101
+ * @const VizbeeConstants
102
+ * @description Metrics Constants used throughout the Vizbee Home SSO implementation
103
+ */
104
+ var VizbeeMetricsConstants = {
105
+ // Events
106
+ METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_RECEIVED: 'SCREEN_HOMESSO_SIGNIN_RECEIVED',
107
+ METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_STATUS: 'SCREEN_HOMESSO_SIGNIN_STATUS',
108
+ // Attributes
109
+ METRICS_ATTR_SCREEN_HOMESSO_SDK_VERSION: 'SCREEN_HOMESSO_SDK_VERSION',
110
+ METRICS_ATTR_IS_SCREEN_SIGNED_IN: 'IS_SCREEN_SIGNED_IN',
111
+ METRICS_ATTR_IS_REMOTE_SIGNED_IN: 'IS_REMOTE_SIGNED_IN',
112
+ METRICS_ATTR_IS_SCREEN_SIGN_IN_STATUS: 'SCREEN_SIGN_IN_STATUS',
113
+ METRICS_ATTR_SCREEN_HOMESSO_USER_ID: 'SCREEN_HOMESSO_USER_ID',
114
+ METRICS_ATTR_SCREEN_HOMESSO_USER_INFO: 'SCREEN_HOMESSO_USER_INFO',
115
+ METRICS_ATTR_HOMESSO_SIGN_IN_TYPE: 'HOMESSO_SIGN_IN_TYPE',
116
+ METRICS_ATTR_REMOTE_DEVICE_ID: 'REMOTE_DEVICE_ID',
117
+ METRICS_ATTR_REMOTE_DEVICE_TYPE: 'REMOTE_DEVICE_TYPE',
118
+ METRICS_ATTR_REMOTE_FRIENDLY_NAME: 'REMOTE_FRIENDLY_NAME',
119
+ METRICS_ATTR_REMOTE_NETWORK_SESSION_ID: 'REMOTE_NETWORK_SESSION_ID',
120
+ METRICS_ATTR_USER_LOGIN_TYPE: 'user_login_type',
121
+ METRICS_ATTR_USER_IS_SIGNED_IN: 'user_is_signed_in',
122
+ METRICS_ATTR_USER_LOGIN: 'user_login',
123
+ METRICS_ATTR_USER_NAME: 'user_name',
124
+ METRICS_ATTR_USER_SUBSCRIPTION_TYPE: 'user_subscription_type',
125
+ METRICS_ATTR_USER_SUBSCRIPTION_VALUE: 'user_subscription_value',
126
+ METRICS_ATTR_USER_SUBSCRIPTION_RENEWAL_TYPE: 'user_subscription_renewal_type',
127
+ METRICS_ATTR_USER_ADDITIONAL_INFO: 'user_additional_info',
128
+ };
129
+
130
+ /**
131
+ * Logger
132
+ * A flexible logging system for TypeScript SDK with
133
+ * enable/disable capabilities and different log levels.
134
+ *
135
+ * Features:
136
+ * - Multiple severity levels from ERROR to TRACE
137
+ * - Colored console output with timestamps
138
+ * - Local storage persistence with size management
139
+ * - Environment-aware execution (handles environments without localStorage)
140
+ * - Export and clearing capabilities
141
+ */
142
+ /**
143
+ * Defines logging severity levels in ascending order of verbosity.
144
+ * Lower values indicate higher severity. This hierarchy ensures
145
+ * that when a specific level is set, all logs of that level and
146
+ * higher severity (lower enum value) will be captured.
147
+ */
148
+ exports.LogLevel = void 0;
149
+ (function (LogLevel) {
150
+ /** Critical application errors that prevent proper functioning */
151
+ LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
152
+ /** Important issues that don't stop execution but require attention */
153
+ LogLevel[LogLevel["WARN"] = 1] = "WARN";
154
+ /** General operational information about system behavior */
155
+ LogLevel[LogLevel["INFO"] = 2] = "INFO";
156
+ /** Detailed diagnostic information for troubleshooting */
157
+ LogLevel[LogLevel["DEBUG"] = 3] = "DEBUG";
158
+ /** Extremely verbose execution flow information */
159
+ LogLevel[LogLevel["TRACE"] = 4] = "TRACE";
160
+ })(exports.LogLevel || (exports.LogLevel = {}));
161
+ /**
162
+ * Default configuration applied when creating a new logger
163
+ * without explicit settings. These values can be overridden
164
+ * through the constructor or setConfig method.
165
+ */
166
+ var DEFAULT_CONFIG = {
167
+ enabled: false,
168
+ level: exports.LogLevel.ERROR,
169
+ useTimestamp: true,
170
+ useColors: true,
171
+ logToConsole: true,
172
+ logToStorage: false,
173
+ maxStorageLogs: 1000,
174
+ };
175
+ /**
176
+ * Core logger implementation that provides multiple severity levels,
177
+ * configurable outputs, and flexible message formatting.
178
+ *
179
+ * The logger handles both console output and storage persistence,
180
+ * with environment detection to gracefully handle different contexts.
181
+ */
182
+ var Logger = /** @class */ (function () {
183
+ /**
184
+ * Creates a new logger instance with optional custom configuration.
185
+ * The provided configuration is merged with default settings.
186
+ *
187
+ * @param config - Partial configuration to override default values
188
+ */
189
+ function Logger(config) {
190
+ if (config === void 0) { config = {}; }
191
+ /**
192
+ * Storage key used for persisting logs in localStorage.
193
+ * Prefixed with 'vizbee_homesso_' to avoid collisions.
194
+ */
195
+ this.storageKey = 'vizbee_homesso_logs';
196
+ this.config = __assign(__assign({}, DEFAULT_CONFIG), config);
197
+ // Initialize storage if enabled in the configuration
198
+ if (this.config.logToStorage) {
199
+ this.initializeStorage();
200
+ }
201
+ }
202
+ /**
203
+ * Enables or disables all logging functionality.
204
+ * When disabled, no logs will be output regardless of level.
205
+ *
206
+ * @param enabled - Whether logging should be active (defaults to true)
207
+ */
208
+ Logger.prototype.enable = function (enabled) {
209
+ if (enabled === void 0) { enabled = true; }
210
+ this.config.enabled = enabled;
211
+ this.info("Logger ".concat(enabled ? 'enabled' : 'disabled'));
212
+ };
213
+ /**
214
+ * Sets the minimum severity level for capturing logs.
215
+ * Only logs at this level and more severe levels will be processed.
216
+ *
217
+ * @param level - The minimum LogLevel to capture
218
+ */
219
+ Logger.prototype.setLevel = function (level) {
220
+ this.config.level = level;
221
+ this.info("Log level set to ".concat(exports.LogLevel[level]));
222
+ };
223
+ /**
224
+ * Returns a copy of the current logger configuration.
225
+ * Returns a new object to prevent accidental modification.
226
+ *
227
+ * @returns The complete current configuration
228
+ */
229
+ Logger.prototype.getConfig = function () {
230
+ return __assign({}, this.config);
231
+ };
232
+ /**
233
+ * Updates logger configuration with new settings.
234
+ * Merges the provided settings with the existing configuration.
235
+ *
236
+ * @param config - Partial configuration to apply
237
+ */
238
+ Logger.prototype.setConfig = function (config) {
239
+ // Store current storage setting to detect changes
240
+ var wasStorageEnabled = this.config.logToStorage;
241
+ // Update configuration by merging with existing settings
242
+ this.config = __assign(__assign({}, this.config), config);
243
+ // Initialize storage if it was just enabled
244
+ if (!wasStorageEnabled && this.config.logToStorage) {
245
+ this.initializeStorage();
246
+ }
247
+ this.info('Logger configuration updated');
248
+ };
249
+ /**
250
+ * Logs an error message (highest severity).
251
+ * Use for critical failures that prevent proper operation.
252
+ *
253
+ * @param message - The error message to log
254
+ * @param data - Optional supplementary information
255
+ */
256
+ Logger.prototype.error = function (message) {
257
+ var data = [];
258
+ for (var _i = 1; _i < arguments.length; _i++) {
259
+ data[_i - 1] = arguments[_i];
260
+ }
261
+ this.log(exports.LogLevel.ERROR, message, data);
262
+ };
263
+ /**
264
+ * Logs a warning message.
265
+ * Use for potential issues that don't stop execution.
266
+ *
267
+ * @param message - The warning message to log
268
+ * @param data - Optional supplementary information
269
+ */
270
+ Logger.prototype.warn = function (message) {
271
+ var data = [];
272
+ for (var _i = 1; _i < arguments.length; _i++) {
273
+ data[_i - 1] = arguments[_i];
274
+ }
275
+ this.log(exports.LogLevel.WARN, message, data);
276
+ };
277
+ /**
278
+ * Logs an informational message.
279
+ * Use for general application state and noteworthy events.
280
+ *
281
+ * @param message - The info message to log
282
+ * @param data - Optional supplementary information
283
+ */
284
+ Logger.prototype.info = function (message) {
285
+ var data = [];
286
+ for (var _i = 1; _i < arguments.length; _i++) {
287
+ data[_i - 1] = arguments[_i];
288
+ }
289
+ this.log(exports.LogLevel.INFO, message, data);
290
+ };
291
+ /**
292
+ * Logs a debug message.
293
+ * Use for detailed information helpful during development.
294
+ *
295
+ * @param message - The debug message to log
296
+ * @param data - Optional supplementary information
297
+ */
298
+ Logger.prototype.debug = function (message) {
299
+ var data = [];
300
+ for (var _i = 1; _i < arguments.length; _i++) {
301
+ data[_i - 1] = arguments[_i];
302
+ }
303
+ this.log(exports.LogLevel.DEBUG, message, data);
304
+ };
305
+ /**
306
+ * Logs a trace message (lowest severity/highest verbosity).
307
+ * Use for extremely detailed execution path tracking.
308
+ *
309
+ * @param message - The trace message to log
310
+ * @param data - Optional supplementary information
311
+ */
312
+ Logger.prototype.trace = function (message) {
313
+ var data = [];
314
+ for (var _i = 1; _i < arguments.length; _i++) {
315
+ data[_i - 1] = arguments[_i];
316
+ }
317
+ this.log(exports.LogLevel.TRACE, message, data);
318
+ };
319
+ /**
320
+ * Core logging method that handles level filtering and message routing.
321
+ * Formats the message and sends it to appropriate outputs based on configuration.
322
+ *
323
+ * @param level - Log severity level
324
+ * @param message - The message to log
325
+ * @param data - Additional data to include with the log
326
+ */
327
+ Logger.prototype.log = function (level, message, data) {
328
+ if (data === void 0) { data = []; }
329
+ // Early return if logging is disabled or level is too verbose
330
+ if (!this.config.enabled || level > this.config.level) {
331
+ return;
332
+ }
333
+ // Format components based on configuration
334
+ var timestamp = this.config.useTimestamp
335
+ ? "[".concat(new Date().toISOString(), "]")
336
+ : '';
337
+ var levelName = "[".concat(exports.LogLevel[level], "]");
338
+ // Create the formatted message with application prefix
339
+ var formattedMessage = "".concat(timestamp, "[VizbeeHomeSSO]").concat(levelName, ": ").concat(message);
340
+ // Send to appropriate outputs based on configuration
341
+ if (this.config.logToConsole) {
342
+ this.logToConsole(level, formattedMessage, data);
343
+ }
344
+ if (this.config.logToStorage) {
345
+ this.logToStorage(formattedMessage, data);
346
+ }
347
+ };
348
+ /**
349
+ * Handles console output with optional color styling.
350
+ * Applies different colors based on log level for better readability.
351
+ *
352
+ * @param level - Log severity level
353
+ * @param message - Formatted message to output
354
+ * @param data - Additional data to log
355
+ */
356
+ Logger.prototype.logToConsole = function (level, message, data) {
357
+ var hasData = data && data.length > 0;
358
+ // Apply color styling if enabled
359
+ if (this.config.useColors) {
360
+ var styles = this.getConsoleStyles(level);
361
+ if (hasData) {
362
+ console.log.apply(console, __spreadArray(["%c".concat(message), styles], data, false));
363
+ }
364
+ else {
365
+ console.log("%c".concat(message), styles);
366
+ }
367
+ }
368
+ else {
369
+ // Plain output without colors
370
+ if (hasData) {
371
+ console.log.apply(console, __spreadArray([message], data, false));
372
+ }
373
+ else {
374
+ console.log(message);
375
+ }
376
+ }
377
+ };
378
+ /**
379
+ * Determines CSS styling for console output based on log level.
380
+ * Returns different colors to visually distinguish log levels.
381
+ *
382
+ * @param level - Log severity level
383
+ * @returns CSS style string for console output
384
+ */
385
+ Logger.prototype.getConsoleStyles = function (level) {
386
+ switch (level) {
387
+ case exports.LogLevel.ERROR:
388
+ return 'color: #FF5252; font-weight: bold'; // Bright red, bold
389
+ case exports.LogLevel.WARN:
390
+ return 'color: #FFC107; font-weight: bold'; // Amber, bold
391
+ case exports.LogLevel.INFO:
392
+ return 'color: #2196F3'; // Blue
393
+ case exports.LogLevel.DEBUG:
394
+ return 'color: #4CAF50'; // Green
395
+ case exports.LogLevel.TRACE:
396
+ return 'color: #9E9E9E'; // Gray
397
+ default:
398
+ return '';
399
+ }
400
+ };
401
+ /**
402
+ * Sets up localStorage for persisting logs if available.
403
+ * Creates the initial empty logs array if not already present.
404
+ * Gracefully handles environments without localStorage access.
405
+ */
406
+ Logger.prototype.initializeStorage = function () {
407
+ try {
408
+ // Verify localStorage is available in this environment
409
+ if (typeof localStorage !== 'undefined') {
410
+ // Create empty logs array if not already initialized
411
+ if (!localStorage.getItem(this.storageKey)) {
412
+ localStorage.setItem(this.storageKey, JSON.stringify([]));
413
+ }
414
+ }
415
+ }
416
+ catch (error) {
417
+ // Handle environments where localStorage is not available or blocked
418
+ console.warn('localStorage not available for logging', error);
419
+ this.config.logToStorage = false;
420
+ }
421
+ };
422
+ /**
423
+ * Persists a log entry to localStorage with rotation management.
424
+ * Removes oldest entries when the maximum count is exceeded.
425
+ * Handles storage errors gracefully.
426
+ *
427
+ * @param message - Formatted message to store
428
+ * @param data - Additional data to include
429
+ */
430
+ Logger.prototype.logToStorage = function (message, data) {
431
+ try {
432
+ if (typeof localStorage !== 'undefined') {
433
+ // Retrieve current logs
434
+ var logs = JSON.parse(localStorage.getItem(this.storageKey) || '[]');
435
+ // Add new log entry
436
+ logs.push({
437
+ timestamp: new Date().toISOString(),
438
+ message: message,
439
+ data: data.length > 0 ? JSON.stringify(data) : undefined,
440
+ });
441
+ // Apply size limit by removing oldest logs if needed
442
+ if (logs.length > (this.config.maxStorageLogs || 1000)) {
443
+ logs.shift(); // Remove oldest log
444
+ }
445
+ // Save updated logs back to storage
446
+ localStorage.setItem(this.storageKey, JSON.stringify(logs));
447
+ }
448
+ }
449
+ catch (error) {
450
+ console.error('Failed to write logs to storage', error);
451
+ }
452
+ };
453
+ /**
454
+ * Exports all stored logs as a JSON string.
455
+ * Returns an empty array string if storage is unavailable.
456
+ *
457
+ * @returns JSON string containing all stored logs
458
+ */
459
+ Logger.prototype.exportLogs = function () {
460
+ try {
461
+ if (typeof localStorage !== 'undefined') {
462
+ var logs = localStorage.getItem(this.storageKey) || '[]';
463
+ return logs;
464
+ }
465
+ }
466
+ catch (error) {
467
+ console.error('Failed to export logs', error);
468
+ }
469
+ return '[]';
470
+ };
471
+ /**
472
+ * Clears all logs from storage.
473
+ * Replaces the current logs with an empty array.
474
+ */
475
+ Logger.prototype.clearLogs = function () {
476
+ try {
477
+ if (typeof localStorage !== 'undefined') {
478
+ localStorage.setItem(this.storageKey, JSON.stringify([]));
479
+ this.info('Logs cleared from storage');
480
+ }
481
+ }
482
+ catch (error) {
483
+ console.error('Failed to clear logs', error);
484
+ }
485
+ };
486
+ return Logger;
487
+ }());
488
+ /**
489
+ * Default singleton logger instance with standard configuration.
490
+ * Available as a ready-to-use logger throughout the application.
491
+ * For custom configurations, create additional Logger instances.
492
+ */
493
+ var logger = new Logger();
494
+
495
+ var LOG_TAG$1 = 'VizbeeHomeSSOManager';
496
+ /* eslint-disable @typescript-eslint/no-explicit-any */
497
+ var VizbeeMetricsManager = /** @class */ (function () {
498
+ function VizbeeMetricsManager() {
499
+ var _this = this;
500
+ var _a, _b, _c;
501
+ this.senderInfo = null;
502
+ this.getSignInInfo = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
503
+ return [2 /*return*/, []];
504
+ }); }); };
505
+ if ((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.vizbee) === null || _a === void 0 ? void 0 : _a.continuity) === null || _b === void 0 ? void 0 : _b.analytics) === null || _c === void 0 ? void 0 : _c.AnalyticsProvider) {
506
+ this.metricsManager =
507
+ new window.vizbee.continuity.analytics.AnalyticsProvider();
508
+ // Create a wrapper with 'provider' property
509
+ var attributesProvider = {
510
+ getAttributes: function () { return _this.getAttributes(); },
511
+ };
512
+ this.metricsManager.addProvider(attributesProvider, '.*');
513
+ }
514
+ }
515
+ VizbeeMetricsManager.prototype.log = function (event, attributes, bypassAttributeProviders) {
516
+ if (bypassAttributeProviders === void 0) { bypassAttributeProviders = false; }
517
+ if (!this.metricsManager) {
518
+ return;
519
+ }
520
+ logger.debug("[".concat(LOG_TAG$1, "][log] - Logging metrics event: "), event, attributes, bypassAttributeProviders);
521
+ if (event ===
522
+ VizbeeMetricsConstants.METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_RECEIVED) {
523
+ this.senderInfo = attributes.senderInfo;
524
+ }
525
+ var attributesToBeSent = this.addDefaultAttributes();
526
+ attributesToBeSent[VizbeeMetricsConstants.METRICS_ATTR_IS_SCREEN_SIGNED_IN] = attributes.isScreenSignedIn;
527
+ attributesToBeSent[VizbeeMetricsConstants.METRICS_ATTR_IS_REMOTE_SIGNED_IN] = attributes.isRemoteSignedIn;
528
+ attributesToBeSent[VizbeeMetricsConstants.METRICS_ATTR_HOMESSO_SIGN_IN_TYPE] = attributes.signInType;
529
+ attributesToBeSent[VizbeeMetricsConstants.METRICS_ATTR_IS_SCREEN_SIGN_IN_STATUS] = attributes.signInState;
530
+ if (attributes.userId) {
531
+ attributesToBeSent[VizbeeMetricsConstants.METRICS_ATTR_SCREEN_HOMESSO_USER_ID] = attributes.userId;
532
+ }
533
+ logger.debug("[".concat(LOG_TAG$1, "][log] - Logging metrics event: "), event, attributesToBeSent);
534
+ this.metricsManager.logMetrics(event, attributesToBeSent);
535
+ };
536
+ VizbeeMetricsManager.prototype.setCustomAttributes = function (customAttributes) {
537
+ this.metricsManager.setCustomAttributes(customAttributes);
538
+ };
539
+ VizbeeMetricsManager.prototype.getAttributes = function () {
540
+ return this.createAttributesJson();
541
+ };
542
+ VizbeeMetricsManager.prototype.createAttributesJson = function () {
543
+ return __awaiter(this, void 0, void 0, function () {
544
+ var attributes, userInfoArray, signInInfoList;
545
+ var _this = this;
546
+ return __generator(this, function (_a) {
547
+ switch (_a.label) {
548
+ case 0:
549
+ attributes = {};
550
+ userInfoArray = [];
551
+ return [4 /*yield*/, this.getSignInInfo()];
552
+ case 1:
553
+ signInInfoList = _a.sent();
554
+ signInInfoList === null || signInInfoList === void 0 ? void 0 : signInInfoList.forEach(function (signInInfo) {
555
+ var userInfoObject = _this.createUserInfoObject(signInInfo);
556
+ userInfoArray.push(userInfoObject);
557
+ });
558
+ attributes[VizbeeMetricsConstants.METRICS_ATTR_SCREEN_HOMESSO_USER_INFO] =
559
+ userInfoArray;
560
+ return [2 /*return*/, attributes];
561
+ }
562
+ });
563
+ });
564
+ };
565
+ VizbeeMetricsManager.prototype.createUserInfoObject = function (signInInfo) {
566
+ var _a;
567
+ var UNKNOWN_VALUE = 'UNKNOWN';
568
+ var userInfo = (_a = {},
569
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_LOGIN_TYPE] = signInInfo.userLoginType,
570
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_IS_SIGNED_IN] = signInInfo.isSignedIn,
571
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_LOGIN] = signInInfo.userLogin || UNKNOWN_VALUE,
572
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_NAME] = signInInfo.userName || UNKNOWN_VALUE,
573
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_SUBSCRIPTION_TYPE] = signInInfo.userSubscriptionType || UNKNOWN_VALUE,
574
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_SUBSCRIPTION_VALUE] = signInInfo.userSubscriptionValue || UNKNOWN_VALUE,
575
+ _a[VizbeeMetricsConstants.METRICS_ATTR_USER_SUBSCRIPTION_RENEWAL_TYPE] = signInInfo.userSubscriptionRenewalType || UNKNOWN_VALUE,
576
+ _a);
577
+ if (signInInfo.userAdditionalInfo) {
578
+ userInfo[VizbeeMetricsConstants.METRICS_ATTR_USER_ADDITIONAL_INFO] =
579
+ signInInfo.userAdditionalInfo || {};
580
+ }
581
+ return userInfo;
582
+ };
583
+ VizbeeMetricsManager.prototype.addDefaultAttributes = function () {
584
+ var _a, _b, _c, _d;
585
+ var attributes = {};
586
+ attributes[VizbeeMetricsConstants.METRICS_ATTR_SCREEN_HOMESSO_SDK_VERSION] =
587
+ '1.0.1';
588
+ attributes['REMOTE_FRIENDLY_NAME'] = (_a = this.senderInfo) === null || _a === void 0 ? void 0 : _a.friendlyName;
589
+ attributes['REMOTE_DEVICE_ID'] = (_b = this.senderInfo) === null || _b === void 0 ? void 0 : _b.deviceId;
590
+ attributes['REMOTE_DEVICE_TYPE'] = (_c = this.senderInfo) === null || _c === void 0 ? void 0 : _c.deviceType;
591
+ attributes['REMOTE_NETWORK_SESSION_ID'] = (_d = this.senderInfo) === null || _d === void 0 ? void 0 : _d.networkSessionId;
592
+ return attributes;
593
+ };
594
+ return VizbeeMetricsManager;
595
+ }());
596
+
597
+ /**
598
+ * @const VizbeeConstants
599
+ * @description Constants used throughout the Vizbee Home SSO implementation
600
+ */
601
+ var VizbeeConstants = {
602
+ EVENT_SSO_NAME: 'tv.vizbee.homesso.signin',
603
+ // Sign in event keys
604
+ KEY_SUB_TYPE: 'sub_type',
605
+ KEY_SIGN_IN_STATUS: 'sstatus',
606
+ KEY_STATE: 'sstate',
607
+ KEY_CUSTOM_DATA: 'custom_data',
608
+ KEY_REG_CODE: 'regcode',
609
+ // Custom metadata keys
610
+ KEY_START_SIGN_IN_INFO: 'sinfo',
611
+ KEY_IS_SIGNED_IN: 'is_signed_in',
612
+ KEY_SIGN_IN_TYPE: 'stype',
613
+ KEY_DEVICE_MODEL: 'device_model',
614
+ KEY_DEVICE_OS: 'device_os',
615
+ // Event subtypes
616
+ EVENT_SUBTYPE_START_SIGN_IN: 'start_sign_in',
617
+ EVENT_SUBTYPE_SIGN_IN_STATUS: 'sign_in_status',
618
+ // SDK events types
619
+ VIZBEE_SESSION_READY: 'vizbee-bicast-session-ready',
620
+ };
621
+ // Enum for sign in states
622
+ var VizbeeSignInState;
623
+ (function (VizbeeSignInState) {
624
+ VizbeeSignInState["SIGN_IN_NOT_STARTED"] = "not_started";
625
+ VizbeeSignInState["SIGN_IN_IN_PROGRESS"] = "in_progress";
626
+ VizbeeSignInState["SIGN_IN_COMPLETED"] = "completed";
627
+ VizbeeSignInState["SIGN_IN_FAILED"] = "failed";
628
+ VizbeeSignInState["SIGN_IN_CANCELLED"] = "cancelled";
629
+ })(VizbeeSignInState || (VizbeeSignInState = {}));
630
+
631
+ // Base abstract class for sign in status
632
+ var VizbeeSignInStatus = /** @class */ (function () {
633
+ function VizbeeSignInStatus(signInType, customData) {
634
+ this.signInType = signInType;
635
+ this.customData = customData;
636
+ }
637
+ VizbeeSignInStatus.prototype.serialize = function () {
638
+ var _a;
639
+ return _a = {},
640
+ _a[VizbeeConstants.KEY_SIGN_IN_TYPE] = this.signInType,
641
+ _a[VizbeeConstants.KEY_STATE] = this.getState(),
642
+ _a[VizbeeConstants.KEY_CUSTOM_DATA] = this.customData,
643
+ _a;
644
+ };
645
+ return VizbeeSignInStatus;
646
+ }());
647
+ // Progress status class
648
+ var ProgressStatus = /** @class */ (function (_super) {
649
+ __extends(ProgressStatus, _super);
650
+ function ProgressStatus(signInType, customData) {
651
+ if (customData === void 0) { customData = null; }
652
+ var _this = _super.call(this, signInType, customData) || this;
653
+ _this.signInType = signInType;
654
+ _this.customData = customData;
655
+ return _this;
656
+ }
657
+ ProgressStatus.prototype.getState = function () {
658
+ return VizbeeSignInState.SIGN_IN_IN_PROGRESS;
659
+ };
660
+ return ProgressStatus;
661
+ }(VizbeeSignInStatus));
662
+ // Success status class
663
+ var SuccessStatus = /** @class */ (function (_super) {
664
+ __extends(SuccessStatus, _super);
665
+ function SuccessStatus(signInType, userId, customData) {
666
+ if (userId === void 0) { userId = null; }
667
+ if (customData === void 0) { customData = null; }
668
+ var _this = _super.call(this, signInType, customData) || this;
669
+ _this.signInType = signInType;
670
+ _this.userId = userId;
671
+ _this.customData = customData;
672
+ return _this;
673
+ }
674
+ SuccessStatus.prototype.getState = function () {
675
+ return VizbeeSignInState.SIGN_IN_COMPLETED;
676
+ };
677
+ return SuccessStatus;
678
+ }(VizbeeSignInStatus));
679
+ // Failure status class
680
+ var FailureStatus = /** @class */ (function (_super) {
681
+ __extends(FailureStatus, _super);
682
+ function FailureStatus(signInType, isCancelled, reason, exception, customData) {
683
+ if (reason === void 0) { reason = null; }
684
+ if (exception === void 0) { exception = null; }
685
+ if (customData === void 0) { customData = null; }
686
+ var _this = _super.call(this, signInType, customData) || this;
687
+ _this.signInType = signInType;
688
+ _this.isCancelled = isCancelled;
689
+ _this.reason = reason;
690
+ _this.exception = exception;
691
+ _this.customData = customData;
692
+ return _this;
693
+ }
694
+ FailureStatus.prototype.getState = function () {
695
+ return this.isCancelled
696
+ ? VizbeeSignInState.SIGN_IN_CANCELLED
697
+ : VizbeeSignInState.SIGN_IN_FAILED;
698
+ };
699
+ return FailureStatus;
700
+ }(VizbeeSignInStatus));
701
+
702
+ /**
703
+ * @fileoverview Configuration and type definitions for Vizbee Home SSO UI components
704
+ * Defines interfaces and default configurations for various modal states and themes
705
+ */
706
+ /**
707
+ * Enum defining the different types of sign-in modals available in the system
708
+ */
709
+ var SignInModalType;
710
+ (function (SignInModalType) {
711
+ SignInModalType["INFORMATION"] = "information";
712
+ SignInModalType["PROGRESS"] = "progress";
713
+ SignInModalType["SUCCESS"] = "success";
714
+ })(SignInModalType || (SignInModalType = {}));
715
+ /**
716
+ * Default theme configuration with basic color scheme
717
+ */
718
+ var defaultTheme = {
719
+ primaryColor: '#000000',
720
+ secondaryColor: '#262626',
721
+ tertiaryColor: '#FFFFFF',
722
+ subTextColor: undefined,
723
+ primaryFont: undefined,
724
+ secondaryFont: undefined,
725
+ direction: 'ltr',
726
+ };
727
+ /**
728
+ * Collection of Base64 encoded icon images used in different modal states
729
+ */
730
+ var icons = {
731
+ vzb_unconnected: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQAAAA4CAYAAABE814IAAAH0klEQVRoBe2bXYhWRRjHfdXMNTNEiz7Jlbowkggqu8jCoE+CAom+IIo+SJDopku9rouIoKCIoJuoIDIqIvqyDMq6iTIMglbLpG+V0j5sdfv9Zuc5zR7P++5u7m7ru/vAf2fmmWfOzPOfZ+bMOWff1owsAwMDs1qt1gGL5I8mmZmrujU5iL9/6VzpeysrqGuhH1hCeS24CSwE3Sy7ce5Z8Ci+b8f3xIEszCR3kHQllc+A08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SjwwvRjcC04szrSEhQnnfUdQAkpkhH9w7Vt9oWcONeXFs8QkvoPYPctXYlO0+UUnrUoIVbof5f5A7a3OzDSbtbQs+m50ebuIhlKZv576F66QmCIeT02N0klZGTZvLE+q/S/zIQYjQvvIRS2jOlcHDOkr+4PFJt7ivgqUFLftkJyz0s79Cwb37jdD5SWENt8stbvyA8plBnBjnFaOI2+hgjxm/6Wbp+oA3BA2nwxbKjfQqW/88LYWc8/GJGdcWZvpfwycDLwZwXb+tLYXwAl5D6QX/T8mfM/tNmFzVMlP0PYRrwK+IY+drNGp7v+PjB4YlhnAvF5Q/3p90y3R/Q6NnR17kTwGQZ2BoN1Vn1zLhm22wnuB8rsfFKc06mLzVM39qS2UfrP3Vb7nC898tO/Z5OYaWGIDMf8T3CoPzBsnSRSzsFS3ot2JTiEs/6w7e+9iqwr9qd+3gIO/tlKSOonPRtbP1pLRT7KzxjJLEPqxDuOb+DTwVGE+GwrOrvvwEHqHzXjv6RMdtNPHHwFNqMrkqWwB0PrYOqfjn3ZN9QMpkmdVCfiYeD20C2ZhQajo8L3F0MO/gl7nELtpBy1Xe4ZRXKHnjXUR1oN1U/ZUlPHuRdcxmTvIp1JmA79WWb7MB0ZGrRkPQH6gz7QNm50+xmnvk0XG1vT/Vjq0D8hzhYnCRU3miGH8wTXy1FO1n2ijZyp1rezZzG2PHPcdPDfVP8HFQNfCMkCPhUAAAAASUVORK5CYII=",
736
+ };
737
+ /**
738
+ * Default configuration for informational sign-in modal
739
+ * Shown when initial sign-in process starts
740
+ */
741
+ var defaultInformationalModalConfig = {
742
+ enable: true,
743
+ options: {
744
+ width: undefined,
745
+ backgroundColor: undefined,
746
+ marginBottom: undefined,
747
+ marginRight: undefined,
748
+ direction: undefined,
749
+ iconBase64String: icons['vzb_unconnected'],
750
+ iconWidth: undefined,
751
+ iconHeight: undefined,
752
+ iconMarginRight: undefined,
753
+ titleText: 'Mobile Sign In',
754
+ titleTextFontFamily: undefined,
755
+ titleTextFontColor: undefined,
756
+ titleTextFontSize: undefined,
757
+ descriptionText: 'Please use your mobile app to complete the sign in process.',
758
+ descriptionTextFontFamily: undefined,
759
+ descriptionTextFontColor: undefined,
760
+ descriptionTextFontSize: undefined,
761
+ position: 'bottom-right',
762
+ borderColor: undefined,
763
+ borderWidth: undefined,
764
+ boxShadow: undefined,
765
+ height: undefined,
766
+ minHeight: undefined,
767
+ padding: undefined,
768
+ borderRadius: undefined,
769
+ edgeMargin: undefined,
770
+ marginTop: undefined,
771
+ marginLeft: undefined,
772
+ titleTextFontWeight: undefined,
773
+ titleTextLineHeight: undefined,
774
+ titleMarginBottom: undefined,
775
+ descriptionTextFontWeight: undefined,
776
+ descriptionTextLineHeight: undefined,
777
+ },
778
+ };
779
+ /**
780
+ * Default configuration for progress sign-in modal
781
+ * Shown while sign-in is in progress
782
+ */
783
+ var defaultProgressModalConfig = {
784
+ enable: true,
785
+ options: {
786
+ width: undefined,
787
+ backgroundColor: undefined,
788
+ marginBottom: undefined,
789
+ marginRight: undefined,
790
+ direction: undefined,
791
+ iconBase64String: icons['vzb_connection_progress_0'],
792
+ iconBase64Strings: [
793
+ icons['vzb_connection_progress_0'],
794
+ icons['vzb_connection_progress_1'],
795
+ icons['vzb_connection_progress_2'],
796
+ icons['vzb_connection_progress_1'],
797
+ ],
798
+ iconWidth: undefined,
799
+ iconHeight: undefined,
800
+ iconMarginRight: undefined,
801
+ titleText: undefined,
802
+ titleTextFontFamily: undefined,
803
+ titleTextFontColor: undefined,
804
+ titleTextFontSize: undefined,
805
+ descriptionText: 'Signing in using your mobile app ...',
806
+ descriptionTextFontFamily: undefined,
807
+ descriptionTextFontColor: undefined,
808
+ descriptionTextFontSize: undefined,
809
+ position: 'bottom-right',
810
+ borderColor: undefined,
811
+ borderWidth: undefined,
812
+ boxShadow: undefined,
813
+ height: undefined,
814
+ minHeight: undefined,
815
+ padding: undefined,
816
+ borderRadius: undefined,
817
+ edgeMargin: undefined,
818
+ marginTop: undefined,
819
+ marginLeft: undefined,
820
+ titleTextFontWeight: undefined,
821
+ titleTextLineHeight: undefined,
822
+ titleMarginBottom: undefined,
823
+ descriptionTextFontWeight: undefined,
824
+ descriptionTextLineHeight: undefined,
825
+ },
826
+ };
827
+ /**
828
+ * Default configuration for success sign-in modal
829
+ * Shown when sign-in process completes successfully
830
+ */
831
+ var defaultSuccessModalConfig = {
832
+ enable: true,
833
+ options: {
834
+ width: undefined,
835
+ backgroundColor: undefined,
836
+ marginBottom: undefined,
837
+ marginRight: undefined,
838
+ direction: undefined,
839
+ iconBase64String: icons['vzb_connected'],
840
+ iconWidth: undefined,
841
+ iconHeight: undefined,
842
+ iconMarginRight: undefined,
843
+ titleText: 'Mobile Sign In Successful!',
844
+ titleTextFontFamily: undefined,
845
+ titleTextFontColor: undefined,
846
+ titleTextFontSize: undefined,
847
+ descriptionText: 'Cast or select any content to start watching.',
848
+ descriptionTextFontFamily: undefined,
849
+ descriptionTextFontColor: undefined,
850
+ descriptionTextFontSize: undefined,
851
+ position: 'bottom-right',
852
+ duration: 10000,
853
+ borderColor: undefined,
854
+ borderWidth: undefined,
855
+ boxShadow: undefined,
856
+ height: undefined,
857
+ minHeight: undefined,
858
+ padding: undefined,
859
+ borderRadius: undefined,
860
+ edgeMargin: undefined,
861
+ marginTop: undefined,
862
+ marginLeft: undefined,
863
+ titleTextFontWeight: undefined,
864
+ titleTextLineHeight: undefined,
865
+ titleMarginBottom: undefined,
866
+ descriptionTextFontWeight: undefined,
867
+ descriptionTextLineHeight: undefined,
868
+ },
869
+ };
870
+
871
+ /* eslint-disable @typescript-eslint/no-explicit-any */
872
+ /**
873
+ * Singleton class responsible for managing UI configurations for Home SSO experience
874
+ * Handles theme customization and specific modal configurations for different sign-in states
875
+ */
876
+ var VizbeeHomeSSOUIManager = /** @class */ (function () {
877
+ /**
878
+ * Private constructor to enforce singleton pattern
879
+ * Initializes configurations with default values using deep merge
880
+ */
881
+ function VizbeeHomeSSOUIManager() {
882
+ this.themeConfig = this.deepMerge({}, defaultTheme);
883
+ this.commonModalConfig = this.deepMerge({});
884
+ this.informationalModalConfig =
885
+ this.deepMerge(defaultInformationalModalConfig.options);
886
+ this.progressModalConfig = this.deepMerge(defaultProgressModalConfig.options);
887
+ this.successModalConfig = this.deepMerge(defaultSuccessModalConfig.options);
888
+ }
889
+ /**
890
+ * Gets the singleton instance of VizbeeHomeSSOUIManager
891
+ * Creates a new instance if one doesn't exist
892
+ * @returns The singleton instance of VizbeeHomeSSOUIManager
893
+ */
894
+ VizbeeHomeSSOUIManager.getInstance = function () {
895
+ if (!VizbeeHomeSSOUIManager.instance) {
896
+ VizbeeHomeSSOUIManager.instance = new VizbeeHomeSSOUIManager();
897
+ }
898
+ return VizbeeHomeSSOUIManager.instance;
899
+ };
900
+ /**
901
+ * Creates a deep clone of an object or array
902
+ * @param obj - Object to clone
903
+ * @returns Deep cloned copy of the input
904
+ */
905
+ VizbeeHomeSSOUIManager.prototype.deepClone = function (obj) {
906
+ // Handle primitives and null
907
+ if (obj === null || typeof obj !== 'object') {
908
+ return obj;
909
+ }
910
+ try {
911
+ // Attempt JSON serialization - this will throw on circular references
912
+ return JSON.parse(JSON.stringify(obj));
913
+ }
914
+ catch (error) {
915
+ // Fall back to manual deep cloning when JSON serialization fails
916
+ return this.fallbackDeepClone(obj);
917
+ }
918
+ };
919
+ // Fallback manual deep clone that handles circular references
920
+ VizbeeHomeSSOUIManager.prototype.fallbackDeepClone = function (obj, visited) {
921
+ var _this = this;
922
+ if (visited === void 0) { visited = new Map(); }
923
+ if (obj === null || typeof obj !== 'object') {
924
+ return obj;
925
+ }
926
+ // Handle circular references
927
+ if (visited.has(obj)) {
928
+ return visited.get(obj);
929
+ }
930
+ // Handle arrays
931
+ if (Array.isArray(obj)) {
932
+ var clone_1 = [];
933
+ visited.set(obj, clone_1);
934
+ for (var i = 0; i < obj.length; i++) {
935
+ clone_1[i] = this.fallbackDeepClone(obj[i], visited);
936
+ }
937
+ return clone_1;
938
+ }
939
+ // Handle objects
940
+ var clone = {};
941
+ visited.set(obj, clone);
942
+ Object.keys(obj).forEach(function (key) {
943
+ clone[key] = _this.fallbackDeepClone(obj[key], visited);
944
+ });
945
+ return clone;
946
+ };
947
+ /**
948
+ * Performs a deep merge of multiple objects
949
+ * @param target - Base object to merge into
950
+ * @param sources - Array of objects to merge from
951
+ * @returns Merged object combining all sources into target
952
+ */
953
+ VizbeeHomeSSOUIManager.prototype.deepMerge = function (target) {
954
+ var sources = [];
955
+ for (var _i = 1; _i < arguments.length; _i++) {
956
+ sources[_i - 1] = arguments[_i];
957
+ }
958
+ var result = JSON.parse(JSON.stringify(target));
959
+ if (sources.length === 0)
960
+ return result;
961
+ for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
962
+ var source = sources_1[_a];
963
+ if (!source)
964
+ continue;
965
+ for (var _b = 0, _c = Object.keys(source); _b < _c.length; _b++) {
966
+ var key = _c[_b];
967
+ var sourceValue = source[key];
968
+ if (sourceValue === undefined)
969
+ continue;
970
+ if (sourceValue === null) {
971
+ result[key] = null;
972
+ continue;
973
+ }
974
+ if (typeof sourceValue === 'object' && !Array.isArray(sourceValue)) {
975
+ if (!result[key] || typeof result[key] !== 'object') {
976
+ result[key] = {};
977
+ }
978
+ result[key] = this.deepMerge(result[key], sourceValue);
979
+ }
980
+ else {
981
+ result[key] = JSON.parse(JSON.stringify(sourceValue));
982
+ }
983
+ }
984
+ }
985
+ return result;
986
+ };
987
+ /**
988
+ * Maps theme configuration to modal configuration properties
989
+ * @param theme - Current theme configuration
990
+ * @returns Partial modal configuration based on theme
991
+ */
992
+ VizbeeHomeSSOUIManager.prototype.mapThemeToModalConfig = function (theme) {
993
+ return {
994
+ borderColor: theme.primaryColor,
995
+ backgroundColor: theme.secondaryColor,
996
+ titleTextFontColor: theme.tertiaryColor,
997
+ descriptionTextFontColor: theme.subTextColor,
998
+ titleTextFontFamily: theme.primaryFont,
999
+ descriptionTextFontFamily: theme.secondaryFont,
1000
+ direction: theme.direction,
1001
+ };
1002
+ };
1003
+ /**
1004
+ * Returns default configurations for all modal types
1005
+ * @returns Object containing default configs for informational, progress, and success modals
1006
+ */
1007
+ VizbeeHomeSSOUIManager.prototype.getDefaultConfig = function () {
1008
+ var themeBasedConfig = this.mapThemeToModalConfig(this.themeConfig);
1009
+ var informational = this.deepMerge(defaultInformationalModalConfig.options, themeBasedConfig);
1010
+ var progress = this.deepMerge(defaultProgressModalConfig.options, themeBasedConfig);
1011
+ var successBase = this.deepMerge(defaultSuccessModalConfig.options, themeBasedConfig);
1012
+ return {
1013
+ informational: informational,
1014
+ progress: progress,
1015
+ success: __assign(__assign({}, successBase), { duration: defaultSuccessModalConfig.options.duration }),
1016
+ };
1017
+ };
1018
+ /**
1019
+ * Updates the current theme configuration
1020
+ * @param theme - Partial theme configuration to merge with current theme
1021
+ */
1022
+ VizbeeHomeSSOUIManager.prototype.setTheme = function (theme) {
1023
+ this.themeConfig = this.deepMerge(defaultTheme, theme);
1024
+ };
1025
+ /**
1026
+ * Retrieves current theme configuration
1027
+ * @returns Deep clone of current theme configuration
1028
+ */
1029
+ VizbeeHomeSSOUIManager.prototype.getTheme = function () {
1030
+ return this.deepClone(this.themeConfig);
1031
+ };
1032
+ /**
1033
+ * Updates common modal configuration applied to all modal types
1034
+ * @param config - Partial configuration to merge with current common config
1035
+ */
1036
+ VizbeeHomeSSOUIManager.prototype.setCommonModalConfig = function (config) {
1037
+ this.commonModalConfig = this.deepMerge(this.commonModalConfig, config);
1038
+ };
1039
+ /**
1040
+ * Updates informational sign-in modal configuration
1041
+ * @param config - Partial configuration to merge with current informational config
1042
+ */
1043
+ VizbeeHomeSSOUIManager.prototype.setInformationalSignInModalConfig = function (config) {
1044
+ this.informationalModalConfig = this.deepMerge(this.informationalModalConfig, config);
1045
+ };
1046
+ /**
1047
+ * Updates progress sign-in modal configuration
1048
+ * @param config - Partial configuration to merge with current progress config
1049
+ */
1050
+ VizbeeHomeSSOUIManager.prototype.setProgressSignInModalConfig = function (config) {
1051
+ this.progressModalConfig = this.deepMerge(this.progressModalConfig, config);
1052
+ };
1053
+ /**
1054
+ * Updates success sign-in modal configuration
1055
+ * @param config - Partial configuration to merge with current success config
1056
+ */
1057
+ VizbeeHomeSSOUIManager.prototype.setSuccessSignInModalConfig = function (config) {
1058
+ this.successModalConfig = this.deepMerge(this.successModalConfig, config);
1059
+ };
1060
+ /**
1061
+ * Retrieves complete configuration for informational sign-in modal
1062
+ * Combines default, theme-based, common, and specific configurations
1063
+ * @returns Complete informational modal configuration
1064
+ */
1065
+ VizbeeHomeSSOUIManager.prototype.getInformationalSignInModalConfig = function () {
1066
+ var themeBasedConfig = this.mapThemeToModalConfig(this.themeConfig);
1067
+ return this.deepMerge(defaultInformationalModalConfig.options, themeBasedConfig, this.commonModalConfig, this.informationalModalConfig);
1068
+ };
1069
+ /**
1070
+ * Retrieves complete configuration for progress sign-in modal
1071
+ * Combines default, theme-based, common, and specific configurations
1072
+ * @returns Complete progress modal configuration
1073
+ */
1074
+ VizbeeHomeSSOUIManager.prototype.getProgressSignInModalConfig = function () {
1075
+ var themeBasedConfig = this.mapThemeToModalConfig(this.themeConfig);
1076
+ return this.deepMerge(defaultProgressModalConfig.options, themeBasedConfig, this.commonModalConfig, this.progressModalConfig);
1077
+ };
1078
+ /**
1079
+ * Retrieves complete configuration for success sign-in modal
1080
+ * Combines default, theme-based, common, and specific configurations
1081
+ * @returns Complete success modal configuration
1082
+ */
1083
+ VizbeeHomeSSOUIManager.prototype.getSuccessSignInModalConfig = function () {
1084
+ var themeBasedConfig = this.mapThemeToModalConfig(this.themeConfig);
1085
+ var baseConfig = this.deepMerge(defaultSuccessModalConfig.options, themeBasedConfig, this.commonModalConfig, this.successModalConfig);
1086
+ return __assign(__assign({}, baseConfig), { duration: this.successModalConfig.duration });
1087
+ };
1088
+ return VizbeeHomeSSOUIManager;
1089
+ }());
1090
+
1091
+ /**
1092
+ * A class that manages the display of snackbar notifications with customizable styling and animations
1093
+ */
1094
+ var VizbeeSnackbar = /** @class */ (function () {
1095
+ /**
1096
+ * Creates a new instance of VizbeeSnackbar
1097
+ */
1098
+ function VizbeeSnackbar() {
1099
+ this.BASE_DIMENSIONS = {
1100
+ REFERENCE_WIDTH: 1920,
1101
+ REFERENCE_HEIGHT: 1080,
1102
+ WIDTH: 720,
1103
+ PADDING: 20,
1104
+ BORDER_RADIUS: 20,
1105
+ BORDER_WIDTH: 2,
1106
+ MARGIN: 32,
1107
+ ICON_SIZE: 40,
1108
+ ICON_MARGIN: 12,
1109
+ TITLE_FONT_SIZE: 32,
1110
+ MESSAGE_FONT_SIZE: 28,
1111
+ };
1112
+ this.uiManager = VizbeeHomeSSOUIManager.getInstance();
1113
+ this.setupContainer();
1114
+ }
1115
+ /**
1116
+ * Shows the snackbar with the specified options
1117
+ */
1118
+ VizbeeSnackbar.prototype.show = function (options) {
1119
+ var _this = this;
1120
+ this.hide();
1121
+ clearTimeout(this.showSnackbarTimerId);
1122
+ this.showSnackbarTimerId = window.setTimeout(function () {
1123
+ _this.createSnackbar(options);
1124
+ if (_this.currentSnackbar) {
1125
+ _this.currentSnackbar.style.transform =
1126
+ _this.getSlideTransform('top-right');
1127
+ }
1128
+ if (options === null || options === void 0 ? void 0 : options.shouldAnimateIcon) {
1129
+ _this.startIconAnimation(options.iconBase64Strings);
1130
+ }
1131
+ if ((options === null || options === void 0 ? void 0 : options.duration) && options.duration > 0) {
1132
+ _this.timeoutId = window.setTimeout(function () { return _this.hide(); }, options.duration);
1133
+ }
1134
+ }, 1000);
1135
+ };
1136
+ /**
1137
+ * Hides the currently displayed snackbar
1138
+ */
1139
+ VizbeeSnackbar.prototype.hide = function () {
1140
+ var _this = this;
1141
+ this.stopIconAnimation();
1142
+ if (this.timeoutId) {
1143
+ clearTimeout(this.timeoutId);
1144
+ this.timeoutId = undefined;
1145
+ }
1146
+ if (this.currentSnackbar) {
1147
+ this.currentSnackbar.style.transform = this.getSlideTransform('bottom-right', true);
1148
+ this.currentSnackbar.style.opacity = '0';
1149
+ setTimeout(function () {
1150
+ var _a;
1151
+ if (((_a = _this.currentSnackbar) === null || _a === void 0 ? void 0 : _a.parentNode) === _this.container) {
1152
+ _this.container.removeChild(_this.currentSnackbar);
1153
+ }
1154
+ _this.currentSnackbar = undefined;
1155
+ }, 300);
1156
+ }
1157
+ };
1158
+ VizbeeSnackbar.prototype.getScreenScale = function () {
1159
+ var width = window.innerWidth;
1160
+ return width / this.BASE_DIMENSIONS.REFERENCE_WIDTH;
1161
+ };
1162
+ VizbeeSnackbar.prototype.scaleValue = function (value) {
1163
+ return Math.round(value * this.getScreenScale());
1164
+ };
1165
+ VizbeeSnackbar.prototype.setupContainer = function () {
1166
+ this.container = document.createElement('div');
1167
+ this.container.style.cssText = "\n position: fixed;\n z-index: 9999;\n pointer-events: none;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n ";
1168
+ document.body.appendChild(this.container);
1169
+ };
1170
+ VizbeeSnackbar.prototype.getSlideTransform = function (position, hide) {
1171
+ if (hide === void 0) { hide = false; }
1172
+ var transformValue = '150%';
1173
+ var isTop = position.includes('top');
1174
+ return "translateY(".concat((hide === isTop ? '-' : '') + transformValue, ")");
1175
+ };
1176
+ VizbeeSnackbar.prototype.getPositionStyles = function (position, edgeMargin) {
1177
+ var margin = edgeMargin || this.scaleValue(this.BASE_DIMENSIONS.MARGIN) + 'px';
1178
+ var positions = {
1179
+ 'top-right': "top: ".concat(margin, "; right: ").concat(margin, ";"),
1180
+ 'top-left': "top: ".concat(margin, "; left: ").concat(margin, ";"),
1181
+ 'bottom-right': "bottom: ".concat(margin, "; right: ").concat(margin, ";"),
1182
+ 'bottom-left': "bottom: ".concat(margin, "; left: ").concat(margin, ";"),
1183
+ };
1184
+ return positions[position];
1185
+ };
1186
+ VizbeeSnackbar.prototype.startIconAnimation = function (iconBase64Strings) {
1187
+ var _this = this;
1188
+ if (this.animationInterval) {
1189
+ clearInterval(this.animationInterval);
1190
+ }
1191
+ if (!iconBase64Strings || iconBase64Strings.length === 0) {
1192
+ return;
1193
+ }
1194
+ var currentIndex = 0;
1195
+ this.animationInterval = window.setInterval(function () {
1196
+ if (_this.currentIconElement) {
1197
+ currentIndex = (currentIndex + 1) % iconBase64Strings.length;
1198
+ _this.currentIconElement.src = iconBase64Strings[currentIndex];
1199
+ }
1200
+ }, 500);
1201
+ };
1202
+ VizbeeSnackbar.prototype.stopIconAnimation = function () {
1203
+ if (this.animationInterval) {
1204
+ clearInterval(this.animationInterval);
1205
+ this.animationInterval = undefined;
1206
+ }
1207
+ };
1208
+ /**
1209
+ * Whether the snackbar should render right-to-left.
1210
+ * Defaults to LTR when no direction is provided.
1211
+ */
1212
+ VizbeeSnackbar.prototype.isRtl = function (options) {
1213
+ return ((options === null || options === void 0 ? void 0 : options.direction) || 'ltr') === 'rtl';
1214
+ };
1215
+ VizbeeSnackbar.prototype.createSnackbar = function (options) {
1216
+ var snackbar = document.createElement('div');
1217
+ snackbar.style.cssText = this.getSnackbarStyles(options);
1218
+ var isRtl = this.isRtl(options);
1219
+ var contentWrapper = this.createContentWrapper(isRtl);
1220
+ var iconBase64 = options === null || options === void 0 ? void 0 : options.iconBase64String;
1221
+ if (iconBase64) {
1222
+ var iconWrapper = this.createIconWrapper(iconBase64, options.iconWidth, options.iconHeight, options.iconMarginRight, isRtl);
1223
+ contentWrapper.appendChild(iconWrapper);
1224
+ }
1225
+ var textWrapper = this.createTextWrapper(options);
1226
+ contentWrapper.appendChild(textWrapper);
1227
+ snackbar.appendChild(contentWrapper);
1228
+ this.container.appendChild(snackbar);
1229
+ this.currentSnackbar = snackbar;
1230
+ requestAnimationFrame(function () {
1231
+ snackbar.style.opacity = '1';
1232
+ snackbar.style.transform = 'translateY(0)';
1233
+ });
1234
+ };
1235
+ VizbeeSnackbar.prototype.getSnackbarStyles = function (options) {
1236
+ var _a;
1237
+ var theme = this.uiManager.getTheme();
1238
+ var borderColor = (options === null || options === void 0 ? void 0 : options.borderColor) || theme.primaryColor;
1239
+ var borderWidth = (options === null || options === void 0 ? void 0 : options.borderWidth) ||
1240
+ this.scaleValue(this.BASE_DIMENSIONS.BORDER_WIDTH) + 'px';
1241
+ var boxShadow = (options === null || options === void 0 ? void 0 : options.boxShadow) ||
1242
+ "0 ".concat(this.scaleValue(2), "px ").concat(this.scaleValue(8), "px rgba(0, 0, 0, 0.4)");
1243
+ var padding = (options === null || options === void 0 ? void 0 : options.padding) || this.scaleValue(this.BASE_DIMENSIONS.PADDING) + 'px';
1244
+ var borderRadius = (options === null || options === void 0 ? void 0 : options.borderRadius) ||
1245
+ this.scaleValue(this.BASE_DIMENSIONS.BORDER_RADIUS) + 'px';
1246
+ return "\n position: absolute;\n display: flex;\n background: ".concat((options === null || options === void 0 ? void 0 : options.backgroundColor) || 'rgba(0, 0, 0, 0.75)', ";\n color: white;\n width: ").concat((options === null || options === void 0 ? void 0 : options.width) || this.scaleValue(this.BASE_DIMENSIONS.WIDTH) + 'px', ";\n ").concat((options === null || options === void 0 ? void 0 : options.height) ? "height: ".concat(options.height, ";") : '', "\n ").concat((options === null || options === void 0 ? void 0 : options.minHeight) ? "min-height: ".concat(options.minHeight, ";") : '', "\n padding: ").concat(padding, ";\n border-radius: ").concat(borderRadius, ";\n border: ").concat(borderWidth, " solid ").concat(borderColor, ";\n box-shadow: ").concat(boxShadow, ";\n font-family: ").concat(theme.primaryFont || '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif', ";\n pointer-events: auto;\n transition: all 0.3s ease;\n opacity: 0;\n margin-top: ").concat((options === null || options === void 0 ? void 0 : options.marginTop) || '0', ";\n margin-right: ").concat((options === null || options === void 0 ? void 0 : options.marginRight) || '0', ";\n margin-bottom: ").concat((options === null || options === void 0 ? void 0 : options.marginBottom) || '0', ";\n margin-left: ").concat((options === null || options === void 0 ? void 0 : options.marginLeft) || '0', ";\n ").concat(this.getPositionStyles((options === null || options === void 0 ? void 0 : options.position) || 'bottom-right', options === null || options === void 0 ? void 0 : options.edgeMargin), "\n transform: translateY(").concat(((_a = options === null || options === void 0 ? void 0 : options.position) === null || _a === void 0 ? void 0 : _a.includes('top')) ? '-150%' : '150%', ");\n ");
1247
+ };
1248
+ VizbeeSnackbar.prototype.createContentWrapper = function (isRtl) {
1249
+ if (isRtl === void 0) { isRtl = false; }
1250
+ var wrapper = document.createElement('div');
1251
+ // `row-reverse` places the icon on the trailing (right) side for RTL.
1252
+ // Using an explicit flex-direction keeps ordering deterministic across TV
1253
+ // browsers rather than relying on `direction`-driven flex reordering.
1254
+ wrapper.style.cssText = "\n display: flex;\n flex-direction: ".concat(isRtl ? 'row-reverse' : 'row', ";\n align-items: flex-start;\n height: 100%;\n width: 100%;\n ");
1255
+ return wrapper;
1256
+ };
1257
+ VizbeeSnackbar.prototype.createIconWrapper = function (iconBase64, width, height, marginRight, isRtl) {
1258
+ if (isRtl === void 0) { isRtl = false; }
1259
+ var wrapper = document.createElement('div');
1260
+ var iconSize = this.scaleValue(this.BASE_DIMENSIONS.ICON_SIZE);
1261
+ var iconGap = marginRight || this.scaleValue(this.BASE_DIMENSIONS.ICON_MARGIN) + 'px';
1262
+ // The gap always sits between the icon and the text. In RTL the icon is on
1263
+ // the right (row-reverse), so the gap belongs on its left instead.
1264
+ var iconGapSide = isRtl ? 'margin-left' : 'margin-right';
1265
+ wrapper.style.cssText = "\n ".concat(iconGapSide, ": ").concat(iconGap, ";\n display: flex;\n align-items: flex-start;\n justify-content: center;\n min-width: ").concat(width || iconSize + 'px', ";\n width: ").concat(width || iconSize + 'px', ";\n height: ").concat(height || iconSize + 'px', ";\n color: white;\n margin-top: 0;\n ");
1266
+ var iconElement = document.createElement('img');
1267
+ iconElement.src = iconBase64;
1268
+ iconElement.style.cssText = "\n width: 100%;\n height: 100%;\n object-fit: contain;\n vertical-align: middle;\n ";
1269
+ this.currentIconElement = iconElement;
1270
+ wrapper.appendChild(iconElement);
1271
+ return wrapper;
1272
+ };
1273
+ VizbeeSnackbar.prototype.createTextWrapper = function (options) {
1274
+ var isRtl = this.isRtl(options);
1275
+ var wrapper = document.createElement('div');
1276
+ // `direction` drives bidi text shaping; `text-align` aligns the title and
1277
+ // description to the leading edge. Both inherit to the child text elements.
1278
+ wrapper.style.cssText = "\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n direction: ".concat(isRtl ? 'rtl' : 'ltr', ";\n text-align: ").concat(isRtl ? 'right' : 'left', ";\n ");
1279
+ if (options === null || options === void 0 ? void 0 : options.titleText) {
1280
+ var titleElement = document.createElement('div');
1281
+ titleElement.style.cssText = "\n font-size: ".concat((options === null || options === void 0 ? void 0 : options.titleTextFontSize) || this.scaleValue(this.BASE_DIMENSIONS.TITLE_FONT_SIZE) + 'px', ";\n font-family: ").concat((options === null || options === void 0 ? void 0 : options.titleTextFontFamily) || '-apple-system', ";\n color: ").concat((options === null || options === void 0 ? void 0 : options.titleTextFontColor) || 'white', ";\n font-weight: ").concat((options === null || options === void 0 ? void 0 : options.titleTextFontWeight) || '500', ";\n margin-bottom: ").concat((options === null || options === void 0 ? void 0 : options.titleMarginBottom) || this.scaleValue(4) + 'px', ";\n line-height: ").concat((options === null || options === void 0 ? void 0 : options.titleTextLineHeight) || '1.2', ";\n ");
1282
+ titleElement.textContent = options.titleText;
1283
+ wrapper.appendChild(titleElement);
1284
+ }
1285
+ var messageElement = document.createElement('div');
1286
+ messageElement.style.cssText = "\n font-size: ".concat((options === null || options === void 0 ? void 0 : options.descriptionTextFontSize) ||
1287
+ this.scaleValue((options === null || options === void 0 ? void 0 : options.titleText)
1288
+ ? this.BASE_DIMENSIONS.MESSAGE_FONT_SIZE
1289
+ : this.BASE_DIMENSIONS.TITLE_FONT_SIZE) + 'px', ";\n font-family: ").concat((options === null || options === void 0 ? void 0 : options.descriptionTextFontFamily) || '-apple-system', ";\n color: ").concat((options === null || options === void 0 ? void 0 : options.descriptionTextFontColor) || 'rgba(255, 255, 255, 0.9)', ";\n font-weight: ").concat((options === null || options === void 0 ? void 0 : options.descriptionTextFontWeight) || 'normal', ";\n line-height: ").concat((options === null || options === void 0 ? void 0 : options.descriptionTextLineHeight) || '1.3', ";\n ");
1290
+ messageElement.textContent = options.descriptionText;
1291
+ wrapper.appendChild(messageElement);
1292
+ return wrapper;
1293
+ };
1294
+ return VizbeeSnackbar;
1295
+ }());
1296
+
1297
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1298
+ var LOG_TAG = 'VizbeeHomeSSOManager';
1299
+ /**
1300
+ * Manages Single Sign-On (SSO) functionality between mobile and TV devices in the Vizbee ecosystem.
1301
+ * Implements singleton pattern for global state management.
1302
+ *
1303
+ * @remarks
1304
+ * This class serves as the central manager for SSO operations, handling:
1305
+ * - Communication between mobile and TV devices
1306
+ * - Sign-in status management and updates
1307
+ * - UI state management
1308
+ * - Analytics and metrics tracking
1309
+ *
1310
+ * @class VizbeeHomeSSOManager
1311
+ * @public
1312
+ */
1313
+ var VizbeeHomeSSOManager = /** @class */ (function () {
1314
+ /**
1315
+ * Private constructor to enforce singleton pattern
1316
+ * Initializes necessary components and sets up default handlers
1317
+ *
1318
+ * @internal
1319
+ */
1320
+ function VizbeeHomeSSOManager() {
1321
+ /** @internal List of sign-in information for different services */
1322
+ this.signInInfoList = [];
1323
+ /** @internal Tracks if remote device is signed in */
1324
+ this.isRemoteSignedIn = false;
1325
+ /** @internal Tracks if screen device is signed in */
1326
+ this.isScreenSignedIn = false;
1327
+ /** @internal Tracks if sign-in process is currently active */
1328
+ this.isSignInInProgress = false;
1329
+ /** @internal Information about the sender device */
1330
+ this.senderInfo = null;
1331
+ /**
1332
+ * Modal display preferences for the SSO UI
1333
+ * @public
1334
+ */
1335
+ this.modalPreferences = {};
1336
+ this.vizbeeHomeSSOUIManager = VizbeeHomeSSOUIManager.getInstance();
1337
+ this.snackbar = new VizbeeSnackbar();
1338
+ this.vizbeeMetricsManager = new VizbeeMetricsManager();
1339
+ }
1340
+ /**
1341
+ * Gets the singleton instance of VizbeeHomeSSOManager
1342
+ * Creates a new instance if one doesn't exist
1343
+ *
1344
+ * @returns The singleton instance of the SSO manager
1345
+ * @public
1346
+ */
1347
+ VizbeeHomeSSOManager.getInstance = function () {
1348
+ if (!VizbeeHomeSSOManager.instance) {
1349
+ VizbeeHomeSSOManager.instance = new VizbeeHomeSSOManager();
1350
+ }
1351
+ return VizbeeHomeSSOManager.instance;
1352
+ };
1353
+ VizbeeHomeSSOManager.prototype.init = function () {
1354
+ this.initializeVizbeeSession();
1355
+ };
1356
+ /**
1357
+ * Sets up a handler for processing sign-in events from mobile devices
1358
+ *
1359
+ * @param handler - Callback function to process sign-in information and provide status updates
1360
+ * @public
1361
+ */
1362
+ VizbeeHomeSSOManager.prototype.setSignInHandler = function (handler) {
1363
+ logger.debug("[".concat(LOG_TAG, "][setSignInHandler] - setSignInHandler called"));
1364
+ if (!handler) {
1365
+ logger.error("[".concat(LOG_TAG, "][setSignInHandler] - Error: Sign-in handler is missing"));
1366
+ return;
1367
+ }
1368
+ if (typeof handler !== 'function') {
1369
+ logger.error("[".concat(LOG_TAG, "][setSignInHandler] - Error: Sign-in handler is not a function"));
1370
+ return;
1371
+ }
1372
+ logger.info("[".concat(LOG_TAG, "][setSignInHandler] - Setting sign-in handler"));
1373
+ this.signInHandler = handler;
1374
+ };
1375
+ /**
1376
+ * Sets the callback for retrieving sign-in information
1377
+ *
1378
+ * @param getSignInInfo - Async callback that provides the list of sign-in information
1379
+ * @public
1380
+ */
1381
+ VizbeeHomeSSOManager.prototype.setSignInInfoGetter = function (getSignInInfo) {
1382
+ if (!getSignInInfo) {
1383
+ logger.error("[".concat(LOG_TAG, "][setSignInInfoGetter] - Error: GetSignInInfo callback is missing"));
1384
+ return;
1385
+ }
1386
+ if (typeof getSignInInfo !== 'function') {
1387
+ logger.error("[".concat(LOG_TAG, "][setSignInInfoGetter] - Error: GetSignInInfo is not a function"));
1388
+ return;
1389
+ }
1390
+ if (!this.vizbeeMetricsManager) {
1391
+ logger.error("[".concat(LOG_TAG, "][setSignInInfoGetter] - Error: Metrics manager is missing"));
1392
+ return;
1393
+ }
1394
+ if (!this.vizbeeMetricsManager.getSignInInfo) {
1395
+ logger.error("[".concat(LOG_TAG, "][setSignInInfoGetter] - Error: GetAttributes callback is missing"));
1396
+ return;
1397
+ }
1398
+ this.vizbeeMetricsManager.getSignInInfo = getSignInInfo;
1399
+ };
1400
+ /**
1401
+ * Handles sign-in progress updates
1402
+ * Updates UI, sends status to mobile device, and logs metrics
1403
+ *
1404
+ * @param progressStatus - Current progress status of the sign-in process
1405
+ * @public
1406
+ */
1407
+ VizbeeHomeSSOManager.prototype.onProgress = function (progressStatus) {
1408
+ logger.info("[".concat(LOG_TAG, "][onProgress] - OnProgress is invoked"));
1409
+ this.isSignInInProgress = true;
1410
+ this.sendStatusToSender(progressStatus);
1411
+ this.updateProgressUI();
1412
+ this.vizbeeMetricsManager.log(VizbeeMetricsConstants.METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_STATUS, {
1413
+ isScreenSignedIn: false,
1414
+ isRemoteSignedIn: this.isRemoteSignedIn,
1415
+ signInState: progressStatus.getState(),
1416
+ userId: null,
1417
+ signInType: progressStatus.signInType,
1418
+ });
1419
+ };
1420
+ /**
1421
+ * Handles successful sign-in completion
1422
+ * Updates UI, sends success status to mobile device, and logs metrics
1423
+ *
1424
+ * @param successStatus - Success status details
1425
+ * @public
1426
+ */
1427
+ VizbeeHomeSSOManager.prototype.onSuccess = function (successStatus) {
1428
+ logger.info("[".concat(LOG_TAG, "][onSuccess] - OnSuccess is invoked"));
1429
+ this.isSignInInProgress = false;
1430
+ this.isRemoteSignedIn = true;
1431
+ this.sendStatusToSender(successStatus);
1432
+ this.updateSuccessUI();
1433
+ this.vizbeeMetricsManager.log(VizbeeMetricsConstants.METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_STATUS, {
1434
+ isScreenSignedIn: true,
1435
+ isRemoteSignedIn: this.isRemoteSignedIn,
1436
+ signInState: successStatus.getState(),
1437
+ userId: successStatus.userId,
1438
+ signInType: successStatus.signInType,
1439
+ });
1440
+ };
1441
+ /**
1442
+ * Handles sign-in failures
1443
+ * Updates UI and sends failure status to mobile device
1444
+ *
1445
+ * @param failureStatus - Failure status details
1446
+ * @public
1447
+ */
1448
+ VizbeeHomeSSOManager.prototype.onFailure = function (failureStatus) {
1449
+ logger.info("[".concat(LOG_TAG, "][onFailure] - OnFailure is invoked"));
1450
+ this.isSignInInProgress = false;
1451
+ this.sendStatusToSender(failureStatus);
1452
+ this.updateFailureUI();
1453
+ this.vizbeeMetricsManager.log(VizbeeMetricsConstants.METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_STATUS, {
1454
+ isScreenSignedIn: false,
1455
+ isRemoteSignedIn: this.isRemoteSignedIn,
1456
+ signInState: failureStatus.getState(),
1457
+ userId: null,
1458
+ signInType: failureStatus.signInType,
1459
+ });
1460
+ };
1461
+ /**
1462
+ * Adds custom attributes for metrics tracking
1463
+ *
1464
+ * @param customEventAttributes - Dictionary of custom attributes to track
1465
+ * @public
1466
+ */
1467
+ VizbeeHomeSSOManager.prototype.addCustomEventAttributes = function (customEventAttributes) {
1468
+ var _a;
1469
+ if (customEventAttributes) {
1470
+ (_a = this.vizbeeMetricsManager) === null || _a === void 0 ? void 0 : _a.setCustomAttributes(customEventAttributes);
1471
+ }
1472
+ };
1473
+ /**
1474
+ * Initializes Vizbee session and messaging client
1475
+ *
1476
+ * @throws Error if initialization fails
1477
+ * @internal
1478
+ */
1479
+ VizbeeHomeSSOManager.prototype.initializeVizbeeSession = function () {
1480
+ var _this = this;
1481
+ var _a, _b;
1482
+ try {
1483
+ logger.info("[".concat(LOG_TAG, "][initializeVizbeeSession] - Initializing Vizbee session"));
1484
+ // Check if vizbee and continuity exist before accessing xmessages
1485
+ if (!((_b = (_a = window.vizbee) === null || _a === void 0 ? void 0 : _a.continuity) === null || _b === void 0 ? void 0 : _b.xmessages)) {
1486
+ throw new Error('Vizbee continuity or xmessages not initialized');
1487
+ }
1488
+ // Access VizbeeBicastSessionManager directly from the existing object
1489
+ var sessionManager_1 = new window.vizbee.continuity.xmessages.VizbeeBicastSessionManager();
1490
+ if (!sessionManager_1) {
1491
+ throw new Error('Session manager initialization failed');
1492
+ }
1493
+ // add sessionStateListener
1494
+ logger.debug("[".concat(LOG_TAG, "]initializeVizbeeSession - Adding session state listener"));
1495
+ sessionManager_1.addSessionStateListener({
1496
+ onSessionStateChanged: function (state) {
1497
+ logger.info("[".concat(LOG_TAG, "][onSessionStateChanged] - Session state changed:"), state);
1498
+ if (state === 3) {
1499
+ _this.vizbeeSession = sessionManager_1.getSession();
1500
+ _this.vizbeeMessagingClient =
1501
+ _this.vizbeeSession.getMessagingClient();
1502
+ if (_this.signInHandler) {
1503
+ logger.info("[".concat(LOG_TAG, "][onSessionStateChanged] - Adding sign-in request receiver"));
1504
+ _this.vizbeeMessagingClient.addReceiver(VizbeeConstants.EVENT_SSO_NAME, function (payload, namespace, device) { return __awaiter(_this, void 0, void 0, function () {
1505
+ return __generator(this, function (_a) {
1506
+ switch (_a.label) {
1507
+ case 0:
1508
+ logger.debug("[".concat(LOG_TAG, "][onSessionStateChanged] - Received sign-in request on namespace:"), namespace);
1509
+ this.senderInfo = device;
1510
+ return [4 /*yield*/, this.handleSignInRequest(payload, this.signInHandler)];
1511
+ case 1:
1512
+ _a.sent();
1513
+ return [2 /*return*/];
1514
+ }
1515
+ });
1516
+ }); });
1517
+ }
1518
+ else {
1519
+ logger.warn("[".concat(LOG_TAG, "][onSessionStateChanged] - Error: Sign-in handler is missing"));
1520
+ }
1521
+ }
1522
+ },
1523
+ });
1524
+ }
1525
+ catch (error) {
1526
+ logger.warn("[".concat(LOG_TAG, "][onSessionStateChanged] - Error initializing Vizbee session:"), error);
1527
+ throw error;
1528
+ }
1529
+ };
1530
+ /**
1531
+ * Processes incoming sign-in requests
1532
+ * Validates request and triggers appropriate handler
1533
+ *
1534
+ * @param payload - Sign-in request payload
1535
+ * @param handler - Callback to handle the sign-in request
1536
+ * @internal
1537
+ */
1538
+ VizbeeHomeSSOManager.prototype.handleSignInRequest = function (payload, handler) {
1539
+ return __awaiter(this, void 0, void 0, function () {
1540
+ var senderSignInInfo, signInType, _a, signInInfo;
1541
+ var _b, _c;
1542
+ return __generator(this, function (_d) {
1543
+ switch (_d.label) {
1544
+ case 0:
1545
+ senderSignInInfo = payload[VizbeeConstants.KEY_START_SIGN_IN_INFO];
1546
+ if (!senderSignInInfo) {
1547
+ logger.warn("[".concat(LOG_TAG, "][handleSignInRequest] - Error: Sender info is missing"));
1548
+ return [2 /*return*/];
1549
+ }
1550
+ signInType = senderSignInInfo[VizbeeConstants.KEY_SIGN_IN_TYPE];
1551
+ _a = this;
1552
+ return [4 /*yield*/, this.isUserAlreadySignedIn(signInType)];
1553
+ case 1:
1554
+ _a.isScreenSignedIn = _d.sent();
1555
+ this.isRemoteSignedIn = payload[VizbeeConstants.KEY_START_SIGN_IN_INFO][VizbeeConstants.KEY_IS_SIGNED_IN];
1556
+ this.vizbeeMetricsManager.log(VizbeeMetricsConstants.METRICS_EVENT_SCREEN_HOMESSO_SIGNIN_RECEIVED, {
1557
+ isScreenSignedIn: this.isScreenSignedIn,
1558
+ isRemoteSignedIn: this.isRemoteSignedIn,
1559
+ signInType: signInType,
1560
+ senderInfo: this.senderInfo,
1561
+ });
1562
+ return [4 /*yield*/, this.shouldIgnoreSignInRequest()];
1563
+ case 2:
1564
+ if (_d.sent()) {
1565
+ return [2 /*return*/];
1566
+ }
1567
+ signInInfo = {
1568
+ isSignedIn: this.isRemoteSignedIn,
1569
+ signInType: signInType,
1570
+ deviceId: (_b = this.senderInfo) === null || _b === void 0 ? void 0 : _b.deviceId,
1571
+ deviceType: (_c = this.senderInfo) === null || _c === void 0 ? void 0 : _c.deviceType,
1572
+ customData: {},
1573
+ };
1574
+ handler(signInInfo, this.handleSignInStatus.bind(this));
1575
+ return [2 /*return*/];
1576
+ }
1577
+ });
1578
+ });
1579
+ };
1580
+ /**
1581
+ * Determines if a sign-in request should be ignored
1582
+ * Checks various conditions like existing sign-in state
1583
+ *
1584
+ * @returns Promise<boolean> indicating if request should be ignored
1585
+ * @internal
1586
+ */
1587
+ VizbeeHomeSSOManager.prototype.shouldIgnoreSignInRequest = function () {
1588
+ return __awaiter(this, void 0, void 0, function () {
1589
+ return __generator(this, function (_a) {
1590
+ if (this.isScreenSignedIn) {
1591
+ logger.info("[".concat(LOG_TAG, "][shouldIgnoreSignInRequest] - User is already signed in"));
1592
+ return [2 /*return*/, true];
1593
+ }
1594
+ return [2 /*return*/, false];
1595
+ });
1596
+ });
1597
+ };
1598
+ /**
1599
+ * Checks if user is already signed in for a specific sign-in type
1600
+ *
1601
+ * @param signInType - Type of sign-in to check
1602
+ * @returns Promise<boolean> indicating if user is signed in
1603
+ * @internal
1604
+ */
1605
+ VizbeeHomeSSOManager.prototype.isUserAlreadySignedIn = function (signInType) {
1606
+ return __awaiter(this, void 0, void 0, function () {
1607
+ var attributes, signInInfoList, tvSignInInfo, error_1;
1608
+ var _a, _b;
1609
+ return __generator(this, function (_c) {
1610
+ switch (_c.label) {
1611
+ case 0:
1612
+ _c.trys.push([0, 2, , 3]);
1613
+ return [4 /*yield*/, ((_b = (_a = this.vizbeeMetricsManager) === null || _a === void 0 ? void 0 : _a.getAttributes) === null || _b === void 0 ? void 0 : _b.call(_a))];
1614
+ case 1:
1615
+ attributes = _c.sent();
1616
+ signInInfoList = attributes === null || attributes === void 0 ? void 0 : attributes['SCREEN_HOMESSO_USER_INFO'];
1617
+ logger.info("[".concat(LOG_TAG, "][isUserAlreadySignedIn] - signInInfoList"), signInInfoList);
1618
+ tvSignInInfo = signInInfoList.find(function (info) { return info.user_login_type === signInType; });
1619
+ logger.debug("[".concat(LOG_TAG, "][isUserAlreadySignedIn] - TV sign in status fetched:"), tvSignInInfo);
1620
+ return [2 /*return*/, tvSignInInfo === null || tvSignInInfo === void 0 ? void 0 : tvSignInInfo.user_is_signed_in];
1621
+ case 2:
1622
+ error_1 = _c.sent();
1623
+ logger.warn("[".concat(LOG_TAG, "][isUserAlreadySignedIn] - Error checking sign-in status:"), error_1);
1624
+ return [2 /*return*/, false];
1625
+ case 3: return [2 /*return*/];
1626
+ }
1627
+ });
1628
+ });
1629
+ };
1630
+ /**
1631
+ * Handles sign-in status updates
1632
+ * Routes status updates to appropriate handlers
1633
+ *
1634
+ * @param status - Current status of the sign-in process
1635
+ * @internal
1636
+ */
1637
+ VizbeeHomeSSOManager.prototype.handleSignInStatus = function (status) {
1638
+ var _a, _b;
1639
+ if (status instanceof ProgressStatus) {
1640
+ var regcode = (_a = status.customData) === null || _a === void 0 ? void 0 : _a.regcode;
1641
+ if (regcode) {
1642
+ this.onProgress(status);
1643
+ }
1644
+ }
1645
+ else if (status instanceof SuccessStatus) {
1646
+ var userEmail = (_b = status.customData) === null || _b === void 0 ? void 0 : _b.email;
1647
+ if (userEmail) {
1648
+ this.onSuccess(status);
1649
+ }
1650
+ }
1651
+ else if (status instanceof FailureStatus) {
1652
+ this.onFailure(status);
1653
+ }
1654
+ };
1655
+ /**
1656
+ * Sends status updates to mobile device
1657
+ *
1658
+ * @param status - Status to send to mobile device
1659
+ * @internal
1660
+ */
1661
+ VizbeeHomeSSOManager.prototype.sendStatusToSender = function (status) {
1662
+ var _a;
1663
+ var signInStatus = this.serializeStatus(status);
1664
+ var data = (_a = {},
1665
+ _a[VizbeeConstants.KEY_SUB_TYPE] = VizbeeConstants.EVENT_SUBTYPE_SIGN_IN_STATUS,
1666
+ _a[VizbeeConstants.KEY_SIGN_IN_STATUS] = signInStatus,
1667
+ _a);
1668
+ this.vizbeeMessagingClient.send(data, VizbeeConstants.EVENT_SSO_NAME);
1669
+ };
1670
+ /**
1671
+ * Serializes status objects for transmission to mobile device
1672
+ *
1673
+ * @param status - Status object to serialize
1674
+ * @returns Serialized status object or null if invalid status type
1675
+ * @internal
1676
+ */
1677
+ VizbeeHomeSSOManager.prototype.serializeStatus = function (status) {
1678
+ if (status instanceof ProgressStatus) {
1679
+ return status.serialize();
1680
+ }
1681
+ else if (status instanceof SuccessStatus) {
1682
+ return status.serialize();
1683
+ }
1684
+ else if (status instanceof FailureStatus) {
1685
+ return status.serialize();
1686
+ }
1687
+ return null;
1688
+ };
1689
+ /**
1690
+ * Updates UI for sign-in progress state
1691
+ * Shows appropriate modal based on remote sign-in status
1692
+ *
1693
+ * @internal
1694
+ */
1695
+ VizbeeHomeSSOManager.prototype.updateProgressUI = function () {
1696
+ if (!this.isRemoteSignedIn) {
1697
+ var modalOptions = this.vizbeeHomeSSOUIManager.getInformationalSignInModalConfig();
1698
+ this.snackbar.show(modalOptions);
1699
+ }
1700
+ else {
1701
+ var modalOptions = this.vizbeeHomeSSOUIManager.getProgressSignInModalConfig();
1702
+ this.snackbar.show(__assign(__assign({}, modalOptions), { shouldAnimateIcon: true }));
1703
+ }
1704
+ };
1705
+ /**
1706
+ * Updates UI for successful sign-in
1707
+ * Shows success modal with appropriate message
1708
+ *
1709
+ * @internal
1710
+ */
1711
+ VizbeeHomeSSOManager.prototype.updateSuccessUI = function () {
1712
+ // Enforce only the success duration; leave title/description to the
1713
+ // integrator's config (or the defaults) so the success toast can be
1714
+ // themed/localized like the informational and progress modals.
1715
+ this.vizbeeHomeSSOUIManager.setSuccessSignInModalConfig({ duration: 10000 });
1716
+ var modalOptions = this.vizbeeHomeSSOUIManager.getSuccessSignInModalConfig();
1717
+ this.snackbar.show(modalOptions);
1718
+ };
1719
+ /**
1720
+ * Updates UI for failed sign-in
1721
+ * Hides any active modals
1722
+ *
1723
+ * @internal
1724
+ */
1725
+ VizbeeHomeSSOManager.prototype.updateFailureUI = function () {
1726
+ this.snackbar.hide();
1727
+ };
1728
+ /** @internal Singleton instance of the manager */
1729
+ VizbeeHomeSSOManager.instance = null;
1730
+ return VizbeeHomeSSOManager;
1731
+ }());
1732
+
1733
+ var UNKNOWN_VALUE = 'UNKNOWN';
1734
+
1735
+ /**
1736
+ * @class HomeSSOContext
1737
+ * @description Context provider for Vizbee Home SSO functionality
1738
+ */
1739
+ var HomeSSOContext = /** @class */ (function () {
1740
+ function HomeSSOContext() {
1741
+ this.homeSSOUIManager = null;
1742
+ }
1743
+ /**
1744
+ * Gets the singleton instance of HomeSSOContext
1745
+ * @returns The singleton instance of HomeSSOContext
1746
+ */
1747
+ HomeSSOContext.getInstance = function () {
1748
+ if (!HomeSSOContext.instance) {
1749
+ HomeSSOContext.instance = new HomeSSOContext();
1750
+ }
1751
+ return HomeSSOContext.instance;
1752
+ };
1753
+ /**
1754
+ * Gets the HomeSSOManager instance
1755
+ * @returns The singleton instance of VizbeeHomeSSOManager
1756
+ */
1757
+ HomeSSOContext.prototype.getHomeSSOManager = function () {
1758
+ return VizbeeHomeSSOManager.getInstance();
1759
+ };
1760
+ /**
1761
+ * Gets the HomeSSOUIManager instance
1762
+ * @param config Optional UI configuration including theme settings
1763
+ * @returns The singleton instance of VizbeeHomeSSOUIManager
1764
+ */
1765
+ HomeSSOContext.prototype.getHomeSSOUIManager = function () {
1766
+ return VizbeeHomeSSOUIManager.getInstance();
1767
+ };
1768
+ HomeSSOContext.prototype.enableLogger = function (enable) {
1769
+ logger.setConfig({
1770
+ enabled: enable,
1771
+ });
1772
+ };
1773
+ HomeSSOContext.prototype.setLoggerLevel = function (level) {
1774
+ logger.setConfig({
1775
+ enabled: true,
1776
+ level: level,
1777
+ });
1778
+ };
1779
+ HomeSSOContext.instance = null;
1780
+ return HomeSSOContext;
1781
+ }());
1782
+ var init = function () {
1783
+ // Initialize the global namespace
1784
+ if (typeof window !== 'undefined') {
1785
+ if (!window.vizbee) {
1786
+ window.addEventListener('VIZBEE_SDK_READY', function () {
1787
+ if (window.vizbee) {
1788
+ setupHomeSSO();
1789
+ }
1790
+ });
1791
+ }
1792
+ else {
1793
+ setupHomeSSO();
1794
+ }
1795
+ }
1796
+ };
1797
+ var setupHomeSSO = function () {
1798
+ window.vizbee.homesso = {
1799
+ HomeSSOContext: HomeSSOContext,
1800
+ messages: {
1801
+ ProgressStatus: ProgressStatus,
1802
+ SuccessStatus: SuccessStatus,
1803
+ FailureStatus: FailureStatus,
1804
+ },
1805
+ LoggerLevel: exports.LogLevel,
1806
+ // Replaced at build time with package.json's version by
1807
+ // @rollup/plugin-replace (same token the metrics manager uses), so
1808
+ // integrators can read the loaded SDK version off the namespace.
1809
+ VERSION: '1.0.1',
1810
+ };
1811
+ window.dispatchEvent(new Event('VIZBEE_HOMESSO_READY'));
1812
+ };
1813
+ init();
1814
+
1815
+ exports.FailureStatus = FailureStatus;
1816
+ exports.HomeSSOContext = HomeSSOContext;
1817
+ exports.ProgressStatus = ProgressStatus;
1818
+ exports.SuccessStatus = SuccessStatus;
1819
+ exports.UNKNOWN_VALUE = UNKNOWN_VALUE;
1820
+ exports.VizbeeHomeSSOManager = VizbeeHomeSSOManager;
1821
+ exports.VizbeeHomeSSOUIManager = VizbeeHomeSSOUIManager;