pds-dev-kit-web-test 0.3.58 → 0.3.60
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.
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +285 -6
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +272 -229
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +5 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/Embed.d.ts +5 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe/Iframe.js → Embed/Embed.js} +4 -35
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedCore.d.ts +6 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/EmbedCore.js +69 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe → Embed}/constant.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Embed/sanitizeEmbedCode.d.ts +9 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe → Embed}/sanitizeEmbedCode.js +13 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +3 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/types.d.ts +4 -4
- package/dist/src/sub/DynamicLayout/sections/CustomSection/types.js +1 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseProperties.d.ts +2 -2
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/types.d.ts +11 -1
- package/package.json +3 -1
- package/release-note.md +2 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Iframe/EmbedCore.d.ts +0 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Iframe/EmbedCore.js +0 -24
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Iframe/Iframe.d.ts +0 -5
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Iframe/sanitizeEmbedCode.d.ts +0 -1
- /package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe → Embed}/constant.d.ts +0 -0
- /package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe → Embed}/types.d.ts +0 -0
- /package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/{Iframe → Embed}/types.js +0 -0
|
@@ -22,23 +22,12 @@ var util_1 = require("../../../../util");
|
|
|
22
22
|
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
|
23
23
|
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
|
24
24
|
var EmbedCore_1 = __importDefault(require("./EmbedCore"));
|
|
25
|
-
function
|
|
25
|
+
function Embed(props) {
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
27
|
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
28
28
|
var CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM, index = props.index;
|
|
29
|
-
var
|
|
30
|
-
// CB_STYLE_PROP_TWITTER: { CB_STYLE_PROP_TWITTER_SPEC_THEME },
|
|
31
|
-
CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW;
|
|
29
|
+
var CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE = props.CB_CONTENT_PROP_CODEBLOCK.CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW;
|
|
32
30
|
var _b = (0, util_1.parseProperties)(props, device), style = _b.style, hoverStyle = _b.hoverStyle, layout = _b.layout, effect = _b.effect;
|
|
33
|
-
if ('display' in layout) {
|
|
34
|
-
delete layout.display;
|
|
35
|
-
}
|
|
36
|
-
if ('alignItems' in layout) {
|
|
37
|
-
delete layout.alignItems;
|
|
38
|
-
}
|
|
39
|
-
if ('justifyContent' in layout) {
|
|
40
|
-
delete layout.justifyContent;
|
|
41
|
-
}
|
|
42
31
|
var cbRef = (0, react_1.useRef)(null);
|
|
43
32
|
var entry = (0, hooks_1.useIntersectionObserver)(cbRef, { threshold: 0.2, freezeOnceVisible: false }, [
|
|
44
33
|
index
|
|
@@ -51,26 +40,6 @@ function Iframe(props) {
|
|
|
51
40
|
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
|
52
41
|
var hasEffect = !isNoneEffectType;
|
|
53
42
|
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, style), layout), effectCssProperties), editModeStyle), hoverStyle: hoverStyle, cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: (0, jsx_runtime_1.jsx)(EmbedCore_1.default, { embedCode:
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, style), layout), effectCssProperties), editModeStyle), hoverStyle: hoverStyle, cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: (0, jsx_runtime_1.jsx)(EmbedCore_1.default, { embedCode: CB_CONTENT_PROP_CODEBLOCK_SPEC_CODE }) })) })));
|
|
55
44
|
}
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
58
|
-
function sanitizeIframe(iframeHtml) {
|
|
59
|
-
var parser = new DOMParser();
|
|
60
|
-
var doc = parser.parseFromString(iframeHtml, 'text/html');
|
|
61
|
-
var iframe = doc.querySelector('iframe');
|
|
62
|
-
if (!iframe) {
|
|
63
|
-
// throw new Error('Invalid iframe.');
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
// Check the src attribute matches allowed patterns
|
|
67
|
-
// if (!iframe.src.startsWith('https://player.vimeo.com/')) {
|
|
68
|
-
// throw new Error('URL not allowed.');
|
|
69
|
-
// }
|
|
70
|
-
// Remove any attributes that are not allowed
|
|
71
|
-
iframe.removeAttribute('onload');
|
|
72
|
-
iframe.removeAttribute('onerror');
|
|
73
|
-
// ...repeat for other attributes
|
|
74
|
-
return iframe.outerHTML;
|
|
75
|
-
}
|
|
76
|
-
exports.default = Iframe;
|
|
45
|
+
exports.default = Embed;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var DOMPurify = __importStar(require("dompurify"));
|
|
44
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
45
|
+
var PURIFY_CONFIG = {
|
|
46
|
+
ADD_TAGS: ['iframe'],
|
|
47
|
+
ADD_ATTR: ['frameborder', 'marginheight', 'marginwidth', 'allowfullscreen', 'referrerpolicy']
|
|
48
|
+
};
|
|
49
|
+
var EmbedCore = function (_a) {
|
|
50
|
+
var embedCode = _a.embedCode;
|
|
51
|
+
var sanitized = DOMPurify.sanitize(embedCode, PURIFY_CONFIG);
|
|
52
|
+
if (DOMPurify.removed.length > 0) {
|
|
53
|
+
var message = removedMessage(DOMPurify.removed).join("\n");
|
|
54
|
+
return (0, jsx_runtime_1.jsx)(S_Error, { children: message });
|
|
55
|
+
}
|
|
56
|
+
// eslint-disable-next-line react/no-danger
|
|
57
|
+
return (0, jsx_runtime_1.jsx)(S_EmbedCore, { dangerouslySetInnerHTML: { __html: sanitized } });
|
|
58
|
+
};
|
|
59
|
+
function removedMessage(removed) {
|
|
60
|
+
return removed.reduce(function (acc, cur) {
|
|
61
|
+
var key = Object.keys(cur)[0];
|
|
62
|
+
var message = "".concat(key, ":").concat(cur[key].localName, " is not allowed.");
|
|
63
|
+
return __spreadArray(__spreadArray([], acc, true), [message], false);
|
|
64
|
+
}, []);
|
|
65
|
+
}
|
|
66
|
+
var S_Error = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n background-color: red;\n display: flex;\n height: 100%;\n justify-content: center;\n white-space: pre-line;\n width: 100%;\n"], ["\n align-items: center;\n background-color: red;\n display: flex;\n height: 100%;\n justify-content: center;\n white-space: pre-line;\n width: 100%;\n"])));
|
|
67
|
+
var S_EmbedCore = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-items: inherit;\n display: inherit;\n flex-direction: inherit;\n height: inherit;\n justify-content: inherit;\n width: inherit;\n"], ["\n align-items: inherit;\n display: inherit;\n flex-direction: inherit;\n height: inherit;\n justify-content: inherit;\n width: inherit;\n"])));
|
|
68
|
+
exports.default = EmbedCore;
|
|
69
|
+
var templateObject_1, templateObject_2;
|
|
@@ -5,6 +5,7 @@ function sanitizeEmbedCode(embedCode) {
|
|
|
5
5
|
try {
|
|
6
6
|
var parser = new DOMParser();
|
|
7
7
|
var doc = parser.parseFromString(embedCode, 'text/html');
|
|
8
|
+
var scripts_1 = [];
|
|
8
9
|
// Function to check for the presence of blacklisted tags or attributes
|
|
9
10
|
var checkForBlacklist_1 = function (node) {
|
|
10
11
|
if (constant_1.tagBlacklist.includes(node.tagName.toLowerCase())) {
|
|
@@ -16,6 +17,13 @@ function sanitizeEmbedCode(embedCode) {
|
|
|
16
17
|
}
|
|
17
18
|
});
|
|
18
19
|
};
|
|
20
|
+
// Collect and remove script tags
|
|
21
|
+
var scriptElements = doc.querySelectorAll('script');
|
|
22
|
+
scriptElements.forEach(function (script) {
|
|
23
|
+
var _a;
|
|
24
|
+
scripts_1.push(script.outerHTML);
|
|
25
|
+
(_a = script.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(script);
|
|
26
|
+
});
|
|
19
27
|
// Recursive function to check all nodes in the document
|
|
20
28
|
var checkNode_1 = function (node) {
|
|
21
29
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
@@ -24,10 +32,13 @@ function sanitizeEmbedCode(embedCode) {
|
|
|
24
32
|
Array.from(node.childNodes).forEach(checkNode_1);
|
|
25
33
|
};
|
|
26
34
|
checkNode_1(doc.body);
|
|
27
|
-
return
|
|
35
|
+
return {
|
|
36
|
+
html: doc.body.innerHTML,
|
|
37
|
+
scripts: scripts_1
|
|
38
|
+
};
|
|
28
39
|
}
|
|
29
40
|
catch (error) {
|
|
30
|
-
return new Error("Sanitization failed: ".concat(error.message));
|
|
41
|
+
return { error: new Error("Sanitization failed: ".concat(error.message)) };
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
44
|
exports.default = sanitizeEmbedCode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CB_BTN_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE, CB_TEXT_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE } from './util/types';
|
|
1
|
+
import type { CB_BTN_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_EMBED_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE, CB_TEXT_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE } from './util/types';
|
|
2
2
|
export type CB_TYPES = 'GENERAL';
|
|
3
3
|
export type ComponentBlock = CB_TEXT_TYPE | CB_BTN_TYPE | CB_RICHTEXT | CB_DIVIDER | CB_IMG | CB_YOUTUBE | CB_TWITTER | CB_IFRAME;
|
|
4
4
|
type GeneralCustomSectionType = {
|
|
@@ -17,7 +17,7 @@ export type GroupCustomSectionType = {
|
|
|
17
17
|
queryableDefinitionPreset: string;
|
|
18
18
|
dynamicLayoutSectionId: number;
|
|
19
19
|
};
|
|
20
|
-
export type AllCBProperties = CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE;
|
|
20
|
+
export type AllCBProperties = CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE | CB_EMBED_PROPERTIES_TYPE;
|
|
21
21
|
export type CB_TEXT_TYPE = GeneralCustomSectionType & {
|
|
22
22
|
componentBlockCode: CB_ALL_CODES.CB_TEXT;
|
|
23
23
|
jsonProperties: {
|
|
@@ -61,7 +61,7 @@ export type CB_TWITTER = GeneralCustomSectionType & {
|
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
export type CB_IFRAME = GeneralCustomSectionType & {
|
|
64
|
-
componentBlockCode: CB_ALL_CODES.
|
|
64
|
+
componentBlockCode: CB_ALL_CODES.CB_EMBED;
|
|
65
65
|
jsonProperties: {
|
|
66
66
|
data: CB_TWITTER_PROPERTIES_TYPE;
|
|
67
67
|
};
|
|
@@ -74,6 +74,6 @@ export declare enum CB_ALL_CODES {
|
|
|
74
74
|
CB_IMG = "CB_IMG",
|
|
75
75
|
CB_YOUTUBE = "CB_YOUTUBE",
|
|
76
76
|
CB_TWITTER = "CB_TWITTER",
|
|
77
|
-
|
|
77
|
+
CB_EMBED = "CB_EMBED"
|
|
78
78
|
}
|
|
79
79
|
export {};
|
|
@@ -10,5 +10,5 @@ var CB_ALL_CODES;
|
|
|
10
10
|
CB_ALL_CODES["CB_IMG"] = "CB_IMG";
|
|
11
11
|
CB_ALL_CODES["CB_YOUTUBE"] = "CB_YOUTUBE";
|
|
12
12
|
CB_ALL_CODES["CB_TWITTER"] = "CB_TWITTER";
|
|
13
|
-
CB_ALL_CODES["
|
|
13
|
+
CB_ALL_CODES["CB_EMBED"] = "CB_EMBED";
|
|
14
14
|
})(CB_ALL_CODES = exports.CB_ALL_CODES || (exports.CB_ALL_CODES = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CB_LAYOUT_PROP_KEYS } from './layoutPropParsers/types';
|
|
2
2
|
import { CB_STYLE_PROP_KEYS } from './stylePropParsers/types';
|
|
3
|
-
import type { Device, ParserResult, CB_TEXT_PROPERTIES_TYPE, CB_BTN_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE } from './types';
|
|
3
|
+
import type { Device, ParserResult, CB_TEXT_PROPERTIES_TYPE, CB_BTN_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE, CB_EMBED_PROPERTIES_TYPE } from './types';
|
|
4
4
|
export type specTypes = CB_LAYOUT_PROP_KEYS | CB_STYLE_PROP_KEYS;
|
|
5
|
-
export default function parseProperties(properties: CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE, device: Device): ParserResult;
|
|
5
|
+
export default function parseProperties(properties: CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_EMBED_PROPERTIES_TYPE, device: Device): ParserResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CB_BTNTEXT_STYLE_PROPS, CB_STYLE_PROP_BTNCOLOR_SPECS } from '../components/ComponentBlock/componentBlocks/Button/btnTypes';
|
|
2
2
|
import type { CB_STYLE_PROP_TEXT_SPECS } from '../components/ComponentBlock/componentBlocks/Text/types';
|
|
3
3
|
import type { CB_TWITTER_STYLE_PROPS } from '../components/ComponentBlock/componentBlocks/Twitter/types';
|
|
4
|
-
import type { CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_IMAGE, CB_CONTENT_PROP_TEXT, CB_CONTENT_PROP_TWITTER } from '../components/ComponentBlock/componentBlocks/types';
|
|
4
|
+
import type { CB_CONTENT_PROP_CLINK, CB_CONTENT_PROP_CODEBLOCK, CB_CONTENT_PROP_IMAGE, CB_CONTENT_PROP_TEXT, CB_CONTENT_PROP_TWITTER } from '../components/ComponentBlock/componentBlocks/types';
|
|
5
5
|
import type { CB_CONTENT_PROP_YOUTUBE_TYPE, CB_STYLE_PROP_BGCOLOR_SPECS } from '../components/ComponentBlock/componentBlocks/Youtube/types';
|
|
6
6
|
import type { CB_CONTENT_PROP_VISIBILITY_SPECS } from './contentPropParsers/parseContentVisibility';
|
|
7
7
|
import type { CB_EFFECT_PROP_ENTANIM_SPECS } from './effectPropParsers/parseEffectPropEntAnim';
|
|
@@ -82,6 +82,16 @@ export type CB_TWITTER_PROPERTIES_TYPE = CB_GENERAL_PROPERTIES_TYPE & {
|
|
|
82
82
|
CB_LAYOUT_PROP_PADDING: CB_LAYOUT_PROP_PADDING_SPECS;
|
|
83
83
|
CB_EFFECT_PROP_ENTANIM: CB_EFFECT_PROP_ENTANIM_SPECS;
|
|
84
84
|
};
|
|
85
|
+
export type CB_EMBED_PROPERTIES_TYPE = CB_GENERAL_PROPERTIES_TYPE & {
|
|
86
|
+
CB_CONTENT_PROP_CODEBLOCK: CB_CONTENT_PROP_CODEBLOCK;
|
|
87
|
+
CB_CONTENT_PROP_VISIBILITY: CB_CONTENT_PROP_VISIBILITY_SPECS;
|
|
88
|
+
CB_STYLE_PROP_SHADOW: CB_STYLE_PROP_SHADOW_SPECS;
|
|
89
|
+
CB_STYLE_PROP_BGCOLOR: CB_STYLE_PROP_BGCOLOR_SPECS;
|
|
90
|
+
CB_STYLE_PROP_OPACITY: CB_STYLE_PROP_TEXT_OPACITY_SPECS;
|
|
91
|
+
CB_LAYOUT_PROP_PADDING: CB_LAYOUT_PROP_PADDING_SPECS;
|
|
92
|
+
CB_LAYOUT_PROP_ARRANGE: CB_LAYOUT_PROP_ARRANGE_SPECS;
|
|
93
|
+
CB_EFFECT_PROP_ENTANIM: CB_EFFECT_PROP_ENTANIM_SPECS;
|
|
94
|
+
};
|
|
85
95
|
export type CB_RICHTEXT_PROPERTIES_TYPE = CB_GENERAL_PROPERTIES_TYPE & {
|
|
86
96
|
CB_CONTENT_PROP_TEXTEDIT: {
|
|
87
97
|
CB_CONTENT_PROP_TEXTEDIT_SPEC_EDITOR: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pds-dev-kit-web-test",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.60",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"@types/google-spreadsheet": "^3.1.5",
|
|
16
16
|
"@types/react": "^17.0.27",
|
|
17
17
|
"@types/react-dom": "^17.0.9",
|
|
18
|
+
"dompurify": "^3.0.9",
|
|
18
19
|
"dotenv": "^8.2.0",
|
|
19
20
|
"google-spreadsheet": "^3.1.15",
|
|
20
21
|
"i18next": "^21.3.2",
|
|
@@ -83,6 +84,7 @@
|
|
|
83
84
|
"@storybook/node-logger": "^6.3.12",
|
|
84
85
|
"@storybook/preset-create-react-app": "^3.2.0",
|
|
85
86
|
"@storybook/react": "^6.3.12",
|
|
87
|
+
"@types/dompurify": "^3.0.5",
|
|
86
88
|
"@types/lodash": "^4.14.175",
|
|
87
89
|
"@types/node": "^16.10.2",
|
|
88
90
|
"@types/react-router-dom": "^5.3.3",
|
package/release-note.md
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
-
return cooked;
|
|
5
|
-
};
|
|
6
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
-
var styled_components_1 = __importDefault(require("styled-components"));
|
|
12
|
-
var sanitizeEmbedCode_1 = __importDefault(require("./sanitizeEmbedCode"));
|
|
13
|
-
var EmbedComponent = function (_a) {
|
|
14
|
-
var embedCode = _a.embedCode;
|
|
15
|
-
var sanitized = (0, sanitizeEmbedCode_1.default)(embedCode);
|
|
16
|
-
if (typeof sanitized !== 'string') {
|
|
17
|
-
return (0, jsx_runtime_1.jsxs)(S_Error, { children: ["Error: ", sanitized.message] });
|
|
18
|
-
}
|
|
19
|
-
// eslint-disable-next-line react/no-danger
|
|
20
|
-
return (0, jsx_runtime_1.jsx)("div", { dangerouslySetInnerHTML: { __html: sanitized } });
|
|
21
|
-
};
|
|
22
|
-
var S_Error = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n background-color: red;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n"], ["\n align-items: center;\n background-color: red;\n display: flex;\n height: 100%;\n justify-content: center;\n width: 100%;\n"])));
|
|
23
|
-
exports.default = EmbedComponent;
|
|
24
|
-
var templateObject_1;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { CB_TWITTER_PROPERTIES_TYPE, IndexForIntersection } from '../../../../util/types';
|
|
3
|
-
type Props = CB_TWITTER_PROPERTIES_TYPE & IndexForIntersection;
|
|
4
|
-
declare function Iframe(props: Props): JSX.Element;
|
|
5
|
-
export default Iframe;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function sanitizeEmbedCode(embedCode: string): string | Error;
|
|
File without changes
|
|
File without changes
|