codeplay-common 4.3.5 → 4.3.6

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.
@@ -28,26 +28,31 @@ const deviceProfiles = [
28
28
  deviceScaleFactor: 3,
29
29
  orientationSensitive: true,
30
30
  mobile: true,
31
- },
31
+ },
32
32
  {
33
- name: 'android-tablet',
34
- label: 'Android tablet',
35
- outputDirectory: 'Android-Tab',
36
- frameType: 'tablet',
37
- width: 800,
38
- height: 1280,
33
+ name: 'android-tablet-7-inch',
34
+ aliases: ['android-tablet'],
35
+ label: 'Android 7-inch Play Store tablet',
36
+ outputDirectory: 'Android-Tab-7inch',
37
+ frameType: 'tablet',
38
+ width: 675,
39
+ height: 1200,
39
40
  deviceScaleFactor: 2,
41
+ framedWidth: 1350,
42
+ framedHeight: 2400,
40
43
  orientationSensitive: true,
41
44
  mobile: true,
42
45
  },
43
46
  {
44
47
  name: 'android-tablet-10-inch',
45
48
  label: 'Android 10-inch Play Store tablet',
46
- outputDirectory: 'Android-Tab-10-Inch',
49
+ outputDirectory: 'Android-Tab-10inch',
47
50
  frameType: 'tablet',
48
- width: 720,
49
- height: 1280,
51
+ width: 900,
52
+ height: 1600,
50
53
  deviceScaleFactor: 2,
54
+ framedWidth: 1800,
55
+ framedHeight: 3200,
51
56
  orientationSensitive: true,
52
57
  mobile: true,
53
58
  },
@@ -157,12 +162,14 @@ const deviceProfiles = [
157
162
  },
158
163
  {
159
164
  name: 'chromebook',
160
- label: 'Chromebook Play Store viewport',
165
+ label: 'Chromebook 4K Play Store viewport',
161
166
  outputDirectory: 'Chromebook',
162
167
  frameType: 'laptop',
163
168
  width: 1920,
164
169
  height: 1080,
165
- deviceScaleFactor: 1,
170
+ deviceScaleFactor: 2,
171
+ framedWidth: 3840,
172
+ framedHeight: 2160,
166
173
  mobile: false,
167
174
  },
168
175
  {
@@ -437,7 +444,9 @@ function selectProfiles(input) {
437
444
  }
438
445
 
439
446
  const selectedProfiles = names.map((name) => {
440
- const profile = deviceProfiles.find((candidate) => candidate.name === name);
447
+ const profile = deviceProfiles.find((candidate) => (
448
+ candidate.name === name || candidate.aliases?.includes(name)
449
+ ));
441
450
 
442
451
  if (!profile) {
443
452
  throw new Error(`Unknown profile: ${name}. Run with --list to see valid profiles.`);
@@ -1148,17 +1157,147 @@ function escapeHtml(value) {
1148
1157
  .replace(/'/g, ''');
1149
1158
  }
1150
1159
 
1151
- function createAmazonAssetHtml(asset, appName, iconBuffer) {
1160
+ function cleanAssetCopy(value, maximumLength, fallback = '') {
1161
+ const cleaned = String(value || '')
1162
+ .replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, ' ')
1163
+ .replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, ' ')
1164
+ .replace(/<[^>]+>/g, ' ')
1165
+ .replace(/&[a-zA-Z#0-9]+;/g, ' ')
1166
+ .replace(/[_|]+/g, ' ')
1167
+ .replace(/\s+/g, ' ')
1168
+ .trim();
1169
+ if (!cleaned) return fallback;
1170
+ if (cleaned.length <= maximumLength) return cleaned;
1171
+ const shortened = cleaned.slice(0, maximumLength + 1);
1172
+ const lastSpace = shortened.lastIndexOf(' ');
1173
+ return shortened.slice(0, lastSpace > maximumLength * 0.55 ? lastSpace : maximumLength).trim();
1174
+ }
1175
+
1176
+ function readJsonAssetSource(filePath) {
1177
+ try {
1178
+ return JSON.parse(fs.readFileSync(filePath, 'utf8'));
1179
+ } catch {
1180
+ return {};
1181
+ }
1182
+ }
1183
+
1184
+ function collectProjectUiPhrases() {
1185
+ const phrases = [];
1186
+ const pageDirectory = path.join(__dirname, 'src', 'pages');
1187
+ if (fs.existsSync(pageDirectory)) {
1188
+ const pageFiles = fs.readdirSync(pageDirectory)
1189
+ .filter((fileName) => /\.(?:f7|html)$/i.test(fileName))
1190
+ .sort()
1191
+ .slice(0, 40);
1192
+ const visibleElementPattern = /<(?:h[1-4]|button|label|option|a|li)\b[^>]*>([\s\S]*?)<\/(?:h[1-4]|button|label|option|a|li)>/gi;
1193
+ for (const fileName of pageFiles) {
1194
+ const source = fs.readFileSync(path.join(pageDirectory, fileName), 'utf8');
1195
+ let match;
1196
+ while ((match = visibleElementPattern.exec(source)) && phrases.length < 120) {
1197
+ const phrase = cleanAssetCopy(match[1], 52);
1198
+ if (phrase) phrases.push(phrase);
1199
+ }
1200
+ }
1201
+ }
1202
+ return phrases;
1203
+ }
1204
+
1205
+ function getStoreAssetCopy(config) {
1206
+ const configuredAppName = cleanAssetCopy(config.appName, 40, 'App');
1207
+ const appUniqueId = String(config.android?.APP_UNIQUE_ID ?? '').trim();
1208
+ const promoCopyPath = appUniqueId
1209
+ ? path.join(
1210
+ __dirname,
1211
+ 'Auto-AI-Video',
1212
+ `${appUniqueId}. ${sanitizeName(configuredAppName, 'App')}-promo-copy.json`,
1213
+ )
1214
+ : '';
1215
+ const promoCopy = promoCopyPath && fs.existsSync(promoCopyPath)
1216
+ ? readJsonAssetSource(promoCopyPath).copy || {}
1217
+ : {};
1218
+ const scenes = Array.isArray(promoCopy.scenes) ? promoCopy.scenes : [];
1219
+ const footerKeywords = Array.isArray(promoCopy.footer_keywords)
1220
+ ? promoCopy.footer_keywords
1221
+ : [];
1222
+ const manifestCandidates = [
1223
+ path.join(__dirname, 'src', 'manifest.webmanifest'),
1224
+ path.join(__dirname, 'public', 'manifest.webmanifest'),
1225
+ path.join(__dirname, 'manifest.webmanifest'),
1226
+ ];
1227
+ const manifestPath = manifestCandidates.find((candidate) => fs.existsSync(candidate));
1228
+ const manifest = manifestPath ? readJsonAssetSource(manifestPath) : {};
1229
+ const candidates = [
1230
+ ...footerKeywords,
1231
+ ...scenes.flatMap((scene) => [
1232
+ `${scene.title_line_1 || ''} ${scene.title_line_2 || ''}`,
1233
+ scene.kicker,
1234
+ scene.body,
1235
+ ]),
1236
+ ...(Array.isArray(manifest.categories) ? manifest.categories : []),
1237
+ manifest.description,
1238
+ ...collectProjectUiPhrases(),
1239
+ ];
1240
+ const uniquePhrases = [];
1241
+ const seen = new Set([configuredAppName.toLowerCase()]);
1242
+ for (const candidate of candidates) {
1243
+ const phrase = cleanAssetCopy(candidate, 52);
1244
+ const key = phrase.toLowerCase();
1245
+ if (phrase.length < 3 || seen.has(key)) continue;
1246
+ seen.add(key);
1247
+ uniquePhrases.push(phrase);
1248
+ }
1249
+
1250
+ const featureLabels = uniquePhrases
1251
+ .map((phrase) => cleanAssetCopy(phrase, 18))
1252
+ .filter((phrase, index, values) => (
1253
+ phrase.length >= 3
1254
+ && values.findIndex((value) => value.toLowerCase() === phrase.toLowerCase()) === index
1255
+ ))
1256
+ .slice(0, 9);
1257
+ while (featureLabels.length < 9) {
1258
+ featureLabels.push(`Feature ${String(featureLabels.length + 1).padStart(2, '0')}`);
1259
+ }
1260
+
1261
+ const firstScene = scenes[0] || {};
1262
+ const firstSceneTitle = cleanAssetCopy(
1263
+ `${firstScene.title_line_1 || ''} ${firstScene.title_line_2 || ''}`,
1264
+ 34,
1265
+ );
1266
+ const primaryPhrase = footerKeywords[0] || featureLabels[0];
1267
+ return {
1268
+ amazonEyebrow: cleanAssetCopy(primaryPhrase, 32, `Explore ${configuredAppName}`),
1269
+ amazonCallout: cleanAssetCopy(
1270
+ firstScene.body || manifest.description || uniquePhrases[0],
1271
+ 52,
1272
+ `Explore ${configuredAppName}`,
1273
+ ),
1274
+ featureLabels,
1275
+ samsungKicker: cleanAssetCopy(firstScene.kicker || primaryPhrase, 28, 'App features'),
1276
+ samsungAction: firstSceneTitle || cleanAssetCopy(primaryPhrase, 34, `Open ${configuredAppName}`),
1277
+ samsungBody: cleanAssetCopy(
1278
+ firstScene.body || manifest.description || uniquePhrases[1],
1279
+ 52,
1280
+ 'Explore the available features',
1281
+ ),
1282
+ };
1283
+ }
1284
+
1285
+ function createAmazonAssetHtml(asset, appName, iconBuffer, storeCopy) {
1152
1286
  const iconDataUrl = `data:image/png;base64,${iconBuffer.toString('base64')}`;
1153
1287
  const safeAppName = escapeHtml(appName);
1288
+ const safeEyebrow = escapeHtml(storeCopy.amazonEyebrow);
1289
+ const safeCallout = escapeHtml(storeCopy.amazonCallout);
1290
+ const featureMarkup = storeCopy.featureLabels.slice(0, 6)
1291
+ .map((label) => `<span>${escapeHtml(label)}</span>`)
1292
+ .join('');
1154
1293
  const logoMarkup = asset.type === 'featured-logo'
1155
- ? `<main class="featured-logo"><img src="${iconDataUrl}" /><div><small>POCKET RHYTHM STUDIO</small><strong>${safeAppName}</strong></div></main>`
1294
+ ? `<main class="featured-logo"><img src="${iconDataUrl}" /><div><small>${safeEyebrow}</small><strong>${safeAppName}</strong></div></main>`
1156
1295
  : '';
1157
1296
  const iconMarkup = asset.type === 'icon'
1158
- ? `<main class="icon-card"><img src="${iconDataUrl}" /><div><small>MAKE THE NEXT BEAT YOURS</small><strong>${safeAppName}</strong></div></main>`
1297
+ ? `<main class="icon-card"><img src="${iconDataUrl}" /><div><small>${safeCallout}</small><strong>${safeAppName}</strong></div></main>`
1159
1298
  : '';
1160
1299
  const backgroundMarkup = asset.type.includes('background')
1161
- ? '<main class="background-art"><div class="pulse pulse-one"></div><div class="pulse pulse-two"></div><div class="equalizer"><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div><div class="pad-grid"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div></main>'
1300
+ ? `<main class="background-art"><div class="pulse pulse-one"></div><div class="pulse pulse-two"></div><div class="feature-grid">${featureMarkup}</div></main>`
1162
1301
  : '';
1163
1302
 
1164
1303
  return `<!doctype html>
@@ -1257,45 +1396,35 @@ function createAmazonAssetHtml(asset, appName, iconBuffer) {
1257
1396
  }
1258
1397
  .pulse-one { width: 520px; height: 520px; top: -180px; left: -110px; }
1259
1398
  .pulse-two { width: 620px; height: 620px; right: -180px; bottom: -310px; border-color: rgba(201,255,65,0.22); }
1260
- .equalizer {
1399
+ .feature-grid {
1261
1400
  position: absolute;
1262
1401
  left: 8%;
1263
- top: 50%;
1264
- display: flex;
1265
- align-items: center;
1266
- gap: 20px;
1267
- height: 44%;
1268
- transform: translateY(-50%);
1269
- }
1270
- .equalizer i { width: 18px; border-radius: 999px; background: #35d4eb; box-shadow: 0 0 25px rgba(53,212,235,0.5); }
1271
- .equalizer i:nth-child(1), .equalizer i:nth-child(7) { height: 28%; }
1272
- .equalizer i:nth-child(2), .equalizer i:nth-child(6) { height: 52%; background: #ff5964; }
1273
- .equalizer i:nth-child(3), .equalizer i:nth-child(5) { height: 76%; background: #ff9f43; }
1274
- .equalizer i:nth-child(4) { height: 100%; background: #c9ff41; }
1275
- .pad-grid {
1276
- position: absolute;
1277
- right: 7%;
1402
+ right: 8%;
1278
1403
  top: 50%;
1279
1404
  display: grid;
1280
- width: 46%;
1281
- height: 64%;
1282
- grid-template-columns: repeat(3, 1fr);
1283
- gap: 20px;
1284
- transform: translateY(-50%) perspective(900px) rotateY(-10deg) rotateX(5deg);
1405
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1406
+ gap: 24px;
1407
+ transform: translateY(-50%);
1285
1408
  }
1286
- .pad-grid i {
1409
+ .feature-grid span {
1410
+ display: flex;
1411
+ min-height: 108px;
1412
+ align-items: center;
1413
+ justify-content: center;
1414
+ padding: 20px;
1415
+ color: #f8fbff;
1287
1416
  border: 2px solid rgba(255,255,255,0.17);
1288
- border-top: 7px solid #35d4eb;
1289
1417
  border-radius: 22px;
1290
1418
  background: linear-gradient(145deg, rgba(42,55,75,0.96), rgba(11,18,29,0.96));
1291
1419
  box-shadow: 0 20px 28px rgba(0,0,0,0.28);
1420
+ font-size: clamp(20px, 2vw, 34px);
1421
+ font-weight: 700;
1422
+ text-align: center;
1292
1423
  }
1293
- .pad-grid i:nth-child(2), .pad-grid i:nth-child(6) { border-top-color: #ff9f43; }
1294
- .pad-grid i:nth-child(3), .pad-grid i:nth-child(7) { border-top-color: #c9ff41; }
1295
- .pad-grid i:nth-child(4), .pad-grid i:nth-child(8) { border-top-color: #ff5964; }
1296
- .pad-grid i:nth-child(5) { border-top-color: #ac7cff; }
1297
- body.featured-background .pad-grid { width: 49%; height: 72%; }
1298
- body.featured-background .equalizer { height: 52%; }
1424
+ .feature-grid span:nth-child(3n+1) { border-top: 7px solid #35d4eb; }
1425
+ .feature-grid span:nth-child(3n+2) { border-top: 7px solid #ff9f43; }
1426
+ .feature-grid span:nth-child(3n) { border-top: 7px solid #c9ff41; }
1427
+ body.featured-background .feature-grid { left: 5%; right: 5%; gap: 18px; }
1299
1428
  </style>
1300
1429
  </head>
1301
1430
  <body class="${asset.type}">
@@ -1313,6 +1442,7 @@ async function createAmazonAssets(client) {
1313
1442
 
1314
1443
  const config = JSON.parse(fs.readFileSync(capacitorConfigPath, 'utf8'));
1315
1444
  const appName = config.appName || 'App';
1445
+ const storeCopy = getStoreAssetCopy(config);
1316
1446
  const iconBuffer = fs.readFileSync(amazonIconPath);
1317
1447
  const assets = [
1318
1448
  { fileName: 'icon-1280x720.png', type: 'icon', width: 1280, height: 720 },
@@ -1338,7 +1468,7 @@ async function createAmazonAssets(client) {
1338
1468
  const frameTree = await client.send('Page.getFrameTree');
1339
1469
  await client.send('Page.setDocumentContent', {
1340
1470
  frameId: frameTree.frameTree.frame.id,
1341
- html: createAmazonAssetHtml(asset, appName, iconBuffer),
1471
+ html: createAmazonAssetHtml(asset, appName, iconBuffer, storeCopy),
1342
1472
  });
1343
1473
  await client.send('Runtime.evaluate', {
1344
1474
  expression: `Promise.all([...document.images].map((image) => image.complete
@@ -1363,15 +1493,18 @@ async function createAmazonAssets(client) {
1363
1493
  }
1364
1494
  }
1365
1495
 
1366
- function createSamsungAssetHtml(asset, appName, iconBuffer) {
1496
+ function createSamsungAssetHtml(asset, appName, iconBuffer, storeCopy) {
1367
1497
  const iconDataUrl = `data:image/png;base64,${iconBuffer.toString('base64')}`;
1368
1498
  const safeAppName = escapeHtml(appName);
1369
- const pads = Array.from({ length: 9 }, (_, index) => (
1370
- `<button><i>0${index + 1}</i><span>${['OPEN', 'CLOSED', 'HIGH', 'CRASH', 'KICK', 'MID', 'RIDE', 'SNARE', 'FLOOR'][index]}</span></button>`
1499
+ const featureButtons = storeCopy.featureLabels.map((label, index) => (
1500
+ `<button><i>0${index + 1}</i><span>${escapeHtml(label.toUpperCase())}</span></button>`
1371
1501
  )).join('');
1502
+ const safeKicker = escapeHtml(storeCopy.samsungKicker.toUpperCase());
1503
+ const safeAction = escapeHtml(storeCopy.samsungAction.toUpperCase());
1504
+ const safeBody = escapeHtml(storeCopy.samsungBody);
1372
1505
  const content = asset.type === 'edge-screen'
1373
- ? `<main class="edge-panel"><header><img src="${iconDataUrl}" /><strong>${safeAppName}</strong></header><section>${pads}</section></main>`
1374
- : `<main class="single-panel"><header><img src="${iconDataUrl}" /><div><small>POCKET RHYTHM</small><strong>${safeAppName}</strong></div></header><div class="single-action"><span>+</span><strong>OPEN STUDIO</strong><small>Tap to start playing</small></div><div class="rhythm"><i></i><i></i><i></i><i></i><i></i></div></main>`;
1506
+ ? `<main class="edge-panel"><header><img src="${iconDataUrl}" /><strong>${safeAppName}</strong></header><section>${featureButtons}</section></main>`
1507
+ : `<main class="single-panel"><header><img src="${iconDataUrl}" /><div><small>${safeKicker}</small><strong>${safeAppName}</strong></div></header><div class="single-action"><span>+</span><strong>${safeAction}</strong><small>${safeBody}</small></div><div class="accent-bars"><i></i><i></i><i></i><i></i><i></i></div></main>`;
1375
1508
 
1376
1509
  return `<!doctype html>
1377
1510
  <html>
@@ -1455,10 +1588,10 @@ function createSamsungAssetHtml(asset, appName, iconBuffer) {
1455
1588
  }
1456
1589
  .single-action strong { margin-top: 65px; font-size: 42px; letter-spacing: 5px; }
1457
1590
  .single-action small { margin-top: 18px; color: #a9b7c9; font-size: 24px; }
1458
- .rhythm { display: flex; align-items: center; gap: 18px; height: 300px; margin-top: auto; }
1459
- .rhythm i { width: 14px; height: 70px; border-radius: 999px; background: #35d4eb; }
1460
- .rhythm i:nth-child(2), .rhythm i:nth-child(4) { height: 140px; background: #ff5964; }
1461
- .rhythm i:nth-child(3) { height: 210px; background: #c9ff41; }
1591
+ .accent-bars { display: flex; align-items: center; gap: 18px; height: 300px; margin-top: auto; }
1592
+ .accent-bars i { width: 14px; height: 70px; border-radius: 999px; background: #35d4eb; }
1593
+ .accent-bars i:nth-child(2), .accent-bars i:nth-child(4) { height: 140px; background: #ff5964; }
1594
+ .accent-bars i:nth-child(3) { height: 210px; background: #c9ff41; }
1462
1595
  </style>
1463
1596
  </head>
1464
1597
  <body>${content}</body>
@@ -1472,6 +1605,7 @@ async function createSamsungAssets(client) {
1472
1605
 
1473
1606
  const config = JSON.parse(fs.readFileSync(capacitorConfigPath, 'utf8'));
1474
1607
  const appName = config.appName || 'App';
1608
+ const storeCopy = getStoreAssetCopy(config);
1475
1609
  const iconBuffer = fs.readFileSync(amazonIconPath);
1476
1610
  const assets = [
1477
1611
  { fileName: 'edge-screen-160x2560.png', type: 'edge-screen', width: 160, height: 2560 },
@@ -1495,7 +1629,7 @@ async function createSamsungAssets(client) {
1495
1629
  const frameTree = await client.send('Page.getFrameTree');
1496
1630
  await client.send('Page.setDocumentContent', {
1497
1631
  frameId: frameTree.frameTree.frame.id,
1498
- html: createSamsungAssetHtml(asset, appName, iconBuffer),
1632
+ html: createSamsungAssetHtml(asset, appName, iconBuffer, storeCopy),
1499
1633
  });
1500
1634
  await client.send('Runtime.evaluate', {
1501
1635
  expression: `Promise.all([...document.images].map((image) => image.complete
@@ -4,7 +4,7 @@
4
4
  //--duration 0 //30,120 (0 is used "Enter" key to stop)
5
5
  //--countdown 0//0,5,10
6
6
  //--name test-name
7
- //--profiles youtube,non-spatial-xr,samsung,amazon
7
+ //--profiles youtube,non-spatial-xr,amazon
8
8
 
9
9
 
10
10
 
@@ -40,15 +40,6 @@ const videoProfiles = {
40
40
  videoBitrate: '12M',
41
41
  h264Level: '5.1',
42
42
  },
43
- samsung: {
44
- label: 'Samsung Galaxy Store YouTube preview',
45
- directory: 'Samsung',
46
- fileSuffix: 'samsung',
47
- width: 1920,
48
- height: 1080,
49
- videoBitrate: '8M',
50
- h264Level: '4.2',
51
- },
52
43
  amazon: {
53
44
  label: 'Amazon Appstore',
54
45
  directory: 'Amazon',
@@ -170,7 +161,7 @@ function parseArguments() {
170
161
  input: '',
171
162
  list: false,
172
163
  name: '',
173
- profiles: 'youtube,non-spatial-xr,samsung,amazon',
164
+ profiles: 'youtube,non-spatial-xr,amazon',
174
165
  spatialInput: '',
175
166
  };
176
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "4.3.5",
3
+ "version": "4.3.6",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",