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