@arc-publishing/sdk-sales
Version:
JS Sales SDK for working with Arc Subs Sales API
26 lines • 959 B
JavaScript
import { __awaiter, __generator } from "tslib";
import { isConfigOptions } from '../sdk/getConfig';
import Sales from './sales';
export default function enforceRecaptcha(recaptchaToken) {
return __awaiter(this, void 0, void 0, function () {
var config;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4, Sales.getConfig()];
case 1:
config = _a.sent();
if (isConfigOptions(config) && config.checkoutRecaptchaEnabled && !recaptchaToken) {
throw {
code: '130001',
message: 'Captcha token invalid'
};
}
else {
return [2, true];
}
return [2];
}
});
});
}
//# sourceMappingURL=enforceRecaptcha.js.map