@builder.io/react 8.2.1 → 8.2.2
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/CHANGELOG.md +6 -0
- package/dist/builder-react-lite.cjs.js +1 -1
- package/dist/builder-react-lite.cjs.js.map +1 -1
- package/dist/builder-react-lite.esm.js +1 -1
- package/dist/builder-react-lite.esm.js.map +1 -1
- package/dist/builder-react.browser.js +2 -2
- package/dist/builder-react.browser.js.map +1 -1
- package/dist/builder-react.cjs.js +1 -1
- package/dist/builder-react.cjs.js.map +1 -1
- package/dist/builder-react.es5.js +1 -1
- package/dist/builder-react.es5.js.map +1 -1
- package/dist/builder-react.unpkg.js +2 -2
- package/dist/builder-react.unpkg.js.map +1 -1
- package/dist/lib/package.json +1 -1
- package/dist/lib/src/blocks/PersonalizationContainer.js +3 -3
- package/dist/lib/src/blocks/PersonalizationContainer.js.map +1 -1
- package/dist/lib/src/blocks/Router.js +2 -2
- package/dist/lib/src/blocks/Router.js.map +1 -1
- package/dist/lib/src/blocks/Symbol.js +1 -1
- package/dist/lib/src/blocks/Symbol.js.map +1 -1
- package/dist/lib/src/components/builder-component.component.js +3 -3
- package/dist/lib/src/components/builder-component.component.js.map +1 -1
- package/dist/lib/src/components/builder-content.component.js +1 -1
- package/dist/lib/src/components/builder-content.component.js.map +1 -1
- package/dist/lib/src/components/variants-provider.component.js +2 -2
- package/dist/lib/src/components/variants-provider.component.js.map +1 -1
- package/dist/lib/src/sdk-version.js +1 -1
- package/dist/types/src/components/builder-component.component.d.ts +5 -0
- package/dist/types/src/components/builder-content.component.d.ts +4 -0
- package/dist/types/src/components/variants-provider.component.d.ts +2 -1
- package/dist/types/src/sdk-version.d.ts +1 -1
- package/package.json +1 -1
- package/src/blocks/PersonalizationContainer.tsx +3 -0
- package/src/blocks/Router.tsx +2 -1
- package/src/blocks/Symbol.tsx +1 -0
- package/src/components/builder-component.component.tsx +8 -0
- package/src/components/builder-content.component.tsx +5 -1
- package/src/components/variants-provider.component.tsx +3 -1
|
@@ -298,6 +298,11 @@ export interface BuilderComponentProps {
|
|
|
298
298
|
* Pass a list of custom components to register with Builder.io.
|
|
299
299
|
*/
|
|
300
300
|
customComponents?: Array<RegisteredComponent>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* CSP nonce to allow the loading and execution of a script or style tag when Content-Security-Policy is enabled.
|
|
304
|
+
*/
|
|
305
|
+
nonce?: string;
|
|
301
306
|
}
|
|
302
307
|
|
|
303
308
|
export interface BuilderComponentState {
|
|
@@ -439,6 +444,7 @@ export class BuilderComponent extends React.Component<
|
|
|
439
444
|
context: {
|
|
440
445
|
...props.context,
|
|
441
446
|
apiKey: this.props.apiKey || builder.apiKey,
|
|
447
|
+
nonce: this.props.nonce,
|
|
442
448
|
},
|
|
443
449
|
state: Object.assign(this.rootState, {
|
|
444
450
|
...(this.inlinedContent && this.inlinedContent.data && this.inlinedContent.data.state),
|
|
@@ -1097,6 +1103,7 @@ export class BuilderComponent extends React.Component<
|
|
|
1097
1103
|
}
|
|
1098
1104
|
contentError={this.props.contentError}
|
|
1099
1105
|
modelName={this.name || 'page'}
|
|
1106
|
+
nonce={this.props.nonce}
|
|
1100
1107
|
>
|
|
1101
1108
|
{(data, loading, fullData) => {
|
|
1102
1109
|
if (this.props.dataOnly) {
|
|
@@ -1191,6 +1198,7 @@ export class BuilderComponent extends React.Component<
|
|
|
1191
1198
|
>
|
|
1192
1199
|
{!codegen && this.getCss(data) && (
|
|
1193
1200
|
<style
|
|
1201
|
+
nonce={this.props.nonce}
|
|
1194
1202
|
ref={ref => (this.styleRef = ref)}
|
|
1195
1203
|
className="builder-custom-styles"
|
|
1196
1204
|
dangerouslySetInnerHTML={{
|
|
@@ -50,6 +50,10 @@ export type BuilderContentProps<ContentType> = {
|
|
|
50
50
|
* Required if `inline` is set to `true`.
|
|
51
51
|
*/
|
|
52
52
|
content?: Content;
|
|
53
|
+
/**
|
|
54
|
+
* CSP nonce to allow the loading and execution of a script or style tag when Content-Security-Policy is enabled.
|
|
55
|
+
*/
|
|
56
|
+
nonce?: string;
|
|
53
57
|
} & ({ model: string } | { modelName: string }); // model and modelName are aliases of the same thing¸
|
|
54
58
|
|
|
55
59
|
/**
|
|
@@ -314,7 +318,7 @@ export class BuilderContent<ContentType extends object = any> extends React.Comp
|
|
|
314
318
|
const useData: any = this.data;
|
|
315
319
|
const TagName = this.props.dataOnly ? NoWrap : 'div';
|
|
316
320
|
return (
|
|
317
|
-
<VariantsProvider initialContent={useData}>
|
|
321
|
+
<VariantsProvider initialContent={useData} nonce={this.props.nonce}>
|
|
318
322
|
{(variants, renderScript) => {
|
|
319
323
|
return (
|
|
320
324
|
<React.Fragment>
|
|
@@ -99,9 +99,10 @@ const variantsScript = (variantsString: string, contentId: string) =>
|
|
|
99
99
|
interface VariantsProviderProps {
|
|
100
100
|
initialContent: BuilderContent;
|
|
101
101
|
children: (variants: BuilderContent[], renderScript?: () => JSX.Element) => JSX.Element;
|
|
102
|
+
nonce?: string;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
export const VariantsProvider = ({ initialContent, children }: VariantsProviderProps) => {
|
|
105
|
+
export const VariantsProvider = ({ initialContent, children, nonce }: VariantsProviderProps) => {
|
|
105
106
|
if (Builder.isBrowser && !builder.canTrack) {
|
|
106
107
|
return children([initialContent]);
|
|
107
108
|
}
|
|
@@ -126,6 +127,7 @@ export const VariantsProvider = ({ initialContent, children }: VariantsProviderP
|
|
|
126
127
|
);
|
|
127
128
|
const renderScript = () => (
|
|
128
129
|
<script
|
|
130
|
+
nonce={nonce}
|
|
129
131
|
id={`variants-script-${initialContent.id}`}
|
|
130
132
|
dangerouslySetInnerHTML={{
|
|
131
133
|
__html: variantsScript(variantsJson, initialContent.id!),
|