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>
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
"use strict";
|
|
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.sprintf = sprintf;
|
|
var _memize = _interopRequireDefault(require("memize"));
|
|
var _sprintfJs = _interopRequireDefault(require("sprintf-js"));
|
|
/**
|
|
* External dependencies
|
|
*/
|
|
|
|
/**
|
|
* Log to console, once per message; or more precisely, per referentially equal
|
|
* argument set. Because Jed throws errors, we log these to the console instead
|
|
* to avoid crashing the application.
|
|
*
|
|
* @param {...*} args Arguments to pass to `console.error`
|
|
*/
|
|
const logErrorOnce = (0, _memize.default)(console.error); // eslint-disable-line no-console
|
|
|
|
/**
|
|
* Returns a formatted string. If an error occurs in applying the format, the
|
|
* original format string is returned.
|
|
*
|
|
* @param {string} format The format of the string to generate.
|
|
* @param {...*} args Arguments to apply to the format.
|
|
*
|
|
* @see https://www.npmjs.com/package/sprintf-js
|
|
*
|
|
* @return {string} The formatted string.
|
|
*/
|
|
function sprintf(format, ...args) {
|
|
try {
|
|
return _sprintfJs.default.sprintf(format, ...args);
|
|
} catch (error) {
|
|
if (error instanceof Error) {
|
|
logErrorOnce('sprintf error: \n\n' + error.toString());
|
|
}
|
|
return format;
|
|
}
|
|
}
|
|
//# sourceMappingURL=sprintf.js.map
|