@builder.io/sdk-react-native 0.4.3 → 0.4.5
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/columns/columns.js +2 -2
- package/dist/blocks/symbol/symbol.js +8 -6
- package/dist/components/block/block.helpers.js +113 -0
- package/dist/components/block/block.js +171 -0
- package/dist/components/block/components/block-styles.js +95 -0
- package/dist/components/block/components/component.js +41 -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 +66 -0
- package/dist/components/blocks/blocks.js +41 -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 +313 -0
- package/dist/components/content/content.helpers.js +42 -0
- package/dist/components/content/content.js +127 -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 +73 -0
- package/dist/components/content-variants/helpers.js +139 -0
- package/dist/components/inlined-script.js +32 -0
- package/dist/components/{render-inlined-styles.js → inlined-styles.js} +2 -2
- 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/sdk-version.js +1 -1
- package/dist/functions/track/index.js +1 -1
- package/dist/helpers/ab-tests.js +3 -0
- package/dist/types/builder-props.js +1 -0
- package/dist/types/enforced-partials.js +1 -0
- package/package.json +1 -1
- package/src/blocks/columns/columns.jsx +2 -2
- package/src/blocks/symbol/symbol.jsx +8 -5
- package/src/components/inlined-script.jsx +18 -0
- package/src/components/{render-inlined-styles.jsx → inlined-styles.jsx} +2 -2
- package/src/components/render-block/block-styles.jsx +2 -2
- package/src/components/render-content/components/render-styles.jsx +2 -2
- package/src/components/render-content/render-content.jsx +8 -6
- package/src/components/render-content-variants/helpers.js +49 -20
- package/src/components/render-content-variants/render-content-variants.jsx +57 -35
- package/src/components/render-content-variants/render-content-variants.types.js +0 -0
- package/src/constants/sdk-version.js +1 -1
- package/src/functions/track/index.js +1 -1
- package/src/helpers/ab-tests.js +3 -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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
const React = __importStar(require("react"));
|
|
31
|
+
const react_native_1 = require("react-native");
|
|
32
|
+
const react_1 = require("react");
|
|
33
|
+
const helpers_1 = require("./helpers");
|
|
34
|
+
const content_1 = __importDefault(require("../content/content"));
|
|
35
|
+
const canTrack_1 = require("../../helpers/canTrack");
|
|
36
|
+
const inlined_styles_1 = __importDefault(require("../inlined-styles"));
|
|
37
|
+
const ab_tests_1 = require("../../helpers/ab-tests");
|
|
38
|
+
function RenderContentVariants(props) {
|
|
39
|
+
var _a, _b, _c, _d, _e;
|
|
40
|
+
const [variantScriptStr, setVariantScriptStr] = (0, react_1.useState)(() => {
|
|
41
|
+
var _a;
|
|
42
|
+
return (0, helpers_1.getVariantsScriptString)((0, helpers_1.getVariants)(props.content).map((value) => ({
|
|
43
|
+
id: value.id,
|
|
44
|
+
testRatio: value.testRatio,
|
|
45
|
+
})), ((_a = props.content) === null || _a === void 0 ? void 0 : _a.id) || "");
|
|
46
|
+
});
|
|
47
|
+
const [shouldRenderVariants, setShouldRenderVariants] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
|
|
48
|
+
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
49
|
+
content: props.content,
|
|
50
|
+
}));
|
|
51
|
+
const [hideVariantsStyleString, setHideVariantsStyleString] = (0, react_1.useState)(() => (0, helpers_1.getVariants)(props.content)
|
|
52
|
+
.map((value) => `.variant-${value.id} { display: none; } `)
|
|
53
|
+
.join(""));
|
|
54
|
+
const [contentToRender, setContentToRender] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
|
|
55
|
+
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
56
|
+
content: props.content,
|
|
57
|
+
})
|
|
58
|
+
? props.content
|
|
59
|
+
: (0, ab_tests_1.handleABTestingSync)({
|
|
60
|
+
item: props.content,
|
|
61
|
+
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
62
|
+
}));
|
|
63
|
+
return (React.createElement(React.Fragment, null,
|
|
64
|
+
shouldRenderVariants ? (React.createElement(React.Fragment, null,
|
|
65
|
+
React.createElement(inlined_styles_1.default, { id: `variants-styles-${(_a = props.content) === null || _a === void 0 ? void 0 : _a.id}`, styles: hideVariantsStyleString }),
|
|
66
|
+
React.createElement(react_native_1.View, { id: `variants-script-${(_b = props.content) === null || _b === void 0 ? void 0 : _b.id}`, dangerouslySetInnerHTML: { __html: variantScriptStr } }), (_c = (0, helpers_1.getVariants)(props.content)) === null || _c === void 0 ? void 0 :
|
|
67
|
+
_c.map((variant) => {
|
|
68
|
+
var _a;
|
|
69
|
+
return (React.createElement(content_1.default, { key: variant.id, content: variant, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents, hideContent: true, parentContentId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.id, isSsrAbTest: shouldRenderVariants }));
|
|
70
|
+
}))) : null,
|
|
71
|
+
React.createElement(content_1.default, { model: props.model, content: contentToRender, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents, classNameProp: `variant-${(_d = props.content) === null || _d === void 0 ? void 0 : _d.id}`, parentContentId: (_e = props.content) === null || _e === void 0 ? void 0 : _e.id, isSsrAbTest: shouldRenderVariants })));
|
|
72
|
+
}
|
|
73
|
+
exports.default = RenderContentVariants;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVariantsScriptString = exports.getVariants = exports.getRenderContentScriptString = exports.checkShouldRunVariants = void 0;
|
|
4
|
+
const target_1 = require("../../constants/target");
|
|
5
|
+
const is_browser_1 = require("../../functions/is-browser");
|
|
6
|
+
const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {});
|
|
7
|
+
exports.getVariants = getVariants;
|
|
8
|
+
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
9
|
+
const hasVariants = getVariants(content).length > 0;
|
|
10
|
+
if (!hasVariants) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (!canTrack) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
if ((0, is_browser_1.isBrowser)()) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
exports.checkShouldRunVariants = checkShouldRunVariants;
|
|
22
|
+
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
23
|
+
function getAndSetVariantId() {
|
|
24
|
+
function setCookie(name, value, days) {
|
|
25
|
+
let expires = "";
|
|
26
|
+
if (days) {
|
|
27
|
+
const date = new Date();
|
|
28
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1e3);
|
|
29
|
+
expires = "; expires=" + date.toUTCString();
|
|
30
|
+
}
|
|
31
|
+
document.cookie = name + "=" + (value || "") + expires + "; path=/; Secure; SameSite=None";
|
|
32
|
+
}
|
|
33
|
+
function getCookie(name) {
|
|
34
|
+
const nameEQ = name + "=";
|
|
35
|
+
const ca = document.cookie.split(";");
|
|
36
|
+
for (let i = 0; i < ca.length; i++) {
|
|
37
|
+
let c = ca[i];
|
|
38
|
+
while (c.charAt(0) === " ")
|
|
39
|
+
c = c.substring(1, c.length);
|
|
40
|
+
if (c.indexOf(nameEQ) === 0)
|
|
41
|
+
return c.substring(nameEQ.length, c.length);
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const cookieName = `builder.tests.${contentId}`;
|
|
46
|
+
const variantInCookie = getCookie(cookieName);
|
|
47
|
+
const availableIDs = variants.map((vr) => vr.id).concat(contentId);
|
|
48
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
49
|
+
return variantInCookie;
|
|
50
|
+
}
|
|
51
|
+
let n = 0;
|
|
52
|
+
const random = Math.random();
|
|
53
|
+
for (let i = 0; i < variants.length; i++) {
|
|
54
|
+
const variant = variants[i];
|
|
55
|
+
const testRatio = variant.testRatio;
|
|
56
|
+
n += testRatio;
|
|
57
|
+
if (random < n) {
|
|
58
|
+
setCookie(cookieName, variant.id);
|
|
59
|
+
return variant.id;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
setCookie(cookieName, contentId);
|
|
63
|
+
return contentId;
|
|
64
|
+
}
|
|
65
|
+
const winningVariantId = getAndSetVariantId();
|
|
66
|
+
const styleEl = document.getElementById(`variants-styles-${contentId}`);
|
|
67
|
+
if (isHydrationTarget2) {
|
|
68
|
+
styleEl.remove();
|
|
69
|
+
const thisScriptEl = document.getElementById(`variants-script-${contentId}`);
|
|
70
|
+
thisScriptEl == null ? void 0 : thisScriptEl.remove();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const newStyleStr = variants.concat({ id: contentId }).filter((variant) => variant.id !== winningVariantId).map((value) => {
|
|
74
|
+
return `.variant-${value.id} { display: none; }
|
|
75
|
+
`;
|
|
76
|
+
}).join("");
|
|
77
|
+
styleEl.innerHTML = newStyleStr;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
81
|
+
if (!navigator.cookieEnabled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
function getCookie(name) {
|
|
85
|
+
const nameEQ = name + "=";
|
|
86
|
+
const ca = document.cookie.split(";");
|
|
87
|
+
for (let i = 0; i < ca.length; i++) {
|
|
88
|
+
let c = ca[i];
|
|
89
|
+
while (c.charAt(0) === " ")
|
|
90
|
+
c = c.substring(1, c.length);
|
|
91
|
+
if (c.indexOf(nameEQ) === 0)
|
|
92
|
+
return c.substring(nameEQ.length, c.length);
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
const cookieName = `builder.tests.${defaultContentId}`;
|
|
97
|
+
const variantId = getCookie(cookieName);
|
|
98
|
+
const parentDiv = document.querySelector(`[builder-content-id="${variantContentId}"]`);
|
|
99
|
+
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
100
|
+
if (variantId === variantContentId) {
|
|
101
|
+
if (variantIsDefaultContent) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
parentDiv == null ? void 0 : parentDiv.removeAttribute("hidden");
|
|
105
|
+
parentDiv == null ? void 0 : parentDiv.removeAttribute("aria-hidden");
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (variantIsDefaultContent) {
|
|
109
|
+
if (isHydrationTarget2) {
|
|
110
|
+
parentDiv == null ? void 0 : parentDiv.remove();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
parentDiv == null ? void 0 : parentDiv.setAttribute("hidden", "true");
|
|
114
|
+
parentDiv == null ? void 0 : parentDiv.setAttribute("aria-hidden", "true");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative" || target === "vue3" || target === "vue2";
|
|
122
|
+
const isHydrationTarget = getIsHydrationTarget(target_1.TARGET);
|
|
123
|
+
const AB_TEST_FN_NAME = "bldrAbTest";
|
|
124
|
+
const CONTENT_FN_NAME = "bldrCntntScrpt";
|
|
125
|
+
const getVariantsScriptString = (variants, contentId) => {
|
|
126
|
+
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
127
|
+
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
128
|
+
return `
|
|
129
|
+
const ${AB_TEST_FN_NAME} = ${fnStr}
|
|
130
|
+
const ${CONTENT_FN_NAME} = ${fnStr2}
|
|
131
|
+
${AB_TEST_FN_NAME}("${contentId}", ${JSON.stringify(variants)}, ${isHydrationTarget})
|
|
132
|
+
`;
|
|
133
|
+
};
|
|
134
|
+
exports.getVariantsScriptString = getVariantsScriptString;
|
|
135
|
+
const getRenderContentScriptString = ({ parentContentId, contentId }) => {
|
|
136
|
+
return `
|
|
137
|
+
${CONTENT_FN_NAME}("${contentId}", "${parentContentId}", ${isHydrationTarget})`;
|
|
138
|
+
};
|
|
139
|
+
exports.getRenderContentScriptString = getRenderContentScriptString;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
const React = __importStar(require("react"));
|
|
28
|
+
const react_native_1 = require("react-native");
|
|
29
|
+
function InlinedScript(props) {
|
|
30
|
+
return (React.createElement(react_native_1.View, { dangerouslySetInnerHTML: { __html: props.scriptStr }, id: props.id }));
|
|
31
|
+
}
|
|
32
|
+
exports.default = InlinedScript;
|
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
27
|
const React = __importStar(require("react"));
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
|
-
function
|
|
29
|
+
function InlinedStyles(props) {
|
|
30
30
|
return (React.createElement(react_native_1.View, { dangerouslySetInnerHTML: { __html: props.styles }, id: props.id }));
|
|
31
31
|
}
|
|
32
|
-
exports.default =
|
|
32
|
+
exports.default = InlinedStyles;
|
|
@@ -34,7 +34,7 @@ const target_js_1 = require("../../constants/target.js");
|
|
|
34
34
|
const get_processed_block_js_1 = require("../../functions/get-processed-block.js");
|
|
35
35
|
const css_js_1 = require("../../helpers/css.js");
|
|
36
36
|
const nullable_js_1 = require("../../helpers/nullable.js");
|
|
37
|
-
const
|
|
37
|
+
const inlined_styles_1 = __importDefault(require("../inlined-styles"));
|
|
38
38
|
function BlockStyles(props) {
|
|
39
39
|
function useBlock() {
|
|
40
40
|
return (0, get_processed_block_js_1.getProcessedBlock)({
|
|
@@ -91,6 +91,6 @@ function BlockStyles(props) {
|
|
|
91
91
|
return [largeStylesClass, mediumStylesClass, smallStylesClass].join(" ");
|
|
92
92
|
}
|
|
93
93
|
return (React.createElement(React.Fragment, null, target_js_1.TARGET !== "reactNative" && css() && canShowBlock() ? (React.createElement(React.Fragment, null,
|
|
94
|
-
React.createElement(
|
|
94
|
+
React.createElement(inlined_styles_1.default, { styles: css() }))) : null));
|
|
95
95
|
}
|
|
96
96
|
exports.default = BlockStyles;
|
|
@@ -30,7 +30,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
32
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
33
|
+
const inlined_styles_1 = __importDefault(require("../../inlined-styles"));
|
|
34
34
|
const render_styles_helpers_1 = require("./render-styles.helpers");
|
|
35
35
|
const render_styles_helpers_2 = require("./render-styles.helpers");
|
|
36
36
|
function RenderContentStyles(props) {
|
|
@@ -56,6 +56,6 @@ ${(0, render_styles_helpers_2.getFontCss)({
|
|
|
56
56
|
font-family: inherit;
|
|
57
57
|
}
|
|
58
58
|
`.trim());
|
|
59
|
-
return React.createElement(
|
|
59
|
+
return React.createElement(inlined_styles_1.default, { styles: injectedStyles });
|
|
60
60
|
}
|
|
61
61
|
exports.default = RenderContentStyles;
|
|
@@ -50,6 +50,7 @@ const target_js_1 = require("../../constants/target.js");
|
|
|
50
50
|
const logger_js_1 = require("../../helpers/logger.js");
|
|
51
51
|
const helpers_js_1 = require("../render-content-variants/helpers.js");
|
|
52
52
|
const wrap_component_ref_js_1 = require("./wrap-component-ref.js");
|
|
53
|
+
const inlined_script_1 = __importDefault(require("../inlined-script"));
|
|
53
54
|
function RenderContent(props) {
|
|
54
55
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
55
56
|
const elementRef = (0, react_1.useRef)(null);
|
|
@@ -208,11 +209,12 @@ function RenderContent(props) {
|
|
|
208
209
|
}
|
|
209
210
|
}
|
|
210
211
|
const [scriptStr, setScriptStr] = (0, react_1.useState)(() => {
|
|
211
|
-
var _a;
|
|
212
|
+
var _a, _b;
|
|
212
213
|
return (0, helpers_js_1.getRenderContentScriptString)({
|
|
213
214
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
variationId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.testVariationId,
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
217
|
+
contentId: (_b = props.content) === null || _b === void 0 ? void 0 : _b.id,
|
|
216
218
|
});
|
|
217
219
|
});
|
|
218
220
|
const [builderContextSignal, setBuilderContextSignal] = (0, react_1.useState)(() => ({
|
|
@@ -358,14 +360,14 @@ function RenderContent(props) {
|
|
|
358
360
|
"builder-content-id": "",
|
|
359
361
|
},
|
|
360
362
|
}
|
|
361
|
-
: {}), ...(props.
|
|
362
|
-
? {
|
|
363
|
+
: {}), ...(props.showContent
|
|
364
|
+
? {}
|
|
365
|
+
: {
|
|
363
366
|
hidden: true,
|
|
364
367
|
"aria-hidden": true,
|
|
365
|
-
}
|
|
366
|
-
: {}) },
|
|
368
|
+
}) },
|
|
367
369
|
props.isSsrAbTest ? (React.createElement(React.Fragment, null,
|
|
368
|
-
React.createElement(
|
|
370
|
+
React.createElement(inlined_script_1.default, { scriptStr: scriptStr }))) : null,
|
|
369
371
|
target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
370
372
|
React.createElement(render_styles_1.default, { contentId: (_f = builderContextSignal.content) === null || _f === void 0 ? void 0 : _f.id, cssCode: (_h = (_g = builderContextSignal.content) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.cssCode, customFonts: (_k = (_j = builderContextSignal.content) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.customFonts }))) : null,
|
|
371
373
|
React.createElement(render_blocks_1.default, { blocks: (_m = (_l = builderContextSignal.content) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.blocks, key: forceReRenderCount })))) : null));
|
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getVariantsScriptString = exports.getVariants = exports.getRenderContentScriptString = exports.checkShouldRunVariants = void 0;
|
|
3
|
+
exports.getVariantsScriptString = exports.getVariants = exports.getScriptString = exports.getRenderContentScriptString = exports.checkShouldRunVariants = 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));
|
|
4
23
|
const target_1 = require("../../constants/target");
|
|
5
24
|
const is_browser_1 = require("../../functions/is-browser");
|
|
6
|
-
const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {})
|
|
25
|
+
const getVariants = (content) => Object.values((content == null ? void 0 : content.variations) || {}).map((variant) => __spreadProps(__spreadValues({}, variant), {
|
|
26
|
+
testVariationId: variant.id,
|
|
27
|
+
id: content == null ? void 0 : content.id
|
|
28
|
+
}));
|
|
7
29
|
exports.getVariants = getVariants;
|
|
8
30
|
const checkShouldRunVariants = ({ canTrack, content }) => {
|
|
9
31
|
const hasVariants = getVariants(content).length > 0;
|
|
10
|
-
if (
|
|
32
|
+
if (target_1.TARGET === "reactNative")
|
|
11
33
|
return false;
|
|
12
|
-
|
|
13
|
-
if (!canTrack) {
|
|
34
|
+
if (!hasVariants)
|
|
14
35
|
return false;
|
|
15
|
-
|
|
16
|
-
|
|
36
|
+
if (!canTrack)
|
|
37
|
+
return false;
|
|
38
|
+
if (target_1.TARGET === "vue2" || target_1.TARGET === "vue3")
|
|
39
|
+
return true;
|
|
40
|
+
if ((0, is_browser_1.isBrowser)())
|
|
17
41
|
return false;
|
|
18
|
-
}
|
|
19
42
|
return true;
|
|
20
43
|
};
|
|
21
44
|
exports.checkShouldRunVariants = checkShouldRunVariants;
|
|
22
45
|
function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
46
|
+
var _a;
|
|
23
47
|
function getAndSetVariantId() {
|
|
24
48
|
function setCookie(name, value, days) {
|
|
25
49
|
let expires = "";
|
|
@@ -63,10 +87,10 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
63
87
|
return contentId;
|
|
64
88
|
}
|
|
65
89
|
const winningVariantId = getAndSetVariantId();
|
|
66
|
-
const styleEl = document.
|
|
90
|
+
const styleEl = (_a = document.currentScript) == null ? void 0 : _a.previousElementSibling;
|
|
67
91
|
if (isHydrationTarget2) {
|
|
68
92
|
styleEl.remove();
|
|
69
|
-
const thisScriptEl = document.
|
|
93
|
+
const thisScriptEl = document.currentScript;
|
|
70
94
|
thisScriptEl == null ? void 0 : thisScriptEl.remove();
|
|
71
95
|
}
|
|
72
96
|
else {
|
|
@@ -78,6 +102,7 @@ function bldrAbTest(contentId, variants, isHydrationTarget2) {
|
|
|
78
102
|
}
|
|
79
103
|
}
|
|
80
104
|
function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2) {
|
|
105
|
+
var _a;
|
|
81
106
|
if (!navigator.cookieEnabled) {
|
|
82
107
|
return;
|
|
83
108
|
}
|
|
@@ -95,7 +120,7 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
95
120
|
}
|
|
96
121
|
const cookieName = `builder.tests.${defaultContentId}`;
|
|
97
122
|
const variantId = getCookie(cookieName);
|
|
98
|
-
const parentDiv = document.
|
|
123
|
+
const parentDiv = (_a = document.currentScript) == null ? void 0 : _a.parentElement;
|
|
99
124
|
const variantIsDefaultContent = variantContentId === defaultContentId;
|
|
100
125
|
if (variantId === variantContentId) {
|
|
101
126
|
if (variantIsDefaultContent) {
|
|
@@ -118,22 +143,26 @@ function bldrCntntScrpt(variantContentId, defaultContentId, isHydrationTarget2)
|
|
|
118
143
|
}
|
|
119
144
|
return;
|
|
120
145
|
}
|
|
121
|
-
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative"
|
|
146
|
+
const getIsHydrationTarget = (target) => target === "react" || target === "reactNative";
|
|
122
147
|
const isHydrationTarget = getIsHydrationTarget(target_1.TARGET);
|
|
123
|
-
const AB_TEST_FN_NAME = "
|
|
124
|
-
const CONTENT_FN_NAME = "
|
|
125
|
-
const
|
|
148
|
+
const AB_TEST_FN_NAME = "builderIoAbTest";
|
|
149
|
+
const CONTENT_FN_NAME = "builderIoRenderContent";
|
|
150
|
+
const getScriptString = () => {
|
|
126
151
|
const fnStr = bldrAbTest.toString().replace(/\s+/g, " ");
|
|
127
152
|
const fnStr2 = bldrCntntScrpt.toString().replace(/\s+/g, " ");
|
|
128
153
|
return `
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
${AB_TEST_FN_NAME}("${contentId}", ${JSON.stringify(variants)}, ${isHydrationTarget})
|
|
154
|
+
window.${AB_TEST_FN_NAME} = ${fnStr}
|
|
155
|
+
window.${CONTENT_FN_NAME} = ${fnStr2}
|
|
132
156
|
`;
|
|
133
157
|
};
|
|
158
|
+
exports.getScriptString = getScriptString;
|
|
159
|
+
const getVariantsScriptString = (variants, contentId) => {
|
|
160
|
+
return `
|
|
161
|
+
window.${AB_TEST_FN_NAME}("${contentId}",${JSON.stringify(variants)}, ${isHydrationTarget})`;
|
|
162
|
+
};
|
|
134
163
|
exports.getVariantsScriptString = getVariantsScriptString;
|
|
135
|
-
const getRenderContentScriptString = ({
|
|
164
|
+
const getRenderContentScriptString = ({ contentId, variationId }) => {
|
|
136
165
|
return `
|
|
137
|
-
|
|
166
|
+
window.${CONTENT_FN_NAME}("${variationId}", "${contentId}", ${isHydrationTarget})`;
|
|
138
167
|
};
|
|
139
168
|
exports.getRenderContentScriptString = getRenderContentScriptString;
|
|
@@ -33,41 +33,46 @@ const react_1 = require("react");
|
|
|
33
33
|
const helpers_1 = require("./helpers");
|
|
34
34
|
const render_content_1 = __importDefault(require("../render-content/render-content"));
|
|
35
35
|
const canTrack_1 = require("../../helpers/canTrack");
|
|
36
|
-
const
|
|
36
|
+
const inlined_styles_1 = __importDefault(require("../inlined-styles"));
|
|
37
37
|
const ab_tests_1 = require("../../helpers/ab-tests");
|
|
38
|
+
const inlined_script_1 = __importDefault(require("../inlined-script"));
|
|
39
|
+
const target_1 = require("../../constants/target");
|
|
38
40
|
function RenderContentVariants(props) {
|
|
39
|
-
var _a, _b, _c
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
const [shouldRenderVariants, setShouldRenderVariants] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
|
|
43
|
+
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
44
|
+
content: props.content,
|
|
45
|
+
}));
|
|
40
46
|
const [variantScriptStr, setVariantScriptStr] = (0, react_1.useState)(() => {
|
|
41
47
|
var _a;
|
|
42
48
|
return (0, helpers_1.getVariantsScriptString)((0, helpers_1.getVariants)(props.content).map((value) => ({
|
|
43
|
-
id: value.
|
|
49
|
+
id: value.testVariationId,
|
|
44
50
|
testRatio: value.testRatio,
|
|
45
51
|
})), ((_a = props.content) === null || _a === void 0 ? void 0 : _a.id) || "");
|
|
46
52
|
});
|
|
47
|
-
const [shouldRenderVariants, setShouldRenderVariants] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
|
|
48
|
-
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
49
|
-
content: props.content,
|
|
50
|
-
}));
|
|
51
53
|
const [hideVariantsStyleString, setHideVariantsStyleString] = (0, react_1.useState)(() => (0, helpers_1.getVariants)(props.content)
|
|
52
|
-
.map((value) => `.variant-${value.
|
|
54
|
+
.map((value) => `.variant-${value.testVariationId} { display: none; } `)
|
|
53
55
|
.join(""));
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}));
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
/**
|
|
58
|
+
* We unmount the non-winning variants post-hydration in Vue.
|
|
59
|
+
*/
|
|
60
|
+
if (target_1.TARGET === "vue2" || target_1.TARGET === "vue3") {
|
|
61
|
+
setShouldRenderVariants(false);
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
63
64
|
return (React.createElement(React.Fragment, null,
|
|
65
|
+
!props.__isNestedRender && target_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
|
|
66
|
+
React.createElement(inlined_script_1.default, { scriptStr: (0, helpers_1.getScriptString)() }))) : null,
|
|
64
67
|
shouldRenderVariants ? (React.createElement(React.Fragment, null,
|
|
65
|
-
React.createElement(
|
|
66
|
-
React.createElement(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
React.createElement(inlined_styles_1.default, { id: `variants-styles-${(_a = props.content) === null || _a === void 0 ? void 0 : _a.id}`, styles: hideVariantsStyleString }),
|
|
69
|
+
React.createElement(inlined_script_1.default, { scriptStr: variantScriptStr }), (_b = (0, helpers_1.getVariants)(props.content)) === null || _b === void 0 ? void 0 :
|
|
70
|
+
_b.map((variant) => (React.createElement(render_content_1.default, { key: variant.testVariationId, content: variant, showContent: false, classNameProp: undefined, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants }))))) : null,
|
|
71
|
+
React.createElement(render_content_1.default, { ...{}, content: shouldRenderVariants
|
|
72
|
+
? props.content
|
|
73
|
+
: (0, ab_tests_1.handleABTestingSync)({
|
|
74
|
+
item: props.content,
|
|
75
|
+
canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
|
|
76
|
+
}), classNameProp: `variant-${(_c = props.content) === null || _c === void 0 ? void 0 : _c.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
|
|
72
77
|
}
|
|
73
78
|
exports.default = RenderContentVariants;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -106,7 +106,7 @@ function _track(eventProps) {
|
|
|
106
106
|
if (!((0, is_browser_js_1.isBrowser)() || target_js_1.TARGET === "reactNative")) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
return fetch(`https://builder.io/api/v1/track`, {
|
|
109
|
+
return fetch(`https://cdn.builder.io/api/v1/track`, {
|
|
110
110
|
method: "POST",
|
|
111
111
|
body: JSON.stringify({
|
|
112
112
|
events: [yield createEvent(eventProps)]
|
package/dist/helpers/ab-tests.js
CHANGED
|
@@ -42,6 +42,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
42
42
|
const cookie_js_1 = require("./cookie.js");
|
|
43
43
|
const nullable_js_1 = require("../helpers/nullable.js");
|
|
44
44
|
const logger_js_1 = require("./logger.js");
|
|
45
|
+
const target_js_1 = require("../constants/target.js");
|
|
45
46
|
const BUILDER_STORE_PREFIX = "builder.tests";
|
|
46
47
|
const getContentTestKey = (id) => `${BUILDER_STORE_PREFIX}.${id}`;
|
|
47
48
|
const getContentVariationCookie = ({ contentId }) => (0, cookie_js_1.getCookie)({ name: getContentTestKey(contentId), canTrack: true });
|
|
@@ -88,6 +89,8 @@ const getTestFields = ({ item, testGroupId }) => {
|
|
|
88
89
|
}
|
|
89
90
|
};
|
|
90
91
|
const handleABTestingSync = ({ item, canTrack }) => {
|
|
92
|
+
if (target_js_1.TARGET === "reactNative")
|
|
93
|
+
return item;
|
|
91
94
|
if (!canTrack) {
|
|
92
95
|
return item;
|
|
93
96
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { useState, useContext } from "react";
|
|
12
12
|
import RenderBlocks from "../../components/render-blocks";
|
|
13
13
|
import { getSizesForBreakpoints } from "../../constants/device-sizes";
|
|
14
|
-
import
|
|
14
|
+
import InlinedStyles from "../../components/inlined-styles";
|
|
15
15
|
import { TARGET } from "../../constants/target.js";
|
|
16
16
|
import BuilderContext from "../../context/builder.context.js";
|
|
17
17
|
|
|
@@ -145,7 +145,7 @@ function Columns(props) {
|
|
|
145
145
|
>
|
|
146
146
|
{TARGET !== "reactNative" ? (
|
|
147
147
|
<>
|
|
148
|
-
<
|
|
148
|
+
<InlinedStyles styles={columnsStyles()} />
|
|
149
149
|
</>
|
|
150
150
|
) : null}
|
|
151
151
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Text,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
import { useState, useContext, useEffect } from "react";
|
|
12
|
-
import
|
|
12
|
+
import RenderContentVariants from "../../components/render-content-variants/render-content-variants";
|
|
13
13
|
import BuilderContext from "../../context/builder.context.js";
|
|
14
14
|
import { getContent } from "../../functions/get-content/index.js";
|
|
15
15
|
import { TARGET } from "../../constants/target";
|
|
@@ -53,9 +53,11 @@ function Symbol(props) {
|
|
|
53
53
|
model: props.symbol.model,
|
|
54
54
|
apiKey: builderContext.apiKey,
|
|
55
55
|
apiVersion: builderContext.apiVersion,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
...(props.symbol?.entry && {
|
|
57
|
+
query: {
|
|
58
|
+
id: props.symbol.entry,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
59
61
|
})
|
|
60
62
|
.then((response) => {
|
|
61
63
|
if (response) {
|
|
@@ -85,7 +87,8 @@ function Symbol(props) {
|
|
|
85
87
|
class: className,
|
|
86
88
|
}}
|
|
87
89
|
>
|
|
88
|
-
<
|
|
90
|
+
<RenderContentVariants
|
|
91
|
+
__isNestedRender={true}
|
|
89
92
|
apiVersion={builderContext.apiVersion}
|
|
90
93
|
apiKey={builderContext.apiKey}
|
|
91
94
|
context={builderContext.context}
|