@times-components/ts-components 1.104.1-alpha.40 → 1.104.1-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,31 +38,26 @@ export const SocialMediaEmbed: React.FC<SocialEmbedProps> = ({
|
|
|
38
38
|
const [allowedOnce, setAllowedOnce] = useState(false);
|
|
39
39
|
const [isSocialAllowed, setIsSocialAllowed] = useState(false);
|
|
40
40
|
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (window.__tcfapi) {
|
|
43
|
-
window.__tcfapi('getCustomVendorConsents', 2, (data, success) => {
|
|
44
|
-
if (success && data && data.consentedVendors) {
|
|
45
|
-
const isSocialVendorAllowed = data.consentedVendors.some(
|
|
46
|
-
(vendor: { name: string }) => vendor.name === 'Twitter'
|
|
47
|
-
);
|
|
48
|
-
setIsSocialAllowed(isSocialVendorAllowed);
|
|
49
|
-
} else {
|
|
50
|
-
// tslint:disable-next-line:no-console
|
|
51
|
-
console.log(
|
|
52
|
-
`Error fetching consent data or ${vendorName} embed not allowed`
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, []);
|
|
58
|
-
|
|
59
41
|
useEffect(
|
|
60
42
|
() => {
|
|
61
|
-
if (
|
|
62
|
-
|
|
43
|
+
if (window.__tcfapi) {
|
|
44
|
+
window.__tcfapi('getCustomVendorConsents', 2, (data, success) => {
|
|
45
|
+
if (success && data && data.consentedVendors) {
|
|
46
|
+
const isSocialVendorAllowed = data.consentedVendors.some(
|
|
47
|
+
(vendor: { name: string }) =>
|
|
48
|
+
vendor.name.toLowerCase() === vendorName.toLowerCase()
|
|
49
|
+
);
|
|
50
|
+
setIsSocialAllowed(isSocialVendorAllowed);
|
|
51
|
+
} else {
|
|
52
|
+
// tslint:disable-next-line:no-console
|
|
53
|
+
console.log(
|
|
54
|
+
`Error fetching consent data or ${vendorName} embed not allowed`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
63
58
|
}
|
|
64
59
|
},
|
|
65
|
-
[
|
|
60
|
+
[vendorName]
|
|
66
61
|
);
|
|
67
62
|
|
|
68
63
|
enum ModalType {
|
|
@@ -100,8 +95,7 @@ export const SocialMediaEmbed: React.FC<SocialEmbedProps> = ({
|
|
|
100
95
|
[key: string]: { id: string; status: string };
|
|
101
96
|
} = {
|
|
102
97
|
twitter: { id: '5fab0c31a22863611c5f8764', status: 'pending' },
|
|
103
|
-
|
|
104
|
-
instagram: { id: 'insta_vendor_id', status: 'pending' }
|
|
98
|
+
youtube: { id: '5e7ac3fae30e7d1bc1ebf5e8', status: 'pending' }
|
|
105
99
|
};
|
|
106
100
|
|
|
107
101
|
const getVendorTitle = (title: string): string => {
|
|
@@ -118,7 +112,7 @@ export const SocialMediaEmbed: React.FC<SocialEmbedProps> = ({
|
|
|
118
112
|
return {
|
|
119
113
|
...socialMediaVendors.vendorName,
|
|
120
114
|
[vendorName]: {
|
|
121
|
-
...socialMediaVendors[
|
|
115
|
+
...socialMediaVendors[providerName],
|
|
122
116
|
status: 'accepted'
|
|
123
117
|
}
|
|
124
118
|
};
|
|
@@ -158,7 +152,7 @@ export const SocialMediaEmbed: React.FC<SocialEmbedProps> = ({
|
|
|
158
152
|
// tslint:disable-next-line:no-console
|
|
159
153
|
console.log('allowedOnce && isSocialAllowed', allowedOnce && isSocialAllowed);
|
|
160
154
|
|
|
161
|
-
return isSocialAllowed ? (
|
|
155
|
+
return isSocialAllowed || allowedOnce ? (
|
|
162
156
|
<InteractiveWrapper
|
|
163
157
|
attributes={element.attributes}
|
|
164
158
|
element={element.value}
|