UNPKG

react-native-gigya-sdk

Version:
36 lines (29 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _sendApiCall = _interopRequireDefault(require("./sendApiCall")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _default() { return new Promise(async (resolve, reject) => { try { var _currentSiteConsents$; const completeGigyaSchema = await (0, _sendApiCall.default)('accounts.getSchema'); const currentSiteConsents = await (0, _sendApiCall.default)('accounts.getConsentsStatements'); let output = []; Object.entries((_currentSiteConsents$ = currentSiteConsents === null || currentSiteConsents === void 0 ? void 0 : currentSiteConsents.preferences) !== null && _currentSiteConsents$ !== void 0 ? _currentSiteConsents$ : {}).forEach(entry => { var _completeGigyaSchema$, _entry$, _entry$2; const consentStatementSchema = completeGigyaSchema === null || completeGigyaSchema === void 0 ? void 0 : (_completeGigyaSchema$ = completeGigyaSchema.preferencesSchema) === null || _completeGigyaSchema$ === void 0 ? void 0 : _completeGigyaSchema$.fields[entry[0]]; if ((_entry$ = entry[1]) !== null && _entry$ !== void 0 && _entry$.isActive && !((_entry$2 = entry[1]) !== null && _entry$2 !== void 0 && _entry$2.isMandatory) && consentStatementSchema) { consentStatementSchema.key = entry[0]; output = [...output, consentStatementSchema]; } }); resolve(output); } catch (e) { reject(e); } }); } //# sourceMappingURL=getOptionalConsentSchemas.js.map