@builder.io/sdk-react-native 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/button/button.js +6 -2
- package/dist/blocks/button/component-info.js +4 -8
- package/dist/blocks/columns/columns.js +19 -23
- package/dist/blocks/columns/component-info.js +27 -48
- package/dist/blocks/custom-code/component-info.js +4 -8
- package/dist/blocks/custom-code/custom-code.js +1 -1
- package/dist/blocks/embed/component-info.js +7 -11
- package/dist/blocks/embed/embed.js +1 -1
- package/dist/blocks/embed/helpers.js +2 -6
- package/dist/blocks/form/component-info.js +33 -69
- package/dist/blocks/form/form.js +2 -203
- package/dist/blocks/fragment/fragment.js +1 -1
- package/dist/blocks/helpers.js +33 -0
- package/dist/blocks/image/component-info.js +21 -47
- package/dist/blocks/image/image.helpers.js +2 -2
- package/dist/blocks/img/component-info.js +2 -4
- package/dist/blocks/img/img.js +2 -1
- package/dist/blocks/input/component-info.js +8 -34
- package/dist/blocks/input/input.js +2 -1
- package/dist/blocks/raw-text/component-info.js +2 -4
- package/dist/blocks/raw-text/raw-text.js +3 -2
- package/dist/blocks/section/component-info.js +5 -10
- package/dist/blocks/section/section.js +2 -1
- package/dist/blocks/select/component-info.js +12 -24
- package/dist/blocks/select/select.js +2 -1
- package/dist/blocks/submit-button/component-info.js +2 -4
- package/dist/blocks/submit-button/submit-button.js +2 -1
- package/dist/blocks/symbol/component-info.js +7 -12
- package/dist/blocks/symbol/symbol.helpers.js +66 -0
- package/dist/blocks/symbol/symbol.js +23 -50
- package/dist/blocks/text/component-info.js +3 -4
- package/dist/blocks/textarea/component-info.js +6 -12
- package/dist/blocks/textarea/textarea.js +2 -1
- package/dist/blocks/video/component-info.js +21 -41
- package/dist/components/block/block.helpers.js +102 -0
- package/dist/components/block/block.js +141 -0
- package/dist/components/block/components/block-styles.js +95 -0
- package/dist/components/block/components/block-wrapper/block-wrapper.js +41 -0
- package/dist/components/block/components/block-wrapper.js +56 -0
- package/dist/components/block/components/component-ref/component-ref.helpers.js +40 -0
- package/dist/components/block/components/component-ref/component-ref.js +63 -0
- package/dist/components/block/components/component-ref.js +81 -0
- package/dist/components/block/components/component.js +41 -0
- package/dist/components/block/components/interactive-element/interactive-element.helpers.js +35 -0
- package/dist/components/block/components/interactive-element/interactive-element.js +36 -0
- package/dist/components/block/components/interactive-element.js +46 -0
- package/dist/components/block/components/repeated-block.js +40 -0
- package/dist/components/block/types.js +1 -0
- package/dist/components/blocks/blocks-wrapper.js +69 -0
- package/dist/components/blocks/blocks.js +41 -0
- package/dist/components/content/builder-editing.js +32 -0
- package/dist/components/content/components/content-styles.helpers.js +55 -0
- package/dist/components/content/components/content-styles.js +61 -0
- package/dist/components/content/components/enable-editor.js +310 -0
- package/dist/components/content/components/styles.helpers.js +55 -0
- package/dist/components/content/components/styles.js +61 -0
- package/dist/components/content/content.helpers.js +49 -0
- package/dist/components/content/content.js +110 -0
- package/dist/components/content/content.types.js +1 -0
- package/dist/components/content/index.js +8 -0
- package/dist/components/content/wrap-component-ref.js +5 -0
- package/dist/components/content-variants/content-variants.js +77 -0
- package/dist/components/content-variants/content-variants.types.js +1 -0
- package/dist/components/content-variants/helpers.js +175 -0
- package/dist/components/inlined-script.js +32 -0
- package/dist/components/{render-inlined-styles.js → inlined-styles.js} +3 -3
- package/dist/components/render-block/block-styles.js +2 -2
- package/dist/components/render-content/components/render-styles.js +2 -2
- package/dist/components/render-content/render-content.js +10 -8
- package/dist/components/render-content-variants/helpers.js +49 -20
- package/dist/components/render-content-variants/render-content-variants.js +29 -24
- package/dist/components/render-content-variants/render-content-variants.types.js +1 -0
- package/dist/constants/device-sizes.js +2 -2
- package/dist/constants/sdk-version.js +1 -1
- package/dist/context/builder.context.js +1 -1
- package/dist/functions/apply-patch-with-mutation.js +75 -0
- package/dist/functions/apply-patch-with-mutation.test.js +55 -0
- package/dist/functions/camel-to-kebab-case.js +1 -1
- package/dist/functions/evaluate/acorn.js +1691 -0
- package/dist/functions/evaluate/evaluate.js +72 -0
- package/dist/functions/evaluate/index.js +5 -0
- package/dist/functions/evaluate/interpreter.js +2903 -0
- package/dist/functions/evaluate/non-node-runtime.js +97 -0
- package/dist/functions/evaluate/types.js +1 -0
- package/dist/functions/evaluate.test.js +12 -6
- package/dist/functions/event-handler-name.js +1 -1
- package/dist/functions/extract-text-styles.js +3 -9
- package/dist/functions/fast-clone.js +1 -1
- package/dist/functions/get-block-actions-handler.js +2 -2
- package/dist/functions/get-block-actions.js +14 -1
- package/dist/functions/get-block-component-options.js +6 -1
- package/dist/functions/get-block-properties.js +21 -8
- package/dist/functions/get-builder-search-params/fn.test.js +3 -3
- package/dist/functions/get-builder-search-params/index.js +4 -4
- package/dist/functions/get-content/generate-content-url.js +12 -5
- package/dist/functions/get-content/generate-content-url.test.js +31 -17
- package/dist/functions/get-content/index.js +36 -12
- package/dist/functions/get-content/processCookies.js +7 -0
- package/dist/functions/get-processed-block.js +8 -3
- package/dist/functions/get-processed-block.test.js +3 -1
- package/dist/functions/get-react-native-block-styles.js +6 -1
- package/dist/functions/is-non-node-server.js +12 -0
- package/dist/functions/on-change.test.js +13 -3
- package/dist/functions/register-component.js +24 -19
- package/dist/functions/sanitize-react-native-block-styles.js +17 -6
- package/dist/functions/set.test.js +9 -3
- package/dist/functions/track/helpers.js +5 -5
- package/dist/functions/track/index.js +29 -18
- package/dist/functions/track/interaction.js +10 -4
- package/dist/functions/transform-block-properties.js +2 -0
- package/dist/helpers/ab-tests.js +38 -14
- package/dist/helpers/canTrack.js +2 -2
- package/dist/helpers/css.js +2 -2
- package/dist/helpers/flatten.js +10 -7
- package/dist/helpers/nullable.js +1 -1
- package/dist/helpers/preview-lru-cache/get.js +11 -0
- package/dist/helpers/preview-lru-cache/helpers.js +13 -0
- package/dist/helpers/preview-lru-cache/init.js +13 -0
- package/dist/helpers/preview-lru-cache/set.js +37 -0
- package/dist/helpers/preview-lru-cache/types.js +1 -0
- package/dist/helpers/sessionId.js +13 -6
- package/dist/helpers/url.js +1 -1
- package/dist/helpers/visitorId.js +4 -1
- package/dist/index-helpers/blocks-exports.js +2 -2
- package/dist/scripts/init-editing.js +61 -46
- package/dist/types/builder-props.js +1 -0
- package/dist/types/enforced-partials.js +1 -0
- package/package.json +2 -2
- package/src/blocks/button/button.jsx +11 -2
- package/src/blocks/button/component-info.js +16 -22
- package/src/blocks/columns/columns.jsx +29 -28
- package/src/blocks/columns/component-info.js +203 -226
- package/src/blocks/custom-code/component-info.js +19 -25
- package/src/blocks/custom-code/custom-code.jsx +1 -1
- package/src/blocks/embed/component-info.js +31 -37
- package/src/blocks/embed/embed.jsx +1 -1
- package/src/blocks/embed/helpers.js +3 -9
- package/src/blocks/form/component-info.js +174 -212
- package/src/blocks/form/form.jsx +3 -247
- package/src/blocks/fragment/component-info.js +1 -3
- package/src/blocks/fragment/fragment.jsx +1 -1
- package/src/blocks/helpers.js +27 -0
- package/src/blocks/image/component-info.js +105 -133
- package/src/blocks/image/image.helpers.js +3 -5
- package/src/blocks/img/component-info.js +8 -12
- package/src/blocks/img/img.jsx +3 -1
- package/src/blocks/input/component-info.js +29 -57
- package/src/blocks/input/input.jsx +3 -1
- package/src/blocks/raw-text/component-info.js +7 -11
- package/src/blocks/raw-text/raw-text.jsx +4 -2
- package/src/blocks/section/component-info.js +24 -31
- package/src/blocks/section/section.jsx +3 -1
- package/src/blocks/select/component-info.js +34 -48
- package/src/blocks/select/select.jsx +3 -1
- package/src/blocks/submit-button/component-info.js +6 -10
- package/src/blocks/submit-button/submit-button.jsx +3 -2
- package/src/blocks/symbol/component-info.js +30 -37
- package/src/blocks/symbol/symbol.helpers.js +60 -0
- package/src/blocks/symbol/symbol.jsx +34 -59
- package/src/blocks/text/component-info.js +10 -13
- package/src/blocks/textarea/component-info.js +22 -30
- package/src/blocks/textarea/textarea.jsx +3 -1
- package/src/blocks/video/component-info.js +74 -96
- package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
- package/src/components/{render-block/render-block.jsx → block/block.jsx} +68 -81
- package/src/components/{render-block → block/components}/block-styles.jsx +19 -18
- package/src/components/block/components/block-wrapper.jsx +58 -0
- package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
- package/src/components/block/components/component-ref/component-ref.jsx +72 -0
- package/src/components/block/components/interactive-element.jsx +37 -0
- package/src/components/{render-block/render-repeated-block.jsx → block/components/repeated-block.jsx} +10 -6
- package/src/components/blocks/blocks-wrapper.jsx +74 -0
- package/src/components/blocks/blocks.jsx +51 -0
- package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +81 -165
- package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
- package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +7 -7
- package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
- package/src/components/content/content.jsx +141 -0
- package/src/components/content/content.types.js +0 -0
- package/src/components/content/index.js +2 -0
- package/src/components/content/wrap-component-ref.js +2 -0
- package/src/components/content-variants/content-variants.jsx +120 -0
- package/src/components/{render-content-variants → content-variants}/helpers.js +58 -41
- package/src/components/inlined-script.jsx +18 -0
- package/src/components/{render-inlined-styles.jsx → inlined-styles.jsx} +3 -3
- package/src/constants/device-sizes.js +6 -6
- package/src/constants/sdk-version.js +1 -1
- package/src/context/builder.context.js +1 -1
- package/src/functions/apply-patch-with-mutation.js +66 -0
- package/src/functions/camel-to-kebab-case.js +2 -4
- package/src/functions/evaluate/acorn.js +1595 -0
- package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
- package/src/functions/evaluate/index.js +2 -0
- package/src/functions/evaluate/interpreter.js +2801 -0
- package/src/functions/evaluate/non-node-runtime.js +92 -0
- package/src/functions/evaluate/types.js +0 -0
- package/src/functions/event-handler-name.js +2 -4
- package/src/functions/extract-text-styles.js +4 -12
- package/src/functions/fast-clone.js +2 -4
- package/src/functions/get-block-actions-handler.js +3 -5
- package/src/functions/get-block-actions.js +15 -4
- package/src/functions/get-block-component-options.js +11 -12
- package/src/functions/get-block-properties.js +29 -19
- package/src/functions/get-builder-search-params/index.js +5 -10
- package/src/functions/get-content/generate-content-url.js +17 -19
- package/src/functions/get-content/index.js +43 -29
- package/src/functions/get-fetch.js +1 -3
- package/src/functions/get-global-this.js +1 -3
- package/src/functions/get-processed-block.js +12 -13
- package/src/functions/get-react-native-block-styles.js +11 -12
- package/src/functions/if-target.js +1 -3
- package/src/functions/is-browser.js +1 -3
- package/src/functions/is-editing.js +1 -3
- package/src/functions/is-iframe.js +1 -3
- package/src/functions/is-non-node-server.js +9 -0
- package/src/functions/is-previewing.js +1 -3
- package/src/functions/on-change.js +1 -4
- package/src/functions/register-component.js +34 -42
- package/src/functions/register.js +1 -3
- package/src/functions/sanitize-react-native-block-styles.js +22 -17
- package/src/functions/set-editor-settings.js +1 -3
- package/src/functions/set.js +1 -3
- package/src/functions/track/helpers.js +3 -5
- package/src/functions/track/index.js +45 -43
- package/src/functions/track/interaction.js +11 -7
- package/src/functions/transform-block-properties.js +2 -0
- package/src/helpers/ab-tests.js +46 -26
- package/src/helpers/canTrack.js +3 -5
- package/src/helpers/css.js +3 -7
- package/src/helpers/flatten.js +15 -18
- package/src/helpers/localStorage.js +1 -4
- package/src/helpers/logger.js +1 -3
- package/src/helpers/nullable.js +2 -4
- package/src/helpers/preview-lru-cache/get.js +8 -0
- package/src/helpers/preview-lru-cache/helpers.js +10 -0
- package/src/helpers/preview-lru-cache/init.js +10 -0
- package/src/helpers/preview-lru-cache/set.js +35 -0
- package/src/helpers/preview-lru-cache/types.js +0 -0
- package/src/helpers/sessionId.js +14 -11
- package/src/helpers/time.js +1 -3
- package/src/helpers/url.js +2 -4
- package/src/helpers/uuid.js +4 -6
- package/src/helpers/visitorId.js +8 -7
- package/src/index-helpers/blocks-exports.js +1 -1
- package/src/index.js +2 -17
- package/src/scripts/init-editing.js +62 -48
- package/src/types/api-version.js +1 -3
- package/src/types/builder-props.js +0 -0
- package/src/types/enforced-partials.js +0 -0
- package/dist/blocks/BaseText.d.ts +0 -6
- package/dist/blocks/button/button.d.ts +0 -9
- package/dist/blocks/button/component-info.d.ts +0 -2
- package/dist/blocks/columns/columns.d.ts +0 -16
- package/dist/blocks/columns/component-info.d.ts +0 -2
- package/dist/blocks/custom-code/component-info.d.ts +0 -2
- package/dist/blocks/custom-code/custom-code.d.ts +0 -5
- package/dist/blocks/embed/component-info.d.ts +0 -2
- package/dist/blocks/embed/embed.d.ts +0 -5
- package/dist/blocks/embed/helpers.d.ts +0 -1
- package/dist/blocks/form/component-info.d.ts +0 -2
- package/dist/blocks/form/form.d.ts +0 -28
- package/dist/blocks/fragment/component-info.d.ts +0 -2
- package/dist/blocks/fragment/fragment.d.ts +0 -8
- package/dist/blocks/image/component-info.d.ts +0 -2
- package/dist/blocks/image/image.d.ts +0 -17
- package/dist/blocks/image/image.helpers.d.ts +0 -1
- package/dist/blocks/img/component-info.d.ts +0 -2
- package/dist/blocks/img/img.d.ts +0 -11
- package/dist/blocks/input/component-info.d.ts +0 -2
- package/dist/blocks/input/input.d.ts +0 -12
- package/dist/blocks/raw-text/component-info.d.ts +0 -2
- package/dist/blocks/raw-text/raw-text.d.ts +0 -5
- package/dist/blocks/section/component-info.d.ts +0 -2
- package/dist/blocks/section/section.d.ts +0 -9
- package/dist/blocks/select/component-info.d.ts +0 -2
- package/dist/blocks/select/select.d.ts +0 -13
- package/dist/blocks/submit-button/component-info.d.ts +0 -2
- package/dist/blocks/submit-button/submit-button.d.ts +0 -7
- package/dist/blocks/symbol/component-info.d.ts +0 -2
- package/dist/blocks/symbol/symbol.d.ts +0 -21
- package/dist/blocks/text/component-info.d.ts +0 -2
- package/dist/blocks/text/text.d.ts +0 -7
- package/dist/blocks/textarea/component-info.d.ts +0 -2
- package/dist/blocks/textarea/textarea.d.ts +0 -10
- package/dist/blocks/util.d.ts +0 -4
- package/dist/blocks/video/component-info.d.ts +0 -2
- package/dist/blocks/video/video.d.ts +0 -31
- package/dist/components/render-block/block-styles.d.ts +0 -9
- package/dist/components/render-block/render-block.d.ts +0 -9
- package/dist/components/render-block/render-block.helpers.d.ts +0 -12
- package/dist/components/render-block/render-component.d.ts +0 -17
- package/dist/components/render-block/render-repeated-block.d.ts +0 -9
- package/dist/components/render-block/types.d.ts +0 -6
- package/dist/components/render-blocks.d.ts +0 -10
- package/dist/components/render-content/builder-editing.d.ts +0 -3
- package/dist/components/render-content/components/render-styles.d.ts +0 -9
- package/dist/components/render-content/components/render-styles.helpers.d.ts +0 -15
- package/dist/components/render-content/index.d.ts +0 -1
- package/dist/components/render-content/render-content.d.ts +0 -4
- package/dist/components/render-content/render-content.helpers.d.ts +0 -7
- package/dist/components/render-content/render-content.types.d.ts +0 -38
- package/dist/components/render-content/wrap-component-ref.d.ts +0 -6
- package/dist/components/render-content-variants/helpers.d.ts +0 -17
- package/dist/components/render-content-variants/render-content-variants.d.ts +0 -5
- package/dist/components/render-inlined-styles.d.ts +0 -7
- package/dist/constants/builder-registered-components.d.ts +0 -6
- package/dist/constants/device-sizes.d.ts +0 -13
- package/dist/constants/sdk-version.d.ts +0 -1
- package/dist/constants/target.d.ts +0 -3
- package/dist/context/builder.context.d.ts +0 -3
- package/dist/context/types.d.ts +0 -35
- package/dist/functions/camel-to-kebab-case.d.ts +0 -1
- package/dist/functions/evaluate.d.ts +0 -7
- package/dist/functions/evaluate.test.d.ts +0 -1
- package/dist/functions/event-handler-name.d.ts +0 -1
- package/dist/functions/extract-text-styles.d.ts +0 -4
- package/dist/functions/fast-clone.d.ts +0 -4
- package/dist/functions/get-block-actions-handler.d.ts +0 -8
- package/dist/functions/get-block-actions.d.ts +0 -9
- package/dist/functions/get-block-component-options.d.ts +0 -2
- package/dist/functions/get-block-properties.d.ts +0 -2
- package/dist/functions/get-builder-search-params/fn.test.d.ts +0 -1
- package/dist/functions/get-builder-search-params/index.d.ts +0 -12
- package/dist/functions/get-content/generate-content-url.d.ts +0 -2
- package/dist/functions/get-content/generate-content-url.test.d.ts +0 -1
- package/dist/functions/get-content/index.d.ts +0 -16
- package/dist/functions/get-content/types.d.ts +0 -51
- package/dist/functions/get-fetch.d.ts +0 -1
- package/dist/functions/get-processed-block.d.ts +0 -10
- package/dist/functions/get-processed-block.test.d.ts +0 -1
- package/dist/functions/get-react-native-block-styles.d.ts +0 -7
- package/dist/functions/if-target.d.ts +0 -7
- package/dist/functions/is-browser.d.ts +0 -1
- package/dist/functions/is-editing.d.ts +0 -1
- package/dist/functions/is-iframe.d.ts +0 -1
- package/dist/functions/is-previewing.d.ts +0 -1
- package/dist/functions/on-change.d.ts +0 -7
- package/dist/functions/on-change.test.d.ts +0 -1
- package/dist/functions/register-component.d.ts +0 -14
- package/dist/functions/register.d.ts +0 -16
- package/dist/functions/sanitize-react-native-block-styles.d.ts +0 -3
- package/dist/functions/set-editor-settings.d.ts +0 -4
- package/dist/functions/set.d.ts +0 -7
- package/dist/functions/set.test.d.ts +0 -1
- package/dist/functions/track/helpers.d.ts +0 -5
- package/dist/functions/track/index.d.ts +0 -51
- package/dist/functions/track/interaction.d.ts +0 -13
- package/dist/functions/transform-block-properties.d.ts +0 -3
- package/dist/functions/transform-block.d.ts +0 -2
- package/dist/helpers/ab-tests.d.ts +0 -9
- package/dist/helpers/canTrack.d.ts +0 -1
- package/dist/helpers/cookie.d.ts +0 -9
- package/dist/helpers/css.d.ts +0 -7
- package/dist/helpers/flatten.d.ts +0 -6
- package/dist/helpers/localStorage.d.ts +0 -9
- package/dist/helpers/logger.d.ts +0 -6
- package/dist/helpers/nullable.d.ts +0 -2
- package/dist/helpers/sessionId.d.ts +0 -6
- package/dist/helpers/time.d.ts +0 -1
- package/dist/helpers/url.d.ts +0 -6
- package/dist/helpers/url.test.d.ts +0 -1
- package/dist/helpers/uuid.d.ts +0 -8
- package/dist/helpers/visitorId.d.ts +0 -6
- package/dist/index-helpers/blocks-exports.d.ts +0 -8
- package/dist/index-helpers/top-of-file.d.ts +0 -1
- package/dist/index.d.ts +0 -15
- package/dist/scripts/init-editing.d.ts +0 -6
- package/dist/types/api-version.d.ts +0 -2
- package/dist/types/builder-block.d.ts +0 -66
- package/dist/types/builder-content.d.ts +0 -44
- package/dist/types/can-track.d.ts +0 -3
- package/dist/types/components.d.ts +0 -105
- package/dist/types/deep-partial.d.ts +0 -3
- package/dist/types/element.d.ts +0 -59
- package/dist/types/input.d.ts +0 -121
- package/dist/types/targets.d.ts +0 -3
- package/dist/types/typescript.d.ts +0 -5
- package/src/blocks/util.js +0 -8
- package/src/components/render-block/render-component.jsx +0 -55
- package/src/components/render-blocks.jsx +0 -101
- package/src/components/render-content/builder-editing.jsx +0 -16
- package/src/components/render-content/index.js +0 -4
- package/src/components/render-content/wrap-component-ref.js +0 -4
- package/src/components/render-content-variants/render-content-variants.jsx +0 -101
- package/src/functions/evaluate.test.js +0 -17
- package/src/functions/get-builder-search-params/fn.test.js +0 -13
- package/src/functions/get-content/generate-content-url.test.js +0 -97
- package/src/functions/get-processed-block.test.js +0 -34
- package/src/functions/on-change.test.js +0 -19
- package/src/functions/set.test.js +0 -16
- package/src/helpers/url.test.js +0 -21
- /package/src/components/{render-block → block}/types.js +0 -0
- /package/src/components/{render-content/render-content.types.js → content-variants/content-variants.types.js} +0 -0
package/src/helpers/logger.js
CHANGED
package/src/helpers/nullable.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getIdFromSearchParams } from "./helpers";
|
|
2
|
+
import { init } from "./init";
|
|
3
|
+
function getPreviewContent(searchParams) {
|
|
4
|
+
init();
|
|
5
|
+
const id = getIdFromSearchParams(searchParams);
|
|
6
|
+
return typeof id === "string" ? globalThis._BUILDER_PREVIEW_LRU_CACHE.get(id) : void 0;
|
|
7
|
+
}
|
|
8
|
+
export { getPreviewContent }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { logger } from "../logger";
|
|
2
|
+
const getIdFromSearchParams = searchParams => {
|
|
3
|
+
const previewedModel = searchParams.get("preview");
|
|
4
|
+
const previewedId = searchParams.get("overrides." + previewedModel);
|
|
5
|
+
if (!previewedId) {
|
|
6
|
+
logger.warn("No previewed ID found in search params.");
|
|
7
|
+
}
|
|
8
|
+
return previewedId;
|
|
9
|
+
};
|
|
10
|
+
export { getIdFromSearchParams }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __async = (__this, __arguments, generator) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
var fulfilled = value => {
|
|
4
|
+
try {
|
|
5
|
+
step(generator.next(value));
|
|
6
|
+
} catch (e) {
|
|
7
|
+
reject(e);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var rejected = value => {
|
|
11
|
+
try {
|
|
12
|
+
step(generator.throw(value));
|
|
13
|
+
} catch (e) {
|
|
14
|
+
reject(e);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
"use server";
|
|
22
|
+
import { init } from "./init";
|
|
23
|
+
function postPreviewContent(_0) {
|
|
24
|
+
return __async(this, arguments, function* ({
|
|
25
|
+
key,
|
|
26
|
+
value
|
|
27
|
+
}) {
|
|
28
|
+
init();
|
|
29
|
+
globalThis._BUILDER_PREVIEW_LRU_CACHE.set(key, value);
|
|
30
|
+
return {
|
|
31
|
+
[key]: value
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { postPreviewContent }
|
|
File without changes
|
package/src/helpers/sessionId.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var __async = (__this, __arguments, generator) => {
|
|
2
2
|
return new Promise((resolve, reject) => {
|
|
3
|
-
var fulfilled =
|
|
3
|
+
var fulfilled = value => {
|
|
4
4
|
try {
|
|
5
5
|
step(generator.next(value));
|
|
6
6
|
} catch (e) {
|
|
7
7
|
reject(e);
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
var rejected =
|
|
10
|
+
var rejected = value => {
|
|
11
11
|
try {
|
|
12
12
|
step(generator.throw(value));
|
|
13
13
|
} catch (e) {
|
|
14
14
|
reject(e);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var step =
|
|
17
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
18
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
19
|
});
|
|
20
20
|
};
|
|
@@ -22,7 +22,7 @@ import { getCookie, setCookie } from "./cookie.js";
|
|
|
22
22
|
import { checkIsDefined } from "./nullable.js";
|
|
23
23
|
import { uuid } from "./uuid.js";
|
|
24
24
|
const SESSION_LOCAL_STORAGE_KEY = "builderSessionId";
|
|
25
|
-
const getSessionId =
|
|
25
|
+
const getSessionId = _0 => __async(void 0, [_0], function* ({
|
|
26
26
|
canTrack
|
|
27
27
|
}) {
|
|
28
28
|
if (!canTrack) {
|
|
@@ -36,7 +36,10 @@ const getSessionId = (_0) => __async(void 0, [_0], function* ({
|
|
|
36
36
|
return sessionId;
|
|
37
37
|
} else {
|
|
38
38
|
const newSessionId = createSessionId();
|
|
39
|
-
setSessionId({
|
|
39
|
+
setSessionId({
|
|
40
|
+
id: newSessionId,
|
|
41
|
+
canTrack
|
|
42
|
+
});
|
|
40
43
|
return newSessionId;
|
|
41
44
|
}
|
|
42
45
|
});
|
|
@@ -44,9 +47,9 @@ const createSessionId = () => uuid();
|
|
|
44
47
|
const setSessionId = ({
|
|
45
48
|
id,
|
|
46
49
|
canTrack
|
|
47
|
-
}) => setCookie({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
50
|
+
}) => setCookie({
|
|
51
|
+
name: SESSION_LOCAL_STORAGE_KEY,
|
|
52
|
+
value: id,
|
|
53
|
+
canTrack
|
|
54
|
+
});
|
|
55
|
+
export { createSessionId, getSessionId, setSessionId }
|
package/src/helpers/time.js
CHANGED
package/src/helpers/url.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const getTopLevelDomain =
|
|
1
|
+
const getTopLevelDomain = host => {
|
|
2
2
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
3
3
|
return host;
|
|
4
4
|
}
|
|
@@ -8,6 +8,4 @@ const getTopLevelDomain = (host) => {
|
|
|
8
8
|
}
|
|
9
9
|
return host;
|
|
10
10
|
};
|
|
11
|
-
export {
|
|
12
|
-
getTopLevelDomain
|
|
13
|
-
};
|
|
11
|
+
export { getTopLevelDomain }
|
package/src/helpers/uuid.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
function uuidv4() {
|
|
2
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
3
|
-
const r = Math.random() * 16 | 0,
|
|
2
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
3
|
+
const r = Math.random() * 16 | 0,
|
|
4
|
+
v = c == "x" ? r : r & 3 | 8;
|
|
4
5
|
return v.toString(16);
|
|
5
6
|
});
|
|
6
7
|
}
|
|
7
8
|
function uuid() {
|
|
8
9
|
return uuidv4().replace(/-/g, "");
|
|
9
10
|
}
|
|
10
|
-
export {
|
|
11
|
-
uuid,
|
|
12
|
-
uuidv4
|
|
13
|
-
};
|
|
11
|
+
export { uuid, uuidv4 }
|
package/src/helpers/visitorId.js
CHANGED
|
@@ -2,7 +2,9 @@ import { getLocalStorageItem, setLocalStorageItem } from "./localStorage.js";
|
|
|
2
2
|
import { checkIsDefined } from "./nullable.js";
|
|
3
3
|
import { uuid } from "./uuid.js";
|
|
4
4
|
const VISITOR_LOCAL_STORAGE_KEY = "builderVisitorId";
|
|
5
|
-
const getVisitorId = ({
|
|
5
|
+
const getVisitorId = ({
|
|
6
|
+
canTrack
|
|
7
|
+
}) => {
|
|
6
8
|
if (!canTrack) {
|
|
7
9
|
return void 0;
|
|
8
10
|
}
|
|
@@ -14,7 +16,10 @@ const getVisitorId = ({ canTrack }) => {
|
|
|
14
16
|
return visitorId;
|
|
15
17
|
} else {
|
|
16
18
|
const newVisitorId = createVisitorId();
|
|
17
|
-
setVisitorId({
|
|
19
|
+
setVisitorId({
|
|
20
|
+
id: newVisitorId,
|
|
21
|
+
canTrack
|
|
22
|
+
});
|
|
18
23
|
return newVisitorId;
|
|
19
24
|
}
|
|
20
25
|
};
|
|
@@ -27,8 +32,4 @@ const setVisitorId = ({
|
|
|
27
32
|
value: id,
|
|
28
33
|
canTrack
|
|
29
34
|
});
|
|
30
|
-
export {
|
|
31
|
-
createVisitorId,
|
|
32
|
-
getVisitorId,
|
|
33
|
-
setVisitorId
|
|
34
|
-
};
|
|
35
|
+
export { createVisitorId, getVisitorId, setVisitorId }
|
|
@@ -5,7 +5,7 @@ import { default as default5 } from "../blocks/symbol/symbol";
|
|
|
5
5
|
import { default as default6 } from "../blocks/button/button";
|
|
6
6
|
import { default as default7 } from "../blocks/section/section";
|
|
7
7
|
import { default as default8 } from "../blocks/fragment/fragment";
|
|
8
|
-
import { default as default9 } from "../components/
|
|
8
|
+
import { default as default9 } from "../components/content/content";
|
|
9
9
|
export {
|
|
10
10
|
default6 as Button,
|
|
11
11
|
default2 as Columns,
|
package/src/index.js
CHANGED
|
@@ -5,22 +5,7 @@ import { isPreviewing } from "./functions/is-previewing.js";
|
|
|
5
5
|
import { createRegisterComponentMessage } from "./functions/register-component.js";
|
|
6
6
|
import { register } from "./functions/register.js";
|
|
7
7
|
import { setEditorSettings } from "./functions/set-editor-settings.js";
|
|
8
|
-
import {
|
|
9
|
-
getAllContent,
|
|
10
|
-
getContent,
|
|
11
|
-
processContentResult
|
|
12
|
-
} from "./functions/get-content/index.js";
|
|
8
|
+
import { getAllContent, getContent, processContentResult } from "./functions/get-content/index.js";
|
|
13
9
|
import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.js";
|
|
14
10
|
import { track } from "./functions/track/index.js";
|
|
15
|
-
export {
|
|
16
|
-
createRegisterComponentMessage,
|
|
17
|
-
getAllContent,
|
|
18
|
-
getBuilderSearchParams,
|
|
19
|
-
getContent,
|
|
20
|
-
isEditing,
|
|
21
|
-
isPreviewing,
|
|
22
|
-
processContentResult,
|
|
23
|
-
register,
|
|
24
|
-
setEditorSettings,
|
|
25
|
-
track
|
|
26
|
-
};
|
|
11
|
+
export { createRegisterComponentMessage, getAllContent, getBuilderSearchParams, getContent, isEditing, isPreviewing, processContentResult, register, setEditorSettings, track }
|
|
@@ -6,18 +6,23 @@ const registerInsertMenu = () => {
|
|
|
6
6
|
register("insertMenu", {
|
|
7
7
|
name: "_default",
|
|
8
8
|
default: true,
|
|
9
|
-
items: [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
items: [{
|
|
10
|
+
name: "Box"
|
|
11
|
+
}, {
|
|
12
|
+
name: "Text"
|
|
13
|
+
}, {
|
|
14
|
+
name: "Image"
|
|
15
|
+
}, {
|
|
16
|
+
name: "Columns"
|
|
17
|
+
}, ...(TARGET === "reactNative" ? [] : [{
|
|
18
|
+
name: "Core:Section"
|
|
19
|
+
}, {
|
|
20
|
+
name: "Core:Button"
|
|
21
|
+
}, {
|
|
22
|
+
name: "Embed"
|
|
23
|
+
}, {
|
|
24
|
+
name: "Custom Code"
|
|
25
|
+
}])]
|
|
21
26
|
});
|
|
22
27
|
};
|
|
23
28
|
let isSetupForEditing = false;
|
|
@@ -44,52 +49,61 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
44
49
|
options
|
|
45
50
|
}
|
|
46
51
|
}, "*");
|
|
47
|
-
window.addEventListener("message", ({
|
|
52
|
+
window.addEventListener("message", ({
|
|
53
|
+
data
|
|
54
|
+
}) => {
|
|
48
55
|
var _a2, _b2;
|
|
49
56
|
if (!(data == null ? void 0 : data.type)) {
|
|
50
57
|
return;
|
|
51
58
|
}
|
|
52
59
|
switch (data.type) {
|
|
53
|
-
case "builder.evaluate":
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
case "builder.evaluate":
|
|
61
|
+
{
|
|
62
|
+
const text = data.data.text;
|
|
63
|
+
const args = data.data.arguments || [];
|
|
64
|
+
const id = data.data.id;
|
|
65
|
+
const fn = new Function(text);
|
|
66
|
+
let result;
|
|
67
|
+
let error = null;
|
|
68
|
+
try {
|
|
69
|
+
result = fn.apply(null, args);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
error = err;
|
|
72
|
+
}
|
|
73
|
+
if (error) {
|
|
74
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage({
|
|
75
|
+
type: "builder.evaluateError",
|
|
76
|
+
data: {
|
|
77
|
+
id,
|
|
78
|
+
error: error.message
|
|
79
|
+
}
|
|
80
|
+
}, "*");
|
|
81
|
+
} else {
|
|
82
|
+
if (result && typeof result.then === "function") {
|
|
83
|
+
result.then(finalResult => {
|
|
84
|
+
var _a3;
|
|
85
|
+
(_a3 = window.parent) == null ? void 0 : _a3.postMessage({
|
|
86
|
+
type: "builder.evaluateResult",
|
|
87
|
+
data: {
|
|
88
|
+
id,
|
|
89
|
+
result: finalResult
|
|
90
|
+
}
|
|
91
|
+
}, "*");
|
|
92
|
+
}).catch(console.error);
|
|
93
|
+
} else {
|
|
94
|
+
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
75
95
|
type: "builder.evaluateResult",
|
|
76
|
-
data: {
|
|
96
|
+
data: {
|
|
97
|
+
result,
|
|
98
|
+
id
|
|
99
|
+
}
|
|
77
100
|
}, "*");
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
(_b2 = window.parent) == null ? void 0 : _b2.postMessage({
|
|
81
|
-
type: "builder.evaluateResult",
|
|
82
|
-
data: { result, id }
|
|
83
|
-
}, "*");
|
|
101
|
+
}
|
|
84
102
|
}
|
|
103
|
+
break;
|
|
85
104
|
}
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
105
|
}
|
|
89
106
|
});
|
|
90
107
|
}
|
|
91
108
|
};
|
|
92
|
-
export {
|
|
93
|
-
registerInsertMenu,
|
|
94
|
-
setupBrowserForEditing
|
|
95
|
-
};
|
|
109
|
+
export { registerInsertMenu, setupBrowserForEditing }
|
package/src/types/api-version.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
/**
|
|
3
|
-
* Implements CSS-like inheritance for `Text` by replacing all calls to `Text` with a custom `BaseText` component that
|
|
4
|
-
* applies the `inheritedStyles` context styles, which contain all styles from all parents that might apply to a `Text`.
|
|
5
|
-
*/
|
|
6
|
-
export default function BaseText(props: any): JSX.Element;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Column = {
|
|
3
|
-
blocks: BuilderBlock[];
|
|
4
|
-
width?: number;
|
|
5
|
-
};
|
|
6
|
-
type StackColumnsAt = "tablet" | "mobile" | "never";
|
|
7
|
-
export interface ColumnProps {
|
|
8
|
-
columns?: Column[];
|
|
9
|
-
builderBlock: BuilderBlock;
|
|
10
|
-
space?: number;
|
|
11
|
-
stackColumnsAt?: StackColumnsAt;
|
|
12
|
-
reverseColumnsWhenStacked?: boolean;
|
|
13
|
-
}
|
|
14
|
-
import type { BuilderBlock } from "../../types/builder-block";
|
|
15
|
-
declare function Columns(props: ColumnProps): JSX.Element;
|
|
16
|
-
export default Columns;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isJsScript: (script: HTMLScriptElement) => boolean;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface BuilderElement {
|
|
3
|
-
}
|
|
4
|
-
export interface FormProps {
|
|
5
|
-
attributes?: any;
|
|
6
|
-
name?: string;
|
|
7
|
-
action?: string;
|
|
8
|
-
validate?: boolean;
|
|
9
|
-
method?: string;
|
|
10
|
-
builderBlock?: BuilderElement;
|
|
11
|
-
sendSubmissionsTo?: string;
|
|
12
|
-
sendSubmissionsToEmail?: string;
|
|
13
|
-
sendWithJs?: boolean;
|
|
14
|
-
contentType?: string;
|
|
15
|
-
customHeaders?: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
};
|
|
18
|
-
successUrl?: string;
|
|
19
|
-
previewState?: FormState;
|
|
20
|
-
successMessage?: BuilderElement[];
|
|
21
|
-
errorMessage?: BuilderElement[];
|
|
22
|
-
sendingMessage?: BuilderElement[];
|
|
23
|
-
resetFormOnSubmit?: boolean;
|
|
24
|
-
errorMessagePath?: string;
|
|
25
|
-
}
|
|
26
|
-
export type FormState = "unsubmitted" | "sending" | "success" | "error";
|
|
27
|
-
declare function FormComponent(props: any): JSX.Element;
|
|
28
|
-
export default FormComponent;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type ImageProps = {
|
|
3
|
-
image: string;
|
|
4
|
-
backgroundSize?: 'cover' | 'contain';
|
|
5
|
-
backgroundPosition?: string;
|
|
6
|
-
aspectRatio?: number;
|
|
7
|
-
width?: number;
|
|
8
|
-
height?: number;
|
|
9
|
-
children?: any;
|
|
10
|
-
builderBlock: any;
|
|
11
|
-
fitContent?: boolean;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @param {ImageProps} props
|
|
15
|
-
*/
|
|
16
|
-
export default function Image(props: ImageProps): JSX.Element;
|
|
17
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getSrcSet(url: string): string;
|
package/dist/blocks/img/img.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface ImgProps {
|
|
3
|
-
attributes?: any;
|
|
4
|
-
imgSrc?: string;
|
|
5
|
-
image?: string;
|
|
6
|
-
altText?: string;
|
|
7
|
-
backgroundSize?: "cover" | "contain";
|
|
8
|
-
backgroundPosition?: "center" | "top" | "left" | "right" | "bottom" | "top left" | "top right" | "bottom left" | "bottom right";
|
|
9
|
-
}
|
|
10
|
-
declare function ImgComponent(props: ImgProps): JSX.Element;
|
|
11
|
-
export default ImgComponent;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface FormInputProps {
|
|
3
|
-
type?: string;
|
|
4
|
-
attributes?: any;
|
|
5
|
-
name?: string;
|
|
6
|
-
value?: string;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
defaultValue?: string;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare function FormInputComponent(props: FormInputProps): JSX.Element;
|
|
12
|
-
export default FormInputComponent;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export interface FormSelectProps {
|
|
3
|
-
options?: {
|
|
4
|
-
name?: string;
|
|
5
|
-
value: string;
|
|
6
|
-
}[];
|
|
7
|
-
attributes?: any;
|
|
8
|
-
name?: string;
|
|
9
|
-
value?: string;
|
|
10
|
-
defaultValue?: string;
|
|
11
|
-
}
|
|
12
|
-
declare function SelectComponent(props: any): JSX.Element;
|
|
13
|
-
export default SelectComponent;
|