codeplay-common 3.2.3 → 3.2.5

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.
@@ -363,10 +363,33 @@ Code: ${line.trim()}
363
363
  👉 Remove:
364
364
  import { showSubscribePopup } from './../js/Ads/IAP-x.x/IAP-check-And-LoadAd.js'
365
365
 
366
+
366
367
  ✅ Use dynamic import (ANY version allowed):
367
368
 
368
- const { showSubscribePopup } = await import('./../js/Ads/IAP-x.x/IAP-check-And-LoadAd.js');
369
- showSubscribePopup();
369
+ let IAPModule = null;
370
+ const loadIAP = async () => {
371
+ if (!IAPModule) {
372
+ IAPModule = await import('./../js/Ads/IAP-x.x/IAP-check-And-LoadAd.js');
373
+ IAPModule.initIAP?.();
374
+ }
375
+
376
+ return IAPModule;
377
+ };
378
+
379
+ $on('pageAfterIn', async () => {
380
+ await loadIAP();
381
+ });
382
+
383
+ const subscribeOrProLink = async () => {
384
+
385
+ //This is only allowed if samsung have pro version
386
+ if(_storeid==2)
387
+ buyProMethod()
388
+ else{
389
+ const module = await loadIAP();
390
+ module.showSubscribePopup();
391
+ }
392
+ };
370
393
  `);
371
394
  subscribeImportError = true;
372
395
  }
@@ -514,18 +537,18 @@ Required:
514
537
 
515
538
  if (invalidConfigs.length > 0) {
516
539
  console.error(`
517
- ❌ INVALID CONFIGURATION LOCATION
540
+ ❌ INVALID CONFIGURATION LOCATION
518
541
 
519
- đŸšĢ configuration.json must NOT be inside version folders.
542
+ đŸšĢ configuration.json must NOT be inside version folders.
520
543
 
521
- Found:
522
- ${invalidConfigs.map(p => " - " + p).join("\n")}
544
+ Found:
545
+ ${invalidConfigs.map(p => " - " + p).join("\n")}
523
546
 
524
- ✅ Correct:
525
- src/js/editor/configuration.json
547
+ ✅ Correct:
548
+ src/js/editor/configuration.json
526
549
 
527
- ❌ Build stopped.
528
- `);
550
+ ❌ Build stopped.
551
+ `);
529
552
  process.exit(1);
530
553
  }
531
554
 
@@ -1956,7 +1979,7 @@ ${oldLocalizationFiles.map(f => " - " + f).join("\n")}
1956
1979
 
1957
1980
  if (fs.existsSync(localizationBaseDir)) {
1958
1981
 
1959
- // ❌ Block localization-x.x.js directly inside localization folder
1982
+ // ❌ Block wrong files
1960
1983
  const invalidFiles = fs.readdirSync(localizationBaseDir)
1961
1984
  .filter(name => /^localization-\d+(\.\d+)*\.js$/.test(name));
1962
1985
 
@@ -1970,10 +1993,6 @@ if (fs.existsSync(localizationBaseDir)) {
1970
1993
  đŸ“Ļ Found:
1971
1994
  ${invalidFiles.map(f => " - " + f).join("\n")}
1972
1995
 
1973
- ✅ Move it to:
1974
-
1975
- src/js/localization/localization-x.x/localization-x.x.js
1976
-
1977
1996
  ❌ Build stopped.
1978
1997
  `);
1979
1998
  process.exit(1);
@@ -1982,7 +2001,62 @@ ${invalidFiles.map(f => " - " + f).join("\n")}
1982
2001
  // 🔍 Find localization-x.x folders
1983
2002
  const localizationVersions = fs.readdirSync(localizationBaseDir)
1984
2003
  .filter(name => /^localization-\d+(\.\d+)+$/.test(name));
1985
- } else {
2004
+
2005
+ if (localizationVersions.length === 0) {
2006
+ console.log("â„šī¸ No localization-x.x folder found. Skipping...");
2007
+ } else {
2008
+
2009
+ // ✅ Get latest version (same logic as editor)
2010
+ const latestLocalizationDir = localizationVersions.sort((a, b) => {
2011
+ const vA = parseFloat(a.split('-')[1]);
2012
+ const vB = parseFloat(b.split('-')[1]);
2013
+ return vB - vA;
2014
+ })[0];
2015
+
2016
+ const localizationPath = path.join(localizationBaseDir, latestLocalizationDir);
2017
+
2018
+ // ======================================================
2019
+ // ✅ CHECK localization-x.x.js exists
2020
+ // ======================================================
2021
+
2022
+ const version = latestLocalizationDir.split('-')[1];
2023
+ const expectedFile = `localization-${version}.js`;
2024
+ const localizationFilePath = path.join(localizationPath, expectedFile);
2025
+
2026
+ if (!fs.existsSync(localizationFilePath)) {
2027
+ console.error(`
2028
+ ❌ localization file missing
2029
+
2030
+ Expected:
2031
+ ${localizationFilePath}
2032
+
2033
+ ❌ Build stopped.
2034
+ `);
2035
+ process.exit(1);
2036
+ }
2037
+
2038
+ // ======================================================
2039
+ // ✅ CHECK run.js exists
2040
+ // ======================================================
2041
+
2042
+ const runJsPath = path.join(localizationPath, "run.js");
2043
+
2044
+ if (!fs.existsSync(runJsPath)) {
2045
+ console.error(`❌ run.js not found in ${latestLocalizationDir}`);
2046
+ process.exit(1);
2047
+ }
2048
+
2049
+ // ======================================================
2050
+ // 🚀 EXECUTE run.js
2051
+ // ======================================================
2052
+
2053
+ console.log(`🌐 Localization detected: ${latestLocalizationDir}`);
2054
+ console.log(`🚀 Executing ${runJsPath}...`);
2055
+
2056
+ execSync(`node "${runJsPath}"`, { stdio: "inherit" });
2057
+ }
2058
+
2059
+ } else {
1986
2060
  console.log("â„šī¸ Localization not used in this project. Skipping...");
1987
2061
  }
1988
2062
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.3",
3
+ "version": "3.2.5",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",