@builder.io/sdk-react 0.1.2 → 0.1.4
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/react/blocks/BaseText.js +7 -0
- package/dist/react/blocks/button/button.js +9 -0
- package/dist/react/blocks/button/component-info.js +39 -0
- package/dist/react/blocks/columns/columns.js +131 -0
- package/dist/react/blocks/columns/component-info.js +241 -0
- package/dist/react/blocks/custom-code/component-info.js +29 -0
- package/dist/react/blocks/custom-code/custom-code.js +49 -0
- package/dist/react/blocks/embed/component-info.js +44 -0
- package/dist/react/blocks/embed/embed.js +40 -0
- package/dist/react/blocks/embed/helpers.js +7 -0
- package/dist/react/blocks/form/component-info.js +260 -0
- package/dist/react/blocks/form/form.js +201 -0
- package/dist/react/blocks/fragment/component-info.js +9 -0
- package/dist/react/blocks/fragment/fragment.js +4 -0
- package/dist/react/blocks/image/component-info.js +149 -0
- package/dist/react/blocks/image/image.helpers.js +46 -0
- package/dist/react/blocks/image/image.js +82 -0
- package/dist/react/blocks/img/component-info.js +18 -0
- package/dist/react/blocks/img/img.js +8 -0
- package/dist/react/blocks/input/component-info.js +72 -0
- package/dist/react/blocks/input/input.js +5 -0
- package/dist/react/blocks/raw-text/component-info.js +14 -0
- package/dist/react/blocks/raw-text/raw-text.js +4 -0
- package/dist/react/blocks/section/component-info.js +47 -0
- package/dist/react/blocks/section/section.js +17 -0
- package/dist/react/blocks/select/component-info.js +57 -0
- package/dist/react/blocks/select/select.js +5 -0
- package/dist/react/blocks/submit-button/component-info.js +26 -0
- package/dist/react/blocks/submit-button/submit-button.js +4 -0
- package/dist/react/blocks/symbol/component-info.js +41 -0
- package/dist/react/blocks/symbol/symbol.js +63 -0
- package/dist/react/blocks/text/component-info.js +22 -0
- package/dist/react/blocks/text/text.js +4 -0
- package/dist/react/blocks/textarea/component-info.js +45 -0
- package/dist/react/blocks/textarea/textarea.js +4 -0
- package/dist/react/blocks/util.js +6 -0
- package/dist/react/blocks/video/component-info.js +104 -0
- package/dist/react/blocks/video/video.js +48 -0
- package/dist/react/components/render-block/block-styles.js +48 -0
- package/dist/react/components/render-block/render-block.helpers.js +104 -0
- package/dist/react/components/render-block/render-block.js +122 -0
- package/dist/react/components/render-block/render-component-with-context.js +27 -0
- package/dist/react/components/render-block/render-component.js +10 -0
- package/dist/react/components/render-block/render-repeated-block.js +15 -0
- package/dist/react/components/render-block/types.js +1 -0
- package/dist/react/components/render-blocks.js +45 -0
- package/dist/react/components/render-content/builder-editing.js +4 -0
- package/dist/react/components/render-content/components/render-styles.js +59 -0
- package/dist/react/components/render-content/index.js +2 -0
- package/dist/react/components/render-content/render-content.js +285 -0
- package/dist/react/components/render-inlined-styles.js +15 -0
- package/dist/react/constants/builder-registered-components.js +52 -0
- package/dist/react/constants/device-sizes.js +45 -0
- package/dist/react/constants/target.js +2 -0
- package/dist/react/context/builder.context.js +10 -0
- package/dist/react/context/types.js +1 -0
- package/dist/react/functions/camel-to-kebab-case.js +2 -0
- package/dist/react/functions/evaluate.js +22 -0
- package/dist/react/functions/event-handler-name.js +5 -0
- package/dist/react/functions/extract-text-styles.js +20 -0
- package/dist/react/functions/fast-clone.js +2 -0
- package/dist/react/functions/get-block-actions-handler.js +9 -0
- package/dist/react/functions/get-block-actions.js +16 -0
- package/dist/react/functions/get-block-component-options.js +26 -0
- package/dist/react/functions/get-block-properties.js +48 -0
- package/dist/react/functions/get-block-tag.js +4 -0
- package/dist/react/functions/get-builder-search-params/fn.test.js +13 -0
- package/dist/react/functions/get-builder-search-params/index.js +33 -0
- package/dist/react/functions/get-content/ab-testing.js +86 -0
- package/dist/react/functions/get-content/generate-content-url.js +41 -0
- package/dist/react/functions/get-content/generate-content-url.test.js +31 -0
- package/dist/react/functions/get-content/index.js +64 -0
- package/dist/react/functions/get-content/types.js +1 -0
- package/dist/react/functions/get-fetch.js +12 -0
- package/dist/react/functions/get-global-this.js +16 -0
- package/dist/react/functions/get-processed-block.js +49 -0
- package/dist/react/functions/get-processed-block.test.js +32 -0
- package/dist/react/functions/get-react-native-block-styles.js +27 -0
- package/dist/react/functions/if-target.js +10 -0
- package/dist/react/functions/is-browser.js +4 -0
- package/dist/react/functions/is-editing.js +5 -0
- package/dist/react/functions/is-iframe.js +5 -0
- package/dist/react/functions/is-previewing.js +12 -0
- package/dist/react/functions/on-change.js +24 -0
- package/dist/react/functions/on-change.test.js +19 -0
- package/dist/react/functions/register-component.js +60 -0
- package/dist/react/functions/register.js +28 -0
- package/dist/react/functions/sanitize-react-native-block-styles.js +68 -0
- package/dist/react/functions/set-editor-settings.js +13 -0
- package/dist/react/functions/set.js +9 -0
- package/dist/react/functions/set.test.js +16 -0
- package/dist/react/functions/track/helpers.js +50 -0
- package/dist/react/functions/track/index.js +120 -0
- package/dist/react/functions/track/interaction.js +48 -0
- package/dist/react/functions/track.js +116 -0
- package/dist/react/functions/transform-block-properties.js +4 -0
- package/dist/react/functions/transform-block.js +4 -0
- package/dist/react/helpers/ab-tests.js +6 -0
- package/dist/react/helpers/cookie.js +70 -0
- package/dist/react/helpers/css.js +28 -0
- package/dist/react/helpers/flatten.js +32 -0
- package/dist/react/helpers/localStorage.js +27 -0
- package/dist/react/helpers/nullable.js +2 -0
- package/dist/react/helpers/sessionId.js +46 -0
- package/dist/react/helpers/time.js +3 -0
- package/dist/react/helpers/url.js +11 -0
- package/dist/react/helpers/url.test.js +21 -0
- package/dist/react/helpers/uuid.js +10 -0
- package/dist/react/helpers/visitorId.js +28 -0
- package/dist/react/index-helpers/blocks-exports.js +11 -0
- package/dist/react/index-helpers/top-of-file.js +2 -0
- package/dist/react/index.js +12 -0
- package/dist/react/scripts/init-editing.js +93 -0
- package/dist/react/types/builder-block.js +1 -0
- package/dist/react/types/builder-content.js +1 -0
- package/dist/react/types/can-track.js +1 -0
- package/dist/react/types/components.js +1 -0
- package/dist/react/types/deep-partial.js +1 -0
- package/dist/react/types/element.js +1 -0
- package/dist/react/types/targets.js +1 -0
- package/dist/react/types/typescript.js +1 -0
- package/dist/rsc/blocks/BaseText.js +7 -0
- package/dist/rsc/blocks/button/button.js +10 -0
- package/dist/rsc/blocks/button/component-info.js +39 -0
- package/dist/rsc/blocks/columns/columns.js +136 -0
- package/dist/rsc/blocks/columns/component-info.js +241 -0
- package/dist/rsc/blocks/custom-code/component-info.js +29 -0
- package/dist/rsc/blocks/custom-code/custom-code.js +45 -0
- package/dist/rsc/blocks/embed/component-info.js +44 -0
- package/dist/rsc/blocks/embed/embed.js +36 -0
- package/dist/rsc/blocks/embed/helpers.js +7 -0
- package/dist/rsc/blocks/form/component-info.js +260 -0
- package/dist/rsc/blocks/form/form.js +204 -0
- package/dist/rsc/blocks/fragment/component-info.js +9 -0
- package/dist/rsc/blocks/fragment/fragment.js +5 -0
- package/dist/rsc/blocks/image/component-info.js +149 -0
- package/dist/rsc/blocks/image/image.helpers.js +46 -0
- package/dist/rsc/blocks/image/image.js +85 -0
- package/dist/rsc/blocks/img/component-info.js +18 -0
- package/dist/rsc/blocks/img/img.js +9 -0
- package/dist/rsc/blocks/input/component-info.js +72 -0
- package/dist/rsc/blocks/input/input.js +6 -0
- package/dist/rsc/blocks/raw-text/component-info.js +14 -0
- package/dist/rsc/blocks/raw-text/raw-text.js +5 -0
- package/dist/rsc/blocks/section/component-info.js +47 -0
- package/dist/rsc/blocks/section/section.js +18 -0
- package/dist/rsc/blocks/select/component-info.js +57 -0
- package/dist/rsc/blocks/select/select.js +6 -0
- package/dist/rsc/blocks/submit-button/component-info.js +26 -0
- package/dist/rsc/blocks/submit-button/submit-button.js +5 -0
- package/dist/rsc/blocks/symbol/component-info.js +41 -0
- package/dist/rsc/blocks/symbol/symbol.js +37 -0
- package/dist/rsc/blocks/text/component-info.js +22 -0
- package/dist/rsc/blocks/text/text.js +5 -0
- package/dist/rsc/blocks/textarea/component-info.js +45 -0
- package/dist/rsc/blocks/textarea/textarea.js +5 -0
- package/dist/rsc/blocks/util.js +6 -0
- package/dist/rsc/blocks/video/component-info.js +104 -0
- package/dist/rsc/blocks/video/video.js +51 -0
- package/dist/rsc/components/render-block/block-styles.js +51 -0
- package/dist/rsc/components/render-block/render-block.helpers.js +104 -0
- package/dist/rsc/components/render-block/render-block.js +126 -0
- package/dist/rsc/components/render-block/render-component-with-context.js +27 -0
- package/dist/rsc/components/render-block/render-component.js +11 -0
- package/dist/rsc/components/render-block/render-repeated-block.js +15 -0
- package/dist/rsc/components/render-block/types.js +1 -0
- package/dist/rsc/components/render-blocks.js +47 -0
- package/dist/rsc/components/render-content/builder-editing.js +5 -0
- package/dist/rsc/components/render-content/components/render-styles.js +62 -0
- package/dist/rsc/components/render-content/index.js +2 -0
- package/dist/rsc/components/render-content/render-content.js +201 -0
- package/dist/rsc/components/render-inlined-styles.js +18 -0
- package/dist/rsc/constants/builder-registered-components.js +52 -0
- package/dist/rsc/constants/device-sizes.js +45 -0
- package/dist/rsc/constants/target.js +2 -0
- package/dist/rsc/context/builder.context.js +9 -0
- package/dist/rsc/context/types.js +1 -0
- package/dist/rsc/functions/camel-to-kebab-case.js +2 -0
- package/dist/rsc/functions/evaluate.js +4 -0
- package/dist/rsc/functions/event-handler-name.js +5 -0
- package/dist/rsc/functions/extract-text-styles.js +20 -0
- package/dist/rsc/functions/fast-clone.js +2 -0
- package/dist/rsc/functions/get-block-actions-handler.js +9 -0
- package/dist/rsc/functions/get-block-actions.js +16 -0
- package/dist/rsc/functions/get-block-component-options.js +26 -0
- package/dist/rsc/functions/get-block-properties.js +48 -0
- package/dist/rsc/functions/get-block-tag.js +4 -0
- package/dist/rsc/functions/get-builder-search-params/fn.test.js +13 -0
- package/dist/rsc/functions/get-builder-search-params/index.js +33 -0
- package/dist/rsc/functions/get-content/ab-testing.js +86 -0
- package/dist/rsc/functions/get-content/generate-content-url.js +41 -0
- package/dist/rsc/functions/get-content/generate-content-url.test.js +31 -0
- package/dist/rsc/functions/get-content/index.js +64 -0
- package/dist/rsc/functions/get-content/types.js +1 -0
- package/dist/rsc/functions/get-fetch.js +12 -0
- package/dist/rsc/functions/get-global-this.js +16 -0
- package/dist/rsc/functions/get-processed-block.js +49 -0
- package/dist/rsc/functions/get-processed-block.test.js +32 -0
- package/dist/rsc/functions/get-react-native-block-styles.js +27 -0
- package/dist/rsc/functions/if-target.js +10 -0
- package/dist/rsc/functions/is-browser.js +4 -0
- package/dist/rsc/functions/is-editing.js +5 -0
- package/dist/rsc/functions/is-iframe.js +5 -0
- package/dist/rsc/functions/is-previewing.js +12 -0
- package/dist/rsc/functions/on-change.js +24 -0
- package/dist/rsc/functions/on-change.test.js +19 -0
- package/dist/rsc/functions/register-component.js +60 -0
- package/dist/rsc/functions/register.js +28 -0
- package/dist/rsc/functions/sanitize-react-native-block-styles.js +68 -0
- package/dist/rsc/functions/set-editor-settings.js +13 -0
- package/dist/rsc/functions/set.js +9 -0
- package/dist/rsc/functions/set.test.js +16 -0
- package/dist/rsc/functions/track/helpers.js +50 -0
- package/dist/rsc/functions/track/index.js +120 -0
- package/dist/rsc/functions/track/interaction.js +48 -0
- package/dist/rsc/functions/track.js +116 -0
- package/dist/rsc/functions/transform-block-properties.js +4 -0
- package/dist/rsc/functions/transform-block.js +4 -0
- package/dist/rsc/helpers/ab-tests.js +6 -0
- package/dist/rsc/helpers/cookie.js +70 -0
- package/dist/rsc/helpers/css.js +28 -0
- package/dist/rsc/helpers/flatten.js +32 -0
- package/dist/rsc/helpers/localStorage.js +27 -0
- package/dist/rsc/helpers/nullable.js +2 -0
- package/dist/rsc/helpers/sessionId.js +46 -0
- package/dist/rsc/helpers/time.js +3 -0
- package/dist/rsc/helpers/url.js +11 -0
- package/dist/rsc/helpers/url.test.js +21 -0
- package/dist/rsc/helpers/uuid.js +10 -0
- package/dist/rsc/helpers/visitorId.js +28 -0
- package/dist/rsc/index-helpers/blocks-exports.js +11 -0
- package/dist/rsc/index-helpers/top-of-file.js +2 -0
- package/dist/rsc/index.js +12 -0
- package/dist/rsc/scripts/init-editing.js +93 -0
- package/dist/rsc/types/builder-block.js +1 -0
- package/dist/rsc/types/builder-content.js +1 -0
- package/dist/rsc/types/can-track.js +1 -0
- package/dist/rsc/types/components.js +1 -0
- package/dist/rsc/types/deep-partial.js +1 -0
- package/dist/rsc/types/element.js +1 -0
- package/dist/rsc/types/targets.js +1 -0
- package/dist/rsc/types/typescript.js +1 -0
- package/package.json +11 -6
- package/packages/_rsc/src/blocks/BaseText.jsx +10 -0
- package/packages/_rsc/src/blocks/button/button.jsx +29 -0
- package/packages/_rsc/src/blocks/columns/{columns.js → columns.jsx} +80 -61
- package/packages/_rsc/src/blocks/custom-code/custom-code.jsx +55 -0
- package/packages/_rsc/src/blocks/embed/embed.jsx +43 -0
- package/packages/_rsc/src/blocks/form/form.jsx +259 -0
- package/packages/_rsc/src/blocks/fragment/fragment.jsx +7 -0
- package/packages/_rsc/src/blocks/image/image.jsx +124 -0
- package/packages/_rsc/src/blocks/img/img.jsx +19 -0
- package/packages/_rsc/src/blocks/input/input.jsx +21 -0
- package/packages/_rsc/src/blocks/raw-text/raw-text.jsx +12 -0
- package/packages/_rsc/src/blocks/section/section.jsx +29 -0
- package/packages/_rsc/src/blocks/select/select.jsx +22 -0
- package/packages/_rsc/src/blocks/submit-button/submit-button.jsx +11 -0
- package/packages/_rsc/src/blocks/symbol/symbol.jsx +56 -0
- package/packages/_rsc/src/blocks/text/text.jsx +12 -0
- package/packages/_rsc/src/blocks/textarea/textarea.jsx +15 -0
- package/packages/_rsc/src/blocks/video/video.jsx +61 -0
- package/packages/_rsc/src/components/render-block/block-styles.jsx +72 -0
- package/packages/_rsc/src/components/render-block/render-block.jsx +251 -0
- package/packages/_rsc/src/components/render-block/render-component-with-context.jsx +38 -0
- package/packages/_rsc/src/components/render-block/render-component.jsx +37 -0
- package/packages/_rsc/src/components/render-block/render-repeated-block.jsx +36 -0
- package/packages/_rsc/src/components/render-blocks.jsx +90 -0
- package/packages/_rsc/src/components/render-content/builder-editing.jsx +7 -0
- package/packages/_rsc/src/components/render-content/components/render-styles.jsx +70 -0
- package/packages/_rsc/src/components/render-content/render-content.jsx +259 -0
- package/packages/_rsc/src/components/render-inlined-styles.jsx +33 -0
- package/packages/react/src/blocks/BaseText.jsx +9 -0
- package/packages/react/src/blocks/button/button.jsx +27 -0
- package/packages/react/src/blocks/button/component-info.js +41 -0
- package/packages/react/src/blocks/columns/columns.jsx +172 -0
- package/packages/react/src/blocks/columns/component-info.js +242 -0
- package/packages/react/src/blocks/custom-code/component-info.js +31 -0
- package/packages/react/src/blocks/custom-code/custom-code.jsx +64 -0
- package/packages/react/src/blocks/embed/component-info.js +44 -0
- package/packages/react/src/blocks/embed/embed.jsx +49 -0
- package/packages/react/src/blocks/embed/helpers.js +9 -0
- package/packages/react/src/blocks/form/component-info.js +262 -0
- package/packages/react/src/blocks/form/form.jsx +253 -0
- package/packages/react/src/blocks/fragment/component-info.js +11 -0
- package/packages/react/src/blocks/fragment/fragment.jsx +5 -0
- package/packages/react/src/blocks/image/component-info.js +151 -0
- package/packages/react/src/blocks/image/image.helpers.js +48 -0
- package/packages/react/src/blocks/image/image.jsx +120 -0
- package/packages/react/src/blocks/img/component-info.js +20 -0
- package/packages/react/src/blocks/img/img.jsx +17 -0
- package/packages/react/src/blocks/input/component-info.js +74 -0
- package/packages/react/src/blocks/input/input.jsx +19 -0
- package/packages/react/src/blocks/raw-text/component-info.js +16 -0
- package/packages/react/src/blocks/raw-text/raw-text.jsx +10 -0
- package/packages/react/src/blocks/section/component-info.js +49 -0
- package/packages/react/src/blocks/section/section.jsx +27 -0
- package/packages/react/src/blocks/select/component-info.js +59 -0
- package/packages/react/src/blocks/select/select.jsx +20 -0
- package/packages/react/src/blocks/submit-button/component-info.js +28 -0
- package/packages/react/src/blocks/submit-button/submit-button.jsx +9 -0
- package/packages/react/src/blocks/symbol/component-info.js +43 -0
- package/packages/react/src/blocks/symbol/symbol.jsx +86 -0
- package/packages/react/src/blocks/text/component-info.js +24 -0
- package/packages/react/src/blocks/text/text.jsx +10 -0
- package/packages/react/src/blocks/textarea/component-info.js +47 -0
- package/packages/react/src/blocks/textarea/textarea.jsx +13 -0
- package/packages/react/src/blocks/util.js +8 -0
- package/packages/react/src/blocks/video/component-info.js +106 -0
- package/packages/react/src/blocks/video/video.jsx +58 -0
- package/packages/react/src/components/render-block/block-styles.jsx +69 -0
- package/packages/react/src/components/render-block/render-block.helpers.js +113 -0
- package/packages/react/src/components/render-block/render-block.jsx +184 -0
- package/packages/react/src/components/render-block/render-component.jsx +33 -0
- package/packages/react/src/components/render-block/render-repeated-block.jsx +21 -0
- package/packages/react/src/components/render-block/types.js +0 -0
- package/packages/react/src/components/render-blocks.jsx +89 -0
- package/packages/react/src/components/render-content/builder-editing.jsx +5 -0
- package/packages/react/src/components/render-content/components/render-styles.jsx +64 -0
- package/packages/react/src/components/render-content/index.js +4 -0
- package/packages/react/src/components/render-content/render-content.jsx +372 -0
- package/packages/react/src/components/render-inlined-styles.jsx +28 -0
- package/packages/react/src/constants/builder-registered-components.js +54 -0
- package/packages/react/src/constants/device-sizes.js +48 -0
- package/packages/react/src/constants/target.js +4 -0
- package/packages/react/src/context/builder.context.js +12 -0
- package/packages/react/src/context/types.js +0 -0
- package/packages/react/src/functions/camel-to-kebab-case.js +4 -0
- package/packages/react/src/functions/evaluate.js +29 -0
- package/packages/react/src/functions/event-handler-name.js +7 -0
- package/packages/react/src/functions/extract-text-styles.js +22 -0
- package/packages/react/src/functions/fast-clone.js +4 -0
- package/packages/react/src/functions/get-block-actions-handler.js +11 -0
- package/packages/react/src/functions/get-block-actions.js +18 -0
- package/packages/{_rsc/src/blocks/textarea/textarea.js → react/src/functions/get-block-component-options.js} +6 -10
- package/packages/react/src/functions/get-block-properties.js +50 -0
- package/packages/react/src/functions/get-block-tag.js +6 -0
- package/packages/react/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/packages/react/src/functions/get-builder-search-params/index.js +38 -0
- package/packages/react/src/functions/get-content/ab-testing.js +99 -0
- package/packages/react/src/functions/get-content/generate-content-url.js +55 -0
- package/packages/react/src/functions/get-content/generate-content-url.test.js +31 -0
- package/packages/react/src/functions/get-content/index.js +65 -0
- package/packages/react/src/functions/get-content/types.js +0 -0
- package/packages/react/src/functions/get-fetch.js +14 -0
- package/packages/react/src/functions/get-global-this.js +18 -0
- package/packages/react/src/functions/get-processed-block.js +59 -0
- package/packages/react/src/functions/get-processed-block.test.js +32 -0
- package/packages/{_rsc/src/blocks/BaseText.js → react/src/functions/get-react-native-block-styles.js} +14 -8
- package/packages/react/src/functions/if-target.js +15 -0
- package/packages/react/src/functions/is-browser.js +6 -0
- package/packages/react/src/functions/is-editing.js +7 -0
- package/packages/react/src/functions/is-iframe.js +7 -0
- package/packages/react/src/functions/is-previewing.js +14 -0
- package/packages/react/src/functions/on-change.js +27 -0
- package/packages/react/src/functions/on-change.test.js +19 -0
- package/packages/react/src/functions/register-component.js +68 -0
- package/packages/react/src/functions/register.js +29 -0
- package/packages/react/src/functions/sanitize-react-native-block-styles.js +66 -0
- package/packages/react/src/functions/set-editor-settings.js +15 -0
- package/packages/react/src/functions/set.js +11 -0
- package/packages/react/src/functions/set.test.js +16 -0
- package/packages/react/src/functions/track/helpers.js +50 -0
- package/packages/react/src/functions/track/index.js +128 -0
- package/packages/react/src/functions/track/interaction.js +53 -0
- package/packages/react/src/functions/transform-block-properties.js +6 -0
- package/packages/react/src/functions/transform-block.js +6 -0
- package/packages/react/src/helpers/ab-tests.js +16 -0
- package/packages/react/src/helpers/cookie.js +81 -0
- package/packages/react/src/helpers/css.js +34 -0
- package/packages/{_rsc/src/blocks/input/input.js → react/src/helpers/flatten.js} +12 -14
- package/packages/react/src/helpers/localStorage.js +35 -0
- package/packages/react/src/helpers/nullable.js +4 -0
- package/packages/react/src/helpers/sessionId.js +52 -0
- package/packages/react/src/helpers/time.js +5 -0
- package/packages/react/src/helpers/url.js +13 -0
- package/packages/react/src/helpers/url.test.js +21 -0
- package/packages/react/src/helpers/uuid.js +13 -0
- package/packages/react/src/helpers/visitorId.js +34 -0
- package/packages/react/src/index-helpers/blocks-exports.js +22 -0
- package/packages/react/src/index-helpers/top-of-file.js +4 -0
- package/packages/react/src/index.js +14 -0
- package/packages/react/src/scripts/init-editing.js +93 -0
- package/packages/react/src/types/builder-block.js +0 -0
- package/packages/react/src/types/builder-content.js +0 -0
- package/packages/react/src/types/can-track.js +0 -0
- package/packages/react/src/types/components.js +0 -0
- package/packages/react/src/types/deep-partial.js +0 -0
- package/packages/react/src/types/element.js +0 -0
- package/packages/react/src/types/targets.js +0 -0
- package/packages/react/src/types/typescript.js +0 -0
- package/packages/rsc/src/blocks/BaseText.jsx +10 -0
- package/packages/rsc/src/blocks/button/button.jsx +29 -0
- package/packages/rsc/src/blocks/button/component-info.js +41 -0
- package/packages/rsc/src/blocks/columns/columns.jsx +172 -0
- package/packages/rsc/src/blocks/columns/component-info.js +242 -0
- package/packages/rsc/src/blocks/custom-code/component-info.js +31 -0
- package/packages/rsc/src/blocks/custom-code/custom-code.jsx +55 -0
- package/packages/rsc/src/blocks/embed/component-info.js +44 -0
- package/packages/rsc/src/blocks/embed/embed.jsx +43 -0
- package/packages/rsc/src/blocks/embed/helpers.js +9 -0
- package/packages/rsc/src/blocks/form/component-info.js +262 -0
- package/packages/rsc/src/blocks/form/form.jsx +259 -0
- package/packages/rsc/src/blocks/fragment/component-info.js +11 -0
- package/packages/rsc/src/blocks/fragment/fragment.jsx +7 -0
- package/packages/rsc/src/blocks/image/component-info.js +151 -0
- package/packages/rsc/src/blocks/image/image.helpers.js +48 -0
- package/packages/rsc/src/blocks/image/image.jsx +122 -0
- package/packages/rsc/src/blocks/img/component-info.js +20 -0
- package/packages/rsc/src/blocks/img/img.jsx +19 -0
- package/packages/rsc/src/blocks/input/component-info.js +74 -0
- package/packages/rsc/src/blocks/input/input.jsx +21 -0
- package/packages/rsc/src/blocks/raw-text/component-info.js +16 -0
- package/packages/rsc/src/blocks/raw-text/raw-text.jsx +12 -0
- package/packages/rsc/src/blocks/section/component-info.js +49 -0
- package/packages/rsc/src/blocks/section/section.jsx +29 -0
- package/packages/rsc/src/blocks/select/component-info.js +59 -0
- package/packages/rsc/src/blocks/select/select.jsx +22 -0
- package/packages/rsc/src/blocks/submit-button/component-info.js +28 -0
- package/packages/rsc/src/blocks/submit-button/submit-button.jsx +11 -0
- package/packages/rsc/src/blocks/symbol/component-info.js +43 -0
- package/packages/rsc/src/blocks/symbol/symbol.jsx +56 -0
- package/packages/rsc/src/blocks/text/component-info.js +24 -0
- package/packages/rsc/src/blocks/text/text.jsx +12 -0
- package/packages/rsc/src/blocks/textarea/component-info.js +47 -0
- package/packages/rsc/src/blocks/textarea/textarea.jsx +15 -0
- package/packages/rsc/src/blocks/util.js +8 -0
- package/packages/rsc/src/blocks/video/component-info.js +106 -0
- package/packages/rsc/src/blocks/video/video.jsx +61 -0
- package/packages/rsc/src/components/render-block/block-styles.jsx +72 -0
- package/packages/rsc/src/components/render-block/render-block.helpers.js +113 -0
- package/packages/rsc/src/components/render-block/render-block.jsx +183 -0
- package/packages/rsc/src/components/render-block/render-component.jsx +37 -0
- package/packages/rsc/src/components/render-block/render-repeated-block.jsx +24 -0
- package/packages/rsc/src/components/render-block/types.js +0 -0
- package/packages/rsc/src/components/render-blocks.jsx +90 -0
- package/packages/rsc/src/components/render-content/builder-editing.jsx +7 -0
- package/packages/rsc/src/components/render-content/components/render-styles.jsx +70 -0
- package/packages/rsc/src/components/render-content/index.js +4 -0
- package/packages/rsc/src/components/render-content/render-content.jsx +245 -0
- package/packages/rsc/src/components/render-inlined-styles.jsx +31 -0
- package/packages/rsc/src/constants/builder-registered-components.js +54 -0
- package/packages/rsc/src/constants/device-sizes.js +48 -0
- package/packages/rsc/src/constants/target.js +4 -0
- package/packages/rsc/src/context/builder.context.js +11 -0
- package/packages/rsc/src/context/types.js +0 -0
- package/packages/rsc/src/functions/camel-to-kebab-case.js +4 -0
- package/packages/rsc/src/functions/evaluate.js +6 -0
- package/packages/rsc/src/functions/event-handler-name.js +7 -0
- package/packages/rsc/src/functions/extract-text-styles.js +22 -0
- package/packages/rsc/src/functions/fast-clone.js +4 -0
- package/packages/rsc/src/functions/get-block-actions-handler.js +11 -0
- package/packages/rsc/src/functions/get-block-actions.js +18 -0
- package/packages/{_rsc/src/blocks/text/text.js → rsc/src/functions/get-block-component-options.js} +8 -7
- package/packages/rsc/src/functions/get-block-properties.js +50 -0
- package/packages/rsc/src/functions/get-block-tag.js +6 -0
- package/packages/rsc/src/functions/get-builder-search-params/fn.test.js +13 -0
- package/packages/rsc/src/functions/get-builder-search-params/index.js +38 -0
- package/packages/rsc/src/functions/get-content/ab-testing.js +99 -0
- package/packages/rsc/src/functions/get-content/generate-content-url.js +55 -0
- package/packages/rsc/src/functions/get-content/generate-content-url.test.js +31 -0
- package/packages/rsc/src/functions/get-content/index.js +65 -0
- package/packages/rsc/src/functions/get-content/types.js +0 -0
- package/packages/rsc/src/functions/get-fetch.js +14 -0
- package/packages/rsc/src/functions/get-global-this.js +18 -0
- package/packages/rsc/src/functions/get-processed-block.js +59 -0
- package/packages/rsc/src/functions/get-processed-block.test.js +32 -0
- package/packages/{_rsc/src/blocks/raw-text/raw-text.js → rsc/src/functions/get-react-native-block-styles.js} +14 -9
- package/packages/rsc/src/functions/if-target.js +15 -0
- package/packages/rsc/src/functions/is-browser.js +6 -0
- package/packages/rsc/src/functions/is-editing.js +7 -0
- package/packages/rsc/src/functions/is-iframe.js +7 -0
- package/packages/rsc/src/functions/is-previewing.js +14 -0
- package/packages/rsc/src/functions/on-change.js +27 -0
- package/packages/rsc/src/functions/on-change.test.js +19 -0
- package/packages/rsc/src/functions/register-component.js +68 -0
- package/packages/rsc/src/functions/register.js +29 -0
- package/packages/rsc/src/functions/sanitize-react-native-block-styles.js +66 -0
- package/packages/rsc/src/functions/set-editor-settings.js +15 -0
- package/packages/rsc/src/functions/set.js +11 -0
- package/packages/rsc/src/functions/set.test.js +16 -0
- package/packages/rsc/src/functions/track/helpers.js +50 -0
- package/packages/rsc/src/functions/track/index.js +128 -0
- package/packages/rsc/src/functions/track/interaction.js +53 -0
- package/packages/rsc/src/functions/transform-block-properties.js +6 -0
- package/packages/rsc/src/functions/transform-block.js +6 -0
- package/packages/rsc/src/helpers/ab-tests.js +16 -0
- package/packages/rsc/src/helpers/cookie.js +81 -0
- package/packages/rsc/src/helpers/css.js +34 -0
- package/packages/{_rsc/src/blocks/section/section.js → rsc/src/helpers/flatten.js} +12 -18
- package/packages/rsc/src/helpers/localStorage.js +35 -0
- package/packages/rsc/src/helpers/nullable.js +4 -0
- package/packages/rsc/src/helpers/sessionId.js +52 -0
- package/packages/rsc/src/helpers/time.js +5 -0
- package/packages/rsc/src/helpers/url.js +13 -0
- package/packages/rsc/src/helpers/url.test.js +21 -0
- package/packages/rsc/src/helpers/uuid.js +13 -0
- package/packages/rsc/src/helpers/visitorId.js +34 -0
- package/packages/rsc/src/index-helpers/blocks-exports.js +22 -0
- package/packages/rsc/src/index-helpers/top-of-file.js +2 -0
- package/packages/rsc/src/index.js +14 -0
- package/packages/rsc/src/scripts/init-editing.js +93 -0
- package/packages/rsc/src/types/builder-block.js +0 -0
- package/packages/rsc/src/types/builder-content.js +0 -0
- package/packages/rsc/src/types/can-track.js +0 -0
- package/packages/rsc/src/types/components.js +0 -0
- package/packages/rsc/src/types/deep-partial.js +0 -0
- package/packages/rsc/src/types/element.js +0 -0
- package/packages/rsc/src/types/targets.js +0 -0
- package/packages/rsc/src/types/typescript.js +0 -0
- package/src/blocks/BaseText.jsx +4 -7
- package/src/blocks/button/button.jsx +25 -32
- package/src/blocks/columns/columns.jsx +83 -59
- package/src/blocks/custom-code/custom-code.jsx +29 -15
- package/src/blocks/embed/embed.jsx +15 -11
- package/src/blocks/form/form.jsx +184 -148
- package/src/blocks/fragment/fragment.jsx +3 -5
- package/src/blocks/image/image.jsx +80 -56
- package/src/blocks/img/img.jsx +14 -29
- package/src/blocks/input/input.jsx +16 -32
- package/src/blocks/raw-text/raw-text.jsx +8 -9
- package/src/blocks/section/section.jsx +25 -37
- package/src/blocks/select/select.jsx +17 -32
- package/src/blocks/submit-button/submit-button.jsx +7 -23
- package/src/blocks/symbol/symbol.jsx +59 -48
- package/src/blocks/text/text.jsx +8 -8
- package/src/blocks/textarea/textarea.jsx +11 -29
- package/src/blocks/video/video.jsx +52 -48
- package/src/components/render-block/block-styles.jsx +48 -29
- package/src/components/render-block/render-block.jsx +150 -100
- package/src/components/render-block/render-component-with-context.jsx +35 -32
- package/src/components/render-block/render-component.jsx +30 -32
- package/src/components/render-block/render-repeated-block.jsx +30 -30
- package/src/components/render-blocks.jsx +73 -47
- package/src/components/render-content/builder-editing.jsx +3 -5
- package/src/components/render-content/components/render-styles.jsx +21 -15
- package/src/components/render-content/index.js +1 -1
- package/src/components/render-content/render-content.jsx +207 -133
- package/src/components/render-inlined-styles.jsx +19 -8
- package/src/constants/builder-registered-components.js +11 -11
- package/src/index-helpers/blocks-exports.js +10 -10
- package/tsconfig.base.json +18 -0
- package/tsconfig.react.json +7 -0
- package/tsconfig.rsc.json +7 -0
- package/packages/_rsc/src/blocks/button/button.js +0 -35
- package/packages/_rsc/src/blocks/custom-code/custom-code.js +0 -63
- package/packages/_rsc/src/blocks/embed/embed.js +0 -55
- package/packages/_rsc/src/blocks/form/form.js +0 -222
- package/packages/_rsc/src/blocks/fragment/fragment.js +0 -24
- package/packages/_rsc/src/blocks/image/image.js +0 -101
- package/packages/_rsc/src/blocks/img/img.js +0 -33
- package/packages/_rsc/src/blocks/select/select.js +0 -36
- package/packages/_rsc/src/blocks/submit-button/submit-button.js +0 -26
- package/packages/_rsc/src/blocks/symbol/symbol.js +0 -60
- package/packages/_rsc/src/blocks/video/video.js +0 -57
- package/packages/_rsc/src/components/render-block/block-styles.js +0 -70
- package/packages/_rsc/src/components/render-block/render-block.js +0 -211
- package/packages/_rsc/src/components/render-block/render-component-with-context.js +0 -51
- package/packages/_rsc/src/components/render-block/render-component.js +0 -43
- package/packages/_rsc/src/components/render-block/render-repeated-block.js +0 -49
- package/packages/_rsc/src/components/render-blocks.js +0 -80
- package/packages/_rsc/src/components/render-content/builder-editing.js +0 -35
- package/packages/_rsc/src/components/render-content/components/render-styles.js +0 -78
- package/packages/_rsc/src/components/render-content/render-content.js +0 -216
- package/packages/_rsc/src/components/render-inlined-styles.js +0 -36
|
@@ -1,24 +1,5 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
1
|
import * as React from "react";
|
|
21
|
-
import { useState, useRef, useEffect } from "react";
|
|
2
|
+
import { useState, useContext, useRef, useEffect } from "react";
|
|
22
3
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
23
4
|
import { TARGET } from "../../constants/target.js";
|
|
24
5
|
import { evaluate } from "../../functions/evaluate.js";
|
|
@@ -29,207 +10,283 @@ import { isEditing } from "../../functions/is-editing.js";
|
|
|
29
10
|
import { isPreviewing } from "../../functions/is-previewing.js";
|
|
30
11
|
import {
|
|
31
12
|
components,
|
|
32
|
-
createRegisterComponentMessage
|
|
13
|
+
createRegisterComponentMessage,
|
|
33
14
|
} from "../../functions/register-component.js";
|
|
34
15
|
import { _track } from "../../functions/track.js";
|
|
35
|
-
import RenderBlocks from "../render-blocks.
|
|
36
|
-
import RenderContentStyles from "./components/render-styles.
|
|
16
|
+
import RenderBlocks from "../render-blocks.js";
|
|
17
|
+
import RenderContentStyles from "./components/render-styles.js";
|
|
37
18
|
import BuilderContext from "../../context/builder.context.js";
|
|
38
19
|
import {
|
|
39
20
|
registerInsertMenu,
|
|
40
|
-
setupBrowserForEditing
|
|
21
|
+
setupBrowserForEditing,
|
|
41
22
|
} from "../../scripts/init-editing.js";
|
|
42
23
|
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
|
|
25
|
+
export default function RenderContent(props) {
|
|
45
26
|
const elementRef = useRef(null);
|
|
46
27
|
const [forceReRenderCount, setForceReRenderCount] = useState(() => 0);
|
|
28
|
+
|
|
47
29
|
const [overrideContent, setOverrideContent] = useState(() => null);
|
|
30
|
+
|
|
48
31
|
function useContent() {
|
|
49
|
-
var _a2, _b2, _c2, _d2, _e2;
|
|
50
32
|
if (!props.content && !overrideContent) {
|
|
51
|
-
return
|
|
33
|
+
return undefined;
|
|
52
34
|
}
|
|
53
|
-
const mergedContent =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
35
|
+
const mergedContent = {
|
|
36
|
+
...props.content,
|
|
37
|
+
...overrideContent,
|
|
38
|
+
data: {
|
|
39
|
+
...props.content?.data,
|
|
40
|
+
...props.data,
|
|
41
|
+
...overrideContent?.data,
|
|
42
|
+
},
|
|
43
|
+
meta: {
|
|
44
|
+
...props.content?.meta,
|
|
45
|
+
...overrideContent?.meta,
|
|
46
|
+
breakpoints:
|
|
47
|
+
useBreakpoints ||
|
|
48
|
+
overrideContent?.meta?.breakpoints ||
|
|
49
|
+
props.content?.meta?.breakpoints,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
59
52
|
return mergedContent;
|
|
60
53
|
}
|
|
54
|
+
|
|
61
55
|
const [update, setUpdate] = useState(() => 0);
|
|
56
|
+
|
|
62
57
|
const [useBreakpoints, setUseBreakpoints] = useState(() => null);
|
|
58
|
+
|
|
63
59
|
function canTrackToUse() {
|
|
64
60
|
return checkIsDefined(props.canTrack) ? props.canTrack : true;
|
|
65
61
|
}
|
|
62
|
+
|
|
66
63
|
const [overrideState, setOverrideState] = useState(() => ({}));
|
|
64
|
+
|
|
67
65
|
function contentState() {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
return {
|
|
67
|
+
...props.content?.data?.state,
|
|
68
|
+
...props.data,
|
|
69
|
+
...(props.locale
|
|
70
|
+
? {
|
|
71
|
+
locale: props.locale,
|
|
72
|
+
}
|
|
73
|
+
: {}),
|
|
74
|
+
...overrideState,
|
|
75
|
+
};
|
|
72
76
|
}
|
|
77
|
+
|
|
73
78
|
function contextContext() {
|
|
74
79
|
return props.context || {};
|
|
75
80
|
}
|
|
81
|
+
|
|
76
82
|
function allRegisteredComponents() {
|
|
77
83
|
const allComponentsArray = [
|
|
78
84
|
...getDefaultRegisteredComponents(),
|
|
85
|
+
// While this `components` object is deprecated, we must maintain support for it.
|
|
86
|
+
// Since users are able to override our default components, we need to make sure that we do not break such
|
|
87
|
+
// existing usage.
|
|
88
|
+
// This is why we spread `components` after the default Builder.io components, but before the `props.customComponents`,
|
|
89
|
+
// which is the new standard way of providing custom components, and must therefore take precedence.
|
|
79
90
|
...components,
|
|
80
|
-
...props.customComponents || []
|
|
91
|
+
...(props.customComponents || []),
|
|
81
92
|
];
|
|
82
|
-
const allComponents = allComponentsArray.reduce(
|
|
83
|
-
|
|
84
|
-
|
|
93
|
+
const allComponents = allComponentsArray.reduce(
|
|
94
|
+
(acc, curr) => ({
|
|
95
|
+
...acc,
|
|
96
|
+
[curr.name]: curr,
|
|
97
|
+
}),
|
|
98
|
+
{}
|
|
99
|
+
);
|
|
85
100
|
return allComponents;
|
|
86
101
|
}
|
|
102
|
+
|
|
87
103
|
function processMessage(event) {
|
|
88
|
-
var _a2;
|
|
89
104
|
const { data } = event;
|
|
90
105
|
if (data) {
|
|
91
106
|
switch (data.type) {
|
|
92
107
|
case "builder.configureSdk": {
|
|
93
108
|
const messageContent = data.data;
|
|
94
109
|
const { breakpoints, contentId } = messageContent;
|
|
95
|
-
if (!contentId || contentId !==
|
|
110
|
+
if (!contentId || contentId !== useContent?.()?.id) {
|
|
96
111
|
return;
|
|
97
112
|
}
|
|
98
113
|
setUseBreakpoints(breakpoints);
|
|
99
|
-
setForceReRenderCount(forceReRenderCount + 1);
|
|
114
|
+
setForceReRenderCount(forceReRenderCount + 1); // This is a hack to force Qwik to re-render.
|
|
100
115
|
break;
|
|
101
116
|
}
|
|
102
117
|
case "builder.contentUpdate": {
|
|
103
118
|
const messageContent = data.data;
|
|
104
|
-
const key =
|
|
119
|
+
const key =
|
|
120
|
+
messageContent.key ||
|
|
121
|
+
messageContent.alias ||
|
|
122
|
+
messageContent.entry ||
|
|
123
|
+
messageContent.modelName;
|
|
105
124
|
const contentData = messageContent.data;
|
|
106
125
|
if (key === props.model) {
|
|
107
126
|
setOverrideContent(contentData);
|
|
108
|
-
setForceReRenderCount(forceReRenderCount + 1);
|
|
127
|
+
setForceReRenderCount(forceReRenderCount + 1); // This is a hack to force Qwik to re-render.
|
|
109
128
|
}
|
|
129
|
+
|
|
110
130
|
break;
|
|
111
131
|
}
|
|
112
132
|
case "builder.patchUpdates": {
|
|
133
|
+
// TODO
|
|
113
134
|
break;
|
|
114
135
|
}
|
|
115
136
|
}
|
|
116
137
|
}
|
|
117
138
|
}
|
|
139
|
+
|
|
118
140
|
function evaluateJsCode() {
|
|
119
|
-
|
|
120
|
-
const jsCode =
|
|
141
|
+
// run any dynamic JS code attached to content
|
|
142
|
+
const jsCode = useContent?.()?.data?.jsCode;
|
|
121
143
|
if (jsCode) {
|
|
122
144
|
evaluate({
|
|
123
145
|
code: jsCode,
|
|
124
146
|
context: contextContext(),
|
|
125
|
-
state: contentState()
|
|
147
|
+
state: contentState(),
|
|
126
148
|
});
|
|
127
149
|
}
|
|
128
150
|
}
|
|
151
|
+
|
|
129
152
|
function httpReqsData() {
|
|
130
153
|
return {};
|
|
131
154
|
}
|
|
155
|
+
|
|
132
156
|
function onClick(_event) {
|
|
133
|
-
var _a2, _b2;
|
|
134
157
|
if (useContent()) {
|
|
135
|
-
const variationId =
|
|
136
|
-
const contentId =
|
|
158
|
+
const variationId = useContent?.()?.testVariationId;
|
|
159
|
+
const contentId = useContent?.()?.id;
|
|
137
160
|
_track({
|
|
138
161
|
type: "click",
|
|
139
162
|
canTrack: canTrackToUse(),
|
|
140
163
|
contentId,
|
|
141
164
|
apiKey: props.apiKey,
|
|
142
|
-
variationId: variationId !== contentId ? variationId :
|
|
165
|
+
variationId: variationId !== contentId ? variationId : undefined,
|
|
143
166
|
});
|
|
144
167
|
}
|
|
145
168
|
}
|
|
169
|
+
|
|
146
170
|
function evalExpression(expression) {
|
|
147
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
171
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) =>
|
|
172
|
+
evaluate({
|
|
173
|
+
code: group,
|
|
174
|
+
context: contextContext(),
|
|
175
|
+
state: contentState(),
|
|
176
|
+
})
|
|
177
|
+
);
|
|
152
178
|
}
|
|
179
|
+
|
|
153
180
|
function handleRequest({ url, key }) {
|
|
154
|
-
fetch(url)
|
|
155
|
-
|
|
156
|
-
|
|
181
|
+
fetch(url)
|
|
182
|
+
.then((response) => response.json())
|
|
183
|
+
.then((json) => {
|
|
184
|
+
const newOverrideState = {
|
|
185
|
+
...overrideState,
|
|
186
|
+
[key]: json,
|
|
187
|
+
};
|
|
188
|
+
setOverrideState(newOverrideState);
|
|
189
|
+
})
|
|
190
|
+
.catch((err) => {
|
|
191
|
+
console.log("error fetching dynamic data", url, err);
|
|
157
192
|
});
|
|
158
|
-
setOverrideState(newOverrideState);
|
|
159
|
-
}).catch((err) => {
|
|
160
|
-
console.log("error fetching dynamic data", url, err);
|
|
161
|
-
});
|
|
162
193
|
}
|
|
194
|
+
|
|
163
195
|
function runHttpRequests() {
|
|
164
|
-
|
|
165
|
-
const requests = (_c2 = (_b2 = (_a2 = useContent == null ? void 0 : useContent()) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests) != null ? _c2 : {};
|
|
196
|
+
const requests = useContent?.()?.data?.httpRequests ?? {};
|
|
166
197
|
Object.entries(requests).forEach(([key, url]) => {
|
|
167
198
|
if (url && (!httpReqsData()[key] || isEditing())) {
|
|
168
199
|
const evaluatedUrl = evalExpression(url);
|
|
169
200
|
handleRequest({
|
|
170
201
|
url: evaluatedUrl,
|
|
171
|
-
key
|
|
202
|
+
key,
|
|
172
203
|
});
|
|
173
204
|
}
|
|
174
205
|
});
|
|
175
206
|
}
|
|
207
|
+
|
|
176
208
|
function emitStateUpdate() {
|
|
177
209
|
if (isEditing()) {
|
|
178
|
-
window.dispatchEvent(
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
210
|
+
window.dispatchEvent(
|
|
211
|
+
new CustomEvent("builder:component:stateChange", {
|
|
212
|
+
detail: {
|
|
213
|
+
state: contentState(),
|
|
214
|
+
ref: {
|
|
215
|
+
name: props.model,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
})
|
|
219
|
+
);
|
|
186
220
|
}
|
|
187
221
|
}
|
|
222
|
+
|
|
188
223
|
function shouldRenderContentStyles() {
|
|
189
|
-
|
|
190
|
-
|
|
224
|
+
return Boolean(
|
|
225
|
+
(useContent?.()?.data?.cssCode ||
|
|
226
|
+
useContent?.()?.data?.customFonts?.length) &&
|
|
227
|
+
TARGET !== "reactNative"
|
|
228
|
+
);
|
|
191
229
|
}
|
|
230
|
+
|
|
192
231
|
useEffect(() => {
|
|
193
|
-
var _a2, _b2;
|
|
194
232
|
if (!props.apiKey) {
|
|
195
|
-
console.error(
|
|
233
|
+
console.error(
|
|
234
|
+
"[Builder.io]: No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
235
|
+
);
|
|
196
236
|
}
|
|
197
237
|
if (isBrowser()) {
|
|
198
238
|
if (isEditing()) {
|
|
199
239
|
setForceReRenderCount(forceReRenderCount + 1);
|
|
200
240
|
registerInsertMenu();
|
|
201
|
-
setupBrowserForEditing(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
241
|
+
setupBrowserForEditing({
|
|
242
|
+
...(props.locale
|
|
243
|
+
? {
|
|
244
|
+
locale: props.locale,
|
|
245
|
+
}
|
|
246
|
+
: {}),
|
|
247
|
+
...(props.includeRefs
|
|
248
|
+
? {
|
|
249
|
+
includeRefs: props.includeRefs,
|
|
250
|
+
}
|
|
251
|
+
: {}),
|
|
210
252
|
});
|
|
253
|
+
Object.values(allRegisteredComponents()).forEach(
|
|
254
|
+
(registeredComponent) => {
|
|
255
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
256
|
+
window.parent?.postMessage(message, "*");
|
|
257
|
+
}
|
|
258
|
+
);
|
|
211
259
|
window.addEventListener("message", processMessage);
|
|
212
|
-
window.addEventListener(
|
|
260
|
+
window.addEventListener(
|
|
261
|
+
"builder:component:stateChangeListenerActivated",
|
|
262
|
+
emitStateUpdate
|
|
263
|
+
);
|
|
213
264
|
}
|
|
214
265
|
if (useContent()) {
|
|
215
|
-
const variationId =
|
|
216
|
-
const contentId =
|
|
266
|
+
const variationId = useContent?.()?.testVariationId;
|
|
267
|
+
const contentId = useContent?.()?.id;
|
|
217
268
|
_track({
|
|
218
269
|
type: "impression",
|
|
219
270
|
canTrack: canTrackToUse(),
|
|
220
271
|
contentId,
|
|
221
272
|
apiKey: props.apiKey,
|
|
222
|
-
variationId: variationId !== contentId ? variationId :
|
|
273
|
+
variationId: variationId !== contentId ? variationId : undefined,
|
|
223
274
|
});
|
|
224
275
|
}
|
|
276
|
+
|
|
277
|
+
// override normal content in preview mode
|
|
225
278
|
if (isPreviewing()) {
|
|
226
279
|
const searchParams = new URL(location.href).searchParams;
|
|
227
|
-
if (
|
|
228
|
-
|
|
280
|
+
if (
|
|
281
|
+
props.model &&
|
|
282
|
+
searchParams.get("builder.preview") === props.model
|
|
283
|
+
) {
|
|
284
|
+
const previewApiKey =
|
|
285
|
+
searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
229
286
|
if (previewApiKey) {
|
|
230
287
|
getContent({
|
|
231
288
|
model: props.model,
|
|
232
|
-
apiKey: previewApiKey
|
|
289
|
+
apiKey: previewApiKey,
|
|
233
290
|
}).then((content) => {
|
|
234
291
|
if (content) {
|
|
235
292
|
setOverrideContent(content);
|
|
@@ -243,54 +300,71 @@ function RenderContent(props) {
|
|
|
243
300
|
emitStateUpdate();
|
|
244
301
|
}
|
|
245
302
|
}, []);
|
|
303
|
+
|
|
246
304
|
useEffect(() => {
|
|
247
305
|
evaluateJsCode();
|
|
248
|
-
}, [
|
|
306
|
+
}, [useContent?.()?.data?.jsCode, contentState()]);
|
|
249
307
|
useEffect(() => {
|
|
250
308
|
runHttpRequests();
|
|
251
|
-
}, [
|
|
309
|
+
}, [useContent?.()?.data?.httpRequests]);
|
|
252
310
|
useEffect(() => {
|
|
253
311
|
emitStateUpdate();
|
|
254
312
|
}, [contentState()]);
|
|
313
|
+
|
|
255
314
|
useEffect(() => {
|
|
256
315
|
return () => {
|
|
257
316
|
if (isBrowser()) {
|
|
258
317
|
window.removeEventListener("message", processMessage);
|
|
259
|
-
window.removeEventListener(
|
|
318
|
+
window.removeEventListener(
|
|
319
|
+
"builder:component:stateChangeListenerActivated",
|
|
320
|
+
emitStateUpdate
|
|
321
|
+
);
|
|
260
322
|
}
|
|
261
323
|
};
|
|
262
324
|
}, []);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<BuilderContext.Provider
|
|
328
|
+
value={{
|
|
329
|
+
get content() {
|
|
330
|
+
return useContent();
|
|
331
|
+
},
|
|
332
|
+
get state() {
|
|
333
|
+
return contentState();
|
|
334
|
+
},
|
|
335
|
+
get context() {
|
|
336
|
+
return contextContext();
|
|
337
|
+
},
|
|
338
|
+
get apiKey() {
|
|
339
|
+
return props.apiKey;
|
|
340
|
+
},
|
|
341
|
+
get registeredComponents() {
|
|
342
|
+
return allRegisteredComponents();
|
|
343
|
+
},
|
|
344
|
+
}}
|
|
345
|
+
>
|
|
346
|
+
{useContent() ? (
|
|
347
|
+
<>
|
|
348
|
+
<div
|
|
349
|
+
ref={elementRef}
|
|
350
|
+
onClick={(event) => onClick(event)}
|
|
351
|
+
builder-content-id={useContent?.()?.id}
|
|
352
|
+
builder-model={props.model}
|
|
353
|
+
>
|
|
354
|
+
{shouldRenderContentStyles() ? (
|
|
355
|
+
<RenderContentStyles
|
|
356
|
+
cssCode={useContent?.()?.data?.cssCode}
|
|
357
|
+
customFonts={useContent?.()?.data?.customFonts}
|
|
358
|
+
/>
|
|
359
|
+
) : null}
|
|
360
|
+
|
|
361
|
+
<RenderBlocks
|
|
362
|
+
blocks={useContent?.()?.data?.blocks}
|
|
363
|
+
key={forceReRenderCount}
|
|
364
|
+
/>
|
|
365
|
+
</div>
|
|
366
|
+
</>
|
|
367
|
+
) : null}
|
|
368
|
+
</BuilderContext.Provider>
|
|
369
|
+
);
|
|
293
370
|
}
|
|
294
|
-
export {
|
|
295
|
-
RenderContent as default
|
|
296
|
-
};
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { TARGET } from "../constants/target.js";
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
export default function RenderInlinedStyles(props) {
|
|
4
5
|
function injectedStyleScript() {
|
|
5
6
|
return `<${tag()}>${props.styles}</${tag()}>`;
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
function tag() {
|
|
8
|
-
|
|
10
|
+
// NOTE: we have to obfusctate the name of the tag due to a limitation in the svelte-preprocessor plugin.
|
|
11
|
+
// https://github.com/sveltejs/vite-plugin-svelte/issues/315#issuecomment-1109000027
|
|
12
|
+
return "sty" + "le";
|
|
9
13
|
}
|
|
14
|
+
|
|
10
15
|
const TagRef = tag();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
{TARGET === "svelte" ? (
|
|
20
|
+
<>
|
|
21
|
+
<div dangerouslySetInnerHTML={{ __html: injectedStyleScript() }} />
|
|
22
|
+
</>
|
|
23
|
+
) : (
|
|
24
|
+
<TagRef>{props.styles}</TagRef>
|
|
25
|
+
)}
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
14
28
|
}
|
|
15
|
-
export {
|
|
16
|
-
RenderInlinedStyles as default
|
|
17
|
-
};
|
|
@@ -14,27 +14,27 @@ var __spreadValues = (a, b) => {
|
|
|
14
14
|
}
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
|
-
import { default as Button } from "../blocks/button/button.
|
|
17
|
+
import { default as Button } from "../blocks/button/button.js";
|
|
18
18
|
import { componentInfo as buttonComponentInfo } from "../blocks/button/component-info.js";
|
|
19
|
-
import { default as Columns } from "../blocks/columns/columns.
|
|
19
|
+
import { default as Columns } from "../blocks/columns/columns.js";
|
|
20
20
|
import { componentInfo as columnsComponentInfo } from "../blocks/columns/component-info.js";
|
|
21
21
|
import { componentInfo as fragmentComponentInfo } from "../blocks/fragment/component-info.js";
|
|
22
|
-
import { default as Fragment } from "../blocks/fragment/fragment.
|
|
22
|
+
import { default as Fragment } from "../blocks/fragment/fragment.js";
|
|
23
23
|
import { componentInfo as imageComponentInfo } from "../blocks/image/component-info.js";
|
|
24
|
-
import { default as Image } from "../blocks/image/image.
|
|
24
|
+
import { default as Image } from "../blocks/image/image.js";
|
|
25
25
|
import { componentInfo as sectionComponentInfo } from "../blocks/section/component-info.js";
|
|
26
|
-
import { default as Section } from "../blocks/section/section.
|
|
26
|
+
import { default as Section } from "../blocks/section/section.js";
|
|
27
27
|
import { componentInfo as symbolComponentInfo } from "../blocks/symbol/component-info.js";
|
|
28
|
-
import { default as Symbol } from "../blocks/symbol/symbol.
|
|
28
|
+
import { default as Symbol } from "../blocks/symbol/symbol.js";
|
|
29
29
|
import { componentInfo as textComponentInfo } from "../blocks/text/component-info.js";
|
|
30
|
-
import { default as Text } from "../blocks/text/text.
|
|
30
|
+
import { default as Text } from "../blocks/text/text.js";
|
|
31
31
|
import { componentInfo as videoComponentInfo } from "../blocks/video/component-info.js";
|
|
32
|
-
import { default as Video } from "../blocks/video/video.
|
|
32
|
+
import { default as Video } from "../blocks/video/video.js";
|
|
33
33
|
import { componentInfo as embedComponentInfo } from "../blocks/embed/component-info.js";
|
|
34
|
-
import { default as embed } from "../blocks/embed/embed.
|
|
35
|
-
import { default as Img } from "../blocks/img/img.
|
|
34
|
+
import { default as embed } from "../blocks/embed/embed.js";
|
|
35
|
+
import { default as Img } from "../blocks/img/img.js";
|
|
36
36
|
import { componentInfo as imgComponentInfo } from "../blocks/img/component-info.js";
|
|
37
|
-
import { default as customCode } from "../blocks/custom-code/custom-code.
|
|
37
|
+
import { default as customCode } from "../blocks/custom-code/custom-code.js";
|
|
38
38
|
import { componentInfo as customCodeInfo } from "../blocks/custom-code/component-info.js";
|
|
39
39
|
const getDefaultRegisteredComponents = () => [
|
|
40
40
|
__spreadValues({ component: Columns }, columnsComponentInfo),
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { default as default2 } from "../blocks/columns/columns.
|
|
2
|
-
import { default as default3 } from "../blocks/image/image.
|
|
3
|
-
import { default as default4 } from "../blocks/text/text.
|
|
4
|
-
import { default as default5 } from "../blocks/video/video.
|
|
5
|
-
import { default as default6 } from "../blocks/symbol/symbol.
|
|
6
|
-
import { default as default7 } from "../blocks/button/button.
|
|
7
|
-
import { default as default8 } from "../blocks/section/section.
|
|
8
|
-
import { default as default9 } from "../blocks/fragment/fragment.
|
|
9
|
-
import { default as default10 } from "../components/render-content/render-content.
|
|
10
|
-
import { default as default11 } from "../components/render-blocks.
|
|
1
|
+
import { default as default2 } from "../blocks/columns/columns.js";
|
|
2
|
+
import { default as default3 } from "../blocks/image/image.js";
|
|
3
|
+
import { default as default4 } from "../blocks/text/text.js";
|
|
4
|
+
import { default as default5 } from "../blocks/video/video.js";
|
|
5
|
+
import { default as default6 } from "../blocks/symbol/symbol.js";
|
|
6
|
+
import { default as default7 } from "../blocks/button/button.js";
|
|
7
|
+
import { default as default8 } from "../blocks/section/section.js";
|
|
8
|
+
import { default as default9 } from "../blocks/fragment/fragment.js";
|
|
9
|
+
import { default as default10 } from "../components/render-content/render-content.js";
|
|
10
|
+
import { default as default11 } from "../components/render-blocks.js";
|
|
11
11
|
export {
|
|
12
12
|
default7 as Button,
|
|
13
13
|
default2 as Columns,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": false,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "Node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "react"
|
|
17
|
+
}
|
|
18
|
+
}
|