@builder.io/sdk-react 0.2.3-0 → 0.2.3-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/cjs/blocks/BaseText.js +11 -0
- package/dist/react/cjs/blocks/button/button.js +15 -0
- package/dist/react/cjs/blocks/button/component-info.js +41 -0
- package/dist/react/cjs/blocks/columns/columns.js +133 -0
- package/dist/react/cjs/blocks/columns/component-info.js +243 -0
- package/dist/react/cjs/blocks/custom-code/component-info.js +31 -0
- package/dist/react/cjs/blocks/custom-code/custom-code.js +53 -0
- package/dist/react/cjs/blocks/embed/component-info.js +46 -0
- package/dist/react/cjs/blocks/embed/embed.js +44 -0
- package/dist/react/cjs/blocks/embed/helpers.js +10 -0
- package/dist/react/cjs/blocks/form/component-info.js +262 -0
- package/dist/react/cjs/blocks/form/form.js +205 -0
- package/dist/react/cjs/blocks/fragment/component-info.js +11 -0
- package/dist/react/cjs/blocks/fragment/fragment.js +8 -0
- package/dist/react/cjs/blocks/image/component-info.js +151 -0
- package/dist/react/cjs/blocks/image/image.helpers.js +49 -0
- package/dist/react/cjs/blocks/image/image.js +84 -0
- package/dist/react/cjs/blocks/img/component-info.js +20 -0
- package/dist/react/cjs/blocks/img/img.js +12 -0
- package/dist/react/cjs/blocks/input/component-info.js +74 -0
- package/dist/react/cjs/blocks/input/input.js +9 -0
- package/dist/react/cjs/blocks/raw-text/component-info.js +16 -0
- package/dist/react/cjs/blocks/raw-text/raw-text.js +8 -0
- package/dist/react/cjs/blocks/section/component-info.js +49 -0
- package/dist/react/cjs/blocks/section/section.js +19 -0
- package/dist/react/cjs/blocks/select/component-info.js +59 -0
- package/dist/react/cjs/blocks/select/select.js +9 -0
- package/dist/react/cjs/blocks/submit-button/component-info.js +28 -0
- package/dist/react/cjs/blocks/submit-button/submit-button.js +8 -0
- package/dist/react/cjs/blocks/symbol/component-info.js +43 -0
- package/dist/react/cjs/blocks/symbol/symbol.js +73 -0
- package/dist/react/cjs/blocks/text/component-info.js +24 -0
- package/dist/react/cjs/blocks/text/text.js +10 -0
- package/dist/react/cjs/blocks/textarea/component-info.js +47 -0
- package/dist/react/cjs/blocks/textarea/textarea.js +8 -0
- package/dist/react/cjs/blocks/util.js +9 -0
- package/dist/react/cjs/blocks/video/component-info.js +106 -0
- package/dist/react/cjs/blocks/video/video.js +52 -0
- package/dist/react/cjs/components/render-block/block-styles.js +66 -0
- package/dist/react/cjs/components/render-block/render-block.helpers.js +125 -0
- package/dist/react/cjs/components/render-block/render-block.js +134 -0
- package/dist/react/cjs/components/render-block/render-component.js +14 -0
- package/dist/react/cjs/components/render-block/render-repeated-block.js +20 -0
- package/dist/react/cjs/components/render-blocks.js +49 -0
- package/dist/react/cjs/components/render-content/builder-editing.js +8 -0
- package/dist/react/cjs/components/render-content/components/render-styles.helpers.js +55 -0
- package/dist/react/cjs/components/render-content/components/render-styles.js +34 -0
- package/dist/react/cjs/components/render-content/index.js +5 -0
- package/dist/react/cjs/components/render-content/render-content.helpers.js +42 -0
- package/dist/react/cjs/components/render-content/render-content.js +297 -0
- package/dist/react/cjs/components/render-inlined-styles.js +19 -0
- package/dist/react/cjs/constants/builder-registered-components.js +55 -0
- package/dist/react/cjs/constants/device-sizes.js +49 -0
- package/dist/react/cjs/constants/target.js +5 -0
- package/dist/react/cjs/context/builder.context.js +16 -0
- package/dist/react/cjs/functions/camel-to-kebab-case.js +5 -0
- package/dist/react/cjs/functions/evaluate.js +25 -0
- package/dist/react/cjs/functions/event-handler-name.js +8 -0
- package/dist/react/cjs/functions/extract-text-styles.js +23 -0
- package/dist/react/cjs/functions/fast-clone.js +5 -0
- package/dist/react/cjs/functions/get-block-actions-handler.js +12 -0
- package/dist/react/cjs/functions/get-block-actions.js +19 -0
- package/dist/react/cjs/functions/get-block-component-options.js +29 -0
- package/dist/react/cjs/functions/get-block-properties.js +54 -0
- package/dist/react/cjs/functions/get-builder-search-params/fn.test.js +15 -0
- package/dist/react/cjs/functions/get-builder-search-params/index.js +39 -0
- package/dist/react/cjs/functions/get-content/ab-testing.js +89 -0
- package/dist/react/cjs/functions/get-content/generate-content-url.js +48 -0
- package/dist/react/cjs/functions/get-content/generate-content-url.test.js +84 -0
- package/dist/react/cjs/functions/get-content/index.js +88 -0
- package/dist/react/cjs/functions/get-fetch.js +15 -0
- package/dist/react/cjs/functions/get-global-this.js +19 -0
- package/dist/react/cjs/functions/get-processed-block.js +52 -0
- package/dist/react/cjs/functions/get-processed-block.test.js +34 -0
- package/dist/react/cjs/functions/get-react-native-block-styles.js +30 -0
- package/dist/react/cjs/functions/if-target.js +13 -0
- package/dist/react/cjs/functions/is-browser.js +7 -0
- package/dist/react/cjs/functions/is-editing.js +9 -0
- package/dist/react/cjs/functions/is-iframe.js +8 -0
- package/dist/react/cjs/functions/is-previewing.js +15 -0
- package/dist/react/cjs/functions/on-change.js +28 -0
- package/dist/react/cjs/functions/on-change.test.js +21 -0
- package/dist/react/cjs/functions/register-component.js +65 -0
- package/dist/react/cjs/functions/register.js +31 -0
- package/dist/react/cjs/functions/sanitize-react-native-block-styles.js +71 -0
- package/dist/react/cjs/functions/set-editor-settings.js +16 -0
- package/dist/react/cjs/functions/set.js +12 -0
- package/dist/react/cjs/functions/set.test.js +18 -0
- package/dist/react/cjs/functions/track/helpers.js +53 -0
- package/dist/react/{functions/track.js → cjs/functions/track/index.js} +21 -12
- package/dist/react/cjs/functions/track/interaction.js +51 -0
- package/dist/react/cjs/functions/transform-block-properties.js +7 -0
- package/dist/react/cjs/functions/transform-block.js +7 -0
- package/dist/react/cjs/helpers/ab-tests.js +10 -0
- package/dist/react/cjs/helpers/cookie.js +74 -0
- package/dist/react/cjs/helpers/css.js +33 -0
- package/dist/react/cjs/helpers/flatten.js +35 -0
- package/dist/react/cjs/helpers/localStorage.js +31 -0
- package/dist/react/cjs/helpers/logger.js +10 -0
- package/dist/react/cjs/helpers/nullable.js +5 -0
- package/dist/react/cjs/helpers/sessionId.js +51 -0
- package/dist/react/cjs/helpers/time.js +6 -0
- package/dist/react/cjs/helpers/url.js +14 -0
- package/dist/react/cjs/helpers/url.test.js +23 -0
- package/dist/react/cjs/helpers/uuid.js +14 -0
- package/dist/react/cjs/helpers/visitorId.js +33 -0
- package/dist/react/cjs/index-helpers/blocks-exports.js +23 -0
- package/dist/react/cjs/index-helpers/top-of-file.js +5 -0
- package/dist/react/cjs/index.js +28 -0
- package/dist/react/cjs/scripts/init-editing.js +97 -0
- package/dist/react/cjs/types/api-version.js +5 -0
- package/dist/react/esm/blocks/BaseText.d.ts +2 -0
- package/dist/react/esm/blocks/button/button.d.ts +2 -0
- package/dist/react/esm/blocks/button/component-info.d.ts +38 -0
- package/dist/react/esm/blocks/columns/columns.d.ts +2 -0
- package/dist/react/esm/blocks/columns/component-info.d.ts +176 -0
- package/dist/react/esm/blocks/custom-code/component-info.d.ts +31 -0
- package/dist/react/esm/blocks/custom-code/custom-code.d.ts +2 -0
- package/dist/react/esm/blocks/embed/component-info.d.ts +22 -0
- package/dist/react/esm/blocks/embed/embed.d.ts +2 -0
- package/dist/react/esm/blocks/embed/helpers.d.ts +1 -0
- package/dist/react/esm/blocks/form/component-info.d.ts +235 -0
- package/dist/react/esm/blocks/form/form.d.ts +2 -0
- package/dist/react/esm/blocks/fragment/component-info.d.ts +8 -0
- package/dist/react/esm/blocks/fragment/fragment.d.ts +2 -0
- package/dist/react/esm/blocks/image/component-info.d.ts +114 -0
- package/dist/react/esm/blocks/image/image.d.ts +2 -0
- package/dist/react/esm/blocks/image/image.helpers.d.ts +1 -0
- package/dist/react/esm/blocks/img/component-info.d.ts +15 -0
- package/dist/react/esm/blocks/img/img.d.ts +2 -0
- package/dist/react/esm/blocks/input/component-info.d.ts +66 -0
- package/dist/react/esm/blocks/input/input.d.ts +2 -0
- package/dist/react/esm/blocks/raw-text/component-info.d.ts +10 -0
- package/dist/react/esm/blocks/raw-text/raw-text.d.ts +2 -0
- package/dist/react/esm/blocks/section/component-info.d.ts +43 -0
- package/dist/react/esm/blocks/section/section.d.ts +2 -0
- package/dist/react/esm/blocks/select/component-info.d.ts +61 -0
- package/dist/react/esm/blocks/select/select.d.ts +2 -0
- package/dist/react/esm/blocks/submit-button/component-info.d.ts +23 -0
- package/dist/react/esm/blocks/submit-button/submit-button.d.ts +2 -0
- package/dist/react/esm/blocks/symbol/component-info.d.ts +35 -0
- package/dist/react/esm/blocks/symbol/symbol.d.ts +2 -0
- package/dist/react/esm/blocks/text/component-info.d.ts +19 -0
- package/dist/react/esm/blocks/text/text.d.ts +2 -0
- package/dist/react/esm/blocks/textarea/component-info.d.ts +53 -0
- package/dist/react/esm/blocks/textarea/textarea.d.ts +2 -0
- package/dist/react/esm/blocks/util.d.ts +1 -0
- package/dist/react/esm/blocks/video/component-info.d.ts +80 -0
- package/dist/react/esm/blocks/video/video.d.ts +2 -0
- package/dist/react/esm/components/render-block/block-styles.d.ts +2 -0
- package/dist/react/esm/components/render-block/render-block.d.ts +2 -0
- package/dist/react/esm/components/render-block/render-block.helpers.d.ts +13 -0
- package/dist/react/esm/components/render-block/render-component.d.ts +2 -0
- package/dist/react/esm/components/render-block/render-repeated-block.d.ts +2 -0
- package/dist/react/esm/components/render-block/types.d.ts +0 -0
- package/dist/react/esm/components/render-block/types.js +1 -0
- package/dist/react/esm/components/render-blocks.d.ts +2 -0
- package/dist/react/esm/components/render-content/builder-editing.d.ts +2 -0
- package/dist/react/esm/components/render-content/components/render-styles.d.ts +2 -0
- package/dist/react/esm/components/render-content/components/render-styles.helpers.d.ts +7 -0
- package/dist/react/esm/components/render-content/index.d.ts +2 -0
- package/dist/react/esm/components/render-content/render-content.d.ts +2 -0
- package/dist/react/esm/components/render-content/render-content.helpers.d.ts +9 -0
- package/dist/react/esm/components/render-content/render-content.types.d.ts +0 -0
- package/dist/react/esm/components/render-content/render-content.types.js +1 -0
- package/dist/react/esm/components/render-inlined-styles.d.ts +2 -0
- package/dist/react/esm/constants/builder-registered-components.d.ts +1 -0
- package/dist/react/esm/constants/device-sizes.d.ts +21 -0
- package/dist/react/esm/constants/target.d.ts +1 -0
- package/dist/react/esm/context/builder.context.d.ts +11 -0
- package/dist/react/esm/context/types.d.ts +0 -0
- package/dist/react/esm/context/types.js +1 -0
- package/dist/react/esm/functions/camel-to-kebab-case.d.ts +1 -0
- package/dist/react/esm/functions/evaluate.d.ts +7 -0
- package/dist/react/esm/functions/event-handler-name.d.ts +1 -0
- package/dist/react/esm/functions/extract-text-styles.d.ts +1 -0
- package/dist/react/esm/functions/fast-clone.d.ts +1 -0
- package/dist/react/esm/functions/get-block-actions-handler.d.ts +1 -0
- package/dist/react/esm/functions/get-block-actions.d.ts +1 -0
- package/dist/react/esm/functions/get-block-component-options.d.ts +1 -0
- package/dist/react/esm/functions/get-block-properties.d.ts +1 -0
- package/dist/react/esm/functions/get-builder-search-params/fn.test.d.ts +1 -0
- package/dist/react/esm/functions/get-builder-search-params/index.d.ts +4 -0
- package/dist/react/esm/functions/get-content/ab-testing.d.ts +1 -0
- package/dist/react/esm/functions/get-content/generate-content-url.d.ts +1 -0
- package/dist/react/esm/functions/get-content/generate-content-url.test.d.ts +1 -0
- package/dist/react/esm/functions/get-content/index.d.ts +2 -0
- package/dist/react/esm/functions/get-content/types.d.ts +0 -0
- package/dist/react/esm/functions/get-content/types.js +1 -0
- package/dist/react/esm/functions/get-fetch.d.ts +1 -0
- package/dist/react/esm/functions/get-global-this.d.ts +1 -0
- package/dist/react/esm/functions/get-processed-block.d.ts +6 -0
- package/dist/react/esm/functions/get-processed-block.test.d.ts +1 -0
- package/dist/react/esm/functions/get-react-native-block-styles.d.ts +5 -0
- package/dist/react/esm/functions/if-target.d.ts +5 -0
- package/dist/react/esm/functions/is-browser.d.ts +1 -0
- package/dist/react/esm/functions/is-editing.d.ts +1 -0
- package/dist/react/esm/functions/is-iframe.d.ts +1 -0
- package/dist/react/esm/functions/is-previewing.d.ts +1 -0
- package/dist/react/esm/functions/on-change.d.ts +2 -0
- package/dist/react/esm/functions/on-change.test.d.ts +1 -0
- package/dist/react/esm/functions/register-component.d.ts +6 -0
- package/dist/react/esm/functions/register.d.ts +1 -0
- package/dist/react/esm/functions/sanitize-react-native-block-styles.d.ts +1 -0
- package/dist/react/esm/functions/set-editor-settings.d.ts +1 -0
- package/dist/react/esm/functions/set.d.ts +1 -0
- package/dist/react/esm/functions/set.test.d.ts +1 -0
- package/dist/react/esm/functions/track/helpers.d.ts +5 -0
- package/dist/react/esm/functions/track/index.d.ts +2 -0
- package/dist/react/esm/functions/track/interaction.d.ts +14 -0
- package/dist/react/esm/functions/transform-block-properties.d.ts +1 -0
- package/dist/react/esm/functions/transform-block.d.ts +1 -0
- package/dist/react/esm/helpers/ab-tests.d.ts +9 -0
- package/dist/react/esm/helpers/cookie.d.ts +2 -0
- package/dist/react/esm/helpers/css.d.ts +7 -0
- package/dist/react/esm/helpers/flatten.d.ts +1 -0
- package/dist/react/esm/helpers/localStorage.d.ts +9 -0
- package/dist/react/esm/helpers/logger.d.ts +5 -0
- package/dist/react/esm/helpers/nullable.d.ts +1 -0
- package/dist/react/esm/helpers/sessionId.d.ts +6 -0
- package/dist/react/esm/helpers/time.d.ts +1 -0
- package/dist/react/esm/helpers/url.d.ts +1 -0
- package/dist/react/esm/helpers/url.test.d.ts +1 -0
- package/dist/react/esm/helpers/uuid.d.ts +2 -0
- package/dist/react/esm/helpers/visitorId.d.ts +8 -0
- package/dist/react/esm/index-helpers/blocks-exports.js +11 -0
- package/dist/react/esm/index-helpers/top-of-file.d.ts +2 -0
- package/dist/react/esm/index.d.ts +11 -0
- package/dist/react/esm/scripts/init-editing.d.ts +2 -0
- package/dist/react/esm/types/api-version.d.ts +1 -0
- package/dist/react/esm/types/builder-block.d.ts +0 -0
- package/dist/react/esm/types/builder-block.js +1 -0
- package/dist/react/esm/types/builder-content.d.ts +0 -0
- package/dist/react/esm/types/builder-content.js +1 -0
- package/dist/react/esm/types/can-track.d.ts +0 -0
- package/dist/react/esm/types/can-track.js +1 -0
- package/dist/react/esm/types/components.d.ts +0 -0
- package/dist/react/esm/types/components.js +1 -0
- package/dist/react/esm/types/deep-partial.d.ts +0 -0
- package/dist/react/esm/types/deep-partial.js +1 -0
- package/dist/react/esm/types/element.d.ts +0 -0
- package/dist/react/esm/types/element.js +1 -0
- package/dist/react/esm/types/input.d.ts +0 -0
- package/dist/react/esm/types/input.js +1 -0
- package/dist/react/esm/types/targets.d.ts +0 -0
- package/dist/react/esm/types/targets.js +1 -0
- package/dist/react/esm/types/typescript.d.ts +0 -0
- package/dist/react/esm/types/typescript.js +1 -0
- package/package.json +11 -6
- package/tsconfig.react-cjs.json +10 -0
- package/tsconfig.react-esm.json +10 -0
- package/dist/react/components/render-block/render-component-with-context.js +0 -27
- package/dist/react/components/render-content-variants/helpers.js +0 -98
- package/dist/react/components/render-content-variants/render-content-variants.js +0 -45
- package/dist/react/functions/get-block-tag.js +0 -4
- package/tsconfig.react.json +0 -7
- /package/dist/react/{blocks → cjs/blocks}/BaseText.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/button/button.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/button/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/columns/columns.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/columns/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/custom-code/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/custom-code/custom-code.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/embed/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/embed/embed.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/embed/helpers.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/form/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/form/form.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/fragment/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/fragment/fragment.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/image/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/image/image.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/image/image.helpers.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/img/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/img/img.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/input/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/input/input.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/raw-text/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/raw-text/raw-text.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/section/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/section/section.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/select/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/select/select.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/submit-button/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/submit-button/submit-button.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/symbol/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/symbol/symbol.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/text/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/text/text.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/textarea/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/textarea/textarea.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/util.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/video/component-info.d.ts +0 -0
- /package/dist/react/{blocks → cjs/blocks}/video/video.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/block-styles.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/render-block.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/render-block.helpers.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/render-component.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/render-repeated-block.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/types.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-block/types.js +0 -0
- /package/dist/react/{components → cjs/components}/render-blocks.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/builder-editing.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/components/render-styles.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/components/render-styles.helpers.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/index.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/render-content.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/render-content.helpers.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/render-content.types.d.ts +0 -0
- /package/dist/react/{components → cjs/components}/render-content/render-content.types.js +0 -0
- /package/dist/react/{components → cjs/components}/render-inlined-styles.d.ts +0 -0
- /package/dist/react/{constants → cjs/constants}/builder-registered-components.d.ts +0 -0
- /package/dist/react/{constants → cjs/constants}/device-sizes.d.ts +0 -0
- /package/dist/react/{constants → cjs/constants}/target.d.ts +0 -0
- /package/dist/react/{context → cjs/context}/builder.context.d.ts +0 -0
- /package/dist/react/{context → cjs/context}/types.d.ts +0 -0
- /package/dist/react/{context → cjs/context}/types.js +0 -0
- /package/dist/react/{functions → cjs/functions}/camel-to-kebab-case.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/evaluate.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/event-handler-name.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/extract-text-styles.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/fast-clone.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-block-actions-handler.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-block-actions.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-block-component-options.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-block-properties.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-builder-search-params/fn.test.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-builder-search-params/index.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/ab-testing.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/generate-content-url.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/generate-content-url.test.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/index.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/types.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-content/types.js +0 -0
- /package/dist/react/{functions → cjs/functions}/get-fetch.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-global-this.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-processed-block.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-processed-block.test.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/get-react-native-block-styles.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/if-target.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/is-browser.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/is-editing.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/is-iframe.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/is-previewing.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/on-change.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/on-change.test.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/register-component.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/register.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/sanitize-react-native-block-styles.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/set-editor-settings.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/set.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/set.test.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/track/helpers.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/track/index.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/track/interaction.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/transform-block-properties.d.ts +0 -0
- /package/dist/react/{functions → cjs/functions}/transform-block.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/ab-tests.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/cookie.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/css.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/flatten.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/localStorage.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/logger.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/nullable.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/sessionId.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/time.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/url.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/url.test.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/uuid.d.ts +0 -0
- /package/dist/react/{helpers → cjs/helpers}/visitorId.d.ts +0 -0
- /package/dist/react/{index-helpers → cjs/index-helpers}/blocks-exports.d.ts +0 -0
- /package/dist/react/{index-helpers → cjs/index-helpers}/top-of-file.d.ts +0 -0
- /package/dist/react/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/react/{scripts → cjs/scripts}/init-editing.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/api-version.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/builder-block.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/builder-block.js +0 -0
- /package/dist/react/{types → cjs/types}/builder-content.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/builder-content.js +0 -0
- /package/dist/react/{types → cjs/types}/can-track.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/can-track.js +0 -0
- /package/dist/react/{types → cjs/types}/components.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/components.js +0 -0
- /package/dist/react/{types → cjs/types}/deep-partial.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/deep-partial.js +0 -0
- /package/dist/react/{types → cjs/types}/element.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/element.js +0 -0
- /package/dist/react/{types → cjs/types}/input.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/input.js +0 -0
- /package/dist/react/{types → cjs/types}/targets.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/targets.js +0 -0
- /package/dist/react/{types → cjs/types}/typescript.d.ts +0 -0
- /package/dist/react/{types → cjs/types}/typescript.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/BaseText.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/button/button.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/button/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/columns/columns.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/columns/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/custom-code/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/custom-code/custom-code.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/embed/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/embed/embed.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/embed/helpers.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/form/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/form/form.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/fragment/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/fragment/fragment.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/image/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/image/image.helpers.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/image/image.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/img/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/img/img.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/input/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/input/input.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/raw-text/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/raw-text/raw-text.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/section/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/section/section.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/select/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/select/select.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/submit-button/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/submit-button/submit-button.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/symbol/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/symbol/symbol.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/text/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/text/text.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/textarea/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/textarea/textarea.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/util.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/video/component-info.js +0 -0
- /package/dist/react/{blocks → esm/blocks}/video/video.js +0 -0
- /package/dist/react/{components → esm/components}/render-block/block-styles.js +0 -0
- /package/dist/react/{components → esm/components}/render-block/render-block.helpers.js +0 -0
- /package/dist/react/{components → esm/components}/render-block/render-block.js +0 -0
- /package/dist/react/{components → esm/components}/render-block/render-component.js +0 -0
- /package/dist/react/{components → esm/components}/render-block/render-repeated-block.js +0 -0
- /package/dist/react/{components → esm/components}/render-blocks.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/builder-editing.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/components/render-styles.helpers.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/components/render-styles.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/index.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/render-content.helpers.js +0 -0
- /package/dist/react/{components → esm/components}/render-content/render-content.js +0 -0
- /package/dist/react/{components → esm/components}/render-inlined-styles.js +0 -0
- /package/dist/react/{constants → esm/constants}/builder-registered-components.js +0 -0
- /package/dist/react/{constants → esm/constants}/device-sizes.js +0 -0
- /package/dist/react/{constants → esm/constants}/target.js +0 -0
- /package/dist/react/{context → esm/context}/builder.context.js +0 -0
- /package/dist/react/{functions → esm/functions}/camel-to-kebab-case.js +0 -0
- /package/dist/react/{functions → esm/functions}/evaluate.js +0 -0
- /package/dist/react/{functions → esm/functions}/event-handler-name.js +0 -0
- /package/dist/react/{functions → esm/functions}/extract-text-styles.js +0 -0
- /package/dist/react/{functions → esm/functions}/fast-clone.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-block-actions-handler.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-block-actions.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-block-component-options.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-block-properties.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-builder-search-params/fn.test.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-builder-search-params/index.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-content/ab-testing.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-content/generate-content-url.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-content/generate-content-url.test.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-content/index.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-fetch.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-global-this.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-processed-block.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-processed-block.test.js +0 -0
- /package/dist/react/{functions → esm/functions}/get-react-native-block-styles.js +0 -0
- /package/dist/react/{functions → esm/functions}/if-target.js +0 -0
- /package/dist/react/{functions → esm/functions}/is-browser.js +0 -0
- /package/dist/react/{functions → esm/functions}/is-editing.js +0 -0
- /package/dist/react/{functions → esm/functions}/is-iframe.js +0 -0
- /package/dist/react/{functions → esm/functions}/is-previewing.js +0 -0
- /package/dist/react/{functions → esm/functions}/on-change.js +0 -0
- /package/dist/react/{functions → esm/functions}/on-change.test.js +0 -0
- /package/dist/react/{functions → esm/functions}/register-component.js +0 -0
- /package/dist/react/{functions → esm/functions}/register.js +0 -0
- /package/dist/react/{functions → esm/functions}/sanitize-react-native-block-styles.js +0 -0
- /package/dist/react/{functions → esm/functions}/set-editor-settings.js +0 -0
- /package/dist/react/{functions → esm/functions}/set.js +0 -0
- /package/dist/react/{functions → esm/functions}/set.test.js +0 -0
- /package/dist/react/{functions → esm/functions}/track/helpers.js +0 -0
- /package/dist/react/{functions → esm/functions}/track/index.js +0 -0
- /package/dist/react/{functions → esm/functions}/track/interaction.js +0 -0
- /package/dist/react/{functions → esm/functions}/transform-block-properties.js +0 -0
- /package/dist/react/{functions → esm/functions}/transform-block.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/ab-tests.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/cookie.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/css.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/flatten.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/localStorage.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/logger.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/nullable.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/sessionId.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/time.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/url.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/url.test.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/uuid.js +0 -0
- /package/dist/react/{helpers → esm/helpers}/visitorId.js +0 -0
- /package/dist/react/{index-helpers/blocks-exports.js → esm/index-helpers/blocks-exports.d.ts} +0 -0
- /package/dist/react/{index-helpers → esm/index-helpers}/top-of-file.js +0 -0
- /package/dist/react/{index.js → esm/index.js} +0 -0
- /package/dist/react/{scripts → esm/scripts}/init-editing.js +0 -0
- /package/dist/react/{types → esm/types}/api-version.js +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBlockProperties = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
const target_js_1 = require("../constants/target.js");
|
|
24
|
+
const css_js_1 = require("../helpers/css.js");
|
|
25
|
+
const transform_block_properties_js_1 = require("./transform-block-properties.js");
|
|
26
|
+
const extractRelevantRootBlockProperties = (block) => {
|
|
27
|
+
return { href: block.href };
|
|
28
|
+
};
|
|
29
|
+
function getBlockProperties(block) {
|
|
30
|
+
var _a;
|
|
31
|
+
const properties = __spreadProps(__spreadValues(__spreadValues({}, extractRelevantRootBlockProperties(block)), block.properties), {
|
|
32
|
+
"builder-id": block.id,
|
|
33
|
+
style: getStyleAttribute(block.style),
|
|
34
|
+
class: [block.id, "builder-block", block.class, (_a = block.properties) == null ? void 0 : _a.class].filter(Boolean).join(" ")
|
|
35
|
+
});
|
|
36
|
+
return (0, transform_block_properties_js_1.transformBlockProperties)(properties);
|
|
37
|
+
}
|
|
38
|
+
exports.getBlockProperties = getBlockProperties;
|
|
39
|
+
function getStyleAttribute(style) {
|
|
40
|
+
if (!style) {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
switch (target_js_1.TARGET) {
|
|
44
|
+
case "svelte":
|
|
45
|
+
case "vue2":
|
|
46
|
+
case "vue3":
|
|
47
|
+
case "solid":
|
|
48
|
+
return (0, css_js_1.convertStyleMapToCSSArray)(style).join(" ");
|
|
49
|
+
case "qwik":
|
|
50
|
+
case "reactNative":
|
|
51
|
+
case "react":
|
|
52
|
+
return style;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const _1 = require(".");
|
|
4
|
+
const querystring = "someotherValue=jklsjfdal&abc=klfdjklgfds&builder.cachebust=true&builder.preview=page&builder.noCache=true&__builder_editing__=true&builder.overrides.page=037948e52eaf4743afed464f02c70da4&builder.overrides.037948e52eaf4743afed464f02c70da4=037948e52eaf4743afed464f02c70da4&builder.overrides.page%3A%2F=037948e52eaf4743afed464f02c70da4&preview_theme_id=128854393017";
|
|
5
|
+
const url = new URL(`localhost:3000/about-us?${querystring}`);
|
|
6
|
+
describe("Get Builder SearchParams", () => {
|
|
7
|
+
test("correctly converts URLSearchParams to object", () => {
|
|
8
|
+
const output = (0, _1.convertSearchParamsToQueryObject)(url.searchParams);
|
|
9
|
+
expect(output).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test("correctly extracts all builder params from a query object", () => {
|
|
12
|
+
const output = (0, _1.getBuilderSearchParams)((0, _1.convertSearchParamsToQueryObject)(url.searchParams));
|
|
13
|
+
expect(output).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeSearchParams = exports.getBuilderSearchParamsFromWindow = exports.getBuilderSearchParams = exports.convertSearchParamsToQueryObject = void 0;
|
|
4
|
+
const is_browser_js_1 = require("../is-browser.js");
|
|
5
|
+
const BUILDER_SEARCHPARAMS_PREFIX = "builder.";
|
|
6
|
+
const BUILDER_OPTIONS_PREFIX = "options.";
|
|
7
|
+
const convertSearchParamsToQueryObject = (searchParams) => {
|
|
8
|
+
const options = {};
|
|
9
|
+
searchParams.forEach((value, key) => {
|
|
10
|
+
options[key] = value;
|
|
11
|
+
});
|
|
12
|
+
return options;
|
|
13
|
+
};
|
|
14
|
+
exports.convertSearchParamsToQueryObject = convertSearchParamsToQueryObject;
|
|
15
|
+
const getBuilderSearchParams = (_options) => {
|
|
16
|
+
if (!_options) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const options = normalizeSearchParams(_options);
|
|
20
|
+
const newOptions = {};
|
|
21
|
+
Object.keys(options).forEach((key) => {
|
|
22
|
+
if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
23
|
+
const trimmedKey = key.replace(BUILDER_SEARCHPARAMS_PREFIX, "").replace(BUILDER_OPTIONS_PREFIX, "");
|
|
24
|
+
newOptions[trimmedKey] = options[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return newOptions;
|
|
28
|
+
};
|
|
29
|
+
exports.getBuilderSearchParams = getBuilderSearchParams;
|
|
30
|
+
const getBuilderSearchParamsFromWindow = () => {
|
|
31
|
+
if (!(0, is_browser_js_1.isBrowser)()) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
35
|
+
return getBuilderSearchParams(searchParams);
|
|
36
|
+
};
|
|
37
|
+
exports.getBuilderSearchParamsFromWindow = getBuilderSearchParamsFromWindow;
|
|
38
|
+
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
39
|
+
exports.normalizeSearchParams = normalizeSearchParams;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handleABTesting = void 0;
|
|
4
|
+
var __async = (__this, __arguments, generator) => {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
var fulfilled = (value) => {
|
|
7
|
+
try {
|
|
8
|
+
step(generator.next(value));
|
|
9
|
+
}
|
|
10
|
+
catch (e) {
|
|
11
|
+
reject(e);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var rejected = (value) => {
|
|
15
|
+
try {
|
|
16
|
+
step(generator.throw(value));
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
reject(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
23
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const ab_tests_js_1 = require("../../helpers/ab-tests.js");
|
|
27
|
+
const nullable_js_1 = require("../../helpers/nullable.js");
|
|
28
|
+
const checkIsBuilderContentWithVariations = (item) => (0, nullable_js_1.checkIsDefined)(item.id) && (0, nullable_js_1.checkIsDefined)(item.variations) && Object.keys(item.variations).length > 0;
|
|
29
|
+
const getRandomVariationId = ({ id, variations }) => {
|
|
30
|
+
var _a;
|
|
31
|
+
let n = 0;
|
|
32
|
+
const random = Math.random();
|
|
33
|
+
for (const id2 in variations) {
|
|
34
|
+
const testRatio = (_a = variations[id2]) == null ? void 0 : _a.testRatio;
|
|
35
|
+
n += testRatio;
|
|
36
|
+
if (random < n) {
|
|
37
|
+
return id2;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return id;
|
|
41
|
+
};
|
|
42
|
+
const getTestFields = ({ item, testGroupId }) => {
|
|
43
|
+
const variationValue = item.variations[testGroupId];
|
|
44
|
+
if (testGroupId === item.id || !variationValue) {
|
|
45
|
+
return {
|
|
46
|
+
testVariationId: item.id,
|
|
47
|
+
testVariationName: "Default"
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return {
|
|
52
|
+
data: variationValue.data,
|
|
53
|
+
testVariationId: variationValue.id,
|
|
54
|
+
testVariationName: variationValue.name || (variationValue.id === item.id ? "Default" : "")
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const getContentVariation = (_0) => __async(void 0, [_0], function* ({ item, canTrack }) {
|
|
59
|
+
const testGroupId = yield (0, ab_tests_js_1.getContentVariationCookie)({
|
|
60
|
+
canTrack,
|
|
61
|
+
contentId: item.id
|
|
62
|
+
});
|
|
63
|
+
const testFields = testGroupId ? getTestFields({ item, testGroupId }) : void 0;
|
|
64
|
+
if (testFields) {
|
|
65
|
+
return testFields;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
const randomVariationId = getRandomVariationId({
|
|
69
|
+
variations: item.variations,
|
|
70
|
+
id: item.id
|
|
71
|
+
});
|
|
72
|
+
(0, ab_tests_js_1.setContentVariationCookie)({
|
|
73
|
+
contentId: item.id,
|
|
74
|
+
value: randomVariationId,
|
|
75
|
+
canTrack
|
|
76
|
+
}).catch((err) => {
|
|
77
|
+
console.error("could not store A/B test variation: ", err);
|
|
78
|
+
});
|
|
79
|
+
return getTestFields({ item, testGroupId: randomVariationId });
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const handleABTesting = (_0) => __async(void 0, [_0], function* ({ item, canTrack }) {
|
|
83
|
+
if (!checkIsBuilderContentWithVariations(item)) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const variationValue = yield getContentVariation({ item, canTrack });
|
|
87
|
+
Object.assign(item, variationValue);
|
|
88
|
+
});
|
|
89
|
+
exports.handleABTesting = handleABTesting;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateContentUrl = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
const flatten_js_1 = require("../../helpers/flatten.js");
|
|
21
|
+
const index_js_1 = require("../get-builder-search-params/index.js");
|
|
22
|
+
const api_version_1 = require("../../types/api-version");
|
|
23
|
+
const generateContentUrl = (options) => {
|
|
24
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = api_version_1.DEFAULT_API_VERSION } = options;
|
|
25
|
+
if (!apiKey) {
|
|
26
|
+
throw new Error("Missing API key");
|
|
27
|
+
}
|
|
28
|
+
if (!["v2", "v3"].includes(apiVersion)) {
|
|
29
|
+
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
30
|
+
}
|
|
31
|
+
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}`);
|
|
32
|
+
const queryOptions = __spreadValues(__spreadValues({}, (0, index_js_1.getBuilderSearchParamsFromWindow)()), (0, index_js_1.normalizeSearchParams)(options.options || {}));
|
|
33
|
+
const flattened = (0, flatten_js_1.flatten)(queryOptions);
|
|
34
|
+
for (const key in flattened) {
|
|
35
|
+
url.searchParams.set(key, String(flattened[key]));
|
|
36
|
+
}
|
|
37
|
+
if (userAttributes) {
|
|
38
|
+
url.searchParams.set("userAttributes", JSON.stringify(userAttributes));
|
|
39
|
+
}
|
|
40
|
+
if (query) {
|
|
41
|
+
const flattened2 = (0, flatten_js_1.flatten)({ query });
|
|
42
|
+
for (const key in flattened2) {
|
|
43
|
+
url.searchParams.set(key, JSON.stringify(flattened2[key]));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return url;
|
|
47
|
+
};
|
|
48
|
+
exports.generateContentUrl = generateContentUrl;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const generate_content_url_1 = require("./generate-content-url");
|
|
4
|
+
const testKey = "YJIGb4i01jvw0SRdL5Bt";
|
|
5
|
+
const testModel = "page";
|
|
6
|
+
const testId = "c1b81bab59704599b997574eb0736def";
|
|
7
|
+
const options = {
|
|
8
|
+
cachebust: "true",
|
|
9
|
+
noCache: "true",
|
|
10
|
+
"overrides.037948e52eaf4743afed464f02c70da4": "037948e52eaf4743afed464f02c70da4",
|
|
11
|
+
"overrides.page": "037948e52eaf4743afed464f02c70da4",
|
|
12
|
+
"overrides.page:/": "037948e52eaf4743afed464f02c70da4",
|
|
13
|
+
preview: "page"
|
|
14
|
+
};
|
|
15
|
+
describe("Generate Content URL", () => {
|
|
16
|
+
test("generates the proper value for a simple query", () => {
|
|
17
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
18
|
+
apiKey: testKey,
|
|
19
|
+
model: testModel,
|
|
20
|
+
query: { id: testId }
|
|
21
|
+
});
|
|
22
|
+
expect(output).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
test("Handles overrides correctly", () => {
|
|
25
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
26
|
+
apiKey: testKey,
|
|
27
|
+
model: testModel,
|
|
28
|
+
query: { id: testId },
|
|
29
|
+
options
|
|
30
|
+
});
|
|
31
|
+
expect(output).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
test("generate content url with apiVersion as default", () => {
|
|
34
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
35
|
+
apiKey: testKey,
|
|
36
|
+
model: testModel,
|
|
37
|
+
query: { id: testId },
|
|
38
|
+
options
|
|
39
|
+
});
|
|
40
|
+
expect(output).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
test("generate content url with apiVersion as v2", () => {
|
|
43
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
44
|
+
apiKey: testKey,
|
|
45
|
+
model: testModel,
|
|
46
|
+
query: { id: testId },
|
|
47
|
+
options,
|
|
48
|
+
apiVersion: "v2"
|
|
49
|
+
});
|
|
50
|
+
expect(output).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
test("generate content url with apiVersion as v3", () => {
|
|
53
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
54
|
+
apiKey: testKey,
|
|
55
|
+
model: testModel,
|
|
56
|
+
query: { id: testId },
|
|
57
|
+
options,
|
|
58
|
+
apiVersion: "v3"
|
|
59
|
+
});
|
|
60
|
+
expect(output).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
test("throw error when trying to generate content url with apiVersion as v1", () => {
|
|
63
|
+
expect(() => {
|
|
64
|
+
(0, generate_content_url_1.generateContentUrl)({
|
|
65
|
+
apiKey: testKey,
|
|
66
|
+
model: testModel,
|
|
67
|
+
query: { id: testId },
|
|
68
|
+
options,
|
|
69
|
+
apiVersion: "v1"
|
|
70
|
+
});
|
|
71
|
+
}).toThrow(`Invalid apiVersion: expected 'v2' or 'v3', received 'v1'`);
|
|
72
|
+
});
|
|
73
|
+
test("throw error when trying to generate content url with an invalid apiVersion value", () => {
|
|
74
|
+
expect(() => {
|
|
75
|
+
(0, generate_content_url_1.generateContentUrl)({
|
|
76
|
+
apiKey: testKey,
|
|
77
|
+
model: testModel,
|
|
78
|
+
query: { id: testId },
|
|
79
|
+
options,
|
|
80
|
+
apiVersion: "INVALID_API_VERSION"
|
|
81
|
+
});
|
|
82
|
+
}).toThrow(`Invalid apiVersion: expected 'v2' or 'v3', received 'INVALID_API_VERSION'`);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContent = exports.getAllContent = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __async = (__this, __arguments, generator) => {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
var fulfilled = (value) => {
|
|
26
|
+
try {
|
|
27
|
+
step(generator.next(value));
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
reject(e);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var rejected = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.throw(value));
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
42
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const logger_js_1 = require("../../helpers/logger.js");
|
|
46
|
+
const get_fetch_js_1 = require("../get-fetch.js");
|
|
47
|
+
const ab_testing_js_1 = require("./ab-testing.js");
|
|
48
|
+
const generate_content_url_js_1 = require("./generate-content-url.js");
|
|
49
|
+
function getContent(options) {
|
|
50
|
+
return __async(this, null, function* () {
|
|
51
|
+
const allContent = yield getAllContent(__spreadProps(__spreadValues({}, options), { limit: 1 }));
|
|
52
|
+
if (allContent && "results" in allContent) {
|
|
53
|
+
return (allContent == null ? void 0 : allContent.results[0]) || null;
|
|
54
|
+
}
|
|
55
|
+
return null;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.getContent = getContent;
|
|
59
|
+
function getAllContent(options) {
|
|
60
|
+
return __async(this, null, function* () {
|
|
61
|
+
try {
|
|
62
|
+
const url = (0, generate_content_url_js_1.generateContentUrl)(options);
|
|
63
|
+
const res = yield (0, get_fetch_js_1.fetch)(url.href);
|
|
64
|
+
const content = yield res.json();
|
|
65
|
+
if ("status" in content && !("results" in content)) {
|
|
66
|
+
logger_js_1.logger.error("Error fetching data. ", { url, content, options });
|
|
67
|
+
return content;
|
|
68
|
+
}
|
|
69
|
+
const canTrack = options.canTrack !== false;
|
|
70
|
+
try {
|
|
71
|
+
if (canTrack && Array.isArray(content.results)) {
|
|
72
|
+
for (const item of content.results) {
|
|
73
|
+
yield (0, ab_testing_js_1.handleABTesting)({ item, canTrack });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
logger_js_1.logger.error("Could not setup A/B testing. ", e);
|
|
79
|
+
}
|
|
80
|
+
return content;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
logger_js_1.logger.error("Error fetching data. ", error);
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
exports.getAllContent = getAllContent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetch = void 0;
|
|
4
|
+
const get_global_this_js_1 = require("./get-global-this.js");
|
|
5
|
+
function getFetch() {
|
|
6
|
+
const globalFetch = (0, get_global_this_js_1.getGlobalThis)().fetch;
|
|
7
|
+
if (typeof globalFetch === "undefined") {
|
|
8
|
+
console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
9
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`);
|
|
10
|
+
throw new Error("Builder SDK could not find a global `fetch` function");
|
|
11
|
+
}
|
|
12
|
+
return globalFetch;
|
|
13
|
+
}
|
|
14
|
+
const fetch = getFetch();
|
|
15
|
+
exports.fetch = fetch;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGlobalThis = void 0;
|
|
4
|
+
function getGlobalThis() {
|
|
5
|
+
if (typeof globalThis !== "undefined") {
|
|
6
|
+
return globalThis;
|
|
7
|
+
}
|
|
8
|
+
if (typeof window !== "undefined") {
|
|
9
|
+
return window;
|
|
10
|
+
}
|
|
11
|
+
if (typeof global !== "undefined") {
|
|
12
|
+
return global;
|
|
13
|
+
}
|
|
14
|
+
if (typeof self !== "undefined") {
|
|
15
|
+
return self;
|
|
16
|
+
}
|
|
17
|
+
return globalThis;
|
|
18
|
+
}
|
|
19
|
+
exports.getGlobalThis = getGlobalThis;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProcessedBlock = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
const evaluate_js_1 = require("./evaluate.js");
|
|
24
|
+
const fast_clone_js_1 = require("./fast-clone.js");
|
|
25
|
+
const set_js_1 = require("./set.js");
|
|
26
|
+
const transform_block_js_1 = require("./transform-block.js");
|
|
27
|
+
const evaluateBindings = ({ block, context, state }) => {
|
|
28
|
+
if (!block.bindings) {
|
|
29
|
+
return block;
|
|
30
|
+
}
|
|
31
|
+
const copy = (0, fast_clone_js_1.fastClone)(block);
|
|
32
|
+
const copied = __spreadProps(__spreadValues({}, copy), {
|
|
33
|
+
properties: __spreadValues({}, copy.properties),
|
|
34
|
+
actions: __spreadValues({}, copy.actions)
|
|
35
|
+
});
|
|
36
|
+
for (const binding in block.bindings) {
|
|
37
|
+
const expression = block.bindings[binding];
|
|
38
|
+
const value = (0, evaluate_js_1.evaluate)({ code: expression, state, context });
|
|
39
|
+
(0, set_js_1.set)(copied, binding, value);
|
|
40
|
+
}
|
|
41
|
+
return copied;
|
|
42
|
+
};
|
|
43
|
+
function getProcessedBlock({ block, context, shouldEvaluateBindings, state }) {
|
|
44
|
+
const transformedBlock = (0, transform_block_js_1.transformBlock)(block);
|
|
45
|
+
if (shouldEvaluateBindings) {
|
|
46
|
+
return evaluateBindings({ block: transformedBlock, state, context });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return transformedBlock;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.getProcessedBlock = getProcessedBlock;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const get_processed_block_js_1 = require("./get-processed-block.js");
|
|
4
|
+
test("Can process bindings", () => {
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
|
+
const block = {
|
|
7
|
+
"@type": "@builder.io/sdk:Element",
|
|
8
|
+
properties: {
|
|
9
|
+
foo: "bar"
|
|
10
|
+
},
|
|
11
|
+
bindings: {
|
|
12
|
+
"properties.foo": '"baz"',
|
|
13
|
+
"responsiveStyles.large.zIndex": "1 + 1",
|
|
14
|
+
"properties.test": "state.test",
|
|
15
|
+
"properties.block": `
|
|
16
|
+
const foo = 'bar';
|
|
17
|
+
return foo;
|
|
18
|
+
`,
|
|
19
|
+
"properties.isEditing": "builder.isEditing"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const processed = (0, get_processed_block_js_1.getProcessedBlock)({
|
|
23
|
+
block,
|
|
24
|
+
context: {},
|
|
25
|
+
state: { test: "hello" },
|
|
26
|
+
shouldEvaluateBindings: true
|
|
27
|
+
});
|
|
28
|
+
expect(processed).not.toEqual(block);
|
|
29
|
+
expect((_a = processed.properties) == null ? void 0 : _a.foo).toEqual("baz");
|
|
30
|
+
expect((_b = processed.properties) == null ? void 0 : _b.test).toEqual("hello");
|
|
31
|
+
expect((_c = processed.properties) == null ? void 0 : _c.block).toEqual("bar");
|
|
32
|
+
expect((_d = processed.properties) == null ? void 0 : _d.isEditing).toEqual(false);
|
|
33
|
+
expect((_f = (_e = processed.responsiveStyles) == null ? void 0 : _e.large) == null ? void 0 : _f.zIndex).toEqual(2);
|
|
34
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReactNativeBlockStyles = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
const sanitize_react_native_block_styles_js_1 = require("./sanitize-react-native-block-styles.js");
|
|
21
|
+
function getReactNativeBlockStyles({ block, context, blockStyles }) {
|
|
22
|
+
const responsiveStyles = block.responsiveStyles;
|
|
23
|
+
if (!responsiveStyles) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
const styles = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, context.inheritedStyles), responsiveStyles.large || {}), responsiveStyles.medium || {}), responsiveStyles.small || {}), blockStyles);
|
|
27
|
+
const newStyles = (0, sanitize_react_native_block_styles_js_1.sanitizeReactNativeBlockStyles)(styles);
|
|
28
|
+
return newStyles;
|
|
29
|
+
}
|
|
30
|
+
exports.getReactNativeBlockStyles = getReactNativeBlockStyles;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ifTarget = void 0;
|
|
4
|
+
const target_js_1 = require("../constants/target.js");
|
|
5
|
+
function ifTarget({ targets, doThing, elseThing }) {
|
|
6
|
+
if (target_js_1.TARGET && targets.includes(target_js_1.TARGET)) {
|
|
7
|
+
return doThing();
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return elseThing == null ? void 0 : elseThing();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ifTarget = ifTarget;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEditing = void 0;
|
|
4
|
+
const target_js_1 = require("../constants/target.js");
|
|
5
|
+
const is_iframe_js_1 = require("./is-iframe.js");
|
|
6
|
+
function isEditing() {
|
|
7
|
+
return (0, is_iframe_js_1.isIframe)() && (target_js_1.TARGET === "reactNative" || window.location.search.indexOf("builder.frameEditing=") !== -1);
|
|
8
|
+
}
|
|
9
|
+
exports.isEditing = isEditing;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isIframe = void 0;
|
|
4
|
+
const is_browser_js_1 = require("./is-browser.js");
|
|
5
|
+
function isIframe() {
|
|
6
|
+
return (0, is_browser_js_1.isBrowser)() && window.self !== window.top;
|
|
7
|
+
}
|
|
8
|
+
exports.isIframe = isIframe;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isPreviewing = void 0;
|
|
4
|
+
const is_browser_js_1 = require("./is-browser.js");
|
|
5
|
+
const is_editing_js_1 = require("./is-editing.js");
|
|
6
|
+
function isPreviewing() {
|
|
7
|
+
if (!(0, is_browser_js_1.isBrowser)()) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if ((0, is_editing_js_1.isEditing)()) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return Boolean(location.search.indexOf("builder.preview=") !== -1);
|
|
14
|
+
}
|
|
15
|
+
exports.isPreviewing = isPreviewing;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onChangeProxySymbol = exports.onChange = void 0;
|
|
4
|
+
const onChangeProxySymbol = Symbol("onChangeProxySymbol");
|
|
5
|
+
exports.onChangeProxySymbol = onChangeProxySymbol;
|
|
6
|
+
function onChange(obj, cb) {
|
|
7
|
+
return new Proxy(obj, {
|
|
8
|
+
get(target, key) {
|
|
9
|
+
if (key === onChangeProxySymbol) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
const value = Reflect.get(target, key);
|
|
13
|
+
if (value && typeof value === "object") {
|
|
14
|
+
if (value[onChangeProxySymbol]) {
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
return onChange(value, cb);
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
},
|
|
21
|
+
set(target, key, value) {
|
|
22
|
+
const returnValue = Reflect.set(target, key, value);
|
|
23
|
+
cb();
|
|
24
|
+
return returnValue;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.onChange = onChange;
|