playkit-sdk 1.2.12 → 1.2.13
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/dist/playkit-sdk.cjs.js +23 -6
- package/dist/playkit-sdk.cjs.js.map +1 -1
- package/dist/playkit-sdk.d.ts +7 -0
- package/dist/playkit-sdk.esm.js +23 -6
- package/dist/playkit-sdk.esm.js.map +1 -1
- package/dist/playkit-sdk.umd.js +23 -6
- package/dist/playkit-sdk.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/playkit-sdk.d.ts
CHANGED
|
@@ -1069,6 +1069,8 @@ declare class AuthManager extends EventEmitter {
|
|
|
1069
1069
|
private logger;
|
|
1070
1070
|
/** Shared promise for current device auth flow - allows multiple callers to await the same result */
|
|
1071
1071
|
private currentDeviceAuthFlowPromise;
|
|
1072
|
+
/** Shared promise for current auth flow (startAuthFlow) - allows multiple callers to await the same result */
|
|
1073
|
+
private currentAuthFlowPromise;
|
|
1072
1074
|
constructor(config: SDKConfig);
|
|
1073
1075
|
/**
|
|
1074
1076
|
* Initialize authentication
|
|
@@ -1081,6 +1083,11 @@ declare class AuthManager extends EventEmitter {
|
|
|
1081
1083
|
* @deprecated 'headless' authentication is deprecated and will be removed in v2.0. Use 'device' instead.
|
|
1082
1084
|
*/
|
|
1083
1085
|
startAuthFlow(authMethod?: 'device' | 'headless'): Promise<void>;
|
|
1086
|
+
/**
|
|
1087
|
+
* Internal method that executes the actual auth flow
|
|
1088
|
+
* @private
|
|
1089
|
+
*/
|
|
1090
|
+
private executeAuthFlow;
|
|
1084
1091
|
/**
|
|
1085
1092
|
* Exchange JWT for player token
|
|
1086
1093
|
*/
|
package/dist/playkit-sdk.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* playkit-sdk v1.2.
|
|
2
|
+
* playkit-sdk v1.2.13
|
|
3
3
|
* PlayKit SDK for JavaScript
|
|
4
4
|
* @license SEE LICENSE IN LICENSE
|
|
5
5
|
*/
|
|
@@ -2426,6 +2426,8 @@ class AuthManager extends EventEmitter {
|
|
|
2426
2426
|
this.logger = Logger.getLogger('AuthManager');
|
|
2427
2427
|
/** Shared promise for current device auth flow - allows multiple callers to await the same result */
|
|
2428
2428
|
this.currentDeviceAuthFlowPromise = null;
|
|
2429
|
+
/** Shared promise for current auth flow (startAuthFlow) - allows multiple callers to await the same result */
|
|
2430
|
+
this.currentAuthFlowPromise = null;
|
|
2429
2431
|
this.config = config;
|
|
2430
2432
|
// Create TokenStorage with appropriate mode for server vs browser environment
|
|
2431
2433
|
this.storage = new TokenStorage({
|
|
@@ -2534,12 +2536,27 @@ class AuthManager extends EventEmitter {
|
|
|
2534
2536
|
* @deprecated 'headless' authentication is deprecated and will be removed in v2.0. Use 'device' instead.
|
|
2535
2537
|
*/
|
|
2536
2538
|
async startAuthFlow(authMethod = 'device') {
|
|
2537
|
-
|
|
2538
|
-
if (this.
|
|
2539
|
-
|
|
2540
|
-
this.
|
|
2541
|
-
return;
|
|
2539
|
+
// If a flow is already in progress, return the shared promise so all callers await the same result
|
|
2540
|
+
if (this.currentAuthFlowPromise) {
|
|
2541
|
+
this.logger.debug('Auth flow already in progress, waiting for existing flow');
|
|
2542
|
+
return this.currentAuthFlowPromise;
|
|
2542
2543
|
}
|
|
2544
|
+
// Store the flow promise so subsequent calls can await the same result
|
|
2545
|
+
const flowPromise = this.executeAuthFlow(authMethod);
|
|
2546
|
+
this.currentAuthFlowPromise = flowPromise;
|
|
2547
|
+
try {
|
|
2548
|
+
return await flowPromise;
|
|
2549
|
+
}
|
|
2550
|
+
finally {
|
|
2551
|
+
this.currentAuthFlowPromise = null;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
/**
|
|
2555
|
+
* Internal method that executes the actual auth flow
|
|
2556
|
+
* @private
|
|
2557
|
+
*/
|
|
2558
|
+
async executeAuthFlow(authMethod = 'device') {
|
|
2559
|
+
var _a, _b;
|
|
2543
2560
|
// Deprecation warning for headless auth
|
|
2544
2561
|
if (authMethod === 'headless') {
|
|
2545
2562
|
this.logger.warn('"headless" authentication is deprecated and will be removed in v2.0. ' +
|