UNPKG

@arc-publishing/sdk-sales

Version:
37 lines 1.45 kB
import { __assign, __awaiter, __generator } from "tslib"; import { isAPIErrorResponse } from '@arc-publishing/sdk-subs-core/lib/utils/APIErrorResponse'; import JSONResponseHandler from '@arc-publishing/sdk-subs-core/lib/utils/JSONResponseHandler'; import { headers } from './constants'; import Sales from './sales'; export function isConfigOptions(object) { return object.checkoutRecaptchaEnabled !== undefined; } export function getConfig() { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { if (!Sales._configOptions) { return [2, fetch("".concat(Sales.apiOrigin, "/sales/public/v1/config"), { method: 'GET', cache: 'no-cache', headers: __assign({}, headers) }) .then(JSONResponseHandler) .then(function (json) { if (isAPIErrorResponse(json)) { throw json; } else { Sales._configOptions = json; return json; } })]; } else { return [2, Sales._configOptions]; } return [2]; }); }); } export default getConfig; //# sourceMappingURL=getConfig.js.map