@builder.io/sdk-react 0.2.1 → 0.2.3-0
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/react/blocks/BaseText.d.ts +2 -0
- package/dist/react/blocks/BaseText.js +1 -0
- package/dist/react/blocks/button/button.d.ts +2 -0
- package/dist/react/blocks/button/button.js +1 -0
- package/dist/react/blocks/button/component-info.d.ts +38 -0
- package/dist/react/blocks/columns/columns.d.ts +2 -0
- package/dist/react/blocks/columns/columns.js +1 -0
- package/dist/react/blocks/columns/component-info.d.ts +176 -0
- package/dist/react/blocks/custom-code/component-info.d.ts +31 -0
- package/dist/react/blocks/custom-code/custom-code.d.ts +2 -0
- package/dist/react/blocks/custom-code/custom-code.js +1 -0
- package/dist/react/blocks/embed/component-info.d.ts +22 -0
- package/dist/react/blocks/embed/embed.d.ts +2 -0
- package/dist/react/blocks/embed/embed.js +1 -0
- package/dist/react/blocks/embed/helpers.d.ts +1 -0
- package/dist/react/blocks/form/component-info.d.ts +235 -0
- package/dist/react/blocks/form/form.d.ts +2 -0
- package/dist/react/blocks/form/form.js +1 -0
- package/dist/react/blocks/fragment/component-info.d.ts +8 -0
- package/dist/react/blocks/fragment/fragment.d.ts +2 -0
- package/dist/react/blocks/fragment/fragment.js +1 -0
- package/dist/react/blocks/image/component-info.d.ts +114 -0
- package/dist/react/blocks/image/image.d.ts +2 -0
- package/dist/react/blocks/image/image.helpers.d.ts +1 -0
- package/dist/react/blocks/image/image.js +1 -0
- package/dist/react/blocks/img/component-info.d.ts +15 -0
- package/dist/react/blocks/img/img.d.ts +2 -0
- package/dist/react/blocks/img/img.js +1 -0
- package/dist/react/blocks/input/component-info.d.ts +66 -0
- package/dist/react/blocks/input/input.d.ts +2 -0
- package/dist/react/blocks/input/input.js +1 -0
- package/dist/react/blocks/raw-text/component-info.d.ts +10 -0
- package/dist/react/blocks/raw-text/raw-text.d.ts +2 -0
- package/dist/react/blocks/raw-text/raw-text.js +1 -0
- package/dist/react/blocks/section/component-info.d.ts +43 -0
- package/dist/react/blocks/section/section.d.ts +2 -0
- package/dist/react/blocks/section/section.js +1 -0
- package/dist/react/blocks/select/component-info.d.ts +61 -0
- package/dist/react/blocks/select/select.d.ts +2 -0
- package/dist/react/blocks/select/select.js +1 -0
- package/dist/react/blocks/submit-button/component-info.d.ts +23 -0
- package/dist/react/blocks/submit-button/submit-button.d.ts +2 -0
- package/dist/react/blocks/submit-button/submit-button.js +1 -0
- package/dist/react/blocks/symbol/component-info.d.ts +35 -0
- package/dist/react/blocks/symbol/symbol.d.ts +2 -0
- package/dist/react/blocks/symbol/symbol.js +3 -1
- package/dist/react/blocks/text/component-info.d.ts +19 -0
- package/dist/react/blocks/text/text.d.ts +2 -0
- package/dist/react/blocks/text/text.js +1 -0
- package/dist/react/blocks/textarea/component-info.d.ts +53 -0
- package/dist/react/blocks/textarea/textarea.d.ts +2 -0
- package/dist/react/blocks/textarea/textarea.js +1 -0
- package/dist/react/blocks/util.d.ts +1 -0
- package/dist/react/blocks/video/component-info.d.ts +80 -0
- package/dist/react/blocks/video/video.d.ts +2 -0
- package/dist/react/blocks/video/video.js +1 -0
- package/dist/react/components/render-block/block-styles.d.ts +2 -0
- package/dist/react/components/render-block/block-styles.js +1 -0
- package/dist/react/components/render-block/render-block.d.ts +2 -0
- package/dist/react/components/render-block/render-block.helpers.d.ts +13 -0
- package/dist/react/components/render-block/render-block.js +3 -3
- package/dist/react/components/render-block/render-component.d.ts +2 -0
- package/dist/react/components/render-block/render-component.js +1 -0
- package/dist/react/components/render-block/render-repeated-block.d.ts +2 -0
- package/dist/react/components/render-block/render-repeated-block.js +1 -0
- package/dist/react/components/render-blocks.d.ts +2 -0
- package/dist/react/components/render-blocks.js +1 -0
- package/dist/react/components/render-content/builder-editing.d.ts +2 -0
- package/dist/react/components/render-content/builder-editing.js +1 -0
- package/dist/react/components/render-content/components/render-styles.d.ts +2 -0
- package/dist/react/components/render-content/components/render-styles.helpers.d.ts +7 -0
- package/dist/react/components/render-content/components/render-styles.js +1 -0
- package/dist/react/components/render-content/index.d.ts +2 -0
- package/dist/react/components/render-content/render-content.d.ts +2 -0
- package/dist/react/components/render-content/render-content.helpers.d.ts +9 -0
- package/dist/react/components/render-content/render-content.js +9 -7
- package/dist/react/components/render-content-variants/helpers.js +98 -0
- package/dist/react/components/render-content-variants/render-content-variants.js +45 -0
- package/dist/react/components/render-inlined-styles.d.ts +2 -0
- package/dist/react/components/render-inlined-styles.js +1 -0
- package/dist/react/constants/builder-registered-components.d.ts +1 -0
- package/dist/react/constants/device-sizes.d.ts +21 -0
- package/dist/react/constants/target.d.ts +1 -0
- package/dist/react/context/builder.context.d.ts +11 -0
- package/dist/react/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/react/functions/evaluate.d.ts +7 -0
- package/dist/react/functions/event-handler-name.d.ts +1 -0
- package/dist/react/functions/extract-text-styles.d.ts +1 -0
- package/dist/react/functions/fast-clone.d.ts +1 -0
- package/dist/react/functions/get-block-actions-handler.d.ts +1 -0
- package/dist/react/functions/get-block-actions.d.ts +1 -0
- package/dist/react/functions/get-block-component-options.d.ts +1 -0
- package/dist/react/functions/get-block-properties.d.ts +1 -0
- package/dist/react/functions/get-block-properties.js +4 -1
- package/dist/react/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/react/functions/get-builder-search-params/index.d.ts +4 -0
- package/dist/react/functions/get-content/ab-testing.d.ts +1 -0
- package/dist/react/functions/get-content/generate-content-url.d.ts +1 -0
- package/dist/react/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/react/functions/get-content/index.d.ts +2 -0
- package/dist/react/functions/get-content/index.js +22 -15
- package/dist/react/functions/get-fetch.d.ts +1 -0
- package/dist/react/functions/get-global-this.d.ts +1 -0
- package/dist/react/functions/get-processed-block.d.ts +6 -0
- package/dist/react/functions/get-processed-block.test.d.ts +1 -0
- package/dist/react/functions/get-react-native-block-styles.d.ts +5 -0
- package/dist/react/functions/if-target.d.ts +5 -0
- package/dist/react/functions/is-browser.d.ts +1 -0
- package/dist/react/functions/is-editing.d.ts +1 -0
- package/dist/react/functions/is-iframe.d.ts +1 -0
- package/dist/react/functions/is-previewing.d.ts +1 -0
- package/dist/react/functions/on-change.d.ts +2 -0
- package/dist/react/functions/on-change.test.d.ts +1 -0
- package/dist/react/functions/register-component.d.ts +6 -0
- package/dist/react/functions/register.d.ts +1 -0
- package/dist/react/functions/sanitize-react-native-block-styles.d.ts +1 -0
- package/dist/react/functions/set-editor-settings.d.ts +1 -0
- package/dist/react/functions/set.d.ts +1 -0
- package/dist/react/functions/set.test.d.ts +1 -0
- package/dist/react/functions/track/helpers.d.ts +5 -0
- package/dist/react/functions/track/index.d.ts +2 -0
- package/dist/react/functions/track/index.js +2 -1
- package/dist/react/functions/track/interaction.d.ts +14 -0
- package/dist/react/functions/transform-block-properties.d.ts +1 -0
- package/dist/react/functions/transform-block.d.ts +1 -0
- package/dist/react/helpers/ab-tests.d.ts +9 -0
- package/dist/react/helpers/cookie.d.ts +2 -0
- package/dist/react/helpers/css.d.ts +7 -0
- package/dist/react/helpers/flatten.d.ts +1 -0
- package/dist/react/helpers/localStorage.d.ts +9 -0
- package/dist/react/helpers/logger.d.ts +5 -0
- package/dist/react/helpers/logger.js +7 -0
- package/dist/react/helpers/nullable.d.ts +1 -0
- package/dist/react/helpers/sessionId.d.ts +6 -0
- package/dist/react/helpers/time.d.ts +1 -0
- package/dist/react/helpers/url.d.ts +1 -0
- package/dist/react/helpers/url.test.d.ts +1 -0
- package/dist/react/helpers/uuid.d.ts +2 -0
- package/dist/react/helpers/visitorId.d.ts +8 -0
- package/dist/react/index-helpers/blocks-exports.d.ts +11 -0
- package/dist/react/index-helpers/top-of-file.d.ts +2 -0
- package/{src/index.js → dist/react/index.d.ts} +2 -5
- package/dist/react/scripts/init-editing.d.ts +2 -0
- package/dist/react/types/api-version.d.ts +1 -0
- package/dist/react/types/targets.d.ts +0 -0
- package/dist/react/types/typescript.d.ts +0 -0
- package/dist/rsc/blocks/BaseText.d.ts +2 -0
- package/dist/rsc/blocks/button/button.d.ts +2 -0
- package/dist/rsc/blocks/button/component-info.d.ts +38 -0
- package/dist/rsc/blocks/columns/columns.d.ts +2 -0
- package/dist/rsc/blocks/columns/component-info.d.ts +176 -0
- package/dist/rsc/blocks/custom-code/component-info.d.ts +31 -0
- package/dist/rsc/blocks/custom-code/custom-code.d.ts +2 -0
- package/dist/rsc/blocks/embed/component-info.d.ts +22 -0
- package/dist/rsc/blocks/embed/embed.d.ts +2 -0
- package/dist/rsc/blocks/embed/helpers.d.ts +1 -0
- package/dist/rsc/blocks/form/component-info.d.ts +235 -0
- package/dist/rsc/blocks/form/form.d.ts +2 -0
- package/dist/rsc/blocks/fragment/component-info.d.ts +8 -0
- package/dist/rsc/blocks/fragment/fragment.d.ts +2 -0
- package/dist/rsc/blocks/image/component-info.d.ts +114 -0
- package/dist/rsc/blocks/image/image.d.ts +2 -0
- package/dist/rsc/blocks/image/image.helpers.d.ts +1 -0
- package/dist/rsc/blocks/img/component-info.d.ts +15 -0
- package/dist/rsc/blocks/img/img.d.ts +2 -0
- package/dist/rsc/blocks/input/component-info.d.ts +66 -0
- package/dist/rsc/blocks/input/input.d.ts +2 -0
- package/dist/rsc/blocks/raw-text/component-info.d.ts +10 -0
- package/dist/rsc/blocks/raw-text/raw-text.d.ts +2 -0
- package/dist/rsc/blocks/section/component-info.d.ts +43 -0
- package/dist/rsc/blocks/section/section.d.ts +2 -0
- package/dist/rsc/blocks/select/component-info.d.ts +61 -0
- package/dist/rsc/blocks/select/select.d.ts +2 -0
- package/dist/rsc/blocks/submit-button/component-info.d.ts +23 -0
- package/dist/rsc/blocks/submit-button/submit-button.d.ts +2 -0
- package/dist/rsc/blocks/symbol/component-info.d.ts +35 -0
- package/dist/rsc/blocks/symbol/symbol.d.ts +2 -0
- package/dist/rsc/blocks/symbol/symbol.js +2 -1
- package/dist/rsc/blocks/text/component-info.d.ts +19 -0
- package/dist/rsc/blocks/text/text.d.ts +2 -0
- package/dist/rsc/blocks/textarea/component-info.d.ts +53 -0
- package/dist/rsc/blocks/textarea/textarea.d.ts +2 -0
- package/dist/rsc/blocks/util.d.ts +1 -0
- package/dist/rsc/blocks/video/component-info.d.ts +80 -0
- package/dist/rsc/blocks/video/video.d.ts +2 -0
- package/dist/rsc/components/render-block/block-styles.d.ts +2 -0
- package/dist/rsc/components/render-block/render-block.d.ts +2 -0
- package/dist/rsc/components/render-block/render-block.helpers.d.ts +10 -0
- package/dist/rsc/components/render-block/render-block.js +2 -3
- package/dist/rsc/components/render-block/render-component.d.ts +2 -0
- package/dist/rsc/components/render-block/render-repeated-block.d.ts +2 -0
- package/dist/rsc/components/render-block/types.d.ts +0 -0
- package/dist/rsc/components/render-blocks.d.ts +2 -0
- package/dist/rsc/components/render-content/builder-editing.d.ts +27 -0
- package/dist/rsc/components/render-content/components/render-styles.d.ts +2 -0
- package/dist/rsc/components/render-content/components/render-styles.helpers.d.ts +7 -0
- package/dist/rsc/components/render-content/index.d.ts +2 -0
- package/dist/rsc/components/render-content/render-content.d.ts +2 -0
- package/dist/rsc/components/render-content/render-content.helpers.d.ts +9 -0
- package/dist/rsc/components/render-content/render-content.js +1 -0
- package/dist/rsc/components/render-content/render-content.types.d.ts +0 -0
- package/dist/rsc/components/render-content-variants/helpers.js +99 -0
- package/dist/rsc/components/render-content-variants/render-content-variants.js +45 -0
- package/dist/rsc/components/render-inlined-styles.d.ts +2 -0
- package/dist/rsc/constants/builder-registered-components.d.ts +1 -0
- package/dist/rsc/constants/device-sizes.d.ts +21 -0
- package/dist/rsc/constants/target.d.ts +1 -0
- package/dist/rsc/context/builder.context.d.ts +11 -0
- package/dist/rsc/context/types.d.ts +0 -0
- package/dist/rsc/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/rsc/functions/evaluate.d.ts +1 -0
- package/dist/rsc/functions/event-handler-name.d.ts +1 -0
- package/dist/rsc/functions/extract-text-styles.d.ts +1 -0
- package/dist/rsc/functions/fast-clone.d.ts +1 -0
- package/dist/rsc/functions/get-block-actions-handler.d.ts +1 -0
- package/dist/rsc/functions/get-block-actions.d.ts +1 -0
- package/dist/rsc/functions/get-block-component-options.d.ts +1 -0
- package/dist/rsc/functions/get-block-properties.d.ts +1 -0
- package/dist/rsc/functions/get-block-properties.js +4 -1
- package/dist/rsc/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/rsc/functions/get-builder-search-params/index.d.ts +4 -0
- package/dist/rsc/functions/get-content/ab-testing.d.ts +1 -0
- package/dist/rsc/functions/get-content/generate-content-url.d.ts +1 -0
- package/dist/rsc/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/rsc/functions/get-content/index.d.ts +2 -0
- package/dist/rsc/functions/get-content/index.js +22 -15
- package/dist/rsc/functions/get-content/types.d.ts +0 -0
- package/dist/rsc/functions/get-fetch.d.ts +1 -0
- package/dist/rsc/functions/get-global-this.d.ts +1 -0
- package/dist/rsc/functions/get-processed-block.d.ts +6 -0
- package/dist/rsc/functions/get-processed-block.test.d.ts +1 -0
- package/dist/rsc/functions/get-react-native-block-styles.d.ts +5 -0
- package/dist/rsc/functions/if-target.d.ts +5 -0
- package/dist/rsc/functions/is-browser.d.ts +1 -0
- package/dist/rsc/functions/is-editing.d.ts +1 -0
- package/dist/rsc/functions/is-iframe.d.ts +1 -0
- package/dist/rsc/functions/is-previewing.d.ts +1 -0
- package/dist/rsc/functions/on-change.d.ts +2 -0
- package/dist/rsc/functions/on-change.test.d.ts +1 -0
- package/dist/rsc/functions/register-component.d.ts +6 -0
- package/dist/rsc/functions/register.d.ts +1 -0
- package/dist/rsc/functions/sanitize-react-native-block-styles.d.ts +1 -0
- package/dist/rsc/functions/set-editor-settings.d.ts +1 -0
- package/dist/rsc/functions/set.d.ts +1 -0
- package/dist/rsc/functions/set.test.d.ts +1 -0
- package/dist/rsc/functions/track/helpers.d.ts +5 -0
- package/dist/rsc/functions/track/index.d.ts +2 -0
- package/dist/rsc/functions/track/index.js +2 -1
- package/dist/rsc/functions/track/interaction.d.ts +14 -0
- package/dist/rsc/functions/transform-block-properties.d.ts +1 -0
- package/dist/rsc/functions/transform-block.d.ts +1 -0
- package/dist/rsc/helpers/ab-tests.d.ts +9 -0
- package/dist/rsc/helpers/cookie.d.ts +2 -0
- package/dist/rsc/helpers/css.d.ts +7 -0
- package/dist/rsc/helpers/flatten.d.ts +1 -0
- package/dist/rsc/helpers/localStorage.d.ts +9 -0
- package/dist/rsc/helpers/logger.d.ts +5 -0
- package/dist/rsc/helpers/logger.js +7 -0
- package/dist/rsc/helpers/nullable.d.ts +1 -0
- package/dist/rsc/helpers/sessionId.d.ts +6 -0
- package/dist/rsc/helpers/time.d.ts +1 -0
- package/dist/rsc/helpers/url.d.ts +1 -0
- package/dist/rsc/helpers/url.test.d.ts +1 -0
- package/dist/rsc/helpers/uuid.d.ts +2 -0
- package/dist/rsc/helpers/visitorId.d.ts +8 -0
- package/dist/rsc/index-helpers/blocks-exports.d.ts +11 -0
- package/dist/rsc/index-helpers/top-of-file.d.ts +2 -0
- package/dist/rsc/index.d.ts +11 -0
- package/dist/rsc/scripts/init-editing.d.ts +2 -0
- package/dist/rsc/types/api-version.d.ts +1 -0
- package/dist/rsc/types/builder-block.d.ts +0 -0
- package/dist/rsc/types/builder-content.d.ts +0 -0
- package/dist/rsc/types/can-track.d.ts +0 -0
- package/dist/rsc/types/components.d.ts +0 -0
- package/dist/rsc/types/deep-partial.d.ts +0 -0
- package/dist/rsc/types/element.d.ts +0 -0
- package/dist/rsc/types/input.d.ts +0 -0
- package/dist/rsc/types/targets.d.ts +0 -0
- package/dist/rsc/types/typescript.d.ts +0 -0
- package/package.json +4 -10
- package/packages/react/src/blocks/BaseText.jsx +1 -0
- package/packages/react/src/blocks/button/button.jsx +1 -0
- package/packages/react/src/blocks/columns/columns.jsx +1 -0
- package/packages/react/src/blocks/custom-code/custom-code.jsx +1 -0
- package/packages/react/src/blocks/embed/embed.jsx +1 -0
- package/packages/react/src/blocks/form/form.jsx +1 -0
- package/packages/react/src/blocks/fragment/fragment.jsx +1 -0
- package/packages/react/src/blocks/image/image.jsx +1 -0
- package/packages/react/src/blocks/img/img.jsx +1 -0
- package/packages/react/src/blocks/input/input.jsx +1 -0
- package/packages/react/src/blocks/raw-text/raw-text.jsx +1 -0
- package/packages/react/src/blocks/section/section.jsx +1 -0
- package/packages/react/src/blocks/select/select.jsx +1 -0
- package/packages/react/src/blocks/submit-button/submit-button.jsx +1 -0
- package/packages/react/src/blocks/symbol/symbol.jsx +3 -1
- package/packages/react/src/blocks/text/text.jsx +1 -0
- package/packages/react/src/blocks/textarea/textarea.jsx +1 -0
- package/packages/react/src/blocks/video/video.jsx +1 -0
- package/packages/react/src/components/render-block/block-styles.jsx +1 -0
- package/packages/react/src/components/render-block/render-block.jsx +3 -3
- package/packages/react/src/components/render-block/render-component.jsx +1 -0
- package/packages/react/src/components/render-block/render-repeated-block.jsx +1 -0
- package/packages/react/src/components/render-blocks.jsx +1 -0
- package/packages/react/src/components/render-content/builder-editing.jsx +1 -0
- package/packages/react/src/components/render-content/components/render-styles.jsx +1 -0
- package/packages/react/src/components/render-content/render-content.jsx +12 -8
- package/packages/react/src/components/render-inlined-styles.jsx +1 -0
- package/packages/react/src/functions/get-block-properties.js +4 -1
- package/packages/react/src/functions/get-content/index.js +21 -15
- package/packages/react/src/functions/track/index.js +2 -1
- package/packages/react/src/helpers/logger.js +9 -0
- package/packages/rsc/src/blocks/symbol/symbol.jsx +2 -4
- package/packages/rsc/src/components/render-block/render-block.jsx +2 -3
- package/packages/rsc/src/components/render-content/render-content.jsx +1 -0
- package/packages/rsc/src/functions/get-block-properties.js +4 -1
- package/packages/rsc/src/functions/get-content/index.js +21 -15
- package/packages/rsc/src/functions/track/index.js +2 -1
- package/packages/rsc/src/helpers/logger.js +9 -0
- package/tsconfig.base.json +8 -3
- package/src/blocks/BaseText.jsx +0 -9
- package/src/blocks/button/button.jsx +0 -27
- package/src/blocks/button/component-info.js +0 -41
- package/src/blocks/columns/columns.jsx +0 -172
- package/src/blocks/columns/component-info.js +0 -242
- package/src/blocks/custom-code/component-info.js +0 -31
- package/src/blocks/custom-code/custom-code.jsx +0 -64
- package/src/blocks/embed/component-info.js +0 -44
- package/src/blocks/embed/embed.jsx +0 -49
- package/src/blocks/embed/helpers.js +0 -9
- package/src/blocks/form/component-info.js +0 -262
- package/src/blocks/form/form.jsx +0 -253
- package/src/blocks/fragment/component-info.js +0 -11
- package/src/blocks/fragment/fragment.jsx +0 -5
- package/src/blocks/image/component-info.js +0 -151
- package/src/blocks/image/image.helpers.js +0 -48
- package/src/blocks/image/image.jsx +0 -122
- package/src/blocks/img/component-info.js +0 -20
- package/src/blocks/img/img.jsx +0 -17
- package/src/blocks/input/component-info.js +0 -74
- package/src/blocks/input/input.jsx +0 -19
- package/src/blocks/raw-text/component-info.js +0 -16
- package/src/blocks/raw-text/raw-text.jsx +0 -10
- package/src/blocks/section/component-info.js +0 -49
- package/src/blocks/section/section.jsx +0 -27
- package/src/blocks/select/component-info.js +0 -59
- package/src/blocks/select/select.jsx +0 -20
- package/src/blocks/submit-button/component-info.js +0 -28
- package/src/blocks/submit-button/submit-button.jsx +0 -9
- package/src/blocks/symbol/component-info.js +0 -43
- package/src/blocks/symbol/symbol.jsx +0 -84
- package/src/blocks/text/component-info.js +0 -24
- package/src/blocks/text/text.jsx +0 -10
- package/src/blocks/textarea/component-info.js +0 -47
- package/src/blocks/textarea/textarea.jsx +0 -13
- package/src/blocks/util.js +0 -8
- package/src/blocks/video/component-info.js +0 -106
- package/src/blocks/video/video.jsx +0 -58
- package/src/components/render-block/block-styles.jsx +0 -69
- package/src/components/render-block/render-block.helpers.js +0 -23
- package/src/components/render-block/render-block.jsx +0 -252
- package/src/components/render-block/render-component-with-context.jsx +0 -38
- package/src/components/render-block/render-component.jsx +0 -33
- package/src/components/render-block/render-repeated-block.jsx +0 -33
- package/src/components/render-blocks.jsx +0 -89
- package/src/components/render-content/builder-editing.jsx +0 -5
- package/src/components/render-content/components/render-styles.jsx +0 -64
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/render-content.jsx +0 -370
- package/src/components/render-inlined-styles.jsx +0 -28
- package/src/constants/builder-registered-components.js +0 -54
- package/src/constants/device-sizes.js +0 -48
- package/src/constants/target.js +0 -4
- package/src/context/builder.context.js +0 -12
- package/src/functions/camel-to-kebab-case.js +0 -4
- package/src/functions/evaluate.js +0 -29
- package/src/functions/event-handler-name.js +0 -7
- package/src/functions/extract-text-styles.js +0 -22
- package/src/functions/fast-clone.js +0 -4
- package/src/functions/get-block-actions-handler.js +0 -11
- package/src/functions/get-block-actions.js +0 -18
- package/src/functions/get-block-component-options.js +0 -28
- package/src/functions/get-block-properties.js +0 -50
- package/src/functions/get-block-tag.js +0 -6
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-builder-search-params/index.js +0 -38
- package/src/functions/get-content/ab-testing.js +0 -99
- package/src/functions/get-content/generate-content-url.js +0 -55
- package/src/functions/get-content/generate-content-url.test.js +0 -31
- package/src/functions/get-content/index.js +0 -65
- package/src/functions/get-fetch.js +0 -14
- package/src/functions/get-global-this.js +0 -18
- package/src/functions/get-processed-block.js +0 -59
- package/src/functions/get-processed-block.test.js +0 -32
- package/src/functions/get-react-native-block-styles.js +0 -33
- package/src/functions/if-target.js +0 -15
- package/src/functions/is-browser.js +0 -6
- package/src/functions/is-editing.js +0 -7
- package/src/functions/is-iframe.js +0 -7
- package/src/functions/is-previewing.js +0 -14
- package/src/functions/on-change.js +0 -27
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/register-component.js +0 -68
- package/src/functions/register.js +0 -29
- package/src/functions/sanitize-react-native-block-styles.js +0 -66
- package/src/functions/set-editor-settings.js +0 -15
- package/src/functions/set.js +0 -11
- package/src/functions/set.test.js +0 -16
- package/src/functions/track.js +0 -124
- package/src/functions/transform-block-properties.js +0 -6
- package/src/functions/transform-block.js +0 -6
- package/src/helpers/ab-tests.js +0 -16
- package/src/helpers/cookie.js +0 -81
- package/src/helpers/css.js +0 -34
- package/src/helpers/flatten.js +0 -34
- package/src/helpers/localStorage.js +0 -35
- package/src/helpers/nullable.js +0 -4
- package/src/helpers/sessionId.js +0 -52
- package/src/helpers/time.js +0 -5
- package/src/helpers/url.js +0 -13
- package/src/helpers/url.test.js +0 -21
- package/src/helpers/uuid.js +0 -13
- package/src/helpers/visitorId.js +0 -34
- package/src/index-helpers/blocks-exports.js +0 -22
- package/src/index-helpers/top-of-file.js +0 -4
- package/src/scripts/init-editing.js +0 -93
- /package/{src/components/render-block/types.js → dist/react/components/render-block/types.d.ts} +0 -0
- /package/{src/context/types.js → dist/react/components/render-content/render-content.types.d.ts} +0 -0
- /package/{src/functions/get-content/types.js → dist/react/context/types.d.ts} +0 -0
- /package/{src/types/builder-block.js → dist/react/functions/get-content/types.d.ts} +0 -0
- /package/{src/types/builder-content.js → dist/react/types/builder-block.d.ts} +0 -0
- /package/{src/types/can-track.js → dist/react/types/builder-content.d.ts} +0 -0
- /package/{src/types/components.js → dist/react/types/can-track.d.ts} +0 -0
- /package/{src/types/deep-partial.js → dist/react/types/components.d.ts} +0 -0
- /package/{src/types/element.js → dist/react/types/deep-partial.d.ts} +0 -0
- /package/{src/types/targets.js → dist/react/types/element.d.ts} +0 -0
- /package/{src/types/typescript.js → dist/react/types/input.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as default2 } from "../blocks/button/button";
|
|
2
|
+
import { default as default3 } from "../blocks/columns/columns";
|
|
3
|
+
import { default as default4 } from "../blocks/fragment/fragment";
|
|
4
|
+
import { default as default5 } from "../blocks/image/image";
|
|
5
|
+
import { default as default6 } from "../components/render-blocks";
|
|
6
|
+
import { default as default7 } from "../components/render-content/render-content";
|
|
7
|
+
import { default as default8 } from "../blocks/section/section";
|
|
8
|
+
import { default as default9 } from "../blocks/symbol/symbol";
|
|
9
|
+
import { default as default10 } from "../blocks/text/text";
|
|
10
|
+
import { default as default11 } from "../blocks/video/video";
|
|
11
|
+
export { default2 as Button, default3 as Columns, default4 as Fragment, default5 as Image, default6 as RenderBlocks, default7 as RenderContent, default8 as Section, default9 as Symbol, default10 as Text, default11 as Video };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./index-helpers/top-of-file.js";
|
|
2
|
+
export * from "./index-helpers/blocks-exports.js";
|
|
3
|
+
export * from "./functions/is-editing.js";
|
|
4
|
+
export * from "./functions/is-previewing.js";
|
|
5
|
+
export * from "./functions/register-component.js";
|
|
6
|
+
export * from "./functions/register.js";
|
|
7
|
+
export * from "./functions/set-editor-settings.js";
|
|
8
|
+
export * from "./functions/get-content/index.js";
|
|
9
|
+
export * from "./functions/get-builder-search-params/index.js";
|
|
10
|
+
export { track };
|
|
11
|
+
import { track } from "./functions/track/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_API_VERSION: "v3";
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react",
|
|
3
3
|
"description": "Builder.io SDK for React",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"main": "src/index.js",
|
|
4
|
+
"version": "0.2.3-0",
|
|
6
5
|
"type": "module",
|
|
7
6
|
"exports": {
|
|
8
|
-
".":
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
"./rsc": {
|
|
13
|
-
"import": "./dist/rsc/index.js",
|
|
14
|
-
"require": "./dist/rsc/index.js"
|
|
15
|
-
}
|
|
7
|
+
".": "./dist/react/index.js",
|
|
8
|
+
"./get-content": "./dist/react/functions/get-content/index.js",
|
|
9
|
+
"./rsc": "./dist/rsc/index.js"
|
|
16
10
|
},
|
|
17
11
|
"scripts": {
|
|
18
12
|
"build:react": "tsc -p ./tsconfig.react.json",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useState, useContext, useEffect } from "react";
|
|
3
4
|
import RenderContent from "../../components/render-content/render-content";
|
|
4
5
|
import BuilderContext from "../../context/builder.context.js";
|
|
5
6
|
import { getContent } from "../../functions/get-content/index.js";
|
|
6
7
|
import { TARGET } from "../../constants/target";
|
|
8
|
+
import { logger } from "../../helpers/logger";
|
|
7
9
|
|
|
8
10
|
function Symbol(props) {
|
|
9
11
|
const [className, setClassName] = useState(() =>
|
|
@@ -53,7 +55,7 @@ function Symbol(props) {
|
|
|
53
55
|
}
|
|
54
56
|
})
|
|
55
57
|
.catch((err) => {
|
|
56
|
-
|
|
58
|
+
logger.error("Could not fetch symbol content: ", err);
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useState } from "react";
|
|
3
4
|
import { getBlockActions } from "../../functions/get-block-actions.js";
|
|
@@ -16,7 +17,6 @@ import { TARGET } from "../../constants/target.js";
|
|
|
16
17
|
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
17
18
|
import RenderComponent from "./render-component";
|
|
18
19
|
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
19
|
-
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
20
20
|
|
|
21
21
|
function RenderBlock(props) {
|
|
22
22
|
const [component, setComponent] = useState(() =>
|
|
@@ -47,10 +47,10 @@ function RenderBlock(props) {
|
|
|
47
47
|
const [tag, setTag] = useState(() => props.block.tagName || "div");
|
|
48
48
|
|
|
49
49
|
function canShowBlock() {
|
|
50
|
-
if (
|
|
50
|
+
if ("hide" in useBlock()) {
|
|
51
51
|
return !useBlock().hide;
|
|
52
52
|
}
|
|
53
|
-
if (
|
|
53
|
+
if ("show" in useBlock()) {
|
|
54
54
|
return useBlock().show;
|
|
55
55
|
}
|
|
56
56
|
return true;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
import { useState, useContext, useRef, useEffect } from "react";
|
|
3
4
|
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components.js";
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
getContextStateInitialValue,
|
|
27
28
|
} from "./render-content.helpers.js";
|
|
28
29
|
import { TARGET } from "../../constants/target.js";
|
|
30
|
+
import { logger } from "../../helpers/logger.js";
|
|
29
31
|
|
|
30
32
|
function RenderContent(props) {
|
|
31
33
|
const elementRef = useRef(null);
|
|
@@ -233,8 +235,8 @@ function RenderContent(props) {
|
|
|
233
235
|
|
|
234
236
|
useEffect(() => {
|
|
235
237
|
if (!props.apiKey) {
|
|
236
|
-
|
|
237
|
-
"
|
|
238
|
+
logger.error(
|
|
239
|
+
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
238
240
|
);
|
|
239
241
|
}
|
|
240
242
|
if (isBrowser()) {
|
|
@@ -280,22 +282,24 @@ function RenderContent(props) {
|
|
|
280
282
|
// override normal content in preview mode
|
|
281
283
|
if (isPreviewing()) {
|
|
282
284
|
const searchParams = new URL(location.href).searchParams;
|
|
283
|
-
const
|
|
285
|
+
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
286
|
+
const searchParamPreviewId = searchParams.get(
|
|
287
|
+
`builder.preview.${searchParamPreviewModel}`
|
|
288
|
+
);
|
|
284
289
|
const previewApiKey =
|
|
285
290
|
searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
286
291
|
|
|
287
292
|
/**
|
|
288
293
|
* Make sure that:
|
|
289
294
|
* - the preview model name is the same as the one we're rendering, since there can be multiple models rendered * at the same time, e.g. header/page/footer. * - the API key is the same, since we don't want to preview content from other organizations.
|
|
290
|
-
*
|
|
291
|
-
* TO-DO: should we check that the preview item ID is the same as the initial one being rendered? Or would
|
|
292
|
-
* this break scenarios where the item is not published yet?
|
|
295
|
+
* - if there is content, that the preview ID is the same as that of the one we receive.
|
|
293
296
|
*
|
|
294
297
|
* TO-DO: should we only update the state when there is a change?
|
|
295
298
|
**/
|
|
296
299
|
if (
|
|
297
|
-
|
|
298
|
-
previewApiKey === props.apiKey
|
|
300
|
+
searchParamPreviewModel === props.model &&
|
|
301
|
+
previewApiKey === props.apiKey &&
|
|
302
|
+
(!props.content || searchParamPreviewId === props.content.id)
|
|
299
303
|
) {
|
|
300
304
|
getContent({
|
|
301
305
|
model: props.model,
|
|
@@ -20,9 +20,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import { TARGET } from "../constants/target.js";
|
|
21
21
|
import { convertStyleMapToCSSArray } from "../helpers/css.js";
|
|
22
22
|
import { transformBlockProperties } from "./transform-block-properties.js";
|
|
23
|
+
const extractRelevantRootBlockProperties = (block) => {
|
|
24
|
+
return { href: block.href };
|
|
25
|
+
};
|
|
23
26
|
function getBlockProperties(block) {
|
|
24
27
|
var _a;
|
|
25
|
-
const properties = __spreadProps(__spreadValues({}, block.properties), {
|
|
28
|
+
const properties = __spreadProps(__spreadValues(__spreadValues({}, extractRelevantRootBlockProperties(block)), block.properties), {
|
|
26
29
|
"builder-id": block.id,
|
|
27
30
|
style: getStyleAttribute(block.style),
|
|
28
31
|
class: [block.id, "builder-block", block.class, (_a = block.properties) == null ? void 0 : _a.class].filter(Boolean).join(" ")
|
|
@@ -37,13 +37,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
37
37
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
+
import { logger } from "../../helpers/logger.js";
|
|
40
41
|
import { fetch } from "../get-fetch.js";
|
|
41
42
|
import { handleABTesting } from "./ab-testing.js";
|
|
42
43
|
import { generateContentUrl } from "./generate-content-url.js";
|
|
43
44
|
function getContent(options) {
|
|
44
45
|
return __async(this, null, function* () {
|
|
45
46
|
const allContent = yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }));
|
|
46
|
-
if ("results" in allContent) {
|
|
47
|
+
if (allContent && "results" in allContent) {
|
|
47
48
|
return (allContent == null ? void 0 : allContent.results[0]) || null;
|
|
48
49
|
}
|
|
49
50
|
return null;
|
|
@@ -51,24 +52,29 @@ function getContent(options) {
|
|
|
51
52
|
}
|
|
52
53
|
function getAllContent(options) {
|
|
53
54
|
return __async(this, null, function* () {
|
|
54
|
-
const url = generateContentUrl(options);
|
|
55
|
-
const res = yield fetch(url.href);
|
|
56
|
-
const content = yield res.json();
|
|
57
|
-
if ("status" in content && !("results" in content)) {
|
|
58
|
-
console.error("[Builder.io]: Error fetching data. ", content, options);
|
|
59
|
-
return content;
|
|
60
|
-
}
|
|
61
|
-
const canTrack = options.canTrack !== false;
|
|
62
55
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
const url = generateContentUrl(options);
|
|
57
|
+
const res = yield fetch(url.href);
|
|
58
|
+
const content = yield res.json();
|
|
59
|
+
if ("status" in content && !("results" in content)) {
|
|
60
|
+
logger.error("Error fetching data. ", { url, content, options });
|
|
61
|
+
return content;
|
|
62
|
+
}
|
|
63
|
+
const canTrack = options.canTrack !== false;
|
|
64
|
+
try {
|
|
65
|
+
if (canTrack && Array.isArray(content.results)) {
|
|
66
|
+
for (const item of content.results) {
|
|
67
|
+
yield handleABTesting({ item, canTrack });
|
|
68
|
+
}
|
|
66
69
|
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
logger.error("Could not setup A/B testing. ", e);
|
|
67
72
|
}
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
return content;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
logger.error("Error fetching data. ", error);
|
|
76
|
+
return null;
|
|
70
77
|
}
|
|
71
|
-
return content;
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
export {
|
|
@@ -50,6 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
import { TARGET } from "../../constants/target.js";
|
|
53
|
+
import { logger } from "../../helpers/logger.js";
|
|
53
54
|
import { getSessionId } from "../../helpers/sessionId.js";
|
|
54
55
|
import { getVisitorId } from "../../helpers/visitorId.js";
|
|
55
56
|
import { isBrowser } from "../is-browser.js";
|
|
@@ -95,7 +96,7 @@ const createEvent = (_a) => __async(void 0, null, function* () {
|
|
|
95
96
|
function _track(eventProps) {
|
|
96
97
|
return __async(this, null, function* () {
|
|
97
98
|
if (!eventProps.apiKey) {
|
|
98
|
-
|
|
99
|
+
logger.error("Missing API key for track call. Please provide your API key.");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
if (!eventProps.canTrack) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const MSG_PREFIX = "[Builder.io]: ";
|
|
2
|
+
const logger = {
|
|
3
|
+
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
4
|
+
error: (...message) => console.error(MSG_PREFIX, ...message),
|
|
5
|
+
warn: (...message) => console.warn(MSG_PREFIX, ...message)
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
logger
|
|
9
|
+
};
|
|
@@ -3,6 +3,7 @@ import RenderContent from "../../components/render-content/render-content";
|
|
|
3
3
|
import BuilderContext from "../../context/builder.context.js";
|
|
4
4
|
import { getContent } from "../../functions/get-content/index.js";
|
|
5
5
|
import { TARGET } from "../../constants/target";
|
|
6
|
+
import { logger } from "../../helpers/logger";
|
|
6
7
|
|
|
7
8
|
function Symbol(props) {
|
|
8
9
|
const _context = { ...props["_context"] };
|
|
@@ -51,10 +52,7 @@ function Symbol(props) {
|
|
|
51
52
|
}
|
|
52
53
|
})
|
|
53
54
|
.catch((err) => {
|
|
54
|
-
|
|
55
|
-
"[Builder.io]: Could not fetch symbol content: ",
|
|
56
|
-
err
|
|
57
|
-
);
|
|
55
|
+
logger.error("Could not fetch symbol content: ", err);
|
|
58
56
|
});
|
|
59
57
|
}
|
|
60
58
|
},
|
|
@@ -15,7 +15,6 @@ import { TARGET } from "../../constants/target.js";
|
|
|
15
15
|
import { extractTextStyles } from "../../functions/extract-text-styles.js";
|
|
16
16
|
import RenderComponent from "./render-component";
|
|
17
17
|
import { getReactNativeBlockStyles } from "../../functions/get-react-native-block-styles.js";
|
|
18
|
-
import { checkIsDefined } from "../../helpers/nullable.js";
|
|
19
18
|
|
|
20
19
|
function RenderBlock(props) {
|
|
21
20
|
const _context = { ...props["_context"] };
|
|
@@ -41,10 +40,10 @@ function RenderBlock(props) {
|
|
|
41
40
|
},
|
|
42
41
|
tag: props.block.tagName || "div",
|
|
43
42
|
get canShowBlock() {
|
|
44
|
-
if (
|
|
43
|
+
if ("hide" in state.useBlock) {
|
|
45
44
|
return !state.useBlock.hide;
|
|
46
45
|
}
|
|
47
|
-
if (
|
|
46
|
+
if ("show" in state.useBlock) {
|
|
48
47
|
return state.useBlock.show;
|
|
49
48
|
}
|
|
50
49
|
return true;
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
getContextStateInitialValue,
|
|
26
26
|
} from "./render-content.helpers.js";
|
|
27
27
|
import { TARGET } from "../../constants/target.js";
|
|
28
|
+
import { logger } from "../../helpers/logger.js";
|
|
28
29
|
|
|
29
30
|
function RenderContent(props) {
|
|
30
31
|
const _context = { ...props["_context"] };
|
|
@@ -20,9 +20,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
import { TARGET } from "../constants/target.js";
|
|
21
21
|
import { convertStyleMapToCSSArray } from "../helpers/css.js";
|
|
22
22
|
import { transformBlockProperties } from "./transform-block-properties.js";
|
|
23
|
+
const extractRelevantRootBlockProperties = (block) => {
|
|
24
|
+
return { href: block.href };
|
|
25
|
+
};
|
|
23
26
|
function getBlockProperties(block) {
|
|
24
27
|
var _a;
|
|
25
|
-
const properties = __spreadProps(__spreadValues({}, block.properties), {
|
|
28
|
+
const properties = __spreadProps(__spreadValues(__spreadValues({}, extractRelevantRootBlockProperties(block)), block.properties), {
|
|
26
29
|
"builder-id": block.id,
|
|
27
30
|
style: getStyleAttribute(block.style),
|
|
28
31
|
class: [block.id, "builder-block", block.class, (_a = block.properties) == null ? void 0 : _a.class].filter(Boolean).join(" ")
|
|
@@ -37,13 +37,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
37
37
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
+
import { logger } from "../../helpers/logger.js";
|
|
40
41
|
import { fetch } from "../get-fetch.js";
|
|
41
42
|
import { handleABTesting } from "./ab-testing.js";
|
|
42
43
|
import { generateContentUrl } from "./generate-content-url.js";
|
|
43
44
|
function getContent(options) {
|
|
44
45
|
return __async(this, null, function* () {
|
|
45
46
|
const allContent = yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }));
|
|
46
|
-
if ("results" in allContent) {
|
|
47
|
+
if (allContent && "results" in allContent) {
|
|
47
48
|
return (allContent == null ? void 0 : allContent.results[0]) || null;
|
|
48
49
|
}
|
|
49
50
|
return null;
|
|
@@ -51,24 +52,29 @@ function getContent(options) {
|
|
|
51
52
|
}
|
|
52
53
|
function getAllContent(options) {
|
|
53
54
|
return __async(this, null, function* () {
|
|
54
|
-
const url = generateContentUrl(options);
|
|
55
|
-
const res = yield fetch(url.href);
|
|
56
|
-
const content = yield res.json();
|
|
57
|
-
if ("status" in content && !("results" in content)) {
|
|
58
|
-
console.error("[Builder.io]: Error fetching data. ", content, options);
|
|
59
|
-
return content;
|
|
60
|
-
}
|
|
61
|
-
const canTrack = options.canTrack !== false;
|
|
62
55
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
const url = generateContentUrl(options);
|
|
57
|
+
const res = yield fetch(url.href);
|
|
58
|
+
const content = yield res.json();
|
|
59
|
+
if ("status" in content && !("results" in content)) {
|
|
60
|
+
logger.error("Error fetching data. ", { url, content, options });
|
|
61
|
+
return content;
|
|
62
|
+
}
|
|
63
|
+
const canTrack = options.canTrack !== false;
|
|
64
|
+
try {
|
|
65
|
+
if (canTrack && Array.isArray(content.results)) {
|
|
66
|
+
for (const item of content.results) {
|
|
67
|
+
yield handleABTesting({ item, canTrack });
|
|
68
|
+
}
|
|
66
69
|
}
|
|
70
|
+
} catch (e) {
|
|
71
|
+
logger.error("Could not setup A/B testing. ", e);
|
|
67
72
|
}
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
return content;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
logger.error("Error fetching data. ", error);
|
|
76
|
+
return null;
|
|
70
77
|
}
|
|
71
|
-
return content;
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
80
|
export {
|
|
@@ -50,6 +50,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
50
50
|
});
|
|
51
51
|
};
|
|
52
52
|
import { TARGET } from "../../constants/target.js";
|
|
53
|
+
import { logger } from "../../helpers/logger.js";
|
|
53
54
|
import { getSessionId } from "../../helpers/sessionId.js";
|
|
54
55
|
import { getVisitorId } from "../../helpers/visitorId.js";
|
|
55
56
|
import { isBrowser } from "../is-browser.js";
|
|
@@ -95,7 +96,7 @@ const createEvent = (_a) => __async(void 0, null, function* () {
|
|
|
95
96
|
function _track(eventProps) {
|
|
96
97
|
return __async(this, null, function* () {
|
|
97
98
|
if (!eventProps.apiKey) {
|
|
98
|
-
|
|
99
|
+
logger.error("Missing API key for track call. Please provide your API key.");
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
102
|
if (!eventProps.canTrack) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const MSG_PREFIX = "[Builder.io]: ";
|
|
2
|
+
const logger = {
|
|
3
|
+
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
4
|
+
error: (...message) => console.error(MSG_PREFIX, ...message),
|
|
5
|
+
warn: (...message) => console.warn(MSG_PREFIX, ...message)
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
logger
|
|
9
|
+
};
|
package/tsconfig.base.json
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ESNext",
|
|
4
4
|
"useDefineForClassFields": true,
|
|
5
|
-
"lib": [
|
|
5
|
+
"lib": [
|
|
6
|
+
"DOM",
|
|
7
|
+
"DOM.Iterable",
|
|
8
|
+
"ESNext"
|
|
9
|
+
],
|
|
6
10
|
"allowJs": true,
|
|
7
11
|
"skipLibCheck": true,
|
|
8
12
|
"esModuleInterop": false,
|
|
@@ -13,6 +17,7 @@
|
|
|
13
17
|
"moduleResolution": "Node",
|
|
14
18
|
"resolveJsonModule": true,
|
|
15
19
|
"isolatedModules": true,
|
|
16
|
-
"jsx": "react"
|
|
20
|
+
"jsx": "react",
|
|
21
|
+
"declaration": true
|
|
17
22
|
}
|
|
18
|
-
}
|
|
23
|
+
}
|
package/src/blocks/BaseText.jsx
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { useContext } from "react";
|
|
3
|
-
import BuilderContext from "../context/builder.context.js";
|
|
4
|
-
|
|
5
|
-
export default function BaseText(props) {
|
|
6
|
-
const builderContext = useContext(BuilderContext);
|
|
7
|
-
|
|
8
|
-
return <span style={builderContext.inheritedStyles}>{props.text}</span>;
|
|
9
|
-
}
|