codeplay-common 3.2.2 → 3.2.4

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-3.1/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
 
@@ -568,231 +591,6 @@ else {
568
591
 
569
592
 
570
593
 
571
- const localizationBaseDir = path.join(__dirname, "..", "src", "js", "localization");
572
-
573
- // ======================================================
574
- // 🌐 LOCALIZATION CHECK (FULLY DYNAMIC)
575
- // ======================================================
576
-
577
-
578
- const jsRootDir = path.join(__dirname, "..", "src", "js");
579
-
580
- // 🔍 Detect OLD localization files in root js/
581
- const oldLocalizationFiles = fs.readdirSync(jsRootDir)
582
- .filter(name =>
583
- /^localization-\d+(\.\d+)*\.js$/.test(name) ||
584
- /^localization_settings-\d+(\.\d+)*\.js$/.test(name)
585
- );
586
-
587
- // ❌ If old structure found → STOP
588
- if (oldLocalizationFiles.length > 0) {
589
-
590
- console.error(`
591
- ❌ OLD LOCALIZATION STRUCTURE DETECTED
592
-
593
- You are using outdated file structure:
594
- src/js/localization-x.x.js
595
- src/js/localization_settings-x.x.js
596
-
597
- 🚨 This is no longer supported.
598
-
599
- đŸ“Ļ Found files:
600
- ${oldLocalizationFiles.map(f => " - " + f).join("\n")}
601
-
602
- 👉 Please move them to new structure:
603
-
604
- src/js/localization/localization_settings-x.x.js
605
- src/js/localization/localization-x.x/
606
-
607
- âš ī¸ Example:
608
-
609
- OLD:
610
- src/js/localization-x.x.js
611
- src/js/localization_settings-x.x.js
612
-
613
- NEW:
614
- src/js/localization/localization_settings-1.1.js
615
- src/js/localization/localization-x.x/localization-x.x.js
616
-
617
- ❌ Build stopped.
618
- `);
619
-
620
- process.exit(1);
621
- }
622
-
623
-
624
- if (fs.existsSync(localizationBaseDir)) {
625
-
626
- // 🔍 Find localization-x.x folders
627
- const localizationVersions = fs.readdirSync(localizationBaseDir)
628
- .filter(name => /^localization-\d+(\.\d+)+$/.test(name));
629
-
630
- if (localizationVersions.length === 0) {
631
- console.log("â„šī¸ No localization-x.x folder found. Skipping...");
632
- } else {
633
-
634
- // đŸ”Ĩ Get latest version (supports 1.6, 1.6.1, etc.)
635
- const latestLocalizationDir = localizationVersions.sort((a, b) => {
636
- const vA = a.split('-')[1].split('.').map(Number);
637
- const vB = b.split('-')[1].split('.').map(Number);
638
-
639
- for (let i = 0; i < Math.max(vA.length, vB.length); i++) {
640
- const diff = (vB[i] || 0) - (vA[i] || 0);
641
- if (diff !== 0) return diff;
642
- }
643
- return 0;
644
- })[0];
645
-
646
- const localizationPath = path.join(localizationBaseDir, latestLocalizationDir);
647
-
648
- // ======================================================
649
- // 🔍 Find settings file dynamically
650
- // ======================================================
651
-
652
- const settingsFile = fs.readdirSync(localizationBaseDir)
653
- .find(name => /^localization_settings-.*\.js$/.test(name));
654
-
655
- if (!settingsFile) {
656
- console.error(`
657
- ❌ MISSING LOCALIZATION SETTINGS FILE
658
-
659
- Expected:
660
- src/js/localization/localization_settings-x.x.js
661
-
662
- ❌ Build stopped.
663
- `);
664
- process.exit(1);
665
- }
666
-
667
- // ======================================================
668
- // 🔍 Find run.js INSIDE version folder
669
- // ======================================================
670
-
671
- const runJsPath = path.join(localizationPath, "run.js");
672
-
673
- if (!fs.existsSync(runJsPath)) {
674
- console.error(`
675
- ❌ LOCALIZATION run.js NOT FOUND
676
-
677
- Expected:
678
- ${runJsPath}
679
-
680
- ❌ Build stopped.
681
- `);
682
- process.exit(1);
683
- }
684
-
685
- console.log(`🌐 Localization detected: ${latestLocalizationDir}`);
686
- console.log(`âš™ī¸ Using settings: ${settingsFile}`);
687
- console.log(`🚀 Executing: ${runJsPath}`);
688
-
689
- // ======================================================
690
- // 🚀 Execute run.js
691
- // ======================================================
692
-
693
- execSync(`node "${runJsPath}"`, { stdio: "inherit" });
694
- }
695
-
696
- } else {
697
- console.log("â„šī¸ Localization not used in this project. Skipping...");
698
- }
699
-
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
- //editor-x.x import old style check and stop execution START
719
-
720
-
721
-
722
- // Match: editor/editor-2.3, editor/editor-2.3.1, etc.
723
- const FORBIDDEN_REGEX = /editor\/editor-\d+(\.\d+)+/;
724
-
725
- let hasError = false;
726
-
727
- const ERROR_MESSAGE = `const ERROR_MESSAGE = ❌ Invalid import detected!
728
-
729
- You are using a direct version-based path like: editor/editor-x.x/editor.js
730
-
731
- đŸšĢ This is NOT allowed.
732
-
733
- 👉 Please use the proper alias or updated import method.
734
- Example: import { ... } from '@editor'
735
-
736
- âš ī¸ Do not use version-based paths in imports.
737
- 👉 Please add this manually in vite.config.js:
738
-
739
- alias: {
740
- '@editor': path.resolve(__dirname, './src/js/editor/editor-x.x')
741
- }`
742
-
743
- function scanDir(dir) {
744
- const files = fs.readdirSync(dir);
745
-
746
- for (const file of files) {
747
- const fullPath = path.join(dir, file);
748
- const stat = fs.statSync(fullPath);
749
-
750
- if (stat.isDirectory()) {
751
- scanDir(fullPath);
752
- } else if (file.endsWith(".js") || file.endsWith(".ts") || file.endsWith(".f7")) {
753
- const content = fs.readFileSync(fullPath, "utf-8");
754
-
755
- const lines = content.split("\n");
756
-
757
- lines.forEach((line, index) => {
758
- if (FORBIDDEN_REGEX.test(line)) {
759
- console.error(
760
- `❌ Forbidden import found:\nFile: ${fullPath}\nLine: ${index + 1}\nCode: ${line.trim()}\n`,
761
- ERROR_MESSAGE
762
- );
763
- hasError = true;
764
- }
765
- });
766
- }
767
- }
768
- }
769
-
770
- // Run scan
771
- scanDir(ROOT_DIR);
772
-
773
- // Throw error (exit process)
774
- if (hasError) {
775
- console.error("đŸšĢ Build failed due to forbidden editor imports.");
776
- process.exit(1);
777
- } else {
778
- console.log("✅ No forbidden imports found.");
779
- }
780
-
781
-
782
-
783
-
784
-
785
-
786
- //editor-x.x import old style check and stop execution START
787
-
788
-
789
-
790
-
791
-
792
-
793
-
794
-
795
-
796
594
 
797
595
  // saveToGalleryAndSaveAnyFile-x.x-ios.js file check for android and return error if exists START
798
596
 
@@ -2122,6 +1920,243 @@ if (hasMandatoryUpdate) {
2122
1920
 
2123
1921
 
2124
1922
 
1923
+
1924
+
1925
+ const localizationBaseDir = path.join(__dirname, "..", "src", "js", "localization");
1926
+
1927
+ // ======================================================
1928
+ // 🌐 LOCALIZATION CHECK (FULLY DYNAMIC)
1929
+ // ======================================================
1930
+
1931
+
1932
+ const jsRootDir = path.join(__dirname, "..", "src", "js");
1933
+
1934
+ // 🔍 Detect OLD localization files in root js/
1935
+ const oldLocalizationFiles = fs.readdirSync(jsRootDir)
1936
+ .filter(name =>
1937
+ /^localization-\d+(\.\d+)*\.js$/.test(name) ||
1938
+ /^localization_settings-\d+(\.\d+)*\.js$/.test(name)
1939
+ );
1940
+
1941
+ // ❌ If old structure found → STOP
1942
+ if (oldLocalizationFiles.length > 0) {
1943
+
1944
+ console.error(`
1945
+ ❌ OLD LOCALIZATION STRUCTURE DETECTED
1946
+
1947
+ You are using outdated file structure:
1948
+ src/js/localization-x.x.js
1949
+ src/js/localization_settings-x.x.js
1950
+
1951
+ 🚨 This is no longer supported.
1952
+
1953
+ đŸ“Ļ Found files:
1954
+ ${oldLocalizationFiles.map(f => " - " + f).join("\n")}
1955
+
1956
+ 👉 Please move them to new structure:
1957
+
1958
+ src/js/localization/localization_settings-x.x.js
1959
+ src/js/localization/localization-x.x/
1960
+
1961
+ âš ī¸ Example:
1962
+
1963
+ OLD:
1964
+ src/js/localization-x.x.js
1965
+ src/js/localization_settings-x.x.js
1966
+
1967
+ NEW:
1968
+ src/js/localization/localization_settings-1.1.js
1969
+ src/js/localization/localization-x.x/localization-x.x.js
1970
+
1971
+ ❌ Build stopped.
1972
+ `);
1973
+
1974
+ process.exit(1);
1975
+ }
1976
+
1977
+
1978
+
1979
+
1980
+ if (fs.existsSync(localizationBaseDir)) {
1981
+
1982
+ // ❌ Block wrong files
1983
+ const invalidFiles = fs.readdirSync(localizationBaseDir)
1984
+ .filter(name => /^localization-\d+(\.\d+)*\.js$/.test(name));
1985
+
1986
+ if (invalidFiles.length > 0) {
1987
+ console.error(`
1988
+ ❌ INVALID LOCALIZATION FILE LOCATION
1989
+
1990
+ đŸšĢ localization-x.x.js must NOT be directly inside:
1991
+ src/js/localization/
1992
+
1993
+ đŸ“Ļ Found:
1994
+ ${invalidFiles.map(f => " - " + f).join("\n")}
1995
+
1996
+ ❌ Build stopped.
1997
+ `);
1998
+ process.exit(1);
1999
+ }
2000
+
2001
+ // 🔍 Find localization-x.x folders
2002
+ const localizationVersions = fs.readdirSync(localizationBaseDir)
2003
+ .filter(name => /^localization-\d+(\.\d+)+$/.test(name));
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 {
2060
+ console.log("â„šī¸ Localization not used in this project. Skipping...");
2061
+ }
2062
+
2063
+
2064
+
2065
+
2066
+
2067
+
2068
+
2069
+
2070
+
2071
+
2072
+
2073
+
2074
+
2075
+
2076
+
2077
+
2078
+
2079
+
2080
+
2081
+ //editor-x.x import old style check and stop execution START
2082
+
2083
+
2084
+
2085
+ // Match: editor/editor-2.3, editor/editor-2.3.1, etc.
2086
+ const FORBIDDEN_REGEX = /editor\/editor-\d+(\.\d+)+/;
2087
+
2088
+ let hasError = false;
2089
+
2090
+ const ERROR_MESSAGE = `const ERROR_MESSAGE = ❌ Invalid import detected!
2091
+
2092
+ You are using a direct version-based path like: editor/editor-x.x/editor.js
2093
+
2094
+ đŸšĢ This is NOT allowed.
2095
+
2096
+ 👉 Please use the proper alias or updated import method.
2097
+ Example: import { ... } from '@editor'
2098
+
2099
+ âš ī¸ Do not use version-based paths in imports.
2100
+ 👉 Please add this manually in vite.config.js:
2101
+
2102
+ alias: {
2103
+ '@editor': path.resolve(__dirname, './src/js/editor/editor-x.x')
2104
+ }`
2105
+
2106
+ function scanDir(dir) {
2107
+ const files = fs.readdirSync(dir);
2108
+
2109
+ for (const file of files) {
2110
+ const fullPath = path.join(dir, file);
2111
+ const stat = fs.statSync(fullPath);
2112
+
2113
+ if (stat.isDirectory()) {
2114
+ scanDir(fullPath);
2115
+ } else if (file.endsWith(".js") || file.endsWith(".ts") || file.endsWith(".f7")) {
2116
+ const content = fs.readFileSync(fullPath, "utf-8");
2117
+
2118
+ const lines = content.split("\n");
2119
+
2120
+ lines.forEach((line, index) => {
2121
+ if (FORBIDDEN_REGEX.test(line)) {
2122
+ console.error(
2123
+ `❌ Forbidden import found:\nFile: ${fullPath}\nLine: ${index + 1}\nCode: ${line.trim()}\n`,
2124
+ ERROR_MESSAGE
2125
+ );
2126
+ hasError = true;
2127
+ }
2128
+ });
2129
+ }
2130
+ }
2131
+ }
2132
+
2133
+ // Run scan
2134
+ scanDir(ROOT_DIR);
2135
+
2136
+ // Throw error (exit process)
2137
+ if (hasError) {
2138
+ console.error("đŸšĢ Build failed due to forbidden editor imports.");
2139
+ process.exit(1);
2140
+ } else {
2141
+ console.log("✅ No forbidden imports found.");
2142
+ }
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2149
+ //editor-x.x import old style check and stop execution START
2150
+
2151
+
2152
+
2153
+
2154
+
2155
+
2156
+
2157
+
2158
+
2159
+
2125
2160
  // Check all the codeplays plugins version START
2126
2161
 
2127
2162
 
@@ -2227,6 +2262,12 @@ const compareVersion = (v1, v2) => {
2227
2262
 
2228
2263
 
2229
2264
 
2265
+
2266
+
2267
+
2268
+
2269
+
2270
+
2230
2271
  const admobConfigPath = path.join('src', 'js','Ads', 'admob-ad-configuration.json');
2231
2272
 
2232
2273
  const checkAdmobConfigurationProperty=()=>{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",