@builder.io/sdk-solid 3.0.5 → 3.0.6
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/index.d.ts +7 -1
- package/lib/browser/dev.js +529 -103
- package/lib/browser/dev.jsx +558 -142
- package/lib/browser/index.js +529 -103
- package/lib/browser/index.jsx +558 -142
- package/lib/edge/dev.js +529 -103
- package/lib/edge/dev.jsx +558 -142
- package/lib/edge/index.js +529 -103
- package/lib/edge/index.jsx +558 -142
- package/lib/node/dev.js +529 -103
- package/lib/node/dev.jsx +558 -142
- package/lib/node/index.js +529 -103
- package/lib/node/index.jsx +558 -142
- package/package.json +1 -1
package/lib/browser/index.jsx
CHANGED
|
@@ -1456,8 +1456,9 @@ function BlocksWrapper(props) {
|
|
|
1456
1456
|
if (!props.path) {
|
|
1457
1457
|
return void 0;
|
|
1458
1458
|
}
|
|
1459
|
+
const thisPrefix = "this.";
|
|
1459
1460
|
const pathPrefix = "component.options.";
|
|
1460
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1461
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1461
1462
|
});
|
|
1462
1463
|
function onClick() {
|
|
1463
1464
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1492,7 +1493,7 @@ function BlocksWrapper(props) {
|
|
|
1492
1493
|
});
|
|
1493
1494
|
return <>
|
|
1494
1495
|
<Dynamic4
|
|
1495
|
-
class={className() + " dynamic-
|
|
1496
|
+
class={className() + " dynamic-3d7ff108"}
|
|
1496
1497
|
ref={blocksWrapperRef}
|
|
1497
1498
|
builder-path={dataPath()}
|
|
1498
1499
|
builder-parent-id={props.parent}
|
|
@@ -1504,7 +1505,7 @@ function BlocksWrapper(props) {
|
|
|
1504
1505
|
{...props.BlocksWrapperProps}
|
|
1505
1506
|
component={props.BlocksWrapper}
|
|
1506
1507
|
>{props.children}</Dynamic4>
|
|
1507
|
-
<style>{`.dynamic-
|
|
1508
|
+
<style>{`.dynamic-3d7ff108 {
|
|
1508
1509
|
display: flex;
|
|
1509
1510
|
flex-direction: column;
|
|
1510
1511
|
align-items: stretch;
|
|
@@ -1876,10 +1877,10 @@ function SectionComponent(props) {
|
|
|
1876
1877
|
var section_default = SectionComponent;
|
|
1877
1878
|
|
|
1878
1879
|
// src/blocks/symbol/symbol.tsx
|
|
1879
|
-
import { onMount as
|
|
1880
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1880
1881
|
|
|
1881
1882
|
// src/components/content-variants/content-variants.tsx
|
|
1882
|
-
import { Show as
|
|
1883
|
+
import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1883
1884
|
|
|
1884
1885
|
// src/helpers/url.ts
|
|
1885
1886
|
var getTopLevelDomain = (host) => {
|
|
@@ -2069,11 +2070,61 @@ var handleABTesting = async ({
|
|
|
2069
2070
|
};
|
|
2070
2071
|
};
|
|
2071
2072
|
|
|
2073
|
+
// src/helpers/user-attributes.ts
|
|
2074
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2075
|
+
function createUserAttributesService() {
|
|
2076
|
+
let canTrack = true;
|
|
2077
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2078
|
+
return {
|
|
2079
|
+
setUserAttributes(newAttrs) {
|
|
2080
|
+
if (!isBrowser()) {
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
const userAttributes = {
|
|
2084
|
+
...this.getUserAttributes(),
|
|
2085
|
+
...newAttrs
|
|
2086
|
+
};
|
|
2087
|
+
setCookie({
|
|
2088
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2089
|
+
value: JSON.stringify(userAttributes),
|
|
2090
|
+
canTrack
|
|
2091
|
+
});
|
|
2092
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2093
|
+
},
|
|
2094
|
+
getUserAttributes() {
|
|
2095
|
+
if (!isBrowser()) {
|
|
2096
|
+
return {};
|
|
2097
|
+
}
|
|
2098
|
+
return JSON.parse(getCookieSync({
|
|
2099
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2100
|
+
canTrack
|
|
2101
|
+
}) || "{}");
|
|
2102
|
+
},
|
|
2103
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2104
|
+
subscribers.add(callback);
|
|
2105
|
+
return () => {
|
|
2106
|
+
subscribers.delete(callback);
|
|
2107
|
+
};
|
|
2108
|
+
},
|
|
2109
|
+
setCanTrack(value) {
|
|
2110
|
+
canTrack = value;
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
var userAttributesService = createUserAttributesService();
|
|
2115
|
+
var setClientUserAttributes = (attributes) => {
|
|
2116
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2117
|
+
};
|
|
2118
|
+
|
|
2072
2119
|
// src/helpers/canTrack.ts
|
|
2073
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2120
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2121
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2122
|
+
userAttributesService.setCanTrack(result);
|
|
2123
|
+
return result;
|
|
2124
|
+
};
|
|
2074
2125
|
|
|
2075
2126
|
// src/components/content/content.tsx
|
|
2076
|
-
import { Show as
|
|
2127
|
+
import { Show as Show15, createSignal as createSignal18 } from "solid-js";
|
|
2077
2128
|
|
|
2078
2129
|
// src/blocks/accordion/component-info.ts
|
|
2079
2130
|
var defaultTitle = {
|
|
@@ -2767,8 +2818,388 @@ var componentInfo5 = {
|
|
|
2767
2818
|
}
|
|
2768
2819
|
};
|
|
2769
2820
|
|
|
2770
|
-
// src/blocks/
|
|
2821
|
+
// src/blocks/personalization-container/component-info.ts
|
|
2771
2822
|
var componentInfo6 = {
|
|
2823
|
+
name: "PersonalizationContainer",
|
|
2824
|
+
shouldReceiveBuilderProps: {
|
|
2825
|
+
builderBlock: true,
|
|
2826
|
+
builderContext: true
|
|
2827
|
+
},
|
|
2828
|
+
noWrap: true,
|
|
2829
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
2830
|
+
canHaveChildren: true,
|
|
2831
|
+
inputs: [{
|
|
2832
|
+
name: "variants",
|
|
2833
|
+
defaultValue: [],
|
|
2834
|
+
behavior: "personalizationVariantList",
|
|
2835
|
+
type: "list",
|
|
2836
|
+
subFields: [{
|
|
2837
|
+
name: "name",
|
|
2838
|
+
type: "text"
|
|
2839
|
+
}, {
|
|
2840
|
+
name: "query",
|
|
2841
|
+
friendlyName: "Targeting rules",
|
|
2842
|
+
type: "BuilderQuery",
|
|
2843
|
+
defaultValue: []
|
|
2844
|
+
}, {
|
|
2845
|
+
name: "startDate",
|
|
2846
|
+
type: "date"
|
|
2847
|
+
}, {
|
|
2848
|
+
name: "endDate",
|
|
2849
|
+
type: "date"
|
|
2850
|
+
}, {
|
|
2851
|
+
name: "blocks",
|
|
2852
|
+
type: "uiBlocks",
|
|
2853
|
+
hideFromUI: true,
|
|
2854
|
+
defaultValue: []
|
|
2855
|
+
}]
|
|
2856
|
+
}]
|
|
2857
|
+
};
|
|
2858
|
+
|
|
2859
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
2860
|
+
import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
|
|
2861
|
+
|
|
2862
|
+
// src/components/inlined-script.tsx
|
|
2863
|
+
function InlinedScript(props) {
|
|
2864
|
+
return <><script
|
|
2865
|
+
innerHTML={props.scriptStr}
|
|
2866
|
+
data-id={props.id}
|
|
2867
|
+
nonce={props.nonce || ""}
|
|
2868
|
+
/></>;
|
|
2869
|
+
}
|
|
2870
|
+
var Inlined_script_default = InlinedScript;
|
|
2871
|
+
|
|
2872
|
+
// src/functions/is-previewing.ts
|
|
2873
|
+
function isPreviewing(_search) {
|
|
2874
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
2875
|
+
if (!search) {
|
|
2876
|
+
return false;
|
|
2877
|
+
}
|
|
2878
|
+
const normalizedSearch = getSearchString(search);
|
|
2879
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
2880
|
+
}
|
|
2881
|
+
|
|
2882
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
2883
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
2884
|
+
function isString(val) {
|
|
2885
|
+
return typeof val === "string";
|
|
2886
|
+
}
|
|
2887
|
+
function isNumber(val) {
|
|
2888
|
+
return typeof val === "number";
|
|
2889
|
+
}
|
|
2890
|
+
function objectMatchesQuery(userattr, query2) {
|
|
2891
|
+
const result = (() => {
|
|
2892
|
+
const property = query2.property;
|
|
2893
|
+
const operator = query2.operator;
|
|
2894
|
+
let testValue = query2.value;
|
|
2895
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
2896
|
+
testValue = query2.value.slice(0, -1);
|
|
2897
|
+
}
|
|
2898
|
+
if (!(property && operator)) {
|
|
2899
|
+
return true;
|
|
2900
|
+
}
|
|
2901
|
+
if (Array.isArray(testValue)) {
|
|
2902
|
+
if (operator === "isNot") {
|
|
2903
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
2904
|
+
property,
|
|
2905
|
+
operator,
|
|
2906
|
+
value: val
|
|
2907
|
+
}));
|
|
2908
|
+
}
|
|
2909
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
2910
|
+
property,
|
|
2911
|
+
operator,
|
|
2912
|
+
value: val
|
|
2913
|
+
}));
|
|
2914
|
+
}
|
|
2915
|
+
const value = userattr[property];
|
|
2916
|
+
if (Array.isArray(value)) {
|
|
2917
|
+
return value.includes(testValue);
|
|
2918
|
+
}
|
|
2919
|
+
switch (operator) {
|
|
2920
|
+
case "is":
|
|
2921
|
+
return value === testValue;
|
|
2922
|
+
case "isNot":
|
|
2923
|
+
return value !== testValue;
|
|
2924
|
+
case "contains":
|
|
2925
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
2926
|
+
case "startsWith":
|
|
2927
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
2928
|
+
case "endsWith":
|
|
2929
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
2930
|
+
case "greaterThan":
|
|
2931
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
2932
|
+
case "lessThan":
|
|
2933
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
2934
|
+
case "greaterThanOrEqualTo":
|
|
2935
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
2936
|
+
case "lessThanOrEqualTo":
|
|
2937
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
2938
|
+
default:
|
|
2939
|
+
return false;
|
|
2940
|
+
}
|
|
2941
|
+
})();
|
|
2942
|
+
return result;
|
|
2943
|
+
}
|
|
2944
|
+
const item = {
|
|
2945
|
+
query,
|
|
2946
|
+
startDate,
|
|
2947
|
+
endDate
|
|
2948
|
+
};
|
|
2949
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
2950
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
2951
|
+
return false;
|
|
2952
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
2953
|
+
return false;
|
|
2954
|
+
}
|
|
2955
|
+
if (!item.query || !item.query.length) {
|
|
2956
|
+
return true;
|
|
2957
|
+
}
|
|
2958
|
+
return item.query.every((filter) => {
|
|
2959
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
2963
|
+
if (!navigator.cookieEnabled) {
|
|
2964
|
+
return;
|
|
2965
|
+
}
|
|
2966
|
+
function getCookie(name) {
|
|
2967
|
+
const nameEQ = name + '=';
|
|
2968
|
+
const ca = document.cookie.split(';');
|
|
2969
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2970
|
+
let c = ca[i];
|
|
2971
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
2972
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
2973
|
+
}
|
|
2974
|
+
return null;
|
|
2975
|
+
}
|
|
2976
|
+
function removeVariants() {
|
|
2977
|
+
variants?.forEach(function (_, index) {
|
|
2978
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
2979
|
+
});
|
|
2980
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
2981
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
2982
|
+
}
|
|
2983
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
2984
|
+
if (locale) {
|
|
2985
|
+
attributes.locale = locale;
|
|
2986
|
+
}
|
|
2987
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
2988
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
2989
|
+
});
|
|
2990
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
2991
|
+
if (isDebug) {
|
|
2992
|
+
console.debug('PersonalizationContainer', {
|
|
2993
|
+
attributes,
|
|
2994
|
+
variants,
|
|
2995
|
+
winningVariantIndex
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
if (winningVariantIndex !== -1) {
|
|
2999
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3000
|
+
if (winningVariant) {
|
|
3001
|
+
const parentNode = winningVariant.parentNode;
|
|
3002
|
+
if (parentNode) {
|
|
3003
|
+
const newParent = parentNode.cloneNode(false);
|
|
3004
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3005
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3006
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3007
|
+
}
|
|
3008
|
+
if (isDebug) {
|
|
3009
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
} else if (variants && variants.length > 0) {
|
|
3013
|
+
removeVariants();
|
|
3014
|
+
}
|
|
3015
|
+
}`;
|
|
3016
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
|
|
3017
|
+
|
|
3018
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3019
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3020
|
+
const hasVariants = variants && variants.length > 0;
|
|
3021
|
+
if (TARGET === "reactNative")
|
|
3022
|
+
return false;
|
|
3023
|
+
if (!hasVariants)
|
|
3024
|
+
return false;
|
|
3025
|
+
if (!canTrack)
|
|
3026
|
+
return false;
|
|
3027
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3028
|
+
return true;
|
|
3029
|
+
if (isBrowser())
|
|
3030
|
+
return false;
|
|
3031
|
+
return true;
|
|
3032
|
+
}
|
|
3033
|
+
function getBlocksToRender({
|
|
3034
|
+
variants,
|
|
3035
|
+
previewingIndex,
|
|
3036
|
+
isHydrated,
|
|
3037
|
+
filteredVariants,
|
|
3038
|
+
fallbackBlocks
|
|
3039
|
+
}) {
|
|
3040
|
+
const fallback = {
|
|
3041
|
+
blocks: fallbackBlocks ?? [],
|
|
3042
|
+
path: "this.children"
|
|
3043
|
+
};
|
|
3044
|
+
if (isHydrated && isEditing()) {
|
|
3045
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3046
|
+
const variant = variants[previewingIndex];
|
|
3047
|
+
return {
|
|
3048
|
+
blocks: variant.blocks,
|
|
3049
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
return fallback;
|
|
3053
|
+
}
|
|
3054
|
+
if (isBrowser()) {
|
|
3055
|
+
const winningVariant = filteredVariants?.[0];
|
|
3056
|
+
if (winningVariant) {
|
|
3057
|
+
return {
|
|
3058
|
+
blocks: winningVariant.blocks,
|
|
3059
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3060
|
+
};
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
3063
|
+
return fallback;
|
|
3064
|
+
}
|
|
3065
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3066
|
+
return `
|
|
3067
|
+
(function() {
|
|
3068
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3069
|
+
${PERSONALIZATION_SCRIPT}
|
|
3070
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3071
|
+
})();
|
|
3072
|
+
`;
|
|
3073
|
+
};
|
|
3074
|
+
|
|
3075
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3076
|
+
function PersonalizationContainer(props) {
|
|
3077
|
+
const [userAttributes, setUserAttributes] = createSignal10(
|
|
3078
|
+
userAttributesService.getUserAttributes()
|
|
3079
|
+
);
|
|
3080
|
+
const [scriptStr, setScriptStr] = createSignal10(
|
|
3081
|
+
getPersonalizationScript(
|
|
3082
|
+
props.variants,
|
|
3083
|
+
props.builderBlock?.id || "none",
|
|
3084
|
+
props.builderContext?.rootState?.locale
|
|
3085
|
+
)
|
|
3086
|
+
);
|
|
3087
|
+
const [unsubscribers, setUnsubscribers] = createSignal10([]);
|
|
3088
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
|
|
3089
|
+
checkShouldRenderVariants(
|
|
3090
|
+
props.variants,
|
|
3091
|
+
getDefaultCanTrack(props.builderContext?.canTrack)
|
|
3092
|
+
)
|
|
3093
|
+
);
|
|
3094
|
+
const [isHydrated, setIsHydrated] = createSignal10(false);
|
|
3095
|
+
const filteredVariants = createMemo10(() => {
|
|
3096
|
+
return (props.variants || []).filter((variant) => {
|
|
3097
|
+
return filterWithCustomTargeting(
|
|
3098
|
+
{
|
|
3099
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3100
|
+
locale: props.builderContext?.rootState?.locale
|
|
3101
|
+
} : {},
|
|
3102
|
+
...userAttributes()
|
|
3103
|
+
},
|
|
3104
|
+
variant.query,
|
|
3105
|
+
variant.startDate,
|
|
3106
|
+
variant.endDate
|
|
3107
|
+
);
|
|
3108
|
+
});
|
|
3109
|
+
});
|
|
3110
|
+
const blocksToRender = createMemo10(() => {
|
|
3111
|
+
return getBlocksToRender({
|
|
3112
|
+
variants: props.variants,
|
|
3113
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3114
|
+
isHydrated: isHydrated(),
|
|
3115
|
+
filteredVariants: filteredVariants(),
|
|
3116
|
+
previewingIndex: props.previewingIndex
|
|
3117
|
+
});
|
|
3118
|
+
});
|
|
3119
|
+
const hideVariantsStyleString = createMemo10(() => {
|
|
3120
|
+
return (props.variants || []).map(
|
|
3121
|
+
(_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
|
|
3122
|
+
).join("");
|
|
3123
|
+
});
|
|
3124
|
+
let rootRef;
|
|
3125
|
+
onMount4(() => {
|
|
3126
|
+
setIsHydrated(true);
|
|
3127
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange(
|
|
3128
|
+
(attrs) => {
|
|
3129
|
+
setUserAttributes(attrs);
|
|
3130
|
+
}
|
|
3131
|
+
);
|
|
3132
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3133
|
+
const variant = filteredVariants()[0];
|
|
3134
|
+
if (rootRef) {
|
|
3135
|
+
rootRef.dispatchEvent(
|
|
3136
|
+
new CustomEvent("builder.variantLoaded", {
|
|
3137
|
+
detail: {
|
|
3138
|
+
variant: variant || "default",
|
|
3139
|
+
content: props.builderContext?.content
|
|
3140
|
+
},
|
|
3141
|
+
bubbles: true
|
|
3142
|
+
})
|
|
3143
|
+
);
|
|
3144
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3145
|
+
entries.forEach((entry) => {
|
|
3146
|
+
if (entry.isIntersecting && rootRef) {
|
|
3147
|
+
rootRef.dispatchEvent(
|
|
3148
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
3149
|
+
detail: {
|
|
3150
|
+
variant: variant || "default",
|
|
3151
|
+
content: props.builderContext?.content
|
|
3152
|
+
},
|
|
3153
|
+
bubbles: true
|
|
3154
|
+
})
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
});
|
|
3158
|
+
});
|
|
3159
|
+
observer.observe(rootRef);
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
unsubscribers().push(unsub);
|
|
3163
|
+
});
|
|
3164
|
+
return <><div
|
|
3165
|
+
class={`builder-personalization-container ${props.attributes?.className || ""}`}
|
|
3166
|
+
ref={rootRef}
|
|
3167
|
+
{...props.attributes}
|
|
3168
|
+
>
|
|
3169
|
+
<Show10 when={shouldRenderVariants()}>
|
|
3170
|
+
<For6 each={props.variants}>{(variant, _index) => {
|
|
3171
|
+
const index = _index();
|
|
3172
|
+
return <template
|
|
3173
|
+
key={index}
|
|
3174
|
+
data-variant-id={`${props.builderBlock?.id}-${index}`}
|
|
3175
|
+
><Blocks_default
|
|
3176
|
+
blocks={variant.blocks}
|
|
3177
|
+
parent={props.builderBlock?.id}
|
|
3178
|
+
path={`component.options.variants.${index}.blocks`}
|
|
3179
|
+
/></template>;
|
|
3180
|
+
}}</For6>
|
|
3181
|
+
<Inlined_styles_default
|
|
3182
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3183
|
+
styles={hideVariantsStyleString()}
|
|
3184
|
+
id={`variants-styles-${props.builderBlock?.id}`}
|
|
3185
|
+
/>
|
|
3186
|
+
<Inlined_script_default
|
|
3187
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3188
|
+
scriptStr={scriptStr()}
|
|
3189
|
+
id={`variants-script-${props.builderBlock?.id}`}
|
|
3190
|
+
/>
|
|
3191
|
+
</Show10>
|
|
3192
|
+
<Blocks_default
|
|
3193
|
+
blocks={blocksToRender().blocks}
|
|
3194
|
+
parent={props.builderBlock?.id}
|
|
3195
|
+
path={blocksToRender().path}
|
|
3196
|
+
/>
|
|
3197
|
+
</div></>;
|
|
3198
|
+
}
|
|
3199
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3200
|
+
|
|
3201
|
+
// src/blocks/section/component-info.ts
|
|
3202
|
+
var componentInfo7 = {
|
|
2772
3203
|
name: "Core:Section",
|
|
2773
3204
|
static: true,
|
|
2774
3205
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2810,7 +3241,7 @@ var componentInfo6 = {
|
|
|
2810
3241
|
};
|
|
2811
3242
|
|
|
2812
3243
|
// src/blocks/slot/component-info.ts
|
|
2813
|
-
var
|
|
3244
|
+
var componentInfo8 = {
|
|
2814
3245
|
name: "Slot",
|
|
2815
3246
|
isRSC: true,
|
|
2816
3247
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -2849,7 +3280,7 @@ function Slot(props) {
|
|
|
2849
3280
|
var slot_default = Slot;
|
|
2850
3281
|
|
|
2851
3282
|
// src/blocks/symbol/component-info.ts
|
|
2852
|
-
var
|
|
3283
|
+
var componentInfo9 = {
|
|
2853
3284
|
name: "Symbol",
|
|
2854
3285
|
noWrap: true,
|
|
2855
3286
|
static: true,
|
|
@@ -2931,7 +3362,7 @@ var defaultElement = {
|
|
|
2931
3362
|
}
|
|
2932
3363
|
}
|
|
2933
3364
|
};
|
|
2934
|
-
var
|
|
3365
|
+
var componentInfo10 = {
|
|
2935
3366
|
name: "Builder: Tabs",
|
|
2936
3367
|
inputs: [{
|
|
2937
3368
|
name: "tabs",
|
|
@@ -3037,9 +3468,9 @@ var componentInfo9 = {
|
|
|
3037
3468
|
};
|
|
3038
3469
|
|
|
3039
3470
|
// src/blocks/tabs/tabs.tsx
|
|
3040
|
-
import { Show as
|
|
3471
|
+
import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
|
|
3041
3472
|
function Tabs(props) {
|
|
3042
|
-
const [activeTab, setActiveTab] =
|
|
3473
|
+
const [activeTab, setActiveTab] = createSignal11(
|
|
3043
3474
|
props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
|
|
3044
3475
|
);
|
|
3045
3476
|
function activeTabContent(active) {
|
|
@@ -3061,7 +3492,7 @@ function Tabs(props) {
|
|
|
3061
3492
|
"justify-content": props.tabHeaderLayout || "flex-start",
|
|
3062
3493
|
overflow: "auto"
|
|
3063
3494
|
}}
|
|
3064
|
-
><
|
|
3495
|
+
><For7 each={props.tabs}>{(tab, _index) => {
|
|
3065
3496
|
const index = _index();
|
|
3066
3497
|
return <span
|
|
3067
3498
|
class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
|
|
@@ -3078,21 +3509,21 @@ function Tabs(props) {
|
|
|
3078
3509
|
registeredComponents={props.builderComponents}
|
|
3079
3510
|
linkComponent={props.builderLinkComponent}
|
|
3080
3511
|
/></span>;
|
|
3081
|
-
}}</
|
|
3082
|
-
<
|
|
3512
|
+
}}</For7></div>
|
|
3513
|
+
<Show11 when={activeTabContent(activeTab())}><div><Blocks_default
|
|
3083
3514
|
parent={props.builderBlock.id}
|
|
3084
3515
|
path={`tabs.${activeTab()}.content`}
|
|
3085
3516
|
blocks={activeTabContent(activeTab())}
|
|
3086
3517
|
context={props.builderContext}
|
|
3087
3518
|
registeredComponents={props.builderComponents}
|
|
3088
3519
|
linkComponent={props.builderLinkComponent}
|
|
3089
|
-
/></div></
|
|
3520
|
+
/></div></Show11>
|
|
3090
3521
|
</div></>;
|
|
3091
3522
|
}
|
|
3092
3523
|
var tabs_default = Tabs;
|
|
3093
3524
|
|
|
3094
3525
|
// src/blocks/text/component-info.ts
|
|
3095
|
-
var
|
|
3526
|
+
var componentInfo11 = {
|
|
3096
3527
|
shouldReceiveBuilderProps: {
|
|
3097
3528
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3098
3529
|
builderContext: true
|
|
@@ -3129,7 +3560,7 @@ function Text(props) {
|
|
|
3129
3560
|
var text_default = Text;
|
|
3130
3561
|
|
|
3131
3562
|
// src/blocks/custom-code/component-info.ts
|
|
3132
|
-
var
|
|
3563
|
+
var componentInfo12 = {
|
|
3133
3564
|
name: "Custom Code",
|
|
3134
3565
|
static: true,
|
|
3135
3566
|
requiredPermissions: ["editCode"],
|
|
@@ -3154,12 +3585,12 @@ var componentInfo11 = {
|
|
|
3154
3585
|
};
|
|
3155
3586
|
|
|
3156
3587
|
// src/blocks/custom-code/custom-code.tsx
|
|
3157
|
-
import { onMount as
|
|
3588
|
+
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
3158
3589
|
function CustomCode(props) {
|
|
3159
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3160
|
-
const [scriptsRun, setScriptsRun] =
|
|
3590
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3591
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3161
3592
|
let elementRef;
|
|
3162
|
-
|
|
3593
|
+
onMount5(() => {
|
|
3163
3594
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3164
3595
|
return;
|
|
3165
3596
|
}
|
|
@@ -3200,7 +3631,7 @@ function CustomCode(props) {
|
|
|
3200
3631
|
var custom_code_default = CustomCode;
|
|
3201
3632
|
|
|
3202
3633
|
// src/blocks/embed/component-info.ts
|
|
3203
|
-
var
|
|
3634
|
+
var componentInfo13 = {
|
|
3204
3635
|
name: "Embed",
|
|
3205
3636
|
static: true,
|
|
3206
3637
|
inputs: [{
|
|
@@ -3218,7 +3649,7 @@ var componentInfo12 = {
|
|
|
3218
3649
|
};
|
|
3219
3650
|
|
|
3220
3651
|
// src/blocks/embed/embed.tsx
|
|
3221
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3652
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3222
3653
|
|
|
3223
3654
|
// src/blocks/embed/helpers.ts
|
|
3224
3655
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3226,9 +3657,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3226
3657
|
|
|
3227
3658
|
// src/blocks/embed/embed.tsx
|
|
3228
3659
|
function Embed(props) {
|
|
3229
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3230
|
-
const [scriptsRun, setScriptsRun] =
|
|
3231
|
-
const [ranInitFn, setRanInitFn] =
|
|
3660
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
3661
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
3662
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
3232
3663
|
function findAndRunScripts() {
|
|
3233
3664
|
if (!elem || !elem.getElementsByTagName)
|
|
3234
3665
|
return;
|
|
@@ -3251,8 +3682,8 @@ function Embed(props) {
|
|
|
3251
3682
|
}
|
|
3252
3683
|
}
|
|
3253
3684
|
let elem;
|
|
3254
|
-
const onUpdateFn_0_elem =
|
|
3255
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3685
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
3686
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
3256
3687
|
function onUpdateFn_0() {
|
|
3257
3688
|
if (elem && !ranInitFn()) {
|
|
3258
3689
|
setRanInitFn(true);
|
|
@@ -3267,7 +3698,7 @@ function Embed(props) {
|
|
|
3267
3698
|
var embed_default = Embed;
|
|
3268
3699
|
|
|
3269
3700
|
// src/blocks/form/form/component-info.ts
|
|
3270
|
-
var
|
|
3701
|
+
var componentInfo14 = {
|
|
3271
3702
|
name: "Form:Form",
|
|
3272
3703
|
// editableTags: ['builder-form-error']
|
|
3273
3704
|
defaults: {
|
|
@@ -3507,7 +3938,7 @@ var componentInfo13 = {
|
|
|
3507
3938
|
};
|
|
3508
3939
|
|
|
3509
3940
|
// src/blocks/form/form/form.tsx
|
|
3510
|
-
import { Show as
|
|
3941
|
+
import { Show as Show12, createSignal as createSignal14 } from "solid-js";
|
|
3511
3942
|
|
|
3512
3943
|
// src/functions/get-env.ts
|
|
3513
3944
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3527,9 +3958,9 @@ function logFetch(url) {
|
|
|
3527
3958
|
|
|
3528
3959
|
// src/blocks/form/form/form.tsx
|
|
3529
3960
|
function FormComponent(props) {
|
|
3530
|
-
const [formState, setFormState] =
|
|
3531
|
-
const [responseData, setResponseData] =
|
|
3532
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3961
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
3962
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
3963
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
3533
3964
|
function mergeNewRootState(newData) {
|
|
3534
3965
|
const combinedState = {
|
|
3535
3966
|
...props.builderContext.rootState,
|
|
@@ -3725,22 +4156,22 @@ function FormComponent(props) {
|
|
|
3725
4156
|
{...props.attributes}
|
|
3726
4157
|
>
|
|
3727
4158
|
{props.children}
|
|
3728
|
-
<
|
|
4159
|
+
<Show12 when={submissionState() === "error"}><Blocks_default
|
|
3729
4160
|
path="errorMessage"
|
|
3730
4161
|
blocks={props.errorMessage}
|
|
3731
4162
|
context={props.builderContext}
|
|
3732
|
-
/></
|
|
3733
|
-
<
|
|
4163
|
+
/></Show12>
|
|
4164
|
+
<Show12 when={submissionState() === "sending"}><Blocks_default
|
|
3734
4165
|
path="sendingMessage"
|
|
3735
4166
|
blocks={props.sendingMessage}
|
|
3736
4167
|
context={props.builderContext}
|
|
3737
|
-
/></
|
|
3738
|
-
<
|
|
3739
|
-
<
|
|
4168
|
+
/></Show12>
|
|
4169
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
4170
|
+
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
3740
4171
|
path="successMessage"
|
|
3741
4172
|
blocks={props.successMessage}
|
|
3742
4173
|
context={props.builderContext}
|
|
3743
|
-
/></
|
|
4174
|
+
/></Show12>
|
|
3744
4175
|
</form>
|
|
3745
4176
|
<style>{`.pre-04a43b72 {
|
|
3746
4177
|
padding: 10px;
|
|
@@ -3752,7 +4183,7 @@ function FormComponent(props) {
|
|
|
3752
4183
|
var form_default = FormComponent;
|
|
3753
4184
|
|
|
3754
4185
|
// src/blocks/form/input/component-info.ts
|
|
3755
|
-
var
|
|
4186
|
+
var componentInfo15 = {
|
|
3756
4187
|
name: "Form:Input",
|
|
3757
4188
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
3758
4189
|
inputs: [
|
|
@@ -3822,7 +4253,7 @@ function FormInputComponent(props) {
|
|
|
3822
4253
|
var input_default = FormInputComponent;
|
|
3823
4254
|
|
|
3824
4255
|
// src/blocks/form/select/component-info.ts
|
|
3825
|
-
var
|
|
4256
|
+
var componentInfo16 = {
|
|
3826
4257
|
name: "Form:Select",
|
|
3827
4258
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3828
4259
|
defaultStyles: {
|
|
@@ -3867,7 +4298,7 @@ var componentInfo15 = {
|
|
|
3867
4298
|
};
|
|
3868
4299
|
|
|
3869
4300
|
// src/blocks/form/select/select.tsx
|
|
3870
|
-
import { For as
|
|
4301
|
+
import { For as For8 } from "solid-js";
|
|
3871
4302
|
function SelectComponent(props) {
|
|
3872
4303
|
return <><select
|
|
3873
4304
|
{...{}}
|
|
@@ -3877,15 +4308,15 @@ function SelectComponent(props) {
|
|
|
3877
4308
|
defaultValue={props.defaultValue}
|
|
3878
4309
|
name={props.name}
|
|
3879
4310
|
required={props.required}
|
|
3880
|
-
><
|
|
4311
|
+
><For8 each={props.options}>{(option, _index) => {
|
|
3881
4312
|
const index = _index();
|
|
3882
4313
|
return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
|
|
3883
|
-
}}</
|
|
4314
|
+
}}</For8></select></>;
|
|
3884
4315
|
}
|
|
3885
4316
|
var select_default = SelectComponent;
|
|
3886
4317
|
|
|
3887
4318
|
// src/blocks/form/submit-button/component-info.ts
|
|
3888
|
-
var
|
|
4319
|
+
var componentInfo17 = {
|
|
3889
4320
|
name: "Form:SubmitButton",
|
|
3890
4321
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
3891
4322
|
defaultStyles: {
|
|
@@ -3919,7 +4350,7 @@ function SubmitButton(props) {
|
|
|
3919
4350
|
var submit_button_default = SubmitButton;
|
|
3920
4351
|
|
|
3921
4352
|
// src/blocks/form/textarea/component-info.ts
|
|
3922
|
-
var
|
|
4353
|
+
var componentInfo18 = {
|
|
3923
4354
|
name: "Form:TextArea",
|
|
3924
4355
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
3925
4356
|
inputs: [{
|
|
@@ -3972,7 +4403,7 @@ function Textarea(props) {
|
|
|
3972
4403
|
var textarea_default = Textarea;
|
|
3973
4404
|
|
|
3974
4405
|
// src/blocks/img/component-info.ts
|
|
3975
|
-
var
|
|
4406
|
+
var componentInfo19 = {
|
|
3976
4407
|
// friendlyName?
|
|
3977
4408
|
name: "Raw:Img",
|
|
3978
4409
|
hideFromInsertMenu: true,
|
|
@@ -4005,7 +4436,7 @@ function ImgComponent(props) {
|
|
|
4005
4436
|
var img_default = ImgComponent;
|
|
4006
4437
|
|
|
4007
4438
|
// src/blocks/video/component-info.ts
|
|
4008
|
-
var
|
|
4439
|
+
var componentInfo20 = {
|
|
4009
4440
|
name: "Video",
|
|
4010
4441
|
canHaveChildren: true,
|
|
4011
4442
|
defaultStyles: {
|
|
@@ -4092,9 +4523,9 @@ var componentInfo19 = {
|
|
|
4092
4523
|
};
|
|
4093
4524
|
|
|
4094
4525
|
// src/blocks/video/video.tsx
|
|
4095
|
-
import { Show as
|
|
4526
|
+
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4096
4527
|
function Video(props) {
|
|
4097
|
-
const videoProps =
|
|
4528
|
+
const videoProps = createMemo15(() => {
|
|
4098
4529
|
return {
|
|
4099
4530
|
...props.autoPlay === true ? {
|
|
4100
4531
|
autoPlay: true
|
|
@@ -4113,7 +4544,7 @@ function Video(props) {
|
|
|
4113
4544
|
} : {}
|
|
4114
4545
|
};
|
|
4115
4546
|
});
|
|
4116
|
-
const spreadProps =
|
|
4547
|
+
const spreadProps = createMemo15(() => {
|
|
4117
4548
|
return {
|
|
4118
4549
|
...videoProps()
|
|
4119
4550
|
};
|
|
@@ -4142,8 +4573,8 @@ function Video(props) {
|
|
|
4142
4573
|
}}
|
|
4143
4574
|
src={props.video || "no-src"}
|
|
4144
4575
|
poster={props.posterImage}
|
|
4145
|
-
><
|
|
4146
|
-
<
|
|
4576
|
+
><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
|
|
4577
|
+
<Show13
|
|
4147
4578
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4148
4579
|
><div
|
|
4149
4580
|
style={{
|
|
@@ -4152,15 +4583,15 @@ function Video(props) {
|
|
|
4152
4583
|
"pointer-events": "none",
|
|
4153
4584
|
"font-size": "0px"
|
|
4154
4585
|
}}
|
|
4155
|
-
/></
|
|
4156
|
-
<
|
|
4586
|
+
/></Show13>
|
|
4587
|
+
<Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
4157
4588
|
style={{
|
|
4158
4589
|
display: "flex",
|
|
4159
4590
|
"flex-direction": "column",
|
|
4160
4591
|
"align-items": "stretch"
|
|
4161
4592
|
}}
|
|
4162
|
-
>{props.children}</div></
|
|
4163
|
-
<
|
|
4593
|
+
>{props.children}</div></Show13>
|
|
4594
|
+
<Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
4164
4595
|
style={{
|
|
4165
4596
|
"pointer-events": "none",
|
|
4166
4597
|
display: "flex",
|
|
@@ -4172,7 +4603,7 @@ function Video(props) {
|
|
|
4172
4603
|
width: "100%",
|
|
4173
4604
|
height: "100%"
|
|
4174
4605
|
}}
|
|
4175
|
-
>{props.children}</div></
|
|
4606
|
+
>{props.children}</div></Show13>
|
|
4176
4607
|
</div></>;
|
|
4177
4608
|
}
|
|
4178
4609
|
var video_default = Video;
|
|
@@ -4180,31 +4611,31 @@ var video_default = Video;
|
|
|
4180
4611
|
// src/constants/extra-components.ts
|
|
4181
4612
|
var getExtraComponents = () => [{
|
|
4182
4613
|
component: custom_code_default,
|
|
4183
|
-
...
|
|
4614
|
+
...componentInfo12
|
|
4184
4615
|
}, {
|
|
4185
4616
|
component: embed_default,
|
|
4186
|
-
...
|
|
4617
|
+
...componentInfo13
|
|
4187
4618
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4188
4619
|
component: form_default,
|
|
4189
|
-
...
|
|
4620
|
+
...componentInfo14
|
|
4190
4621
|
}, {
|
|
4191
4622
|
component: input_default,
|
|
4192
|
-
...
|
|
4623
|
+
...componentInfo15
|
|
4193
4624
|
}, {
|
|
4194
4625
|
component: submit_button_default,
|
|
4195
|
-
...
|
|
4626
|
+
...componentInfo17
|
|
4196
4627
|
}, {
|
|
4197
4628
|
component: select_default,
|
|
4198
|
-
...
|
|
4629
|
+
...componentInfo16
|
|
4199
4630
|
}, {
|
|
4200
4631
|
component: textarea_default,
|
|
4201
|
-
...
|
|
4632
|
+
...componentInfo18
|
|
4202
4633
|
}], {
|
|
4203
4634
|
component: img_default,
|
|
4204
|
-
...
|
|
4635
|
+
...componentInfo19
|
|
4205
4636
|
}, {
|
|
4206
4637
|
component: video_default,
|
|
4207
|
-
...
|
|
4638
|
+
...componentInfo20
|
|
4208
4639
|
}];
|
|
4209
4640
|
|
|
4210
4641
|
// src/constants/builder-registered-components.ts
|
|
@@ -4222,19 +4653,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4222
4653
|
...componentInfo5
|
|
4223
4654
|
}, {
|
|
4224
4655
|
component: section_default,
|
|
4225
|
-
...
|
|
4656
|
+
...componentInfo7
|
|
4226
4657
|
}, {
|
|
4227
4658
|
component: slot_default,
|
|
4228
|
-
...
|
|
4659
|
+
...componentInfo8
|
|
4229
4660
|
}, {
|
|
4230
4661
|
component: symbol_default,
|
|
4231
|
-
...
|
|
4662
|
+
...componentInfo9
|
|
4232
4663
|
}, {
|
|
4233
4664
|
component: text_default,
|
|
4234
|
-
...
|
|
4235
|
-
}, ...TARGET === "
|
|
4665
|
+
...componentInfo11
|
|
4666
|
+
}, ...TARGET === "react" ? [{
|
|
4667
|
+
component: personalization_container_default,
|
|
4668
|
+
...componentInfo6
|
|
4669
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4236
4670
|
component: tabs_default,
|
|
4237
|
-
...
|
|
4671
|
+
...componentInfo10
|
|
4238
4672
|
}, {
|
|
4239
4673
|
component: accordion_default,
|
|
4240
4674
|
...componentInfo
|
|
@@ -4272,7 +4706,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4272
4706
|
testVariationId: variant.id,
|
|
4273
4707
|
id: content?.id
|
|
4274
4708
|
}));
|
|
4275
|
-
var
|
|
4709
|
+
var checkShouldRenderVariants2 = ({
|
|
4276
4710
|
canTrack,
|
|
4277
4711
|
content
|
|
4278
4712
|
}) => {
|
|
@@ -4306,24 +4740,14 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4306
4740
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4307
4741
|
)`;
|
|
4308
4742
|
|
|
4309
|
-
// src/components/inlined-script.tsx
|
|
4310
|
-
function InlinedScript(props) {
|
|
4311
|
-
return <><script
|
|
4312
|
-
innerHTML={props.scriptStr}
|
|
4313
|
-
data-id={props.id}
|
|
4314
|
-
nonce={props.nonce || ""}
|
|
4315
|
-
/></>;
|
|
4316
|
-
}
|
|
4317
|
-
var Inlined_script_default = InlinedScript;
|
|
4318
|
-
|
|
4319
4743
|
// src/components/content/components/enable-editor.tsx
|
|
4320
4744
|
import {
|
|
4321
|
-
Show as
|
|
4322
|
-
onMount as
|
|
4745
|
+
Show as Show14,
|
|
4746
|
+
onMount as onMount6,
|
|
4323
4747
|
on as on3,
|
|
4324
4748
|
createEffect as createEffect3,
|
|
4325
|
-
createMemo as
|
|
4326
|
-
createSignal as
|
|
4749
|
+
createMemo as createMemo16,
|
|
4750
|
+
createSignal as createSignal16
|
|
4327
4751
|
} from "solid-js";
|
|
4328
4752
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4329
4753
|
|
|
@@ -4333,7 +4757,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4333
4757
|
}
|
|
4334
4758
|
|
|
4335
4759
|
// src/constants/sdk-version.ts
|
|
4336
|
-
var SDK_VERSION = "3.0.
|
|
4760
|
+
var SDK_VERSION = "3.0.6";
|
|
4337
4761
|
|
|
4338
4762
|
// src/helpers/sdk-headers.ts
|
|
4339
4763
|
var getSdkHeaders = () => ({
|
|
@@ -4628,16 +5052,6 @@ async function fetchEntries(options) {
|
|
|
4628
5052
|
return _processContentResult(options, content);
|
|
4629
5053
|
}
|
|
4630
5054
|
|
|
4631
|
-
// src/functions/is-previewing.ts
|
|
4632
|
-
function isPreviewing(_search) {
|
|
4633
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4634
|
-
if (!search) {
|
|
4635
|
-
return false;
|
|
4636
|
-
}
|
|
4637
|
-
const normalizedSearch = getSearchString(search);
|
|
4638
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4639
|
-
}
|
|
4640
|
-
|
|
4641
5055
|
// src/helpers/uuid.ts
|
|
4642
5056
|
function uuidv4() {
|
|
4643
5057
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4960,7 +5374,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
4960
5374
|
// Supports builder-model="..." attribute which is needed to
|
|
4961
5375
|
// scope our '+ add block' button styling
|
|
4962
5376
|
supportsAddBlockScoping: true,
|
|
4963
|
-
supportsCustomBreakpoints: true
|
|
5377
|
+
supportsCustomBreakpoints: true,
|
|
5378
|
+
blockLevelPersonalization: true
|
|
4964
5379
|
}
|
|
4965
5380
|
}, "*");
|
|
4966
5381
|
window.parent?.postMessage({
|
|
@@ -5175,12 +5590,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5175
5590
|
|
|
5176
5591
|
// src/components/content/components/enable-editor.tsx
|
|
5177
5592
|
function EnableEditor(props) {
|
|
5178
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5593
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
5179
5594
|
props.contentWrapper || "div"
|
|
5180
5595
|
);
|
|
5181
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5182
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5183
|
-
const [clicked, setClicked] =
|
|
5596
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
5597
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
5598
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
5184
5599
|
function mergeNewRootState(newData) {
|
|
5185
5600
|
const combinedState = {
|
|
5186
5601
|
...props.builderContextSignal.rootState,
|
|
@@ -5214,7 +5629,7 @@ function EnableEditor(props) {
|
|
|
5214
5629
|
content: newContentValue
|
|
5215
5630
|
}));
|
|
5216
5631
|
}
|
|
5217
|
-
const showContentProps =
|
|
5632
|
+
const showContentProps = createMemo16(() => {
|
|
5218
5633
|
return props.showContent ? {} : {
|
|
5219
5634
|
hidden: true,
|
|
5220
5635
|
"aria-hidden": true
|
|
@@ -5320,7 +5735,7 @@ function EnableEditor(props) {
|
|
|
5320
5735
|
let elementRef;
|
|
5321
5736
|
runHttpRequests();
|
|
5322
5737
|
emitStateUpdate();
|
|
5323
|
-
|
|
5738
|
+
onMount6(() => {
|
|
5324
5739
|
if (isBrowser()) {
|
|
5325
5740
|
if (isEditing() && !props.isNestedRender) {
|
|
5326
5741
|
window.addEventListener("message", processMessage);
|
|
@@ -5389,14 +5804,14 @@ function EnableEditor(props) {
|
|
|
5389
5804
|
}
|
|
5390
5805
|
}
|
|
5391
5806
|
});
|
|
5392
|
-
const onUpdateFn_0_props_content =
|
|
5807
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
5393
5808
|
function onUpdateFn_0() {
|
|
5394
5809
|
if (props.content) {
|
|
5395
5810
|
mergeNewContent(props.content);
|
|
5396
5811
|
}
|
|
5397
5812
|
}
|
|
5398
5813
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5399
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5814
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
5400
5815
|
() => props.builderContextSignal.rootState
|
|
5401
5816
|
);
|
|
5402
5817
|
function onUpdateFn_1() {
|
|
@@ -5408,14 +5823,14 @@ function EnableEditor(props) {
|
|
|
5408
5823
|
onUpdateFn_1
|
|
5409
5824
|
)
|
|
5410
5825
|
);
|
|
5411
|
-
const onUpdateFn_2_props_data =
|
|
5826
|
+
const onUpdateFn_2_props_data = createMemo16(() => props.data);
|
|
5412
5827
|
function onUpdateFn_2() {
|
|
5413
5828
|
if (props.data) {
|
|
5414
5829
|
mergeNewRootState(props.data);
|
|
5415
5830
|
}
|
|
5416
5831
|
}
|
|
5417
5832
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5418
|
-
const onUpdateFn_3_props_locale =
|
|
5833
|
+
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
5419
5834
|
function onUpdateFn_3() {
|
|
5420
5835
|
if (props.locale) {
|
|
5421
5836
|
mergeNewRootState({
|
|
@@ -5424,7 +5839,7 @@ function EnableEditor(props) {
|
|
|
5424
5839
|
}
|
|
5425
5840
|
}
|
|
5426
5841
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5427
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><
|
|
5842
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
5428
5843
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5429
5844
|
><Dynamic5
|
|
5430
5845
|
class={getWrapperClassName(
|
|
@@ -5442,14 +5857,14 @@ function EnableEditor(props) {
|
|
|
5442
5857
|
{...showContentProps()}
|
|
5443
5858
|
{...props.contentWrapperProps}
|
|
5444
5859
|
component={ContentWrapper()}
|
|
5445
|
-
>{props.children}</Dynamic5></
|
|
5860
|
+
>{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
|
|
5446
5861
|
}
|
|
5447
5862
|
var Enable_editor_default = EnableEditor;
|
|
5448
5863
|
|
|
5449
5864
|
// src/components/content/components/styles.tsx
|
|
5450
|
-
import { createSignal as
|
|
5865
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
5451
5866
|
function ContentStyles(props) {
|
|
5452
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5867
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
5453
5868
|
`
|
|
5454
5869
|
${getCss({
|
|
5455
5870
|
cssCode: props.cssCode,
|
|
@@ -5507,7 +5922,7 @@ var getContentInitialValue = ({
|
|
|
5507
5922
|
|
|
5508
5923
|
// src/components/content/content.tsx
|
|
5509
5924
|
function ContentComponent(props) {
|
|
5510
|
-
const [scriptStr, setScriptStr] =
|
|
5925
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
5511
5926
|
getUpdateVariantVisibilityScript({
|
|
5512
5927
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5513
5928
|
variationId: props.content?.testVariationId,
|
|
@@ -5515,7 +5930,7 @@ function ContentComponent(props) {
|
|
|
5515
5930
|
contentId: props.content?.id
|
|
5516
5931
|
})
|
|
5517
5932
|
);
|
|
5518
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5933
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
5519
5934
|
[
|
|
5520
5935
|
...getDefaultRegisteredComponents(),
|
|
5521
5936
|
...props.customComponents || []
|
|
@@ -5530,7 +5945,7 @@ function ContentComponent(props) {
|
|
|
5530
5945
|
{}
|
|
5531
5946
|
)
|
|
5532
5947
|
);
|
|
5533
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5948
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
5534
5949
|
content: getContentInitialValue({
|
|
5535
5950
|
content: props.content,
|
|
5536
5951
|
data: props.data
|
|
@@ -5614,18 +6029,18 @@ function ContentComponent(props) {
|
|
|
5614
6029
|
setBuilderContextSignal
|
|
5615
6030
|
}}
|
|
5616
6031
|
>
|
|
5617
|
-
<
|
|
6032
|
+
<Show15 when={props.isSsrAbTest}><Inlined_script_default
|
|
5618
6033
|
id="builderio-variant-visibility"
|
|
5619
6034
|
scriptStr={scriptStr()}
|
|
5620
6035
|
nonce={props.nonce || ""}
|
|
5621
|
-
/></
|
|
5622
|
-
<
|
|
6036
|
+
/></Show15>
|
|
6037
|
+
<Show15 when={TARGET !== "reactNative"}><Styles_default
|
|
5623
6038
|
nonce={props.nonce || ""}
|
|
5624
6039
|
isNestedRender={props.isNestedRender}
|
|
5625
6040
|
contentId={builderContextSignal().content?.id}
|
|
5626
6041
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
5627
6042
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
5628
|
-
/></
|
|
6043
|
+
/></Show15>
|
|
5629
6044
|
<Blocks_default
|
|
5630
6045
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
5631
6046
|
context={builderContextSignal()}
|
|
@@ -5638,13 +6053,13 @@ var Content_default = ContentComponent;
|
|
|
5638
6053
|
|
|
5639
6054
|
// src/components/content-variants/content-variants.tsx
|
|
5640
6055
|
function ContentVariants(props) {
|
|
5641
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5642
|
-
|
|
6056
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
6057
|
+
checkShouldRenderVariants2({
|
|
5643
6058
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5644
6059
|
content: props.content
|
|
5645
6060
|
})
|
|
5646
6061
|
);
|
|
5647
|
-
const updateCookieAndStylesScriptStr =
|
|
6062
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
5648
6063
|
return getUpdateCookieAndStylesScript(
|
|
5649
6064
|
getVariants(props.content).map((value) => ({
|
|
5650
6065
|
id: value.testVariationId,
|
|
@@ -5653,10 +6068,10 @@ function ContentVariants(props) {
|
|
|
5653
6068
|
props.content?.id || ""
|
|
5654
6069
|
);
|
|
5655
6070
|
});
|
|
5656
|
-
const hideVariantsStyleString =
|
|
6071
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
5657
6072
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5658
6073
|
});
|
|
5659
|
-
const defaultContent =
|
|
6074
|
+
const defaultContent = createMemo19(() => {
|
|
5660
6075
|
return shouldRenderVariants() ? {
|
|
5661
6076
|
...props.content,
|
|
5662
6077
|
testVariationId: props.content?.id
|
|
@@ -5665,16 +6080,16 @@ function ContentVariants(props) {
|
|
|
5665
6080
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5666
6081
|
});
|
|
5667
6082
|
});
|
|
5668
|
-
|
|
6083
|
+
onMount7(() => {
|
|
5669
6084
|
setShouldRenderVariants(false);
|
|
5670
6085
|
});
|
|
5671
6086
|
return <><>
|
|
5672
|
-
<
|
|
6087
|
+
<Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
5673
6088
|
id="builderio-init-variants-fns"
|
|
5674
6089
|
scriptStr={getInitVariantsFnsScriptString()}
|
|
5675
6090
|
nonce={props.nonce || ""}
|
|
5676
|
-
/></
|
|
5677
|
-
<
|
|
6091
|
+
/></Show16>
|
|
6092
|
+
<Show16 when={shouldRenderVariants()}>
|
|
5678
6093
|
<Inlined_styles_default
|
|
5679
6094
|
id="builderio-variants"
|
|
5680
6095
|
styles={hideVariantsStyleString()}
|
|
@@ -5685,7 +6100,7 @@ function ContentVariants(props) {
|
|
|
5685
6100
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
5686
6101
|
nonce={props.nonce || ""}
|
|
5687
6102
|
/>
|
|
5688
|
-
<
|
|
6103
|
+
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
5689
6104
|
const index = _index();
|
|
5690
6105
|
return <Content_default
|
|
5691
6106
|
apiHost={props.apiHost}
|
|
@@ -5712,8 +6127,8 @@ function ContentVariants(props) {
|
|
|
5712
6127
|
trustedHosts={props.trustedHosts}
|
|
5713
6128
|
{...{}}
|
|
5714
6129
|
/>;
|
|
5715
|
-
}}</
|
|
5716
|
-
</
|
|
6130
|
+
}}</For9>
|
|
6131
|
+
</Show16>
|
|
5717
6132
|
<Content_default
|
|
5718
6133
|
apiHost={props.apiHost}
|
|
5719
6134
|
nonce={props.nonce}
|
|
@@ -5768,14 +6183,14 @@ var fetchSymbolContent = async ({
|
|
|
5768
6183
|
|
|
5769
6184
|
// src/blocks/symbol/symbol.tsx
|
|
5770
6185
|
function Symbol(props) {
|
|
5771
|
-
const [contentToUse, setContentToUse] =
|
|
5772
|
-
const blocksWrapper =
|
|
6186
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
6187
|
+
const blocksWrapper = createMemo20(() => {
|
|
5773
6188
|
return "div";
|
|
5774
6189
|
});
|
|
5775
|
-
const contentWrapper =
|
|
6190
|
+
const contentWrapper = createMemo20(() => {
|
|
5776
6191
|
return "div";
|
|
5777
6192
|
});
|
|
5778
|
-
const className =
|
|
6193
|
+
const className = createMemo20(() => {
|
|
5779
6194
|
return [
|
|
5780
6195
|
...[props.attributes[getClassPropName()]],
|
|
5781
6196
|
"builder-symbol",
|
|
@@ -5795,9 +6210,9 @@ function Symbol(props) {
|
|
|
5795
6210
|
}
|
|
5796
6211
|
});
|
|
5797
6212
|
}
|
|
5798
|
-
|
|
6213
|
+
onMount8(() => {
|
|
5799
6214
|
});
|
|
5800
|
-
const onUpdateFn_0_props_symbol =
|
|
6215
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
5801
6216
|
function onUpdateFn_0() {
|
|
5802
6217
|
setContent();
|
|
5803
6218
|
}
|
|
@@ -5882,6 +6297,7 @@ export {
|
|
|
5882
6297
|
isEditing,
|
|
5883
6298
|
isPreviewing,
|
|
5884
6299
|
register,
|
|
6300
|
+
setClientUserAttributes,
|
|
5885
6301
|
setEditorSettings,
|
|
5886
6302
|
subscribeToEditor,
|
|
5887
6303
|
track
|