(element, opt_policyId)
| 88 | * - consentPolicySharedData |
| 89 | */ |
| 90 | export function getConsentDataToForward(element, opt_policyId) { |
| 91 | return Services.consentPolicyServiceForDocOrNull(element).then((policy) => { |
| 92 | const gettersOrNull = { |
| 93 | 'consentMetadata': policy && policy.getConsentMetadataInfo, |
| 94 | 'consentString': policy && policy.getConsentStringInfo, |
| 95 | 'consentPolicyState': policy && policy.whenPolicyResolved, |
| 96 | 'consentPolicySharedData': policy && policy.getMergedSharedData, |
| 97 | }; |
| 98 | if (!policy) { |
| 99 | return gettersOrNull; |
| 100 | } |
| 101 | return /** @type {!JsonObject} */ ( |
| 102 | Promise.all( |
| 103 | Object.keys(gettersOrNull).map((key) => |
| 104 | gettersOrNull[key] |
| 105 | .call(policy, opt_policyId || 'default') |
| 106 | .then((value) => ({[key]: value})) |
| 107 | ) |
| 108 | ).then((objs) => Object.assign.apply({}, objs)) |
| 109 | ); |
| 110 | }); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * Determine if an element needs to be blocked by consent based on meta tags. |
no test coverage detected