UNPKG

@automattic/wpcom-checkout

Version:
23 lines 907 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasCheckoutVersion = hasCheckoutVersion; const tslib_1 = require("tslib"); const calypso_config_1 = tslib_1.__importDefault(require("@automattic/calypso-config")); /** * This function can be used to query the checkoutVersion parameter from the URL. Useful for A/B testing. * @param {string} version * @returns {boolean} */ function hasCheckoutVersion(version) { if (typeof window === 'undefined') { return false; } const isCheckoutVersioned = calypso_config_1.default.isEnabled('checkout/checkout-version'); const urlParams = new URLSearchParams(window.location.search); const checkoutVersion = urlParams.get('checkoutVersion'); if (isCheckoutVersioned && checkoutVersion === version) { return true; } return false; } //# sourceMappingURL=checkout-version-checker.js.map