@builder.io/sdk-react-native 1.0.31-2 → 1.0.32
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/lib/browser/commonjs/blocks/image/component-info.js +5 -0
- package/lib/browser/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.helpers.js +27 -7
- package/lib/browser/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/browser/commonjs/components/block/block.js +9 -13
- package/lib/browser/commonjs/components/block/block.js.map +1 -1
- package/lib/browser/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/browser/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/browser/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/browser/commonjs/components/content/content.js +0 -1
- package/lib/browser/commonjs/components/content/content.js.map +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js +1 -1
- package/lib/browser/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/browser/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/browser/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/browser/commonjs/functions/get-block-actions.js +1 -2
- package/lib/browser/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/browser/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/browser/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/browser/commonjs/functions/get-content/index.js +1 -2
- package/lib/browser/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/browser/commonjs/helpers/cookie.js +2 -12
- package/lib/browser/commonjs/helpers/cookie.js.map +1 -1
- package/lib/browser/module/blocks/image/component-info.js +5 -0
- package/lib/browser/module/blocks/image/component-info.js.map +1 -1
- package/lib/browser/module/components/block/block.helpers.js +22 -4
- package/lib/browser/module/components/block/block.helpers.js.map +1 -1
- package/lib/browser/module/components/block/block.js +10 -14
- package/lib/browser/module/components/block/block.js.map +1 -1
- package/lib/browser/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/browser/module/components/content/components/enable-editor.js +9 -9
- package/lib/browser/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/browser/module/components/content/components/styles.helpers.js +2 -2
- package/lib/browser/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/browser/module/components/content/content.js +0 -1
- package/lib/browser/module/components/content/content.js.map +1 -1
- package/lib/browser/module/constants/sdk-version.js +1 -1
- package/lib/browser/module/constants/sdk-version.js.map +1 -1
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/browser/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/browser/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/browser/module/functions/get-block-actions.js +1 -2
- package/lib/browser/module/functions/get-block-actions.js.map +1 -1
- package/lib/browser/module/functions/get-block-component-options.js +1 -5
- package/lib/browser/module/functions/get-block-component-options.js.map +1 -1
- package/lib/browser/module/functions/get-content/index.js +1 -2
- package/lib/browser/module/functions/get-content/index.js.map +1 -1
- package/lib/browser/module/helpers/cookie.js +2 -11
- package/lib/browser/module/helpers/cookie.js.map +1 -1
- package/lib/browser/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/browser/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/browser/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/browser/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/browser/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/browser/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/browser/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/browser/typescript/components/content/content.d.ts.map +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/browser/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/browser/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/browser/typescript/helpers/cookie.d.ts +0 -1
- package/lib/browser/typescript/helpers/cookie.d.ts.map +1 -1
- package/lib/edge/commonjs/blocks/image/component-info.js +5 -0
- package/lib/edge/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.helpers.js +27 -7
- package/lib/edge/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/edge/commonjs/components/block/block.js +9 -13
- package/lib/edge/commonjs/components/block/block.js.map +1 -1
- package/lib/edge/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/edge/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/edge/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/edge/commonjs/components/content/content.js +0 -1
- package/lib/edge/commonjs/components/content/content.js.map +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js +1 -1
- package/lib/edge/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/edge/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/edge/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/edge/commonjs/functions/get-block-actions.js +1 -2
- package/lib/edge/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/edge/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/edge/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/edge/commonjs/functions/get-content/index.js +1 -2
- package/lib/edge/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/edge/commonjs/helpers/cookie.js +2 -12
- package/lib/edge/commonjs/helpers/cookie.js.map +1 -1
- package/lib/edge/module/blocks/image/component-info.js +5 -0
- package/lib/edge/module/blocks/image/component-info.js.map +1 -1
- package/lib/edge/module/components/block/block.helpers.js +22 -4
- package/lib/edge/module/components/block/block.helpers.js.map +1 -1
- package/lib/edge/module/components/block/block.js +10 -14
- package/lib/edge/module/components/block/block.js.map +1 -1
- package/lib/edge/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/edge/module/components/content/components/enable-editor.js +9 -9
- package/lib/edge/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/edge/module/components/content/components/styles.helpers.js +2 -2
- package/lib/edge/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/edge/module/components/content/content.js +0 -1
- package/lib/edge/module/components/content/content.js.map +1 -1
- package/lib/edge/module/constants/sdk-version.js +1 -1
- package/lib/edge/module/constants/sdk-version.js.map +1 -1
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/edge/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/edge/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/edge/module/functions/get-block-actions.js +1 -2
- package/lib/edge/module/functions/get-block-actions.js.map +1 -1
- package/lib/edge/module/functions/get-block-component-options.js +1 -5
- package/lib/edge/module/functions/get-block-component-options.js.map +1 -1
- package/lib/edge/module/functions/get-content/index.js +1 -2
- package/lib/edge/module/functions/get-content/index.js.map +1 -1
- package/lib/edge/module/helpers/cookie.js +2 -11
- package/lib/edge/module/helpers/cookie.js.map +1 -1
- package/lib/edge/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/edge/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/edge/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/edge/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/edge/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/edge/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/edge/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/edge/typescript/components/content/content.d.ts.map +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/edge/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/edge/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/edge/typescript/helpers/cookie.d.ts +0 -1
- package/lib/edge/typescript/helpers/cookie.d.ts.map +1 -1
- package/lib/node/commonjs/blocks/image/component-info.js +5 -0
- package/lib/node/commonjs/blocks/image/component-info.js.map +1 -1
- package/lib/node/commonjs/components/block/block.helpers.js +27 -7
- package/lib/node/commonjs/components/block/block.helpers.js.map +1 -1
- package/lib/node/commonjs/components/block/block.js +9 -13
- package/lib/node/commonjs/components/block/block.js.map +1 -1
- package/lib/node/commonjs/components/block/components/block-wrapper.js.map +1 -1
- package/lib/node/commonjs/components/content/components/enable-editor.js +9 -9
- package/lib/node/commonjs/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/commonjs/components/content/components/styles.helpers.js +2 -2
- package/lib/node/commonjs/components/content/components/styles.helpers.js.map +1 -1
- package/lib/node/commonjs/components/content/content.js +0 -1
- package/lib/node/commonjs/components/content/content.js.map +1 -1
- package/lib/node/commonjs/constants/sdk-version.js +1 -1
- package/lib/node/commonjs/constants/sdk-version.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/node/commonjs/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -4
- package/lib/node/commonjs/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/node/commonjs/functions/get-block-actions.js +1 -2
- package/lib/node/commonjs/functions/get-block-actions.js.map +1 -1
- package/lib/node/commonjs/functions/get-block-component-options.js +1 -5
- package/lib/node/commonjs/functions/get-block-component-options.js.map +1 -1
- package/lib/node/commonjs/functions/get-content/index.js +1 -2
- package/lib/node/commonjs/functions/get-content/index.js.map +1 -1
- package/lib/node/commonjs/helpers/cookie.js +2 -12
- package/lib/node/commonjs/helpers/cookie.js.map +1 -1
- package/lib/node/module/blocks/image/component-info.js +5 -0
- package/lib/node/module/blocks/image/component-info.js.map +1 -1
- package/lib/node/module/components/block/block.helpers.js +22 -4
- package/lib/node/module/components/block/block.helpers.js.map +1 -1
- package/lib/node/module/components/block/block.js +10 -14
- package/lib/node/module/components/block/block.js.map +1 -1
- package/lib/node/module/components/block/components/block-wrapper.js.map +1 -1
- package/lib/node/module/components/content/components/enable-editor.js +9 -9
- package/lib/node/module/components/content/components/enable-editor.js.map +1 -1
- package/lib/node/module/components/content/components/styles.helpers.js +2 -2
- package/lib/node/module/components/content/components/styles.helpers.js.map +1 -1
- package/lib/node/module/components/content/content.js +0 -1
- package/lib/node/module/components/content/content.js.map +1 -1
- package/lib/node/module/constants/sdk-version.js +1 -1
- package/lib/node/module/constants/sdk-version.js.map +1 -1
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js +4 -11
- package/lib/node/module/functions/evaluate/edge-runtime/edge-runtime.js.map +1 -1
- package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js +18 -5
- package/lib/node/module/functions/evaluate/node-runtime/safeDynamicRequire.js.map +1 -1
- package/lib/node/module/functions/get-block-actions.js +1 -2
- package/lib/node/module/functions/get-block-actions.js.map +1 -1
- package/lib/node/module/functions/get-block-component-options.js +1 -5
- package/lib/node/module/functions/get-block-component-options.js.map +1 -1
- package/lib/node/module/functions/get-content/index.js +1 -2
- package/lib/node/module/functions/get-content/index.js.map +1 -1
- package/lib/node/module/helpers/cookie.js +2 -11
- package/lib/node/module/helpers/cookie.js.map +1 -1
- package/lib/node/typescript/blocks/image/component-info.d.ts.map +1 -1
- package/lib/node/typescript/blocks/image/image.types.d.ts +1 -0
- package/lib/node/typescript/blocks/image/image.types.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.d.ts.map +1 -1
- package/lib/node/typescript/components/block/block.helpers.d.ts +20 -2
- package/lib/node/typescript/components/block/block.helpers.d.ts.map +1 -1
- package/lib/node/typescript/components/block/components/block-wrapper.d.ts +0 -1
- package/lib/node/typescript/components/block/components/block-wrapper.d.ts.map +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts +1 -1
- package/lib/node/typescript/components/content/components/enable-editor.d.ts.map +1 -1
- package/lib/node/typescript/components/content/content.d.ts.map +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts +1 -1
- package/lib/node/typescript/constants/sdk-version.d.ts.map +1 -1
- package/lib/node/typescript/functions/get-block-component-options.d.ts.map +1 -1
- package/lib/node/typescript/helpers/cookie.d.ts +0 -1
- package/lib/node/typescript/helpers/cookie.d.ts.map +1 -1
- package/package.json +5 -8
- package/lib/node/index.cjs +0 -6910
- package/lib/node/index.mjs +0 -7477
- package/src/blocks/BaseText.tsx +0 -17
- package/src/blocks/accordion/accordion.tsx +0 -181
- package/src/blocks/accordion/accordion.types.ts +0 -12
- package/src/blocks/accordion/component-info.ts +0 -124
- package/src/blocks/accordion/helpers.ts +0 -3
- package/src/blocks/accordion/index.ts +0 -1
- package/src/blocks/button/button.tsx +0 -56
- package/src/blocks/button/button.types.ts +0 -7
- package/src/blocks/button/component-info.ts +0 -35
- package/src/blocks/button/index.ts +0 -1
- package/src/blocks/columns/columns.tsx +0 -199
- package/src/blocks/columns/columns.types.ts +0 -14
- package/src/blocks/columns/component-info.ts +0 -219
- package/src/blocks/columns/helpers.ts +0 -3
- package/src/blocks/columns/index.ts +0 -1
- package/src/blocks/custom-code/component-info.ts +0 -24
- package/src/blocks/custom-code/custom-code.tsx +0 -71
- package/src/blocks/custom-code/index.ts +0 -1
- package/src/blocks/embed/component-info.ts +0 -38
- package/src/blocks/embed/embed.tsx +0 -62
- package/src/blocks/embed/helpers.ts +0 -2
- package/src/blocks/embed/index.ts +0 -1
- package/src/blocks/form/form/component-info.ts +0 -233
- package/src/blocks/form/form/form.tsx +0 -324
- package/src/blocks/form/form/index.ts +0 -1
- package/src/blocks/form/input/component-info.ts +0 -47
- package/src/blocks/form/input/index.ts +0 -1
- package/src/blocks/form/input/input.tsx +0 -49
- package/src/blocks/form/select/component-info.ts +0 -44
- package/src/blocks/form/select/index.ts +0 -1
- package/src/blocks/form/select/select.tsx +0 -54
- package/src/blocks/form/submit-button/component-info.ts +0 -27
- package/src/blocks/form/submit-button/index.ts +0 -1
- package/src/blocks/form/submit-button/submit-button.tsx +0 -34
- package/src/blocks/fragment/component-info.ts +0 -8
- package/src/blocks/fragment/fragment.tsx +0 -18
- package/src/blocks/fragment/fragment.types.ts +0 -5
- package/src/blocks/fragment/index.ts +0 -1
- package/src/blocks/helpers.ts +0 -43
- package/src/blocks/image/component-info.ts +0 -124
- package/src/blocks/image/image.helpers.ts +0 -47
- package/src/blocks/image/image.tsx +0 -65
- package/src/blocks/image/image.types.ts +0 -19
- package/src/blocks/image/index.ts +0 -1
- package/src/blocks/img/component-info.ts +0 -16
- package/src/blocks/img/img.tsx +0 -55
- package/src/blocks/img/index.ts +0 -1
- package/src/blocks/raw-text/component-info.ts +0 -11
- package/src/blocks/raw-text/index.ts +0 -1
- package/src/blocks/raw-text/raw-text.tsx +0 -1
- package/src/blocks/section/component-info.ts +0 -41
- package/src/blocks/section/index.ts +0 -1
- package/src/blocks/section/section.tsx +0 -39
- package/src/blocks/section/section.types.ts +0 -6
- package/src/blocks/slot/component-info.ts +0 -15
- package/src/blocks/slot/index.ts +0 -1
- package/src/blocks/slot/slot.tsx +0 -42
- package/src/blocks/symbol/component-info.ts +0 -35
- package/src/blocks/symbol/index.ts +0 -1
- package/src/blocks/symbol/symbol.helpers.ts +0 -47
- package/src/blocks/symbol/symbol.tsx +0 -100
- package/src/blocks/symbol/symbol.types.ts +0 -17
- package/src/blocks/tabs/component-info.ts +0 -139
- package/src/blocks/tabs/index.ts +0 -1
- package/src/blocks/tabs/tabs.tsx +0 -79
- package/src/blocks/tabs/tabs.types.ts +0 -13
- package/src/blocks/text/component-info.ts +0 -20
- package/src/blocks/text/index.ts +0 -1
- package/src/blocks/text/text.tsx +0 -105
- package/src/blocks/text/text.types.ts +0 -4
- package/src/blocks/textarea/component-info.ts +0 -38
- package/src/blocks/textarea/index.ts +0 -1
- package/src/blocks/textarea/textarea.tsx +0 -41
- package/src/blocks/video/component-info.ts +0 -83
- package/src/blocks/video/index.ts +0 -1
- package/src/blocks/video/video.tsx +0 -70
- package/src/blocks/video/video.types.ts +0 -21
- package/src/components/block/animator.ts +0 -220
- package/src/components/block/block.helpers.ts +0 -106
- package/src/components/block/block.tsx +0 -235
- package/src/components/block/components/block-styles.tsx +0 -136
- package/src/components/block/components/block-wrapper.tsx +0 -53
- package/src/components/block/components/component-ref/component-ref.helpers.ts +0 -55
- package/src/components/block/components/component-ref/component-ref.tsx +0 -66
- package/src/components/block/components/interactive-element.tsx +0 -53
- package/src/components/block/components/repeated-block.tsx +0 -37
- package/src/components/block/types.ts +0 -6
- package/src/components/blocks/blocks-wrapper.tsx +0 -93
- package/src/components/blocks/blocks.tsx +0 -57
- package/src/components/blocks/blocks.types.ts +0 -7
- package/src/components/blocks/index.ts +0 -1
- package/src/components/content/components/enable-editor.tsx +0 -471
- package/src/components/content/components/styles.helpers.ts +0 -101
- package/src/components/content/components/styles.tsx +0 -42
- package/src/components/content/content.helpers.ts +0 -40
- package/src/components/content/content.tsx +0 -151
- package/src/components/content/content.types.ts +0 -13
- package/src/components/content/contentProps.types.ts +0 -17
- package/src/components/content/index.ts +0 -1
- package/src/components/content/wrap-component-ref.ts +0 -6
- package/src/components/content-variants/content-variants.tsx +0 -146
- package/src/components/content-variants/content-variants.types.ts +0 -84
- package/src/components/content-variants/helpers.ts +0 -72
- package/src/components/content-variants/index.ts +0 -1
- package/src/components/content-variants/inlined-fns.ts +0 -22
- package/src/components/dynamic-div.tsx +0 -30
- package/src/components/dynamic-renderer/dynamic-renderer.helpers.ts +0 -7
- package/src/components/dynamic-renderer/dynamic-renderer.tsx +0 -47
- package/src/components/error-boundary.tsx +0 -38
- package/src/components/inlined-script.tsx +0 -10
- package/src/components/inlined-styles.tsx +0 -10
- package/src/constants/builder-registered-components.ts +0 -59
- package/src/constants/device-sizes.ts +0 -59
- package/src/constants/extra-components.ts +0 -1
- package/src/constants/sdk-version.ts +0 -1
- package/src/constants/target.ts +0 -3
- package/src/context/builder.context.ts +0 -15
- package/src/context/components.context.ts +0 -3
- package/src/context/index.ts +0 -1
- package/src/context/types.ts +0 -38
- package/src/functions/apply-patch-with-mutation.ts +0 -61
- package/src/functions/camel-to-kebab-case.ts +0 -1
- package/src/functions/deopt.ts +0 -6
- package/src/functions/evaluate/browser-runtime/browser.ts +0 -61
- package/src/functions/evaluate/browser-runtime/index.ts +0 -1
- package/src/functions/evaluate/choose-eval.ts +0 -23
- package/src/functions/evaluate/edge-runtime/acorn-interpreter.ts +0 -2891
- package/src/functions/evaluate/edge-runtime/edge-runtime.ts +0 -96
- package/src/functions/evaluate/edge-runtime/index.ts +0 -1
- package/src/functions/evaluate/evaluate.ts +0 -76
- package/src/functions/evaluate/helpers.ts +0 -56
- package/src/functions/evaluate/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/index.ts +0 -1
- package/src/functions/evaluate/node-runtime/init.ts +0 -33
- package/src/functions/evaluate/node-runtime/node-runtime.ts +0 -176
- package/src/functions/evaluate/node-runtime/safeDynamicRequire.ts +0 -14
- package/src/functions/evaluate/placeholder-runtime.ts +0 -4
- package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +0 -16
- package/src/functions/event-handler-name.ts +0 -4
- package/src/functions/extract-text-styles.ts +0 -24
- package/src/functions/fast-clone.ts +0 -4
- package/src/functions/fetch-builder-props.ts +0 -75
- package/src/functions/get-block-actions-handler.ts +0 -17
- package/src/functions/get-block-actions.ts +0 -35
- package/src/functions/get-block-component-options.ts +0 -11
- package/src/functions/get-block-properties.ts +0 -62
- package/src/functions/get-builder-search-params/index.ts +0 -33
- package/src/functions/get-class-prop-name.ts +0 -15
- package/src/functions/get-content/generate-content-url.ts +0 -88
- package/src/functions/get-content/index.ts +0 -99
- package/src/functions/get-content/types.ts +0 -157
- package/src/functions/get-env.ts +0 -5
- package/src/functions/get-fetch.ts +0 -11
- package/src/functions/get-global-this.ts +0 -16
- package/src/functions/get-processed-block.ts +0 -70
- package/src/functions/get-style.ts +0 -38
- package/src/functions/get.ts +0 -4
- package/src/functions/is-browser.ts +0 -3
- package/src/functions/is-edge-runtime.ts +0 -9
- package/src/functions/is-editing.ts +0 -8
- package/src/functions/is-from-trusted-host.ts +0 -8
- package/src/functions/is-iframe.ts +0 -4
- package/src/functions/is-node-runtime.ts +0 -8
- package/src/functions/is-previewing.ts +0 -16
- package/src/functions/on-change.ts +0 -29
- package/src/functions/register-component.ts +0 -30
- package/src/functions/register.ts +0 -44
- package/src/functions/set-editor-settings.ts +0 -15
- package/src/functions/set.ts +0 -14
- package/src/functions/track/helpers.ts +0 -51
- package/src/functions/track/index.ts +0 -131
- package/src/functions/track/interaction.ts +0 -63
- package/src/functions/transform-block-properties.ts +0 -33
- package/src/functions/transform-block.ts +0 -30
- package/src/functions/transform-style-property.ts +0 -296
- package/src/helpers/ab-tests.ts +0 -166
- package/src/helpers/canTrack.ts +0 -2
- package/src/helpers/cookie.ts +0 -109
- package/src/helpers/css.ts +0 -33
- package/src/helpers/flatten.ts +0 -41
- package/src/helpers/localStorage.ts +0 -36
- package/src/helpers/logger.ts +0 -7
- package/src/helpers/nullable.ts +0 -2
- package/src/helpers/omit.ts +0 -7
- package/src/helpers/preview-lru-cache/get.ts +0 -4
- package/src/helpers/preview-lru-cache/helpers.ts +0 -1
- package/src/helpers/preview-lru-cache/init.ts +0 -7
- package/src/helpers/preview-lru-cache/set.ts +0 -12
- package/src/helpers/preview-lru-cache/types.ts +0 -1
- package/src/helpers/search/search.ts +0 -18
- package/src/helpers/sessionId.ts +0 -37
- package/src/helpers/subscribe-to-editor.ts +0 -95
- package/src/helpers/time.ts +0 -2
- package/src/helpers/url.ts +0 -15
- package/src/helpers/uuid.ts +0 -17
- package/src/helpers/visitorId.ts +0 -37
- package/src/index-helpers/blocks-exports.ts +0 -16
- package/src/index-helpers/top-of-file.ts +0 -2
- package/src/index.ts +0 -15
- package/src/scripts/init-editing.ts +0 -119
- package/src/server-index.ts +0 -43
- package/src/types/api-version.ts +0 -2
- package/src/types/builder-block.ts +0 -89
- package/src/types/builder-content.ts +0 -47
- package/src/types/builder-props.ts +0 -12
- package/src/types/can-track.ts +0 -3
- package/src/types/components.ts +0 -119
- package/src/types/deep-partial.ts +0 -1
- package/src/types/element.ts +0 -57
- package/src/types/enforced-partials.ts +0 -19
- package/src/types/input.ts +0 -123
- package/src/types/targets.ts +0 -1
- package/src/types/typescript.ts +0 -9
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { useState, useContext } from "react";
|
|
13
|
-
import { getDefaultRegisteredComponents } from "../../constants/builder-registered-components";
|
|
14
|
-
import { TARGET } from "../../constants/target";
|
|
15
|
-
import ComponentsContext from "../../context/components.context";
|
|
16
|
-
import type {
|
|
17
|
-
BuilderContextInterface,
|
|
18
|
-
BuilderRenderState,
|
|
19
|
-
RegisteredComponents,
|
|
20
|
-
} from "../../context/types";
|
|
21
|
-
import { serializeComponentInfo } from "../../functions/register-component";
|
|
22
|
-
import type { ComponentInfo } from "../../types/components";
|
|
23
|
-
import type { Dictionary } from "../../types/typescript";
|
|
24
|
-
import Blocks from "../blocks/blocks";
|
|
25
|
-
import { getUpdateVariantVisibilityScript } from "../content-variants/helpers";
|
|
26
|
-
import DynamicDiv from "../dynamic-div";
|
|
27
|
-
import InlinedScript from "../inlined-script";
|
|
28
|
-
import EnableEditor from "./components/enable-editor";
|
|
29
|
-
import ContentStyles from "./components/styles";
|
|
30
|
-
import {
|
|
31
|
-
getContentInitialValue,
|
|
32
|
-
getRootStateInitialValue,
|
|
33
|
-
} from "./content.helpers";
|
|
34
|
-
import type { ContentProps } from "./content.types";
|
|
35
|
-
import { wrapComponentRef } from "./wrap-component-ref";
|
|
36
|
-
|
|
37
|
-
function ContentComponent(props: ContentProps) {
|
|
38
|
-
const [scriptStr, setScriptStr] = useState(() =>
|
|
39
|
-
getUpdateVariantVisibilityScript({
|
|
40
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
41
|
-
variationId: props.content?.testVariationId!,
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
43
|
-
contentId: props.content?.id!,
|
|
44
|
-
})
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
function contentSetState(newRootState: BuilderRenderState) {
|
|
48
|
-
setBuilderContextSignal((PREVIOUS_VALUE) => ({
|
|
49
|
-
...PREVIOUS_VALUE,
|
|
50
|
-
rootState: newRootState,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const [registeredComponents, setRegisteredComponents] = useState(() =>
|
|
55
|
-
[
|
|
56
|
-
...getDefaultRegisteredComponents(),
|
|
57
|
-
...(props.customComponents || []),
|
|
58
|
-
].reduce<RegisteredComponents>(
|
|
59
|
-
(acc, { component, ...info }) => ({
|
|
60
|
-
...acc,
|
|
61
|
-
[info.name]: {
|
|
62
|
-
component: component,
|
|
63
|
-
...serializeComponentInfo(info),
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
{}
|
|
67
|
-
)
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
const [builderContextSignal, setBuilderContextSignal] = useState(() => ({
|
|
71
|
-
content: getContentInitialValue({
|
|
72
|
-
content: props.content,
|
|
73
|
-
data: props.data,
|
|
74
|
-
}),
|
|
75
|
-
localState: undefined,
|
|
76
|
-
rootState: getRootStateInitialValue({
|
|
77
|
-
content: props.content,
|
|
78
|
-
data: props.data,
|
|
79
|
-
locale: props.locale,
|
|
80
|
-
}),
|
|
81
|
-
rootSetState: contentSetState,
|
|
82
|
-
context: props.context || {},
|
|
83
|
-
canTrack: props.canTrack,
|
|
84
|
-
apiKey: props.apiKey,
|
|
85
|
-
apiVersion: props.apiVersion,
|
|
86
|
-
componentInfos: [
|
|
87
|
-
...getDefaultRegisteredComponents(),
|
|
88
|
-
...(props.customComponents || []),
|
|
89
|
-
].reduce<Dictionary<ComponentInfo>>(
|
|
90
|
-
(acc, { component: _, ...info }) => ({
|
|
91
|
-
...acc,
|
|
92
|
-
[info.name]: serializeComponentInfo(info),
|
|
93
|
-
}),
|
|
94
|
-
{}
|
|
95
|
-
),
|
|
96
|
-
inheritedStyles: {},
|
|
97
|
-
BlocksWrapper: props.blocksWrapper || ScrollView,
|
|
98
|
-
BlocksWrapperProps: props.blocksWrapperProps || {},
|
|
99
|
-
}));
|
|
100
|
-
|
|
101
|
-
return (
|
|
102
|
-
<ComponentsContext.Provider
|
|
103
|
-
value={{
|
|
104
|
-
registeredComponents: registeredComponents,
|
|
105
|
-
}}
|
|
106
|
-
>
|
|
107
|
-
<EnableEditor
|
|
108
|
-
content={props.content}
|
|
109
|
-
data={props.data}
|
|
110
|
-
model={props.model}
|
|
111
|
-
context={props.context}
|
|
112
|
-
apiKey={props.apiKey}
|
|
113
|
-
canTrack={props.canTrack}
|
|
114
|
-
locale={props.locale}
|
|
115
|
-
enrich={props.enrich}
|
|
116
|
-
showContent={props.showContent}
|
|
117
|
-
builderContextSignal={builderContextSignal}
|
|
118
|
-
contentWrapper={props.contentWrapper}
|
|
119
|
-
contentWrapperProps={props.contentWrapperProps}
|
|
120
|
-
linkComponent={props.linkComponent}
|
|
121
|
-
trustedHosts={props.trustedHosts}
|
|
122
|
-
{...{
|
|
123
|
-
setBuilderContextSignal: setBuilderContextSignal,
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
{props.isSsrAbTest ? (
|
|
127
|
-
<InlinedScript
|
|
128
|
-
id="builderio-variant-visibility"
|
|
129
|
-
scriptStr={scriptStr}
|
|
130
|
-
/>
|
|
131
|
-
) : null}
|
|
132
|
-
{TARGET !== "reactNative" ? (
|
|
133
|
-
<ContentStyles
|
|
134
|
-
isNestedRender={props.isNestedRender}
|
|
135
|
-
contentId={builderContextSignal.content?.id}
|
|
136
|
-
cssCode={builderContextSignal.content?.data?.cssCode}
|
|
137
|
-
customFonts={builderContextSignal.content?.data?.customFonts}
|
|
138
|
-
/>
|
|
139
|
-
) : null}
|
|
140
|
-
<Blocks
|
|
141
|
-
blocks={builderContextSignal.content?.data?.blocks}
|
|
142
|
-
context={builderContextSignal}
|
|
143
|
-
registeredComponents={registeredComponents}
|
|
144
|
-
linkComponent={props.linkComponent}
|
|
145
|
-
/>
|
|
146
|
-
</EnableEditor>
|
|
147
|
-
</ComponentsContext.Provider>
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
export default ContentComponent;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { BuilderRenderState } from '../../context/types';
|
|
2
|
-
export type { ContentProps } from './contentProps.types';
|
|
3
|
-
export interface BuilderComponentStateChange {
|
|
4
|
-
state: BuilderRenderState;
|
|
5
|
-
ref: {
|
|
6
|
-
name?: string;
|
|
7
|
-
props?: {
|
|
8
|
-
builderBlock?: {
|
|
9
|
-
id?: string;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { EnforcePartials } from '../../types/enforced-partials';
|
|
2
|
-
import type { ContentVariantsPrps } from '../content-variants/content-variants.types';
|
|
3
|
-
interface InternalRenderProps {
|
|
4
|
-
showContent: boolean;
|
|
5
|
-
isSsrAbTest: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* This is in a separate file so that we can override it (most notably in Vue,
|
|
10
|
-
* where prop types cannot be wrapped by generics like `EnforcePartials`).
|
|
11
|
-
*/
|
|
12
|
-
export type ContentProps = InternalRenderProps & EnforcePartials<ContentVariantsPrps> & {
|
|
13
|
-
/**
|
|
14
|
-
* For internal use only. Do not provide this prop.
|
|
15
|
-
*/
|
|
16
|
-
isNestedRender?: boolean;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './content'
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
import { useState, useEffect } from "react";
|
|
13
|
-
|
|
14
|
-
type VariantsProviderProps = ContentVariantsPrps & {
|
|
15
|
-
/**
|
|
16
|
-
* For internal use only. Do not provide this prop.
|
|
17
|
-
*/
|
|
18
|
-
isNestedRender?: boolean;
|
|
19
|
-
};
|
|
20
|
-
import { TARGET } from "../../constants/target";
|
|
21
|
-
import { handleABTestingSync } from "../../helpers/ab-tests";
|
|
22
|
-
import { getDefaultCanTrack } from "../../helpers/canTrack";
|
|
23
|
-
import ContentComponent from "../content/content";
|
|
24
|
-
import InlinedScript from "../inlined-script";
|
|
25
|
-
import InlinedStyles from "../inlined-styles";
|
|
26
|
-
import type { ContentVariantsPrps } from "./content-variants.types";
|
|
27
|
-
import {
|
|
28
|
-
checkShouldRenderVariants,
|
|
29
|
-
getInitVariantsFnsScriptString,
|
|
30
|
-
getUpdateCookieAndStylesScript,
|
|
31
|
-
getVariants,
|
|
32
|
-
} from "./helpers";
|
|
33
|
-
|
|
34
|
-
function ContentVariants(props: VariantsProviderProps) {
|
|
35
|
-
const [shouldRenderVariants, setShouldRenderVariants] = useState(() =>
|
|
36
|
-
checkShouldRenderVariants({
|
|
37
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
38
|
-
content: props.content,
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
function updateCookieAndStylesScriptStr() {
|
|
43
|
-
return getUpdateCookieAndStylesScript(
|
|
44
|
-
getVariants(props.content).map((value) => ({
|
|
45
|
-
id: value.testVariationId!,
|
|
46
|
-
testRatio: value.testRatio,
|
|
47
|
-
})),
|
|
48
|
-
props.content?.id || ""
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function hideVariantsStyleString() {
|
|
53
|
-
return getVariants(props.content)
|
|
54
|
-
.map((value) => `.variant-${value.testVariationId} { display: none; } `)
|
|
55
|
-
.join("");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function defaultContent() {
|
|
59
|
-
return shouldRenderVariants
|
|
60
|
-
? {
|
|
61
|
-
...props.content,
|
|
62
|
-
testVariationId: props.content?.id,
|
|
63
|
-
}
|
|
64
|
-
: handleABTestingSync({
|
|
65
|
-
item: props.content,
|
|
66
|
-
canTrack: getDefaultCanTrack(props.canTrack),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
useEffect(() => {
|
|
71
|
-
/**
|
|
72
|
-
* For Solid/Svelte: we unmount the non-winning variants post-hydration.
|
|
73
|
-
*/
|
|
74
|
-
}, []);
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<>
|
|
78
|
-
{!props.isNestedRender && TARGET !== "reactNative" ? (
|
|
79
|
-
<InlinedScript
|
|
80
|
-
id="builderio-init-variants-fns"
|
|
81
|
-
scriptStr={getInitVariantsFnsScriptString()}
|
|
82
|
-
/>
|
|
83
|
-
) : null}
|
|
84
|
-
{shouldRenderVariants ? (
|
|
85
|
-
<>
|
|
86
|
-
<InlinedStyles
|
|
87
|
-
id="builderio-variants"
|
|
88
|
-
styles={hideVariantsStyleString()}
|
|
89
|
-
/>
|
|
90
|
-
<InlinedScript
|
|
91
|
-
id="builderio-variants-visibility"
|
|
92
|
-
scriptStr={updateCookieAndStylesScriptStr()}
|
|
93
|
-
/>
|
|
94
|
-
{getVariants(props.content)?.map((variant) => (
|
|
95
|
-
<ContentComponent
|
|
96
|
-
isNestedRender={props.isNestedRender}
|
|
97
|
-
key={variant.testVariationId}
|
|
98
|
-
content={variant}
|
|
99
|
-
showContent={false}
|
|
100
|
-
model={props.model}
|
|
101
|
-
data={props.data}
|
|
102
|
-
context={props.context}
|
|
103
|
-
apiKey={props.apiKey}
|
|
104
|
-
apiVersion={props.apiVersion}
|
|
105
|
-
customComponents={props.customComponents}
|
|
106
|
-
linkComponent={props.linkComponent}
|
|
107
|
-
canTrack={props.canTrack}
|
|
108
|
-
locale={props.locale}
|
|
109
|
-
enrich={props.enrich}
|
|
110
|
-
isSsrAbTest={shouldRenderVariants}
|
|
111
|
-
blocksWrapper={props.blocksWrapper}
|
|
112
|
-
blocksWrapperProps={props.blocksWrapperProps}
|
|
113
|
-
contentWrapper={props.contentWrapper}
|
|
114
|
-
contentWrapperProps={props.contentWrapperProps}
|
|
115
|
-
trustedHosts={props.trustedHosts}
|
|
116
|
-
/>
|
|
117
|
-
))}
|
|
118
|
-
</>
|
|
119
|
-
) : null}
|
|
120
|
-
<ContentComponent
|
|
121
|
-
isNestedRender={props.isNestedRender}
|
|
122
|
-
{...{}}
|
|
123
|
-
content={defaultContent()}
|
|
124
|
-
showContent
|
|
125
|
-
model={props.model}
|
|
126
|
-
data={props.data}
|
|
127
|
-
context={props.context}
|
|
128
|
-
apiKey={props.apiKey}
|
|
129
|
-
apiVersion={props.apiVersion}
|
|
130
|
-
customComponents={props.customComponents}
|
|
131
|
-
linkComponent={props.linkComponent}
|
|
132
|
-
canTrack={props.canTrack}
|
|
133
|
-
locale={props.locale}
|
|
134
|
-
enrich={props.enrich}
|
|
135
|
-
isSsrAbTest={shouldRenderVariants}
|
|
136
|
-
blocksWrapper={props.blocksWrapper}
|
|
137
|
-
blocksWrapperProps={props.blocksWrapperProps}
|
|
138
|
-
contentWrapper={props.contentWrapper}
|
|
139
|
-
contentWrapperProps={props.contentWrapperProps}
|
|
140
|
-
trustedHosts={props.trustedHosts}
|
|
141
|
-
/>
|
|
142
|
-
</>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export default ContentVariants;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { BuilderRenderContext, RegisteredComponent } from '../../context/types';
|
|
2
|
-
import type { ApiVersion } from '../../types/api-version';
|
|
3
|
-
import type { BuilderContent } from '../../types/builder-content';
|
|
4
|
-
import type { Nullable } from '../../types/typescript';
|
|
5
|
-
export interface ContentVariantsPrps {
|
|
6
|
-
/**
|
|
7
|
-
* The Builder content JSON to render (required).
|
|
8
|
-
*/
|
|
9
|
-
content?: Nullable<BuilderContent>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The Builder content `model` to render (required).
|
|
13
|
-
*/
|
|
14
|
-
model?: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Additional data to inject into your Builder content (optional).
|
|
18
|
-
*/
|
|
19
|
-
data?: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
context?: BuilderRenderContext;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Your API Key: needed to enable visual editing, and to dynamically fetch symbols (required).
|
|
30
|
-
*/
|
|
31
|
-
apiKey: string;
|
|
32
|
-
apiVersion?: ApiVersion;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* An array of custom components to register (optional).
|
|
36
|
-
*/
|
|
37
|
-
customComponents?: RegisteredComponent[];
|
|
38
|
-
/**
|
|
39
|
-
* The component to use for rendering links. Defaults to anchor element `<a>`.
|
|
40
|
-
*/
|
|
41
|
-
linkComponent?: any;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* A boolean to enable or disable tracking (optional). Defaults to `true`.
|
|
45
|
-
*/
|
|
46
|
-
canTrack?: boolean;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* If provided, the API will auto-resolve localized objects to the value of this `locale` key (optional).
|
|
50
|
-
*/
|
|
51
|
-
locale?: string;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* A boolean to enable or disable enriching API content (optional).
|
|
55
|
-
*
|
|
56
|
-
* Enriching will Include multilevel references in the response. Defaults to `false`.
|
|
57
|
-
*/
|
|
58
|
-
enrich?: boolean;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* The element that wraps your content. Defaults to `<div>` ('ScrollView' in React Native).
|
|
62
|
-
*/
|
|
63
|
-
contentWrapper?: any;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Additonal props to pass to `contentWrapper`. Defaults to `{}`.
|
|
67
|
-
*/
|
|
68
|
-
contentWrapperProps?: any;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The element that wraps your blocks. Defaults to `<div>` ('ScrollView' in React Native).
|
|
72
|
-
*/
|
|
73
|
-
blocksWrapper?: any;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Additonal props to pass to `blocksWrapper`. Defaults to `{}`.
|
|
77
|
-
*/
|
|
78
|
-
blocksWrapperProps?: any;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* List of hosts to allow editing content from.
|
|
82
|
-
*/
|
|
83
|
-
trustedHosts?: string[];
|
|
84
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { TARGET } from '../../constants/target';
|
|
2
|
-
import { isBrowser } from '../../functions/is-browser';
|
|
3
|
-
import type { Nullable } from '../../helpers/nullable';
|
|
4
|
-
import type { BuilderContent } from '../../types/builder-content';
|
|
5
|
-
import type { Target } from '../../types/targets';
|
|
6
|
-
import { UPDATE_COOKIES_AND_STYLES_SCRIPT, UPDATE_VARIANT_VISIBILITY_SCRIPT } from './inlined-fns';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* We hardcode explicit function names here, because the `.toString()` of a function can change depending on the bundler.
|
|
10
|
-
* Some bundlers will minify the fn name, etc.
|
|
11
|
-
*
|
|
12
|
-
* So we hardcode the function names here, and then use those names in the script string to make sure the function names are consistent.
|
|
13
|
-
*/
|
|
14
|
-
const UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME = 'builderIoAbTest';
|
|
15
|
-
const UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME = 'builderIoRenderContent';
|
|
16
|
-
export const getVariants = (content: Nullable<BuilderContent>) => Object.values(content?.variations || {}).map(variant => ({
|
|
17
|
-
...variant,
|
|
18
|
-
testVariationId: variant.id,
|
|
19
|
-
id: content?.id
|
|
20
|
-
}));
|
|
21
|
-
export const checkShouldRenderVariants = ({
|
|
22
|
-
canTrack,
|
|
23
|
-
content
|
|
24
|
-
}: {
|
|
25
|
-
canTrack: Nullable<boolean>;
|
|
26
|
-
content: Nullable<BuilderContent>;
|
|
27
|
-
}) => {
|
|
28
|
-
const hasVariants = getVariants(content).length > 0;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* We cannot SSR in React-Native.
|
|
32
|
-
*/
|
|
33
|
-
if (TARGET === 'reactNative') return false;
|
|
34
|
-
if (!hasVariants) return false;
|
|
35
|
-
if (!canTrack) return false;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* For Vue and Svelte, we need to (initially) render the variants. This is to avoid hydration mismatch errors.
|
|
39
|
-
*
|
|
40
|
-
* Unlike React, Vue's hydration checks are shallow and do not check the attributes/contents of each element, so we
|
|
41
|
-
* are able to modify the `hidden` HTML attributes and `display` CSS properties without causing a hydration mismatch error.
|
|
42
|
-
*
|
|
43
|
-
* NOTE: For Solid/Svelte: after the app is hydrated, we strip the variants from the DOM (on mount) to reduce the amount of HTML in the DOM.
|
|
44
|
-
* This isn't necessary, just a nice to have.
|
|
45
|
-
*/
|
|
46
|
-
if (TARGET === 'vue' || TARGET === 'svelte') return true;
|
|
47
|
-
if (isBrowser()) return false;
|
|
48
|
-
return true;
|
|
49
|
-
};
|
|
50
|
-
type VariantData = {
|
|
51
|
-
id: string;
|
|
52
|
-
testRatio?: number;
|
|
53
|
-
};
|
|
54
|
-
const getIsHydrationTarget = (target: Target) => target === 'react' || target === 'reactNative';
|
|
55
|
-
const isHydrationTarget = getIsHydrationTarget(TARGET);
|
|
56
|
-
export const getInitVariantsFnsScriptString = () => `
|
|
57
|
-
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME} = ${UPDATE_COOKIES_AND_STYLES_SCRIPT}
|
|
58
|
-
window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME} = ${UPDATE_VARIANT_VISIBILITY_SCRIPT}
|
|
59
|
-
`;
|
|
60
|
-
export const getUpdateCookieAndStylesScript = (variants: VariantData[], contentId: string) => `
|
|
61
|
-
window.${UPDATE_COOKIES_AND_STYLES_SCRIPT_NAME}(
|
|
62
|
-
"${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget}
|
|
63
|
-
)`;
|
|
64
|
-
export const getUpdateVariantVisibilityScript = ({
|
|
65
|
-
contentId,
|
|
66
|
-
variationId
|
|
67
|
-
}: {
|
|
68
|
-
variationId: string;
|
|
69
|
-
contentId: string;
|
|
70
|
-
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
71
|
-
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
72
|
-
)`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './content-variants'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WARNING: This file contains functions that get stringified and inlined into the HTML at build-time.
|
|
3
|
-
* They cannot import anything.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
type VariantData = {
|
|
7
|
-
id: string;
|
|
8
|
-
testRatio?: number;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* For more information on how this works,
|
|
13
|
-
* see our [SSR A/B Test Docs](https://github.com/BuilderIO/builder/tree/main/packages/sdks/src/SSR_AB_TEST.md)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* For more information on how this works,
|
|
18
|
-
* see our [SSR A/B Test Docs](https://github.com/BuilderIO/builder/tree/main/packages/sdks/src/SSR_AB_TEST.md)
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
22
|
-
export const UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
|
|
13
|
-
export interface DynamicDivProps {
|
|
14
|
-
children?: any;
|
|
15
|
-
attributes: any;
|
|
16
|
-
actionAttributes: any;
|
|
17
|
-
BlockWrapperProps: any;
|
|
18
|
-
builderPath: any;
|
|
19
|
-
builderParentId: any;
|
|
20
|
-
BlocksWrapperProps: any;
|
|
21
|
-
contentWrapperProps: any;
|
|
22
|
-
builderModel: any;
|
|
23
|
-
ref: any;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function DynamicDiv(props: DynamicDivProps) {
|
|
27
|
-
return <View>{props.children}</View>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default DynamicDiv;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://developer.mozilla.org/en-US/docs/Glossary/Empty_element
|
|
3
|
-
*/
|
|
4
|
-
const EMPTY_HTML_ELEMENTS = new Set(['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']);
|
|
5
|
-
export const isEmptyElement = (tagName: any): boolean => {
|
|
6
|
-
return typeof tagName === 'string' && EMPTY_HTML_ELEMENTS.has(tagName.toLowerCase());
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
FlatList,
|
|
4
|
-
ScrollView,
|
|
5
|
-
View,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
Image,
|
|
8
|
-
Text,
|
|
9
|
-
Pressable,
|
|
10
|
-
TextInput,
|
|
11
|
-
} from "react-native";
|
|
12
|
-
|
|
13
|
-
export interface DynamicRendererProps {
|
|
14
|
-
children?: any;
|
|
15
|
-
TagName: any;
|
|
16
|
-
attributes: any;
|
|
17
|
-
actionAttributes: any;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
import { isEmptyElement } from "./dynamic-renderer.helpers";
|
|
21
|
-
import { setAttrs } from "../../blocks/helpers";
|
|
22
|
-
|
|
23
|
-
function DynamicRenderer(props: DynamicRendererProps) {
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
{!isEmptyElement(props.TagName) ? (
|
|
27
|
-
<>
|
|
28
|
-
{typeof props.TagName === "string" ? (
|
|
29
|
-
<props.TagName {...props.attributes} {...props.actionAttributes}>
|
|
30
|
-
{props.children}
|
|
31
|
-
</props.TagName>
|
|
32
|
-
) : (
|
|
33
|
-
<props.TagName {...props.attributes} {...props.actionAttributes}>
|
|
34
|
-
{props.children}
|
|
35
|
-
</props.TagName>
|
|
36
|
-
)}
|
|
37
|
-
</>
|
|
38
|
-
) : (
|
|
39
|
-
<>
|
|
40
|
-
<props.TagName {...props.attributes} {...props.actionAttributes} />
|
|
41
|
-
</>
|
|
42
|
-
)}
|
|
43
|
-
</>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default DynamicRenderer;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { logger } from '../helpers/logger';
|
|
3
|
-
|
|
4
|
-
export default class ErrorBoundary extends React.Component<
|
|
5
|
-
React.PropsWithChildren,
|
|
6
|
-
{ hasError: boolean }
|
|
7
|
-
> {
|
|
8
|
-
constructor(props) {
|
|
9
|
-
super(props);
|
|
10
|
-
this.state = { hasError: false };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
static getDerivedStateFromError(_error) {
|
|
14
|
-
// Update state so the next render will show the fallback UI.
|
|
15
|
-
return { hasError: true };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
componentDidCatch(error, info) {
|
|
19
|
-
logger.error(
|
|
20
|
-
'ErrorBoundary caught error:',
|
|
21
|
-
info.error,
|
|
22
|
-
info.componentStack
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
render() {
|
|
27
|
-
if (this.state.hasError) {
|
|
28
|
-
return (
|
|
29
|
-
<p>
|
|
30
|
-
Builder.io SDK: error while rendering block. See console for full
|
|
31
|
-
logs.
|
|
32
|
-
</p>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return this.props.children;
|
|
37
|
-
}
|
|
38
|
-
}
|