2021-08-30 19:23:54 +00:00
|
|
|
import { withRestApi } from './flows';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Uses the WooCommerce API to get the environment context.
|
|
|
|
*/
|
|
|
|
export const getEnvironmentContext = async () => {
|
|
|
|
try {
|
|
|
|
const environment = await withRestApi.getSystemEnvironment();
|
|
|
|
return {
|
|
|
|
wpVersion: environment.wp_version,
|
|
|
|
wcVersion: environment.version,
|
2022-03-25 08:25:04 +00:00
|
|
|
};
|
2021-08-30 19:23:54 +00:00
|
|
|
} catch ( error ) {
|
|
|
|
// Prevent an error here causing tests to fail.
|
|
|
|
}
|
2022-03-25 08:25:04 +00:00
|
|
|
};
|