@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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const on_change_js_1 = require("./on-change.js");
|
|
4
|
+
test("onChange can observe a shallow change", () => {
|
|
5
|
+
let changeHappend = false;
|
|
6
|
+
const obj = (0, on_change_js_1.onChange)({ foo: "hi" }, () => changeHappend = true);
|
|
7
|
+
obj.foo = "yo";
|
|
8
|
+
expect(changeHappend).toBe(true);
|
|
9
|
+
});
|
|
10
|
+
test("onChange can observe a deep change", () => {
|
|
11
|
+
let changeHappend = false;
|
|
12
|
+
const obj = (0, on_change_js_1.onChange)({ foo: { bar: "hi" } }, () => changeHappend = true);
|
|
13
|
+
obj.foo.bar = "yo";
|
|
14
|
+
expect(changeHappend).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
test("Smoke test: callback is not fired if no properties updated", () => {
|
|
17
|
+
let changeHappend = false;
|
|
18
|
+
const obj = (0, on_change_js_1.onChange)({ foo: { bar: "hi" } }, () => changeHappend = true);
|
|
19
|
+
obj.foo.bar;
|
|
20
|
+
expect(changeHappend).toBe(false);
|
|
21
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerComponent = exports.createRegisterComponentMessage = exports.components = 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 __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
const util_js_1 = require("../blocks/util.js");
|
|
36
|
+
const fast_clone_js_1 = require("./fast-clone.js");
|
|
37
|
+
const components = [];
|
|
38
|
+
exports.components = components;
|
|
39
|
+
function registerComponent(component, info) {
|
|
40
|
+
components.push(__spreadValues({ component }, info));
|
|
41
|
+
console.warn("registerComponent is deprecated. Use the `customComponents` prop in RenderContent instead to provide your custom components to the builder SDK.");
|
|
42
|
+
return component;
|
|
43
|
+
}
|
|
44
|
+
exports.registerComponent = registerComponent;
|
|
45
|
+
const createRegisterComponentMessage = (_a) => {
|
|
46
|
+
var _b = _a, { component: _ } = _b, info = __objRest(_b, [
|
|
47
|
+
"component"
|
|
48
|
+
]);
|
|
49
|
+
return {
|
|
50
|
+
type: "builder.registerComponent",
|
|
51
|
+
data: prepareComponentInfoToSend(info)
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
exports.createRegisterComponentMessage = createRegisterComponentMessage;
|
|
55
|
+
const serializeValue = (value) => typeof value === "function" ? (0, util_js_1.serializeFn)(value) : (0, fast_clone_js_1.fastClone)(value);
|
|
56
|
+
const prepareComponentInfoToSend = (_c) => {
|
|
57
|
+
var _d = _c, { inputs } = _d, info = __objRest(_d, [
|
|
58
|
+
"inputs"
|
|
59
|
+
]);
|
|
60
|
+
return __spreadProps(__spreadValues({}, (0, fast_clone_js_1.fastClone)(info)), {
|
|
61
|
+
inputs: inputs == null ? void 0 : inputs.map((input) => Object.entries(input).reduce((acc, [key, value]) => __spreadProps(__spreadValues({}, acc), {
|
|
62
|
+
[key]: serializeValue(value)
|
|
63
|
+
}), {}))
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.register = void 0;
|
|
4
|
+
const is_browser_js_1 = require("./is-browser.js");
|
|
5
|
+
const registry = {};
|
|
6
|
+
function register(type, info) {
|
|
7
|
+
let typeList = registry[type];
|
|
8
|
+
if (!typeList) {
|
|
9
|
+
typeList = registry[type] = [];
|
|
10
|
+
}
|
|
11
|
+
typeList.push(info);
|
|
12
|
+
if ((0, is_browser_js_1.isBrowser)()) {
|
|
13
|
+
const message = {
|
|
14
|
+
type: "builder.register",
|
|
15
|
+
data: {
|
|
16
|
+
type,
|
|
17
|
+
info
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
try {
|
|
21
|
+
parent.postMessage(message, "*");
|
|
22
|
+
if (parent !== window) {
|
|
23
|
+
window.postMessage(message, "*");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
console.debug("Could not postmessage", err);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.register = register;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeReactNativeBlockStyles = 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 propertiesThatMustBeNumber = new Set(["lineHeight"]);
|
|
24
|
+
const displayValues = new Set(["flex", "none"]);
|
|
25
|
+
const SHOW_WARNINGS = false;
|
|
26
|
+
const normalizeNumber = (value) => {
|
|
27
|
+
if (Number.isNaN(value)) {
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
else if (value < 0) {
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const sanitizeReactNativeBlockStyles = (styles) => {
|
|
38
|
+
return Object.keys(styles).reduce((acc, key) => {
|
|
39
|
+
const propertyValue = styles[key];
|
|
40
|
+
if (key === "display" && !displayValues.has(propertyValue)) {
|
|
41
|
+
if (SHOW_WARNINGS) {
|
|
42
|
+
console.warn(`Style value for key "display" must be "flex" or "none" but had ${propertyValue}`);
|
|
43
|
+
}
|
|
44
|
+
return acc;
|
|
45
|
+
}
|
|
46
|
+
if (propertiesThatMustBeNumber.has(key) && typeof propertyValue !== "number") {
|
|
47
|
+
if (SHOW_WARNINGS) {
|
|
48
|
+
console.warn(`Style key ${key} must be a number, but had value \`${styles[key]}\``);
|
|
49
|
+
}
|
|
50
|
+
return acc;
|
|
51
|
+
}
|
|
52
|
+
if (typeof propertyValue === "string") {
|
|
53
|
+
const isPixelUnit = propertyValue.match(/^-?(\d*)(\.?)(\d*)*px$/);
|
|
54
|
+
if (isPixelUnit) {
|
|
55
|
+
const newValue = parseFloat(propertyValue);
|
|
56
|
+
const normalizedValue = normalizeNumber(newValue);
|
|
57
|
+
if (normalizedValue) {
|
|
58
|
+
return __spreadProps(__spreadValues({}, acc), { [key]: normalizedValue });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return acc;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
else if (propertyValue === "0") {
|
|
65
|
+
return __spreadProps(__spreadValues({}, acc), { [key]: 0 });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return __spreadProps(__spreadValues({}, acc), { [key]: propertyValue });
|
|
69
|
+
}, {});
|
|
70
|
+
};
|
|
71
|
+
exports.sanitizeReactNativeBlockStyles = sanitizeReactNativeBlockStyles;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setEditorSettings = void 0;
|
|
4
|
+
const is_browser_js_1 = require("./is-browser.js");
|
|
5
|
+
const settings = {};
|
|
6
|
+
function setEditorSettings(newSettings) {
|
|
7
|
+
if ((0, is_browser_js_1.isBrowser)()) {
|
|
8
|
+
Object.assign(settings, newSettings);
|
|
9
|
+
const message = {
|
|
10
|
+
type: "builder.settingsChange",
|
|
11
|
+
data: settings
|
|
12
|
+
};
|
|
13
|
+
parent.postMessage(message, "*");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.setEditorSettings = setEditorSettings;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.set = void 0;
|
|
4
|
+
const set = (obj, _path, value) => {
|
|
5
|
+
if (Object(obj) !== obj) {
|
|
6
|
+
return obj;
|
|
7
|
+
}
|
|
8
|
+
const path = Array.isArray(_path) ? _path : _path.toString().match(/[^.[\]]+/g);
|
|
9
|
+
path.slice(0, -1).reduce((a, c, i) => Object(a[c]) === a[c] ? a[c] : a[c] = Math.abs(Number(path[i + 1])) >> 0 === +path[i + 1] ? [] : {}, obj)[path[path.length - 1]] = value;
|
|
10
|
+
return obj;
|
|
11
|
+
};
|
|
12
|
+
exports.set = set;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const set_js_1 = require("./set.js");
|
|
4
|
+
test("can shallow set a property", () => {
|
|
5
|
+
const obj = { foo: "bar" };
|
|
6
|
+
(0, set_js_1.set)(obj, "foo", "baz");
|
|
7
|
+
expect(obj.foo).toBe("baz");
|
|
8
|
+
});
|
|
9
|
+
test("can deeply set a property", () => {
|
|
10
|
+
const obj = { foo: "bar" };
|
|
11
|
+
(0, set_js_1.set)(obj, "foo.bar", "baz");
|
|
12
|
+
expect(obj.foo.bar).toBe("baz");
|
|
13
|
+
});
|
|
14
|
+
test("can deeply create arrays", () => {
|
|
15
|
+
const obj = { foo: "bar" };
|
|
16
|
+
(0, set_js_1.set)(obj, "foo.bar.0", "hi");
|
|
17
|
+
expect(obj.foo.bar).toEqual(["hi"]);
|
|
18
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getUserAttributes = void 0;
|
|
4
|
+
const target_1 = require("../../constants/target");
|
|
5
|
+
const is_browser_1 = require("../is-browser");
|
|
6
|
+
const getLocation = () => {
|
|
7
|
+
if (target_1.TARGET === "reactNative") {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
else if ((0, is_browser_1.isBrowser)()) {
|
|
11
|
+
const parsedLocation = new URL(location.href);
|
|
12
|
+
if (parsedLocation.pathname === "") {
|
|
13
|
+
parsedLocation.pathname = "/";
|
|
14
|
+
}
|
|
15
|
+
return parsedLocation;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.warn("Cannot get location for tracking in non-browser environment");
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const getUserAgent = () => typeof navigator === "object" && navigator.userAgent || "";
|
|
23
|
+
const getUserAttributes = () => {
|
|
24
|
+
const userAgent = getUserAgent();
|
|
25
|
+
const isMobile = {
|
|
26
|
+
Android() {
|
|
27
|
+
return userAgent.match(/Android/i);
|
|
28
|
+
},
|
|
29
|
+
BlackBerry() {
|
|
30
|
+
return userAgent.match(/BlackBerry/i);
|
|
31
|
+
},
|
|
32
|
+
iOS() {
|
|
33
|
+
return userAgent.match(/iPhone|iPod/i);
|
|
34
|
+
},
|
|
35
|
+
Opera() {
|
|
36
|
+
return userAgent.match(/Opera Mini/i);
|
|
37
|
+
},
|
|
38
|
+
Windows() {
|
|
39
|
+
return userAgent.match(/IEMobile/i) || userAgent.match(/WPDesktop/i);
|
|
40
|
+
},
|
|
41
|
+
any() {
|
|
42
|
+
return isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows() || target_1.TARGET === "reactNative";
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const isTablet = userAgent.match(/Tablet|iPad/i);
|
|
46
|
+
const url = getLocation();
|
|
47
|
+
return {
|
|
48
|
+
urlPath: url == null ? void 0 : url.pathname,
|
|
49
|
+
host: (url == null ? void 0 : url.host) || (url == null ? void 0 : url.hostname),
|
|
50
|
+
device: isTablet ? "tablet" : isMobile.any() ? "mobile" : "desktop"
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exports.getUserAttributes = getUserAttributes;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.track = exports._track = void 0;
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
2
5
|
var __defProps = Object.defineProperties;
|
|
3
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -51,17 +54,19 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
54
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
52
55
|
});
|
|
53
56
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const target_js_1 = require("../../constants/target.js");
|
|
58
|
+
const logger_js_1 = require("../../helpers/logger.js");
|
|
59
|
+
const sessionId_js_1 = require("../../helpers/sessionId.js");
|
|
60
|
+
const visitorId_js_1 = require("../../helpers/visitorId.js");
|
|
61
|
+
const is_browser_js_1 = require("../is-browser.js");
|
|
62
|
+
const is_editing_js_1 = require("../is-editing.js");
|
|
63
|
+
const helpers_js_1 = require("./helpers.js");
|
|
59
64
|
const getTrackingEventData = (_0) => __async(void 0, [_0], function* ({ canTrack }) {
|
|
60
65
|
if (!canTrack) {
|
|
61
66
|
return { visitorId: void 0, sessionId: void 0 };
|
|
62
67
|
}
|
|
63
|
-
const sessionId = yield getSessionId({ canTrack });
|
|
64
|
-
const visitorId = getVisitorId({ canTrack });
|
|
68
|
+
const sessionId = yield (0, sessionId_js_1.getSessionId)({ canTrack });
|
|
69
|
+
const visitorId = (0, visitorId_js_1.getVisitorId)({ canTrack });
|
|
65
70
|
return {
|
|
66
71
|
sessionId,
|
|
67
72
|
visitorId
|
|
@@ -77,8 +82,11 @@ const createEvent = (_a) => __async(void 0, null, function* () {
|
|
|
77
82
|
return {
|
|
78
83
|
type: eventType,
|
|
79
84
|
data: __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, properties), {
|
|
80
|
-
metadata:
|
|
85
|
+
metadata: __spreadValues({
|
|
86
|
+
url: location.href
|
|
87
|
+
}, metadata)
|
|
81
88
|
}), yield getTrackingEventData({ canTrack })), {
|
|
89
|
+
userAttributes: (0, helpers_js_1.getUserAttributes)(),
|
|
82
90
|
ownerId: apiKey
|
|
83
91
|
})
|
|
84
92
|
};
|
|
@@ -86,16 +94,16 @@ const createEvent = (_a) => __async(void 0, null, function* () {
|
|
|
86
94
|
function _track(eventProps) {
|
|
87
95
|
return __async(this, null, function* () {
|
|
88
96
|
if (!eventProps.apiKey) {
|
|
89
|
-
|
|
97
|
+
logger_js_1.logger.error("Missing API key for track call. Please provide your API key.");
|
|
90
98
|
return;
|
|
91
99
|
}
|
|
92
100
|
if (!eventProps.canTrack) {
|
|
93
101
|
return;
|
|
94
102
|
}
|
|
95
|
-
if (isEditing()) {
|
|
103
|
+
if ((0, is_editing_js_1.isEditing)()) {
|
|
96
104
|
return;
|
|
97
105
|
}
|
|
98
|
-
if (!(isBrowser() || TARGET === "reactNative")) {
|
|
106
|
+
if (!((0, is_browser_js_1.isBrowser)() || target_js_1.TARGET === "reactNative")) {
|
|
99
107
|
return;
|
|
100
108
|
}
|
|
101
109
|
return fetch(`https://builder.io/api/v1/track`, {
|
|
@@ -112,5 +120,6 @@ function _track(eventProps) {
|
|
|
112
120
|
});
|
|
113
121
|
});
|
|
114
122
|
}
|
|
123
|
+
exports._track = _track;
|
|
115
124
|
const track = (args) => _track(__spreadProps(__spreadValues({}, args), { canTrack: true }));
|
|
116
|
-
|
|
125
|
+
exports.track = track;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInteractionPropertiesForEvent = void 0;
|
|
4
|
+
function round(num) {
|
|
5
|
+
return Math.round(num * 1e3) / 1e3;
|
|
6
|
+
}
|
|
7
|
+
const findParentElement = (target, callback, checkElement = true) => {
|
|
8
|
+
if (!(target instanceof HTMLElement)) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
let parent = checkElement ? target : target.parentElement;
|
|
12
|
+
do {
|
|
13
|
+
if (!parent) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const matches = callback(parent);
|
|
17
|
+
if (matches) {
|
|
18
|
+
return parent;
|
|
19
|
+
}
|
|
20
|
+
} while (parent = parent.parentElement);
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
const findBuilderParent = (target) => findParentElement(target, (el) => {
|
|
24
|
+
const id = el.getAttribute("builder-id") || el.id;
|
|
25
|
+
return Boolean((id == null ? void 0 : id.indexOf("builder-")) === 0);
|
|
26
|
+
});
|
|
27
|
+
const computeOffset = ({ event, target }) => {
|
|
28
|
+
const targetRect = target.getBoundingClientRect();
|
|
29
|
+
const xOffset = event.clientX - targetRect.left;
|
|
30
|
+
const yOffset = event.clientY - targetRect.top;
|
|
31
|
+
const xRatio = round(xOffset / targetRect.width);
|
|
32
|
+
const yRatio = round(yOffset / targetRect.height);
|
|
33
|
+
return {
|
|
34
|
+
x: xRatio,
|
|
35
|
+
y: yRatio
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const getInteractionPropertiesForEvent = (event) => {
|
|
39
|
+
const target = event.target;
|
|
40
|
+
const targetBuilderElement = target && findBuilderParent(target);
|
|
41
|
+
const builderId = (targetBuilderElement == null ? void 0 : targetBuilderElement.getAttribute("builder-id")) || (targetBuilderElement == null ? void 0 : targetBuilderElement.id);
|
|
42
|
+
return {
|
|
43
|
+
targetBuilderElement: builderId || void 0,
|
|
44
|
+
metadata: {
|
|
45
|
+
targetOffset: target ? computeOffset({ event, target }) : void 0,
|
|
46
|
+
builderTargetOffset: targetBuilderElement ? computeOffset({ event, target: targetBuilderElement }) : void 0,
|
|
47
|
+
builderElementIndex: targetBuilderElement && builderId ? [].slice.call(document.getElementsByClassName(builderId)).indexOf(targetBuilderElement) : void 0
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.getInteractionPropertiesForEvent = getInteractionPropertiesForEvent;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setContentVariationCookie = exports.getContentVariationCookie = void 0;
|
|
4
|
+
const cookie_js_1 = require("./cookie.js");
|
|
5
|
+
const BUILDER_STORE_PREFIX = "builderio.variations";
|
|
6
|
+
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
7
|
+
const getContentVariationCookie = ({ contentId, canTrack }) => (0, cookie_js_1.getCookie)({ name: getContentTestKey(contentId), canTrack });
|
|
8
|
+
exports.getContentVariationCookie = getContentVariationCookie;
|
|
9
|
+
const setContentVariationCookie = ({ contentId, canTrack, value }) => (0, cookie_js_1.setCookie)({ name: getContentTestKey(contentId), value, canTrack });
|
|
10
|
+
exports.setContentVariationCookie = setContentVariationCookie;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setCookie = exports.getCookie = 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 is_browser_js_1 = require("../functions/is-browser.js");
|
|
27
|
+
const nullable_js_1 = require("./nullable.js");
|
|
28
|
+
const url_js_1 = require("./url.js");
|
|
29
|
+
const getCookie = (_0) => __async(void 0, [_0], function* ({ name, canTrack }) {
|
|
30
|
+
var _a;
|
|
31
|
+
try {
|
|
32
|
+
if (!canTrack) {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
return (_a = document.cookie.split("; ").find((row) => row.startsWith(`${name}=`))) == null ? void 0 : _a.split("=")[1];
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
console.debug("[COOKIE] GET error: ", err);
|
|
39
|
+
return void 0;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
exports.getCookie = getCookie;
|
|
43
|
+
const stringifyCookie = (cookie) => cookie.map(([key, value]) => value ? `${key}=${value}` : key).filter(nullable_js_1.checkIsDefined).join("; ");
|
|
44
|
+
const SECURE_CONFIG = [
|
|
45
|
+
["secure", ""],
|
|
46
|
+
["SameSite", "None"]
|
|
47
|
+
];
|
|
48
|
+
const createCookieString = ({ name, value, expires }) => {
|
|
49
|
+
const secure = (0, is_browser_js_1.isBrowser)() ? location.protocol === "https:" : true;
|
|
50
|
+
const secureObj = secure ? SECURE_CONFIG : [[]];
|
|
51
|
+
const expiresObj = expires ? [["expires", expires.toUTCString()]] : [[]];
|
|
52
|
+
const cookieValue = [
|
|
53
|
+
[name, value],
|
|
54
|
+
...expiresObj,
|
|
55
|
+
["path", "/"],
|
|
56
|
+
["domain", (0, url_js_1.getTopLevelDomain)(window.location.hostname)],
|
|
57
|
+
...secureObj
|
|
58
|
+
];
|
|
59
|
+
const cookie = stringifyCookie(cookieValue);
|
|
60
|
+
return cookie;
|
|
61
|
+
};
|
|
62
|
+
const setCookie = (_0) => __async(void 0, [_0], function* ({ name, value, expires, canTrack }) {
|
|
63
|
+
try {
|
|
64
|
+
if (!canTrack) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const cookie = createCookieString({ name, value, expires });
|
|
68
|
+
document.cookie = cookie;
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
console.warn("[COOKIE] SET error: ", err);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
exports.setCookie = setCookie;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCssClass = exports.convertStyleMapToCSSArray = exports.convertStyleMapToCSS = void 0;
|
|
4
|
+
const camel_to_kebab_case_js_1 = require("../functions/camel-to-kebab-case.js");
|
|
5
|
+
const nullable_js_1 = require("./nullable.js");
|
|
6
|
+
const convertStyleMapToCSSArray = (style) => {
|
|
7
|
+
const cssProps = Object.entries(style).map(([key, value]) => {
|
|
8
|
+
if (typeof value === "string") {
|
|
9
|
+
return `${(0, camel_to_kebab_case_js_1.camelToKebabCase)(key)}: ${value};`;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return cssProps.filter(nullable_js_1.checkIsDefined);
|
|
16
|
+
};
|
|
17
|
+
exports.convertStyleMapToCSSArray = convertStyleMapToCSSArray;
|
|
18
|
+
const convertStyleMapToCSS = (style) => convertStyleMapToCSSArray(style).join("\n");
|
|
19
|
+
exports.convertStyleMapToCSS = convertStyleMapToCSS;
|
|
20
|
+
const createCssClass = ({ mediaQuery, className, styles }) => {
|
|
21
|
+
const cssClass = `.${className} {
|
|
22
|
+
${convertStyleMapToCSS(styles)}
|
|
23
|
+
}`;
|
|
24
|
+
if (mediaQuery) {
|
|
25
|
+
return `${mediaQuery} {
|
|
26
|
+
${cssClass}
|
|
27
|
+
}`;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return cssClass;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.createCssClass = createCssClass;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flatten = 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
|
+
function flatten(object, path = null, separator = ".") {
|
|
24
|
+
return Object.keys(object).reduce((acc, key) => {
|
|
25
|
+
const value = object[key];
|
|
26
|
+
const newPath = [path, key].filter(Boolean).join(separator);
|
|
27
|
+
const isObject = [
|
|
28
|
+
typeof value === "object",
|
|
29
|
+
value !== null,
|
|
30
|
+
!(Array.isArray(value) && value.length === 0)
|
|
31
|
+
].every(Boolean);
|
|
32
|
+
return isObject ? __spreadValues(__spreadValues({}, acc), flatten(value, newPath, separator)) : __spreadProps(__spreadValues({}, acc), { [newPath]: value });
|
|
33
|
+
}, {});
|
|
34
|
+
}
|
|
35
|
+
exports.flatten = flatten;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setLocalStorageItem = exports.getLocalStorageItem = void 0;
|
|
4
|
+
const is_browser_js_1 = require("../functions/is-browser.js");
|
|
5
|
+
const getLocalStorage = () => (0, is_browser_js_1.isBrowser)() && typeof localStorage !== "undefined" ? localStorage : void 0;
|
|
6
|
+
const getLocalStorageItem = ({ key, canTrack }) => {
|
|
7
|
+
var _a;
|
|
8
|
+
try {
|
|
9
|
+
if (canTrack) {
|
|
10
|
+
return (_a = getLocalStorage()) == null ? void 0 : _a.getItem(key);
|
|
11
|
+
}
|
|
12
|
+
return void 0;
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
console.debug("[LocalStorage] GET error: ", err);
|
|
16
|
+
return void 0;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.getLocalStorageItem = getLocalStorageItem;
|
|
20
|
+
const setLocalStorageItem = ({ key, canTrack, value }) => {
|
|
21
|
+
var _a;
|
|
22
|
+
try {
|
|
23
|
+
if (canTrack) {
|
|
24
|
+
(_a = getLocalStorage()) == null ? void 0 : _a.setItem(key, value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.debug("[LocalStorage] SET error: ", err);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.setLocalStorageItem = setLocalStorageItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = void 0;
|
|
4
|
+
const MSG_PREFIX = "[Builder.io]: ";
|
|
5
|
+
const logger = {
|
|
6
|
+
log: (...message) => console.log(MSG_PREFIX, ...message),
|
|
7
|
+
error: (...message) => console.error(MSG_PREFIX, ...message),
|
|
8
|
+
warn: (...message) => console.warn(MSG_PREFIX, ...message)
|
|
9
|
+
};
|
|
10
|
+
exports.logger = logger;
|