playkit-sdk 1.2.6 → 1.2.7
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 +39 -101
- package/dist/playkit-sdk.cjs.js.map +1 -1
- package/dist/playkit-sdk.esm.js +39 -101
- package/dist/playkit-sdk.esm.js.map +1 -1
- package/dist/playkit-sdk.umd.js +39 -101
- package/dist/playkit-sdk.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/playkit-sdk.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* playkit-sdk v1.2.
|
|
2
|
+
* playkit-sdk v1.2.7
|
|
3
3
|
* PlayKit SDK for JavaScript
|
|
4
4
|
* @license SEE LICENSE IN LICENSE
|
|
5
5
|
*/
|
|
@@ -1270,12 +1270,12 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1270
1270
|
* Show login modal and return promises for user interaction
|
|
1271
1271
|
* @private
|
|
1272
1272
|
*/
|
|
1273
|
-
showLoginModal(
|
|
1273
|
+
showLoginModal(_gameInfo) {
|
|
1274
1274
|
let resolveClicked;
|
|
1275
1275
|
let resolveCancelled;
|
|
1276
1276
|
const clicked = new Promise((resolve) => { resolveClicked = resolve; });
|
|
1277
1277
|
const cancelled = new Promise((resolve) => { resolveCancelled = resolve; });
|
|
1278
|
-
// Create modal overlay
|
|
1278
|
+
// Create modal overlay - dark bg-black/80 style
|
|
1279
1279
|
const overlay = document.createElement('div');
|
|
1280
1280
|
overlay.id = 'playkit-login-modal';
|
|
1281
1281
|
overlay.style.cssText = `
|
|
@@ -1284,74 +1284,30 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1284
1284
|
left: 0;
|
|
1285
1285
|
right: 0;
|
|
1286
1286
|
bottom: 0;
|
|
1287
|
-
background: rgba(0, 0, 0, 0.
|
|
1288
|
-
backdrop-filter: blur(8px);
|
|
1289
|
-
-webkit-backdrop-filter: blur(8px);
|
|
1287
|
+
background: rgba(0, 0, 0, 0.8);
|
|
1290
1288
|
display: flex;
|
|
1291
1289
|
align-items: center;
|
|
1292
1290
|
justify-content: center;
|
|
1293
1291
|
z-index: 999999;
|
|
1294
1292
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
1295
1293
|
`;
|
|
1296
|
-
// Create modal card
|
|
1294
|
+
// Create modal card - square corners, shadow-xl style
|
|
1297
1295
|
const card = document.createElement('div');
|
|
1298
1296
|
card.style.cssText = `
|
|
1299
|
-
background:
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
padding: 32px;
|
|
1304
|
-
max-width: 400px;
|
|
1297
|
+
background: #fff;
|
|
1298
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
1299
|
+
padding: 24px;
|
|
1300
|
+
max-width: 320px;
|
|
1305
1301
|
width: 90%;
|
|
1306
|
-
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.
|
|
1302
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.05);
|
|
1307
1303
|
text-align: center;
|
|
1308
1304
|
`;
|
|
1309
|
-
//
|
|
1310
|
-
const iconContainer = document.createElement('div');
|
|
1311
|
-
iconContainer.style.cssText = `
|
|
1312
|
-
width: 56px;
|
|
1313
|
-
height: 56px;
|
|
1314
|
-
margin: 0 auto 16px;
|
|
1315
|
-
border-radius: 12px;
|
|
1316
|
-
overflow: hidden;
|
|
1317
|
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
1318
|
-
`;
|
|
1319
|
-
if (gameInfo.icon) {
|
|
1320
|
-
const icon = document.createElement('img');
|
|
1321
|
-
icon.src = gameInfo.icon;
|
|
1322
|
-
icon.alt = gameInfo.name;
|
|
1323
|
-
icon.style.cssText = 'width: 100%; height: 100%; object-fit: cover;';
|
|
1324
|
-
iconContainer.appendChild(icon);
|
|
1325
|
-
}
|
|
1326
|
-
else {
|
|
1327
|
-
// Default game icon
|
|
1328
|
-
iconContainer.style.cssText += `
|
|
1329
|
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
1330
|
-
display: flex;
|
|
1331
|
-
align-items: center;
|
|
1332
|
-
justify-content: center;
|
|
1333
|
-
color: white;
|
|
1334
|
-
font-size: 24px;
|
|
1335
|
-
`;
|
|
1336
|
-
iconContainer.textContent = '🎮';
|
|
1337
|
-
}
|
|
1338
|
-
card.appendChild(iconContainer);
|
|
1339
|
-
// Game name
|
|
1340
|
-
const gameName = document.createElement('h2');
|
|
1341
|
-
gameName.textContent = gameInfo.name;
|
|
1342
|
-
gameName.style.cssText = `
|
|
1343
|
-
margin: 0 0 8px;
|
|
1344
|
-
font-size: 20px;
|
|
1345
|
-
font-weight: 600;
|
|
1346
|
-
color: #1a1a1a;
|
|
1347
|
-
`;
|
|
1348
|
-
card.appendChild(gameName);
|
|
1349
|
-
// Subtitle
|
|
1305
|
+
// Subtitle / status text
|
|
1350
1306
|
const subtitle = document.createElement('p');
|
|
1351
1307
|
subtitle.id = 'playkit-modal-subtitle';
|
|
1352
1308
|
subtitle.textContent = this.t('loginWithPlayKit');
|
|
1353
1309
|
subtitle.style.cssText = `
|
|
1354
|
-
margin: 0 0
|
|
1310
|
+
margin: 0 0 20px;
|
|
1355
1311
|
font-size: 14px;
|
|
1356
1312
|
color: #666;
|
|
1357
1313
|
`;
|
|
@@ -1361,11 +1317,11 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1361
1317
|
spinner.id = 'playkit-modal-spinner';
|
|
1362
1318
|
spinner.style.cssText = `
|
|
1363
1319
|
display: none;
|
|
1364
|
-
width:
|
|
1365
|
-
height:
|
|
1320
|
+
width: 24px;
|
|
1321
|
+
height: 24px;
|
|
1366
1322
|
margin: 0 auto 16px;
|
|
1367
|
-
border:
|
|
1368
|
-
border-top-color: #
|
|
1323
|
+
border: 2px solid #e5e7eb;
|
|
1324
|
+
border-top-color: #171717;
|
|
1369
1325
|
border-radius: 50%;
|
|
1370
1326
|
animation: playkit-spin 1s linear infinite;
|
|
1371
1327
|
`;
|
|
@@ -1378,36 +1334,32 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1378
1334
|
}
|
|
1379
1335
|
`;
|
|
1380
1336
|
document.head.appendChild(style);
|
|
1381
|
-
// Login button
|
|
1337
|
+
// Login button - square corners, simple dark style
|
|
1382
1338
|
const loginBtn = document.createElement('button');
|
|
1383
1339
|
loginBtn.id = 'playkit-modal-login-btn';
|
|
1384
1340
|
loginBtn.textContent = this.t('loginToPlay');
|
|
1385
1341
|
loginBtn.style.cssText = `
|
|
1386
1342
|
width: 100%;
|
|
1387
|
-
padding:
|
|
1388
|
-
font-size:
|
|
1343
|
+
padding: 10px 16px;
|
|
1344
|
+
font-size: 14px;
|
|
1389
1345
|
font-weight: 500;
|
|
1390
1346
|
color: white;
|
|
1391
|
-
background:
|
|
1347
|
+
background: #171717;
|
|
1392
1348
|
border: none;
|
|
1393
|
-
border-radius: 8px;
|
|
1394
1349
|
cursor: pointer;
|
|
1395
|
-
transition:
|
|
1396
|
-
box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
|
|
1350
|
+
transition: background 0.2s ease;
|
|
1397
1351
|
`;
|
|
1398
1352
|
loginBtn.onmouseenter = () => {
|
|
1399
|
-
loginBtn.style.
|
|
1400
|
-
loginBtn.style.transform = 'translateY(-1px)';
|
|
1353
|
+
loginBtn.style.background = '#404040';
|
|
1401
1354
|
};
|
|
1402
1355
|
loginBtn.onmouseleave = () => {
|
|
1403
|
-
loginBtn.style.
|
|
1404
|
-
loginBtn.style.transform = 'translateY(0)';
|
|
1356
|
+
loginBtn.style.background = '#171717';
|
|
1405
1357
|
};
|
|
1406
1358
|
loginBtn.onmousedown = () => {
|
|
1407
|
-
loginBtn.style.
|
|
1359
|
+
loginBtn.style.background = '#0a0a0a';
|
|
1408
1360
|
};
|
|
1409
1361
|
loginBtn.onmouseup = () => {
|
|
1410
|
-
loginBtn.style.
|
|
1362
|
+
loginBtn.style.background = '#404040';
|
|
1411
1363
|
};
|
|
1412
1364
|
loginBtn.onclick = () => {
|
|
1413
1365
|
// Switch to waiting state
|
|
@@ -1418,29 +1370,30 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1418
1370
|
resolveClicked();
|
|
1419
1371
|
};
|
|
1420
1372
|
card.appendChild(loginBtn);
|
|
1421
|
-
// Cancel button (hidden initially)
|
|
1373
|
+
// Cancel button (hidden initially) - outline style
|
|
1422
1374
|
const cancelBtn = document.createElement('button');
|
|
1423
1375
|
cancelBtn.id = 'playkit-modal-cancel-btn';
|
|
1424
1376
|
cancelBtn.textContent = this.t('cancel');
|
|
1425
1377
|
cancelBtn.style.cssText = `
|
|
1426
1378
|
display: none;
|
|
1427
1379
|
width: 100%;
|
|
1428
|
-
margin-top:
|
|
1429
|
-
padding:
|
|
1430
|
-
font-size:
|
|
1380
|
+
margin-top: 8px;
|
|
1381
|
+
padding: 10px 16px;
|
|
1382
|
+
font-size: 14px;
|
|
1431
1383
|
font-weight: 500;
|
|
1432
1384
|
color: #666;
|
|
1433
|
-
background:
|
|
1434
|
-
border:
|
|
1435
|
-
border-radius: 8px;
|
|
1385
|
+
background: transparent;
|
|
1386
|
+
border: 1px solid #e5e7eb;
|
|
1436
1387
|
cursor: pointer;
|
|
1437
1388
|
transition: all 0.2s ease;
|
|
1438
1389
|
`;
|
|
1439
1390
|
cancelBtn.onmouseenter = () => {
|
|
1440
|
-
cancelBtn.style.background = '#
|
|
1391
|
+
cancelBtn.style.background = '#f5f5f5';
|
|
1392
|
+
cancelBtn.style.borderColor = '#d4d4d4';
|
|
1441
1393
|
};
|
|
1442
1394
|
cancelBtn.onmouseleave = () => {
|
|
1443
|
-
cancelBtn.style.background = '
|
|
1395
|
+
cancelBtn.style.background = 'transparent';
|
|
1396
|
+
cancelBtn.style.borderColor = '#e5e7eb';
|
|
1444
1397
|
};
|
|
1445
1398
|
cancelBtn.onclick = () => {
|
|
1446
1399
|
this.closeModal();
|
|
@@ -1467,7 +1420,7 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1467
1420
|
* @private
|
|
1468
1421
|
*/
|
|
1469
1422
|
showModalError(type, onClose) {
|
|
1470
|
-
var _a
|
|
1423
|
+
var _a;
|
|
1471
1424
|
if (!this.currentModal)
|
|
1472
1425
|
return;
|
|
1473
1426
|
const subtitle = this.currentModal.querySelector('#playkit-modal-subtitle');
|
|
@@ -1499,35 +1452,20 @@ class DeviceAuthFlowManager extends EventEmitter {
|
|
|
1499
1452
|
// Hide spinner
|
|
1500
1453
|
if (spinner)
|
|
1501
1454
|
spinner.style.display = 'none';
|
|
1502
|
-
// Create error icon
|
|
1503
|
-
const errorIcon = document.createElement('div');
|
|
1504
|
-
errorIcon.style.cssText = `
|
|
1505
|
-
width: 48px;
|
|
1506
|
-
height: 48px;
|
|
1507
|
-
margin: 0 auto 16px;
|
|
1508
|
-
border-radius: 50%;
|
|
1509
|
-
background: ${iconColor}15;
|
|
1510
|
-
display: flex;
|
|
1511
|
-
align-items: center;
|
|
1512
|
-
justify-content: center;
|
|
1513
|
-
font-size: 24px;
|
|
1514
|
-
`;
|
|
1515
|
-
errorIcon.textContent = type === 'expired' ? '⏱' : '✕';
|
|
1516
1455
|
// Create error title
|
|
1517
1456
|
const errorTitle = document.createElement('h3');
|
|
1518
1457
|
errorTitle.textContent = this.t(titleKey);
|
|
1519
1458
|
errorTitle.style.cssText = `
|
|
1520
1459
|
margin: 0 0 8px;
|
|
1521
|
-
font-size:
|
|
1460
|
+
font-size: 14px;
|
|
1522
1461
|
font-weight: 600;
|
|
1523
1462
|
color: ${iconColor};
|
|
1524
1463
|
`;
|
|
1525
1464
|
// Update subtitle with error description
|
|
1526
1465
|
subtitle.textContent = this.t(descKey);
|
|
1527
1466
|
subtitle.style.color = '#666';
|
|
1528
|
-
// Insert error
|
|
1529
|
-
(_a = subtitle.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(
|
|
1530
|
-
(_b = subtitle.parentNode) === null || _b === void 0 ? void 0 : _b.insertBefore(errorTitle, subtitle);
|
|
1467
|
+
// Insert error title before subtitle
|
|
1468
|
+
(_a = subtitle.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(errorTitle, subtitle);
|
|
1531
1469
|
// Update cancel button to close button
|
|
1532
1470
|
if (cancelBtn) {
|
|
1533
1471
|
cancelBtn.textContent = this.t('close');
|