@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/dev.jsx
CHANGED
|
@@ -1463,8 +1463,9 @@ function BlocksWrapper(props) {
|
|
|
1463
1463
|
if (!props.path) {
|
|
1464
1464
|
return void 0;
|
|
1465
1465
|
}
|
|
1466
|
+
const thisPrefix = "this.";
|
|
1466
1467
|
const pathPrefix = "component.options.";
|
|
1467
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1468
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1468
1469
|
});
|
|
1469
1470
|
function onClick() {
|
|
1470
1471
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1499,7 +1500,7 @@ function BlocksWrapper(props) {
|
|
|
1499
1500
|
});
|
|
1500
1501
|
return <>
|
|
1501
1502
|
<Dynamic4
|
|
1502
|
-
class={className() + " dynamic-
|
|
1503
|
+
class={className() + " dynamic-3d7ff108"}
|
|
1503
1504
|
ref={blocksWrapperRef}
|
|
1504
1505
|
builder-path={dataPath()}
|
|
1505
1506
|
builder-parent-id={props.parent}
|
|
@@ -1511,7 +1512,7 @@ function BlocksWrapper(props) {
|
|
|
1511
1512
|
{...props.BlocksWrapperProps}
|
|
1512
1513
|
component={props.BlocksWrapper}
|
|
1513
1514
|
>{props.children}</Dynamic4>
|
|
1514
|
-
<style>{`.dynamic-
|
|
1515
|
+
<style>{`.dynamic-3d7ff108 {
|
|
1515
1516
|
display: flex;
|
|
1516
1517
|
flex-direction: column;
|
|
1517
1518
|
align-items: stretch;
|
|
@@ -1884,10 +1885,10 @@ function SectionComponent(props) {
|
|
|
1884
1885
|
var section_default = SectionComponent;
|
|
1885
1886
|
|
|
1886
1887
|
// src/blocks/symbol/symbol.tsx
|
|
1887
|
-
import { onMount as
|
|
1888
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
1888
1889
|
|
|
1889
1890
|
// src/components/content-variants/content-variants.tsx
|
|
1890
|
-
import { Show as
|
|
1891
|
+
import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
1891
1892
|
|
|
1892
1893
|
// src/helpers/url.ts
|
|
1893
1894
|
var getTopLevelDomain = (host) => {
|
|
@@ -2077,11 +2078,61 @@ var handleABTesting = async ({
|
|
|
2077
2078
|
};
|
|
2078
2079
|
};
|
|
2079
2080
|
|
|
2081
|
+
// src/helpers/user-attributes.ts
|
|
2082
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2083
|
+
function createUserAttributesService() {
|
|
2084
|
+
let canTrack = true;
|
|
2085
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2086
|
+
return {
|
|
2087
|
+
setUserAttributes(newAttrs) {
|
|
2088
|
+
if (!isBrowser()) {
|
|
2089
|
+
return;
|
|
2090
|
+
}
|
|
2091
|
+
const userAttributes = {
|
|
2092
|
+
...this.getUserAttributes(),
|
|
2093
|
+
...newAttrs
|
|
2094
|
+
};
|
|
2095
|
+
setCookie({
|
|
2096
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2097
|
+
value: JSON.stringify(userAttributes),
|
|
2098
|
+
canTrack
|
|
2099
|
+
});
|
|
2100
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2101
|
+
},
|
|
2102
|
+
getUserAttributes() {
|
|
2103
|
+
if (!isBrowser()) {
|
|
2104
|
+
return {};
|
|
2105
|
+
}
|
|
2106
|
+
return JSON.parse(getCookieSync({
|
|
2107
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2108
|
+
canTrack
|
|
2109
|
+
}) || "{}");
|
|
2110
|
+
},
|
|
2111
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2112
|
+
subscribers.add(callback);
|
|
2113
|
+
return () => {
|
|
2114
|
+
subscribers.delete(callback);
|
|
2115
|
+
};
|
|
2116
|
+
},
|
|
2117
|
+
setCanTrack(value) {
|
|
2118
|
+
canTrack = value;
|
|
2119
|
+
}
|
|
2120
|
+
};
|
|
2121
|
+
}
|
|
2122
|
+
var userAttributesService = createUserAttributesService();
|
|
2123
|
+
var setClientUserAttributes = (attributes) => {
|
|
2124
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2125
|
+
};
|
|
2126
|
+
|
|
2080
2127
|
// src/helpers/canTrack.ts
|
|
2081
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2128
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2129
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2130
|
+
userAttributesService.setCanTrack(result);
|
|
2131
|
+
return result;
|
|
2132
|
+
};
|
|
2082
2133
|
|
|
2083
2134
|
// src/components/content/content.tsx
|
|
2084
|
-
import { Show as
|
|
2135
|
+
import { Show as Show15, createSignal as createSignal18 } from "solid-js";
|
|
2085
2136
|
|
|
2086
2137
|
// src/blocks/accordion/component-info.ts
|
|
2087
2138
|
var defaultTitle = {
|
|
@@ -2776,8 +2827,388 @@ var componentInfo5 = {
|
|
|
2776
2827
|
}
|
|
2777
2828
|
};
|
|
2778
2829
|
|
|
2779
|
-
// src/blocks/
|
|
2830
|
+
// src/blocks/personalization-container/component-info.ts
|
|
2780
2831
|
var componentInfo6 = {
|
|
2832
|
+
name: "PersonalizationContainer",
|
|
2833
|
+
shouldReceiveBuilderProps: {
|
|
2834
|
+
builderBlock: true,
|
|
2835
|
+
builderContext: true
|
|
2836
|
+
},
|
|
2837
|
+
noWrap: true,
|
|
2838
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
2839
|
+
canHaveChildren: true,
|
|
2840
|
+
inputs: [{
|
|
2841
|
+
name: "variants",
|
|
2842
|
+
defaultValue: [],
|
|
2843
|
+
behavior: "personalizationVariantList",
|
|
2844
|
+
type: "list",
|
|
2845
|
+
subFields: [{
|
|
2846
|
+
name: "name",
|
|
2847
|
+
type: "text"
|
|
2848
|
+
}, {
|
|
2849
|
+
name: "query",
|
|
2850
|
+
friendlyName: "Targeting rules",
|
|
2851
|
+
type: "BuilderQuery",
|
|
2852
|
+
defaultValue: []
|
|
2853
|
+
}, {
|
|
2854
|
+
name: "startDate",
|
|
2855
|
+
type: "date"
|
|
2856
|
+
}, {
|
|
2857
|
+
name: "endDate",
|
|
2858
|
+
type: "date"
|
|
2859
|
+
}, {
|
|
2860
|
+
name: "blocks",
|
|
2861
|
+
type: "uiBlocks",
|
|
2862
|
+
hideFromUI: true,
|
|
2863
|
+
defaultValue: []
|
|
2864
|
+
}]
|
|
2865
|
+
}]
|
|
2866
|
+
};
|
|
2867
|
+
|
|
2868
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
2869
|
+
import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
|
|
2870
|
+
|
|
2871
|
+
// src/components/inlined-script.tsx
|
|
2872
|
+
function InlinedScript(props) {
|
|
2873
|
+
return <><script
|
|
2874
|
+
innerHTML={props.scriptStr}
|
|
2875
|
+
data-id={props.id}
|
|
2876
|
+
nonce={props.nonce || ""}
|
|
2877
|
+
/></>;
|
|
2878
|
+
}
|
|
2879
|
+
var Inlined_script_default = InlinedScript;
|
|
2880
|
+
|
|
2881
|
+
// src/functions/is-previewing.ts
|
|
2882
|
+
function isPreviewing(_search) {
|
|
2883
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
2884
|
+
if (!search) {
|
|
2885
|
+
return false;
|
|
2886
|
+
}
|
|
2887
|
+
const normalizedSearch = getSearchString(search);
|
|
2888
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
2892
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
2893
|
+
function isString(val) {
|
|
2894
|
+
return typeof val === "string";
|
|
2895
|
+
}
|
|
2896
|
+
function isNumber(val) {
|
|
2897
|
+
return typeof val === "number";
|
|
2898
|
+
}
|
|
2899
|
+
function objectMatchesQuery(userattr, query2) {
|
|
2900
|
+
const result = (() => {
|
|
2901
|
+
const property = query2.property;
|
|
2902
|
+
const operator = query2.operator;
|
|
2903
|
+
let testValue = query2.value;
|
|
2904
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
2905
|
+
testValue = query2.value.slice(0, -1);
|
|
2906
|
+
}
|
|
2907
|
+
if (!(property && operator)) {
|
|
2908
|
+
return true;
|
|
2909
|
+
}
|
|
2910
|
+
if (Array.isArray(testValue)) {
|
|
2911
|
+
if (operator === "isNot") {
|
|
2912
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
2913
|
+
property,
|
|
2914
|
+
operator,
|
|
2915
|
+
value: val
|
|
2916
|
+
}));
|
|
2917
|
+
}
|
|
2918
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
2919
|
+
property,
|
|
2920
|
+
operator,
|
|
2921
|
+
value: val
|
|
2922
|
+
}));
|
|
2923
|
+
}
|
|
2924
|
+
const value = userattr[property];
|
|
2925
|
+
if (Array.isArray(value)) {
|
|
2926
|
+
return value.includes(testValue);
|
|
2927
|
+
}
|
|
2928
|
+
switch (operator) {
|
|
2929
|
+
case "is":
|
|
2930
|
+
return value === testValue;
|
|
2931
|
+
case "isNot":
|
|
2932
|
+
return value !== testValue;
|
|
2933
|
+
case "contains":
|
|
2934
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
2935
|
+
case "startsWith":
|
|
2936
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
2937
|
+
case "endsWith":
|
|
2938
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
2939
|
+
case "greaterThan":
|
|
2940
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
2941
|
+
case "lessThan":
|
|
2942
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
2943
|
+
case "greaterThanOrEqualTo":
|
|
2944
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
2945
|
+
case "lessThanOrEqualTo":
|
|
2946
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
2947
|
+
default:
|
|
2948
|
+
return false;
|
|
2949
|
+
}
|
|
2950
|
+
})();
|
|
2951
|
+
return result;
|
|
2952
|
+
}
|
|
2953
|
+
const item = {
|
|
2954
|
+
query,
|
|
2955
|
+
startDate,
|
|
2956
|
+
endDate
|
|
2957
|
+
};
|
|
2958
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
2959
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
2960
|
+
return false;
|
|
2961
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
2962
|
+
return false;
|
|
2963
|
+
}
|
|
2964
|
+
if (!item.query || !item.query.length) {
|
|
2965
|
+
return true;
|
|
2966
|
+
}
|
|
2967
|
+
return item.query.every((filter) => {
|
|
2968
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
2972
|
+
if (!navigator.cookieEnabled) {
|
|
2973
|
+
return;
|
|
2974
|
+
}
|
|
2975
|
+
function getCookie(name) {
|
|
2976
|
+
const nameEQ = name + '=';
|
|
2977
|
+
const ca = document.cookie.split(';');
|
|
2978
|
+
for (let i = 0; i < ca.length; i++) {
|
|
2979
|
+
let c = ca[i];
|
|
2980
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
2981
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
2982
|
+
}
|
|
2983
|
+
return null;
|
|
2984
|
+
}
|
|
2985
|
+
function removeVariants() {
|
|
2986
|
+
variants?.forEach(function (_, index) {
|
|
2987
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
2988
|
+
});
|
|
2989
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
2990
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
2991
|
+
}
|
|
2992
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
2993
|
+
if (locale) {
|
|
2994
|
+
attributes.locale = locale;
|
|
2995
|
+
}
|
|
2996
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
2997
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
2998
|
+
});
|
|
2999
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
3000
|
+
if (isDebug) {
|
|
3001
|
+
console.debug('PersonalizationContainer', {
|
|
3002
|
+
attributes,
|
|
3003
|
+
variants,
|
|
3004
|
+
winningVariantIndex
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
3007
|
+
if (winningVariantIndex !== -1) {
|
|
3008
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3009
|
+
if (winningVariant) {
|
|
3010
|
+
const parentNode = winningVariant.parentNode;
|
|
3011
|
+
if (parentNode) {
|
|
3012
|
+
const newParent = parentNode.cloneNode(false);
|
|
3013
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3014
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3015
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3016
|
+
}
|
|
3017
|
+
if (isDebug) {
|
|
3018
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
} else if (variants && variants.length > 0) {
|
|
3022
|
+
removeVariants();
|
|
3023
|
+
}
|
|
3024
|
+
}`;
|
|
3025
|
+
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}";
|
|
3026
|
+
|
|
3027
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3028
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3029
|
+
const hasVariants = variants && variants.length > 0;
|
|
3030
|
+
if (TARGET === "reactNative")
|
|
3031
|
+
return false;
|
|
3032
|
+
if (!hasVariants)
|
|
3033
|
+
return false;
|
|
3034
|
+
if (!canTrack)
|
|
3035
|
+
return false;
|
|
3036
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3037
|
+
return true;
|
|
3038
|
+
if (isBrowser())
|
|
3039
|
+
return false;
|
|
3040
|
+
return true;
|
|
3041
|
+
}
|
|
3042
|
+
function getBlocksToRender({
|
|
3043
|
+
variants,
|
|
3044
|
+
previewingIndex,
|
|
3045
|
+
isHydrated,
|
|
3046
|
+
filteredVariants,
|
|
3047
|
+
fallbackBlocks
|
|
3048
|
+
}) {
|
|
3049
|
+
const fallback = {
|
|
3050
|
+
blocks: fallbackBlocks ?? [],
|
|
3051
|
+
path: "this.children"
|
|
3052
|
+
};
|
|
3053
|
+
if (isHydrated && isEditing()) {
|
|
3054
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3055
|
+
const variant = variants[previewingIndex];
|
|
3056
|
+
return {
|
|
3057
|
+
blocks: variant.blocks,
|
|
3058
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3059
|
+
};
|
|
3060
|
+
}
|
|
3061
|
+
return fallback;
|
|
3062
|
+
}
|
|
3063
|
+
if (isBrowser()) {
|
|
3064
|
+
const winningVariant = filteredVariants?.[0];
|
|
3065
|
+
if (winningVariant) {
|
|
3066
|
+
return {
|
|
3067
|
+
blocks: winningVariant.blocks,
|
|
3068
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3069
|
+
};
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
return fallback;
|
|
3073
|
+
}
|
|
3074
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3075
|
+
return `
|
|
3076
|
+
(function() {
|
|
3077
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3078
|
+
${PERSONALIZATION_SCRIPT}
|
|
3079
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3080
|
+
})();
|
|
3081
|
+
`;
|
|
3082
|
+
};
|
|
3083
|
+
|
|
3084
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3085
|
+
function PersonalizationContainer(props) {
|
|
3086
|
+
const [userAttributes, setUserAttributes] = createSignal10(
|
|
3087
|
+
userAttributesService.getUserAttributes()
|
|
3088
|
+
);
|
|
3089
|
+
const [scriptStr, setScriptStr] = createSignal10(
|
|
3090
|
+
getPersonalizationScript(
|
|
3091
|
+
props.variants,
|
|
3092
|
+
props.builderBlock?.id || "none",
|
|
3093
|
+
props.builderContext?.rootState?.locale
|
|
3094
|
+
)
|
|
3095
|
+
);
|
|
3096
|
+
const [unsubscribers, setUnsubscribers] = createSignal10([]);
|
|
3097
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
|
|
3098
|
+
checkShouldRenderVariants(
|
|
3099
|
+
props.variants,
|
|
3100
|
+
getDefaultCanTrack(props.builderContext?.canTrack)
|
|
3101
|
+
)
|
|
3102
|
+
);
|
|
3103
|
+
const [isHydrated, setIsHydrated] = createSignal10(false);
|
|
3104
|
+
const filteredVariants = createMemo10(() => {
|
|
3105
|
+
return (props.variants || []).filter((variant) => {
|
|
3106
|
+
return filterWithCustomTargeting(
|
|
3107
|
+
{
|
|
3108
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3109
|
+
locale: props.builderContext?.rootState?.locale
|
|
3110
|
+
} : {},
|
|
3111
|
+
...userAttributes()
|
|
3112
|
+
},
|
|
3113
|
+
variant.query,
|
|
3114
|
+
variant.startDate,
|
|
3115
|
+
variant.endDate
|
|
3116
|
+
);
|
|
3117
|
+
});
|
|
3118
|
+
});
|
|
3119
|
+
const blocksToRender = createMemo10(() => {
|
|
3120
|
+
return getBlocksToRender({
|
|
3121
|
+
variants: props.variants,
|
|
3122
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3123
|
+
isHydrated: isHydrated(),
|
|
3124
|
+
filteredVariants: filteredVariants(),
|
|
3125
|
+
previewingIndex: props.previewingIndex
|
|
3126
|
+
});
|
|
3127
|
+
});
|
|
3128
|
+
const hideVariantsStyleString = createMemo10(() => {
|
|
3129
|
+
return (props.variants || []).map(
|
|
3130
|
+
(_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
|
|
3131
|
+
).join("");
|
|
3132
|
+
});
|
|
3133
|
+
let rootRef;
|
|
3134
|
+
onMount4(() => {
|
|
3135
|
+
setIsHydrated(true);
|
|
3136
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange(
|
|
3137
|
+
(attrs) => {
|
|
3138
|
+
setUserAttributes(attrs);
|
|
3139
|
+
}
|
|
3140
|
+
);
|
|
3141
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3142
|
+
const variant = filteredVariants()[0];
|
|
3143
|
+
if (rootRef) {
|
|
3144
|
+
rootRef.dispatchEvent(
|
|
3145
|
+
new CustomEvent("builder.variantLoaded", {
|
|
3146
|
+
detail: {
|
|
3147
|
+
variant: variant || "default",
|
|
3148
|
+
content: props.builderContext?.content
|
|
3149
|
+
},
|
|
3150
|
+
bubbles: true
|
|
3151
|
+
})
|
|
3152
|
+
);
|
|
3153
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3154
|
+
entries.forEach((entry) => {
|
|
3155
|
+
if (entry.isIntersecting && rootRef) {
|
|
3156
|
+
rootRef.dispatchEvent(
|
|
3157
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
3158
|
+
detail: {
|
|
3159
|
+
variant: variant || "default",
|
|
3160
|
+
content: props.builderContext?.content
|
|
3161
|
+
},
|
|
3162
|
+
bubbles: true
|
|
3163
|
+
})
|
|
3164
|
+
);
|
|
3165
|
+
}
|
|
3166
|
+
});
|
|
3167
|
+
});
|
|
3168
|
+
observer.observe(rootRef);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
unsubscribers().push(unsub);
|
|
3172
|
+
});
|
|
3173
|
+
return <><div
|
|
3174
|
+
class={`builder-personalization-container ${props.attributes?.className || ""}`}
|
|
3175
|
+
ref={rootRef}
|
|
3176
|
+
{...props.attributes}
|
|
3177
|
+
>
|
|
3178
|
+
<Show10 when={shouldRenderVariants()}>
|
|
3179
|
+
<For6 each={props.variants}>{(variant, _index) => {
|
|
3180
|
+
const index = _index();
|
|
3181
|
+
return <template
|
|
3182
|
+
key={index}
|
|
3183
|
+
data-variant-id={`${props.builderBlock?.id}-${index}`}
|
|
3184
|
+
><Blocks_default
|
|
3185
|
+
blocks={variant.blocks}
|
|
3186
|
+
parent={props.builderBlock?.id}
|
|
3187
|
+
path={`component.options.variants.${index}.blocks`}
|
|
3188
|
+
/></template>;
|
|
3189
|
+
}}</For6>
|
|
3190
|
+
<Inlined_styles_default
|
|
3191
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3192
|
+
styles={hideVariantsStyleString()}
|
|
3193
|
+
id={`variants-styles-${props.builderBlock?.id}`}
|
|
3194
|
+
/>
|
|
3195
|
+
<Inlined_script_default
|
|
3196
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3197
|
+
scriptStr={scriptStr()}
|
|
3198
|
+
id={`variants-script-${props.builderBlock?.id}`}
|
|
3199
|
+
/>
|
|
3200
|
+
</Show10>
|
|
3201
|
+
<Blocks_default
|
|
3202
|
+
blocks={blocksToRender().blocks}
|
|
3203
|
+
parent={props.builderBlock?.id}
|
|
3204
|
+
path={blocksToRender().path}
|
|
3205
|
+
/>
|
|
3206
|
+
</div></>;
|
|
3207
|
+
}
|
|
3208
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3209
|
+
|
|
3210
|
+
// src/blocks/section/component-info.ts
|
|
3211
|
+
var componentInfo7 = {
|
|
2781
3212
|
name: "Core:Section",
|
|
2782
3213
|
static: true,
|
|
2783
3214
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2819,7 +3250,7 @@ var componentInfo6 = {
|
|
|
2819
3250
|
};
|
|
2820
3251
|
|
|
2821
3252
|
// src/blocks/slot/component-info.ts
|
|
2822
|
-
var
|
|
3253
|
+
var componentInfo8 = {
|
|
2823
3254
|
name: "Slot",
|
|
2824
3255
|
isRSC: true,
|
|
2825
3256
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -2858,7 +3289,7 @@ function Slot(props) {
|
|
|
2858
3289
|
var slot_default = Slot;
|
|
2859
3290
|
|
|
2860
3291
|
// src/blocks/symbol/component-info.ts
|
|
2861
|
-
var
|
|
3292
|
+
var componentInfo9 = {
|
|
2862
3293
|
name: "Symbol",
|
|
2863
3294
|
noWrap: true,
|
|
2864
3295
|
static: true,
|
|
@@ -2940,7 +3371,7 @@ var defaultElement = {
|
|
|
2940
3371
|
}
|
|
2941
3372
|
}
|
|
2942
3373
|
};
|
|
2943
|
-
var
|
|
3374
|
+
var componentInfo10 = {
|
|
2944
3375
|
name: "Builder: Tabs",
|
|
2945
3376
|
inputs: [{
|
|
2946
3377
|
name: "tabs",
|
|
@@ -3046,9 +3477,9 @@ var componentInfo9 = {
|
|
|
3046
3477
|
};
|
|
3047
3478
|
|
|
3048
3479
|
// src/blocks/tabs/tabs.tsx
|
|
3049
|
-
import { Show as
|
|
3480
|
+
import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
|
|
3050
3481
|
function Tabs(props) {
|
|
3051
|
-
const [activeTab, setActiveTab] =
|
|
3482
|
+
const [activeTab, setActiveTab] = createSignal11(
|
|
3052
3483
|
props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
|
|
3053
3484
|
);
|
|
3054
3485
|
function activeTabContent(active) {
|
|
@@ -3070,7 +3501,7 @@ function Tabs(props) {
|
|
|
3070
3501
|
"justify-content": props.tabHeaderLayout || "flex-start",
|
|
3071
3502
|
overflow: "auto"
|
|
3072
3503
|
}}
|
|
3073
|
-
><
|
|
3504
|
+
><For7 each={props.tabs}>{(tab, _index) => {
|
|
3074
3505
|
const index = _index();
|
|
3075
3506
|
return <span
|
|
3076
3507
|
class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
|
|
@@ -3087,21 +3518,21 @@ function Tabs(props) {
|
|
|
3087
3518
|
registeredComponents={props.builderComponents}
|
|
3088
3519
|
linkComponent={props.builderLinkComponent}
|
|
3089
3520
|
/></span>;
|
|
3090
|
-
}}</
|
|
3091
|
-
<
|
|
3521
|
+
}}</For7></div>
|
|
3522
|
+
<Show11 when={activeTabContent(activeTab())}><div><Blocks_default
|
|
3092
3523
|
parent={props.builderBlock.id}
|
|
3093
3524
|
path={`tabs.${activeTab()}.content`}
|
|
3094
3525
|
blocks={activeTabContent(activeTab())}
|
|
3095
3526
|
context={props.builderContext}
|
|
3096
3527
|
registeredComponents={props.builderComponents}
|
|
3097
3528
|
linkComponent={props.builderLinkComponent}
|
|
3098
|
-
/></div></
|
|
3529
|
+
/></div></Show11>
|
|
3099
3530
|
</div></>;
|
|
3100
3531
|
}
|
|
3101
3532
|
var tabs_default = Tabs;
|
|
3102
3533
|
|
|
3103
3534
|
// src/blocks/text/component-info.ts
|
|
3104
|
-
var
|
|
3535
|
+
var componentInfo11 = {
|
|
3105
3536
|
shouldReceiveBuilderProps: {
|
|
3106
3537
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3107
3538
|
builderContext: true
|
|
@@ -3138,7 +3569,7 @@ function Text(props) {
|
|
|
3138
3569
|
var text_default = Text;
|
|
3139
3570
|
|
|
3140
3571
|
// src/blocks/custom-code/component-info.ts
|
|
3141
|
-
var
|
|
3572
|
+
var componentInfo12 = {
|
|
3142
3573
|
name: "Custom Code",
|
|
3143
3574
|
static: true,
|
|
3144
3575
|
requiredPermissions: ["editCode"],
|
|
@@ -3163,12 +3594,12 @@ var componentInfo11 = {
|
|
|
3163
3594
|
};
|
|
3164
3595
|
|
|
3165
3596
|
// src/blocks/custom-code/custom-code.tsx
|
|
3166
|
-
import { onMount as
|
|
3597
|
+
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
3167
3598
|
function CustomCode(props) {
|
|
3168
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3169
|
-
const [scriptsRun, setScriptsRun] =
|
|
3599
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3600
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3170
3601
|
let elementRef;
|
|
3171
|
-
|
|
3602
|
+
onMount5(() => {
|
|
3172
3603
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3173
3604
|
return;
|
|
3174
3605
|
}
|
|
@@ -3210,7 +3641,7 @@ function CustomCode(props) {
|
|
|
3210
3641
|
var custom_code_default = CustomCode;
|
|
3211
3642
|
|
|
3212
3643
|
// src/blocks/embed/component-info.ts
|
|
3213
|
-
var
|
|
3644
|
+
var componentInfo13 = {
|
|
3214
3645
|
name: "Embed",
|
|
3215
3646
|
static: true,
|
|
3216
3647
|
inputs: [{
|
|
@@ -3228,7 +3659,7 @@ var componentInfo12 = {
|
|
|
3228
3659
|
};
|
|
3229
3660
|
|
|
3230
3661
|
// src/blocks/embed/embed.tsx
|
|
3231
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3662
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3232
3663
|
|
|
3233
3664
|
// src/blocks/embed/helpers.ts
|
|
3234
3665
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3236,9 +3667,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3236
3667
|
|
|
3237
3668
|
// src/blocks/embed/embed.tsx
|
|
3238
3669
|
function Embed(props) {
|
|
3239
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3240
|
-
const [scriptsRun, setScriptsRun] =
|
|
3241
|
-
const [ranInitFn, setRanInitFn] =
|
|
3670
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
3671
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
3672
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
3242
3673
|
function findAndRunScripts() {
|
|
3243
3674
|
if (!elem || !elem.getElementsByTagName)
|
|
3244
3675
|
return;
|
|
@@ -3262,8 +3693,8 @@ function Embed(props) {
|
|
|
3262
3693
|
}
|
|
3263
3694
|
}
|
|
3264
3695
|
let elem;
|
|
3265
|
-
const onUpdateFn_0_elem =
|
|
3266
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3696
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
3697
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
3267
3698
|
function onUpdateFn_0() {
|
|
3268
3699
|
if (elem && !ranInitFn()) {
|
|
3269
3700
|
setRanInitFn(true);
|
|
@@ -3278,7 +3709,7 @@ function Embed(props) {
|
|
|
3278
3709
|
var embed_default = Embed;
|
|
3279
3710
|
|
|
3280
3711
|
// src/blocks/form/form/component-info.ts
|
|
3281
|
-
var
|
|
3712
|
+
var componentInfo14 = {
|
|
3282
3713
|
name: "Form:Form",
|
|
3283
3714
|
// editableTags: ['builder-form-error']
|
|
3284
3715
|
defaults: {
|
|
@@ -3518,7 +3949,7 @@ var componentInfo13 = {
|
|
|
3518
3949
|
};
|
|
3519
3950
|
|
|
3520
3951
|
// src/blocks/form/form/form.tsx
|
|
3521
|
-
import { Show as
|
|
3952
|
+
import { Show as Show12, createSignal as createSignal14 } from "solid-js";
|
|
3522
3953
|
|
|
3523
3954
|
// src/functions/get-env.ts
|
|
3524
3955
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3538,9 +3969,9 @@ function logFetch(url) {
|
|
|
3538
3969
|
|
|
3539
3970
|
// src/blocks/form/form/form.tsx
|
|
3540
3971
|
function FormComponent(props) {
|
|
3541
|
-
const [formState, setFormState] =
|
|
3542
|
-
const [responseData, setResponseData] =
|
|
3543
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
3972
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
3973
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
3974
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
3544
3975
|
function mergeNewRootState(newData) {
|
|
3545
3976
|
const combinedState = {
|
|
3546
3977
|
...props.builderContext.rootState,
|
|
@@ -3736,22 +4167,22 @@ function FormComponent(props) {
|
|
|
3736
4167
|
{...props.attributes}
|
|
3737
4168
|
>
|
|
3738
4169
|
{props.children}
|
|
3739
|
-
<
|
|
4170
|
+
<Show12 when={submissionState() === "error"}><Blocks_default
|
|
3740
4171
|
path="errorMessage"
|
|
3741
4172
|
blocks={props.errorMessage}
|
|
3742
4173
|
context={props.builderContext}
|
|
3743
|
-
/></
|
|
3744
|
-
<
|
|
4174
|
+
/></Show12>
|
|
4175
|
+
<Show12 when={submissionState() === "sending"}><Blocks_default
|
|
3745
4176
|
path="sendingMessage"
|
|
3746
4177
|
blocks={props.sendingMessage}
|
|
3747
4178
|
context={props.builderContext}
|
|
3748
|
-
/></
|
|
3749
|
-
<
|
|
3750
|
-
<
|
|
4179
|
+
/></Show12>
|
|
4180
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
4181
|
+
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
3751
4182
|
path="successMessage"
|
|
3752
4183
|
blocks={props.successMessage}
|
|
3753
4184
|
context={props.builderContext}
|
|
3754
|
-
/></
|
|
4185
|
+
/></Show12>
|
|
3755
4186
|
</form>
|
|
3756
4187
|
<style>{`.pre-04a43b72 {
|
|
3757
4188
|
padding: 10px;
|
|
@@ -3763,7 +4194,7 @@ function FormComponent(props) {
|
|
|
3763
4194
|
var form_default = FormComponent;
|
|
3764
4195
|
|
|
3765
4196
|
// src/blocks/form/input/component-info.ts
|
|
3766
|
-
var
|
|
4197
|
+
var componentInfo15 = {
|
|
3767
4198
|
name: "Form:Input",
|
|
3768
4199
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
3769
4200
|
inputs: [
|
|
@@ -3833,7 +4264,7 @@ function FormInputComponent(props) {
|
|
|
3833
4264
|
var input_default = FormInputComponent;
|
|
3834
4265
|
|
|
3835
4266
|
// src/blocks/form/select/component-info.ts
|
|
3836
|
-
var
|
|
4267
|
+
var componentInfo16 = {
|
|
3837
4268
|
name: "Form:Select",
|
|
3838
4269
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3839
4270
|
defaultStyles: {
|
|
@@ -3878,7 +4309,7 @@ var componentInfo15 = {
|
|
|
3878
4309
|
};
|
|
3879
4310
|
|
|
3880
4311
|
// src/blocks/form/select/select.tsx
|
|
3881
|
-
import { For as
|
|
4312
|
+
import { For as For8 } from "solid-js";
|
|
3882
4313
|
function SelectComponent(props) {
|
|
3883
4314
|
return <><select
|
|
3884
4315
|
{...{}}
|
|
@@ -3888,15 +4319,15 @@ function SelectComponent(props) {
|
|
|
3888
4319
|
defaultValue={props.defaultValue}
|
|
3889
4320
|
name={props.name}
|
|
3890
4321
|
required={props.required}
|
|
3891
|
-
><
|
|
4322
|
+
><For8 each={props.options}>{(option, _index) => {
|
|
3892
4323
|
const index = _index();
|
|
3893
4324
|
return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
|
|
3894
|
-
}}</
|
|
4325
|
+
}}</For8></select></>;
|
|
3895
4326
|
}
|
|
3896
4327
|
var select_default = SelectComponent;
|
|
3897
4328
|
|
|
3898
4329
|
// src/blocks/form/submit-button/component-info.ts
|
|
3899
|
-
var
|
|
4330
|
+
var componentInfo17 = {
|
|
3900
4331
|
name: "Form:SubmitButton",
|
|
3901
4332
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
3902
4333
|
defaultStyles: {
|
|
@@ -3930,7 +4361,7 @@ function SubmitButton(props) {
|
|
|
3930
4361
|
var submit_button_default = SubmitButton;
|
|
3931
4362
|
|
|
3932
4363
|
// src/blocks/form/textarea/component-info.ts
|
|
3933
|
-
var
|
|
4364
|
+
var componentInfo18 = {
|
|
3934
4365
|
name: "Form:TextArea",
|
|
3935
4366
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
3936
4367
|
inputs: [{
|
|
@@ -3983,7 +4414,7 @@ function Textarea(props) {
|
|
|
3983
4414
|
var textarea_default = Textarea;
|
|
3984
4415
|
|
|
3985
4416
|
// src/blocks/img/component-info.ts
|
|
3986
|
-
var
|
|
4417
|
+
var componentInfo19 = {
|
|
3987
4418
|
// friendlyName?
|
|
3988
4419
|
name: "Raw:Img",
|
|
3989
4420
|
hideFromInsertMenu: true,
|
|
@@ -4016,7 +4447,7 @@ function ImgComponent(props) {
|
|
|
4016
4447
|
var img_default = ImgComponent;
|
|
4017
4448
|
|
|
4018
4449
|
// src/blocks/video/component-info.ts
|
|
4019
|
-
var
|
|
4450
|
+
var componentInfo20 = {
|
|
4020
4451
|
name: "Video",
|
|
4021
4452
|
canHaveChildren: true,
|
|
4022
4453
|
defaultStyles: {
|
|
@@ -4103,9 +4534,9 @@ var componentInfo19 = {
|
|
|
4103
4534
|
};
|
|
4104
4535
|
|
|
4105
4536
|
// src/blocks/video/video.tsx
|
|
4106
|
-
import { Show as
|
|
4537
|
+
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4107
4538
|
function Video(props) {
|
|
4108
|
-
const videoProps =
|
|
4539
|
+
const videoProps = createMemo15(() => {
|
|
4109
4540
|
return {
|
|
4110
4541
|
...props.autoPlay === true ? {
|
|
4111
4542
|
autoPlay: true
|
|
@@ -4124,7 +4555,7 @@ function Video(props) {
|
|
|
4124
4555
|
} : {}
|
|
4125
4556
|
};
|
|
4126
4557
|
});
|
|
4127
|
-
const spreadProps =
|
|
4558
|
+
const spreadProps = createMemo15(() => {
|
|
4128
4559
|
return {
|
|
4129
4560
|
...videoProps()
|
|
4130
4561
|
};
|
|
@@ -4153,8 +4584,8 @@ function Video(props) {
|
|
|
4153
4584
|
}}
|
|
4154
4585
|
src={props.video || "no-src"}
|
|
4155
4586
|
poster={props.posterImage}
|
|
4156
|
-
><
|
|
4157
|
-
<
|
|
4587
|
+
><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
|
|
4588
|
+
<Show13
|
|
4158
4589
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4159
4590
|
><div
|
|
4160
4591
|
style={{
|
|
@@ -4163,15 +4594,15 @@ function Video(props) {
|
|
|
4163
4594
|
"pointer-events": "none",
|
|
4164
4595
|
"font-size": "0px"
|
|
4165
4596
|
}}
|
|
4166
|
-
/></
|
|
4167
|
-
<
|
|
4597
|
+
/></Show13>
|
|
4598
|
+
<Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
4168
4599
|
style={{
|
|
4169
4600
|
display: "flex",
|
|
4170
4601
|
"flex-direction": "column",
|
|
4171
4602
|
"align-items": "stretch"
|
|
4172
4603
|
}}
|
|
4173
|
-
>{props.children}</div></
|
|
4174
|
-
<
|
|
4604
|
+
>{props.children}</div></Show13>
|
|
4605
|
+
<Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
4175
4606
|
style={{
|
|
4176
4607
|
"pointer-events": "none",
|
|
4177
4608
|
display: "flex",
|
|
@@ -4183,7 +4614,7 @@ function Video(props) {
|
|
|
4183
4614
|
width: "100%",
|
|
4184
4615
|
height: "100%"
|
|
4185
4616
|
}}
|
|
4186
|
-
>{props.children}</div></
|
|
4617
|
+
>{props.children}</div></Show13>
|
|
4187
4618
|
</div></>;
|
|
4188
4619
|
}
|
|
4189
4620
|
var video_default = Video;
|
|
@@ -4191,31 +4622,31 @@ var video_default = Video;
|
|
|
4191
4622
|
// src/constants/extra-components.ts
|
|
4192
4623
|
var getExtraComponents = () => [{
|
|
4193
4624
|
component: custom_code_default,
|
|
4194
|
-
...
|
|
4625
|
+
...componentInfo12
|
|
4195
4626
|
}, {
|
|
4196
4627
|
component: embed_default,
|
|
4197
|
-
...
|
|
4628
|
+
...componentInfo13
|
|
4198
4629
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4199
4630
|
component: form_default,
|
|
4200
|
-
...
|
|
4631
|
+
...componentInfo14
|
|
4201
4632
|
}, {
|
|
4202
4633
|
component: input_default,
|
|
4203
|
-
...
|
|
4634
|
+
...componentInfo15
|
|
4204
4635
|
}, {
|
|
4205
4636
|
component: submit_button_default,
|
|
4206
|
-
...
|
|
4637
|
+
...componentInfo17
|
|
4207
4638
|
}, {
|
|
4208
4639
|
component: select_default,
|
|
4209
|
-
...
|
|
4640
|
+
...componentInfo16
|
|
4210
4641
|
}, {
|
|
4211
4642
|
component: textarea_default,
|
|
4212
|
-
...
|
|
4643
|
+
...componentInfo18
|
|
4213
4644
|
}], {
|
|
4214
4645
|
component: img_default,
|
|
4215
|
-
...
|
|
4646
|
+
...componentInfo19
|
|
4216
4647
|
}, {
|
|
4217
4648
|
component: video_default,
|
|
4218
|
-
...
|
|
4649
|
+
...componentInfo20
|
|
4219
4650
|
}];
|
|
4220
4651
|
|
|
4221
4652
|
// src/constants/builder-registered-components.ts
|
|
@@ -4233,19 +4664,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4233
4664
|
...componentInfo5
|
|
4234
4665
|
}, {
|
|
4235
4666
|
component: section_default,
|
|
4236
|
-
...
|
|
4667
|
+
...componentInfo7
|
|
4237
4668
|
}, {
|
|
4238
4669
|
component: slot_default,
|
|
4239
|
-
...
|
|
4670
|
+
...componentInfo8
|
|
4240
4671
|
}, {
|
|
4241
4672
|
component: symbol_default,
|
|
4242
|
-
...
|
|
4673
|
+
...componentInfo9
|
|
4243
4674
|
}, {
|
|
4244
4675
|
component: text_default,
|
|
4245
|
-
...
|
|
4246
|
-
}, ...TARGET === "
|
|
4676
|
+
...componentInfo11
|
|
4677
|
+
}, ...TARGET === "react" ? [{
|
|
4678
|
+
component: personalization_container_default,
|
|
4679
|
+
...componentInfo6
|
|
4680
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4247
4681
|
component: tabs_default,
|
|
4248
|
-
...
|
|
4682
|
+
...componentInfo10
|
|
4249
4683
|
}, {
|
|
4250
4684
|
component: accordion_default,
|
|
4251
4685
|
...componentInfo
|
|
@@ -4283,7 +4717,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4283
4717
|
testVariationId: variant.id,
|
|
4284
4718
|
id: content?.id
|
|
4285
4719
|
}));
|
|
4286
|
-
var
|
|
4720
|
+
var checkShouldRenderVariants2 = ({
|
|
4287
4721
|
canTrack,
|
|
4288
4722
|
content
|
|
4289
4723
|
}) => {
|
|
@@ -4317,24 +4751,14 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4317
4751
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4318
4752
|
)`;
|
|
4319
4753
|
|
|
4320
|
-
// src/components/inlined-script.tsx
|
|
4321
|
-
function InlinedScript(props) {
|
|
4322
|
-
return <><script
|
|
4323
|
-
innerHTML={props.scriptStr}
|
|
4324
|
-
data-id={props.id}
|
|
4325
|
-
nonce={props.nonce || ""}
|
|
4326
|
-
/></>;
|
|
4327
|
-
}
|
|
4328
|
-
var Inlined_script_default = InlinedScript;
|
|
4329
|
-
|
|
4330
4754
|
// src/components/content/components/enable-editor.tsx
|
|
4331
4755
|
import {
|
|
4332
|
-
Show as
|
|
4333
|
-
onMount as
|
|
4756
|
+
Show as Show14,
|
|
4757
|
+
onMount as onMount6,
|
|
4334
4758
|
on as on3,
|
|
4335
4759
|
createEffect as createEffect3,
|
|
4336
|
-
createMemo as
|
|
4337
|
-
createSignal as
|
|
4760
|
+
createMemo as createMemo16,
|
|
4761
|
+
createSignal as createSignal16
|
|
4338
4762
|
} from "solid-js";
|
|
4339
4763
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4340
4764
|
|
|
@@ -4344,7 +4768,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4344
4768
|
}
|
|
4345
4769
|
|
|
4346
4770
|
// src/constants/sdk-version.ts
|
|
4347
|
-
var SDK_VERSION = "3.0.
|
|
4771
|
+
var SDK_VERSION = "3.0.6";
|
|
4348
4772
|
|
|
4349
4773
|
// src/helpers/sdk-headers.ts
|
|
4350
4774
|
var getSdkHeaders = () => ({
|
|
@@ -4641,16 +5065,6 @@ async function fetchEntries(options) {
|
|
|
4641
5065
|
return _processContentResult(options, content);
|
|
4642
5066
|
}
|
|
4643
5067
|
|
|
4644
|
-
// src/functions/is-previewing.ts
|
|
4645
|
-
function isPreviewing(_search) {
|
|
4646
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4647
|
-
if (!search) {
|
|
4648
|
-
return false;
|
|
4649
|
-
}
|
|
4650
|
-
const normalizedSearch = getSearchString(search);
|
|
4651
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4652
|
-
}
|
|
4653
|
-
|
|
4654
5068
|
// src/helpers/uuid.ts
|
|
4655
5069
|
function uuidv4() {
|
|
4656
5070
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -4977,7 +5391,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
4977
5391
|
// Supports builder-model="..." attribute which is needed to
|
|
4978
5392
|
// scope our '+ add block' button styling
|
|
4979
5393
|
supportsAddBlockScoping: true,
|
|
4980
|
-
supportsCustomBreakpoints: true
|
|
5394
|
+
supportsCustomBreakpoints: true,
|
|
5395
|
+
blockLevelPersonalization: true
|
|
4981
5396
|
}
|
|
4982
5397
|
}, "*");
|
|
4983
5398
|
window.parent?.postMessage({
|
|
@@ -5192,12 +5607,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5192
5607
|
|
|
5193
5608
|
// src/components/content/components/enable-editor.tsx
|
|
5194
5609
|
function EnableEditor(props) {
|
|
5195
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5610
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
5196
5611
|
props.contentWrapper || "div"
|
|
5197
5612
|
);
|
|
5198
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5199
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5200
|
-
const [clicked, setClicked] =
|
|
5613
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
5614
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
5615
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
5201
5616
|
function mergeNewRootState(newData) {
|
|
5202
5617
|
const combinedState = {
|
|
5203
5618
|
...props.builderContextSignal.rootState,
|
|
@@ -5231,7 +5646,7 @@ function EnableEditor(props) {
|
|
|
5231
5646
|
content: newContentValue
|
|
5232
5647
|
}));
|
|
5233
5648
|
}
|
|
5234
|
-
const showContentProps =
|
|
5649
|
+
const showContentProps = createMemo16(() => {
|
|
5235
5650
|
return props.showContent ? {} : {
|
|
5236
5651
|
hidden: true,
|
|
5237
5652
|
"aria-hidden": true
|
|
@@ -5338,7 +5753,7 @@ function EnableEditor(props) {
|
|
|
5338
5753
|
let elementRef;
|
|
5339
5754
|
runHttpRequests();
|
|
5340
5755
|
emitStateUpdate();
|
|
5341
|
-
|
|
5756
|
+
onMount6(() => {
|
|
5342
5757
|
if (isBrowser()) {
|
|
5343
5758
|
if (isEditing() && !props.isNestedRender) {
|
|
5344
5759
|
window.addEventListener("message", processMessage);
|
|
@@ -5407,14 +5822,14 @@ function EnableEditor(props) {
|
|
|
5407
5822
|
}
|
|
5408
5823
|
}
|
|
5409
5824
|
});
|
|
5410
|
-
const onUpdateFn_0_props_content =
|
|
5825
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
5411
5826
|
function onUpdateFn_0() {
|
|
5412
5827
|
if (props.content) {
|
|
5413
5828
|
mergeNewContent(props.content);
|
|
5414
5829
|
}
|
|
5415
5830
|
}
|
|
5416
5831
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5417
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5832
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
5418
5833
|
() => props.builderContextSignal.rootState
|
|
5419
5834
|
);
|
|
5420
5835
|
function onUpdateFn_1() {
|
|
@@ -5426,14 +5841,14 @@ function EnableEditor(props) {
|
|
|
5426
5841
|
onUpdateFn_1
|
|
5427
5842
|
)
|
|
5428
5843
|
);
|
|
5429
|
-
const onUpdateFn_2_props_data =
|
|
5844
|
+
const onUpdateFn_2_props_data = createMemo16(() => props.data);
|
|
5430
5845
|
function onUpdateFn_2() {
|
|
5431
5846
|
if (props.data) {
|
|
5432
5847
|
mergeNewRootState(props.data);
|
|
5433
5848
|
}
|
|
5434
5849
|
}
|
|
5435
5850
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5436
|
-
const onUpdateFn_3_props_locale =
|
|
5851
|
+
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
5437
5852
|
function onUpdateFn_3() {
|
|
5438
5853
|
if (props.locale) {
|
|
5439
5854
|
mergeNewRootState({
|
|
@@ -5442,7 +5857,7 @@ function EnableEditor(props) {
|
|
|
5442
5857
|
}
|
|
5443
5858
|
}
|
|
5444
5859
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5445
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><
|
|
5860
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
5446
5861
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5447
5862
|
><Dynamic5
|
|
5448
5863
|
class={getWrapperClassName(
|
|
@@ -5460,14 +5875,14 @@ function EnableEditor(props) {
|
|
|
5460
5875
|
{...showContentProps()}
|
|
5461
5876
|
{...props.contentWrapperProps}
|
|
5462
5877
|
component={ContentWrapper()}
|
|
5463
|
-
>{props.children}</Dynamic5></
|
|
5878
|
+
>{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
|
|
5464
5879
|
}
|
|
5465
5880
|
var Enable_editor_default = EnableEditor;
|
|
5466
5881
|
|
|
5467
5882
|
// src/components/content/components/styles.tsx
|
|
5468
|
-
import { createSignal as
|
|
5883
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
5469
5884
|
function ContentStyles(props) {
|
|
5470
|
-
const [injectedStyles, setInjectedStyles] =
|
|
5885
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
5471
5886
|
`
|
|
5472
5887
|
${getCss({
|
|
5473
5888
|
cssCode: props.cssCode,
|
|
@@ -5525,7 +5940,7 @@ var getContentInitialValue = ({
|
|
|
5525
5940
|
|
|
5526
5941
|
// src/components/content/content.tsx
|
|
5527
5942
|
function ContentComponent(props) {
|
|
5528
|
-
const [scriptStr, setScriptStr] =
|
|
5943
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
5529
5944
|
getUpdateVariantVisibilityScript({
|
|
5530
5945
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5531
5946
|
variationId: props.content?.testVariationId,
|
|
@@ -5533,7 +5948,7 @@ function ContentComponent(props) {
|
|
|
5533
5948
|
contentId: props.content?.id
|
|
5534
5949
|
})
|
|
5535
5950
|
);
|
|
5536
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
5951
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
5537
5952
|
[
|
|
5538
5953
|
...getDefaultRegisteredComponents(),
|
|
5539
5954
|
...props.customComponents || []
|
|
@@ -5548,7 +5963,7 @@ function ContentComponent(props) {
|
|
|
5548
5963
|
{}
|
|
5549
5964
|
)
|
|
5550
5965
|
);
|
|
5551
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
5966
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
5552
5967
|
content: getContentInitialValue({
|
|
5553
5968
|
content: props.content,
|
|
5554
5969
|
data: props.data
|
|
@@ -5632,18 +6047,18 @@ function ContentComponent(props) {
|
|
|
5632
6047
|
setBuilderContextSignal
|
|
5633
6048
|
}}
|
|
5634
6049
|
>
|
|
5635
|
-
<
|
|
6050
|
+
<Show15 when={props.isSsrAbTest}><Inlined_script_default
|
|
5636
6051
|
id="builderio-variant-visibility"
|
|
5637
6052
|
scriptStr={scriptStr()}
|
|
5638
6053
|
nonce={props.nonce || ""}
|
|
5639
|
-
/></
|
|
5640
|
-
<
|
|
6054
|
+
/></Show15>
|
|
6055
|
+
<Show15 when={TARGET !== "reactNative"}><Styles_default
|
|
5641
6056
|
nonce={props.nonce || ""}
|
|
5642
6057
|
isNestedRender={props.isNestedRender}
|
|
5643
6058
|
contentId={builderContextSignal().content?.id}
|
|
5644
6059
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
5645
6060
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
5646
|
-
/></
|
|
6061
|
+
/></Show15>
|
|
5647
6062
|
<Blocks_default
|
|
5648
6063
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
5649
6064
|
context={builderContextSignal()}
|
|
@@ -5656,13 +6071,13 @@ var Content_default = ContentComponent;
|
|
|
5656
6071
|
|
|
5657
6072
|
// src/components/content-variants/content-variants.tsx
|
|
5658
6073
|
function ContentVariants(props) {
|
|
5659
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5660
|
-
|
|
6074
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
6075
|
+
checkShouldRenderVariants2({
|
|
5661
6076
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5662
6077
|
content: props.content
|
|
5663
6078
|
})
|
|
5664
6079
|
);
|
|
5665
|
-
const updateCookieAndStylesScriptStr =
|
|
6080
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
5666
6081
|
return getUpdateCookieAndStylesScript(
|
|
5667
6082
|
getVariants(props.content).map((value) => ({
|
|
5668
6083
|
id: value.testVariationId,
|
|
@@ -5671,10 +6086,10 @@ function ContentVariants(props) {
|
|
|
5671
6086
|
props.content?.id || ""
|
|
5672
6087
|
);
|
|
5673
6088
|
});
|
|
5674
|
-
const hideVariantsStyleString =
|
|
6089
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
5675
6090
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5676
6091
|
});
|
|
5677
|
-
const defaultContent =
|
|
6092
|
+
const defaultContent = createMemo19(() => {
|
|
5678
6093
|
return shouldRenderVariants() ? {
|
|
5679
6094
|
...props.content,
|
|
5680
6095
|
testVariationId: props.content?.id
|
|
@@ -5683,16 +6098,16 @@ function ContentVariants(props) {
|
|
|
5683
6098
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5684
6099
|
});
|
|
5685
6100
|
});
|
|
5686
|
-
|
|
6101
|
+
onMount7(() => {
|
|
5687
6102
|
setShouldRenderVariants(false);
|
|
5688
6103
|
});
|
|
5689
6104
|
return <><>
|
|
5690
|
-
<
|
|
6105
|
+
<Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
5691
6106
|
id="builderio-init-variants-fns"
|
|
5692
6107
|
scriptStr={getInitVariantsFnsScriptString()}
|
|
5693
6108
|
nonce={props.nonce || ""}
|
|
5694
|
-
/></
|
|
5695
|
-
<
|
|
6109
|
+
/></Show16>
|
|
6110
|
+
<Show16 when={shouldRenderVariants()}>
|
|
5696
6111
|
<Inlined_styles_default
|
|
5697
6112
|
id="builderio-variants"
|
|
5698
6113
|
styles={hideVariantsStyleString()}
|
|
@@ -5703,7 +6118,7 @@ function ContentVariants(props) {
|
|
|
5703
6118
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
5704
6119
|
nonce={props.nonce || ""}
|
|
5705
6120
|
/>
|
|
5706
|
-
<
|
|
6121
|
+
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
5707
6122
|
const index = _index();
|
|
5708
6123
|
return <Content_default
|
|
5709
6124
|
apiHost={props.apiHost}
|
|
@@ -5730,8 +6145,8 @@ function ContentVariants(props) {
|
|
|
5730
6145
|
trustedHosts={props.trustedHosts}
|
|
5731
6146
|
{...{}}
|
|
5732
6147
|
/>;
|
|
5733
|
-
}}</
|
|
5734
|
-
</
|
|
6148
|
+
}}</For9>
|
|
6149
|
+
</Show16>
|
|
5735
6150
|
<Content_default
|
|
5736
6151
|
apiHost={props.apiHost}
|
|
5737
6152
|
nonce={props.nonce}
|
|
@@ -5786,14 +6201,14 @@ var fetchSymbolContent = async ({
|
|
|
5786
6201
|
|
|
5787
6202
|
// src/blocks/symbol/symbol.tsx
|
|
5788
6203
|
function Symbol(props) {
|
|
5789
|
-
const [contentToUse, setContentToUse] =
|
|
5790
|
-
const blocksWrapper =
|
|
6204
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
6205
|
+
const blocksWrapper = createMemo20(() => {
|
|
5791
6206
|
return "div";
|
|
5792
6207
|
});
|
|
5793
|
-
const contentWrapper =
|
|
6208
|
+
const contentWrapper = createMemo20(() => {
|
|
5794
6209
|
return "div";
|
|
5795
6210
|
});
|
|
5796
|
-
const className =
|
|
6211
|
+
const className = createMemo20(() => {
|
|
5797
6212
|
return [
|
|
5798
6213
|
...[props.attributes[getClassPropName()]],
|
|
5799
6214
|
"builder-symbol",
|
|
@@ -5813,9 +6228,9 @@ function Symbol(props) {
|
|
|
5813
6228
|
}
|
|
5814
6229
|
});
|
|
5815
6230
|
}
|
|
5816
|
-
|
|
6231
|
+
onMount8(() => {
|
|
5817
6232
|
});
|
|
5818
|
-
const onUpdateFn_0_props_symbol =
|
|
6233
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
5819
6234
|
function onUpdateFn_0() {
|
|
5820
6235
|
setContent();
|
|
5821
6236
|
}
|
|
@@ -5900,6 +6315,7 @@ export {
|
|
|
5900
6315
|
isEditing,
|
|
5901
6316
|
isPreviewing,
|
|
5902
6317
|
register,
|
|
6318
|
+
setClientUserAttributes,
|
|
5903
6319
|
setEditorSettings,
|
|
5904
6320
|
subscribeToEditor,
|
|
5905
6321
|
track
|