fix: prevent asset conflicts between React and Grid.js versions

Add coexistence checks to all enqueue methods to prevent loading
both React and Grid.js assets simultaneously.

Changes:
- ReactAdmin.php: Only enqueue React assets when ?react=1
- Init.php: Skip Grid.js when React active on admin pages
- Form.php, Coupon.php, Access.php: Restore classic assets when ?react=0
- Customer.php, Product.php, License.php: Add coexistence checks

Now the toggle between Classic and React versions works correctly.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-04-18 17:02:14 +07:00
parent bd9cdac02e
commit e8fbfb14c1
74973 changed files with 6658406 additions and 71 deletions

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isShallowEqualArrays;
/**
* Returns true if the two arrays are shallow equal, or false otherwise.
*
* @param {any[]} a First array to compare.
* @param {any[]} b Second array to compare.
*
* @return {boolean} Whether the two arrays are shallow equal.
*/
function isShallowEqualArrays(a, b) {
if (a === b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (let i = 0, len = a.length; i < len; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
//# sourceMappingURL=arrays.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["isShallowEqualArrays","a","b","length","i","len"],"sources":["@wordpress/is-shallow-equal/src/arrays.js"],"sourcesContent":["/**\n * Returns true if the two arrays are shallow equal, or false otherwise.\n *\n * @param {any[]} a First array to compare.\n * @param {any[]} b Second array to compare.\n *\n * @return {boolean} Whether the two arrays are shallow equal.\n */\nexport default function isShallowEqualArrays( a, b ) {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tif ( a.length !== b.length ) {\n\t\treturn false;\n\t}\n\n\tfor ( let i = 0, len = a.length; i < len; i++ ) {\n\t\tif ( a[ i ] !== b[ i ] ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,oBAAoBA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACpD,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,IAAKD,CAAC,CAACE,MAAM,KAAKD,CAAC,CAACC,MAAM,EAAG;IAC5B,OAAO,KAAK;EACb;EAEA,KAAM,IAAIC,CAAC,GAAG,CAAC,EAAEC,GAAG,GAAGJ,CAAC,CAACE,MAAM,EAAEC,CAAC,GAAGC,GAAG,EAAED,CAAC,EAAE,EAAG;IAC/C,IAAKH,CAAC,CAAEG,CAAC,CAAE,KAAKF,CAAC,CAAEE,CAAC,CAAE,EAAG;MACxB,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}

View File

@@ -0,0 +1,49 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isShallowEqual;
Object.defineProperty(exports, "isShallowEqualArrays", {
enumerable: true,
get: function () {
return _arrays.default;
}
});
Object.defineProperty(exports, "isShallowEqualObjects", {
enumerable: true,
get: function () {
return _objects.default;
}
});
var _objects = _interopRequireDefault(require("./objects"));
var _arrays = _interopRequireDefault(require("./arrays"));
/**
* Internal dependencies
*/
/**
* @typedef {Record<string, any>} ComparableObject
*/
/**
* Returns true if the two arrays or objects are shallow equal, or false
* otherwise. Also handles primitive values, just in case.
*
* @param {unknown} a First object or array to compare.
* @param {unknown} b Second object or array to compare.
*
* @return {boolean} Whether the two values are shallow equal.
*/
function isShallowEqual(a, b) {
if (a && b) {
if (a.constructor === Object && b.constructor === Object) {
return (0, _objects.default)(a, b);
} else if (Array.isArray(a) && Array.isArray(b)) {
return (0, _arrays.default)(a, b);
}
}
return a === b;
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_objects","_interopRequireDefault","require","_arrays","isShallowEqual","a","b","constructor","Object","isShallowEqualObjects","Array","isArray","isShallowEqualArrays"],"sources":["@wordpress/is-shallow-equal/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport isShallowEqualObjects from './objects';\nimport isShallowEqualArrays from './arrays';\n\nexport { default as isShallowEqualObjects } from './objects';\nexport { default as isShallowEqualArrays } from './arrays';\n\n/**\n * @typedef {Record<string, any>} ComparableObject\n */\n\n/**\n * Returns true if the two arrays or objects are shallow equal, or false\n * otherwise. Also handles primitive values, just in case.\n *\n * @param {unknown} a First object or array to compare.\n * @param {unknown} b Second object or array to compare.\n *\n * @return {boolean} Whether the two values are shallow equal.\n */\nexport default function isShallowEqual( a, b ) {\n\tif ( a && b ) {\n\t\tif ( a.constructor === Object && b.constructor === Object ) {\n\t\t\treturn isShallowEqualObjects( a, b );\n\t\t} else if ( Array.isArray( a ) && Array.isArray( b ) ) {\n\t\t\treturn isShallowEqualArrays( a, b );\n\t\t}\n\t}\n\n\treturn a === b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAOA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASE,cAAcA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EAC9C,IAAKD,CAAC,IAAIC,CAAC,EAAG;IACb,IAAKD,CAAC,CAACE,WAAW,KAAKC,MAAM,IAAIF,CAAC,CAACC,WAAW,KAAKC,MAAM,EAAG;MAC3D,OAAO,IAAAC,gBAAqB,EAAEJ,CAAC,EAAEC,CAAE,CAAC;IACrC,CAAC,MAAM,IAAKI,KAAK,CAACC,OAAO,CAAEN,CAAE,CAAC,IAAIK,KAAK,CAACC,OAAO,CAAEL,CAAE,CAAC,EAAG;MACtD,OAAO,IAAAM,eAAoB,EAAEP,CAAC,EAAEC,CAAE,CAAC;IACpC;EACD;EAEA,OAAOD,CAAC,KAAKC,CAAC;AACf","ignoreList":[]}

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isShallowEqualObjects;
/**
* Returns true if the two objects are shallow equal, or false otherwise.
*
* @param {import('.').ComparableObject} a First object to compare.
* @param {import('.').ComparableObject} b Second object to compare.
*
* @return {boolean} Whether the two objects are shallow equal.
*/
function isShallowEqualObjects(a, b) {
if (a === b) {
return true;
}
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
if (aKeys.length !== bKeys.length) {
return false;
}
let i = 0;
while (i < aKeys.length) {
const key = aKeys[i];
const aValue = a[key];
if (
// In iterating only the keys of the first object after verifying
// equal lengths, account for the case that an explicit `undefined`
// value in the first is implicitly undefined in the second.
//
// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )
aValue === undefined && !b.hasOwnProperty(key) || aValue !== b[key]) {
return false;
}
i++;
}
return true;
}
//# sourceMappingURL=objects.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["isShallowEqualObjects","a","b","aKeys","Object","keys","bKeys","length","i","key","aValue","undefined","hasOwnProperty"],"sources":["@wordpress/is-shallow-equal/src/objects.js"],"sourcesContent":["/**\n * Returns true if the two objects are shallow equal, or false otherwise.\n *\n * @param {import('.').ComparableObject} a First object to compare.\n * @param {import('.').ComparableObject} b Second object to compare.\n *\n * @return {boolean} Whether the two objects are shallow equal.\n */\nexport default function isShallowEqualObjects( a, b ) {\n\tif ( a === b ) {\n\t\treturn true;\n\t}\n\n\tconst aKeys = Object.keys( a );\n\tconst bKeys = Object.keys( b );\n\n\tif ( aKeys.length !== bKeys.length ) {\n\t\treturn false;\n\t}\n\n\tlet i = 0;\n\n\twhile ( i < aKeys.length ) {\n\t\tconst key = aKeys[ i ];\n\t\tconst aValue = a[ key ];\n\n\t\tif (\n\t\t\t// In iterating only the keys of the first object after verifying\n\t\t\t// equal lengths, account for the case that an explicit `undefined`\n\t\t\t// value in the first is implicitly undefined in the second.\n\t\t\t//\n\t\t\t// Example: isShallowEqualObjects( { a: undefined }, { b: 5 } )\n\t\t\t( aValue === undefined && ! b.hasOwnProperty( key ) ) ||\n\t\t\taValue !== b[ key ]\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\ti++;\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,qBAAqBA,CAAEC,CAAC,EAAEC,CAAC,EAAG;EACrD,IAAKD,CAAC,KAAKC,CAAC,EAAG;IACd,OAAO,IAAI;EACZ;EAEA,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAAEJ,CAAE,CAAC;EAC9B,MAAMK,KAAK,GAAGF,MAAM,CAACC,IAAI,CAAEH,CAAE,CAAC;EAE9B,IAAKC,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAG;IACpC,OAAO,KAAK;EACb;EAEA,IAAIC,CAAC,GAAG,CAAC;EAET,OAAQA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAG;IAC1B,MAAME,GAAG,GAAGN,KAAK,CAAEK,CAAC,CAAE;IACtB,MAAME,MAAM,GAAGT,CAAC,CAAEQ,GAAG,CAAE;IAEvB;IACC;IACA;IACA;IACA;IACA;IACEC,MAAM,KAAKC,SAAS,IAAI,CAAET,CAAC,CAACU,cAAc,CAAEH,GAAI,CAAC,IACnDC,MAAM,KAAKR,CAAC,CAAEO,GAAG,CAAE,EAClB;MACD,OAAO,KAAK;IACb;IAEAD,CAAC,EAAE;EACJ;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}