@builder.io/sdk-solid 3.0.3 → 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/lib/node/dev.jsx CHANGED
@@ -1634,8 +1634,9 @@ function BlocksWrapper(props) {
1634
1634
  if (!props.path) {
1635
1635
  return void 0;
1636
1636
  }
1637
+ const thisPrefix = "this.";
1637
1638
  const pathPrefix = "component.options.";
1638
- return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
1639
+ return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
1639
1640
  });
1640
1641
  function onClick() {
1641
1642
  if (isEditing() && !props.blocks?.length) {
@@ -1670,7 +1671,7 @@ function BlocksWrapper(props) {
1670
1671
  });
1671
1672
  return <>
1672
1673
  <Dynamic4
1673
- class={className() + " dynamic-3c4beb0c"}
1674
+ class={className() + " dynamic-3d7ff108"}
1674
1675
  ref={blocksWrapperRef}
1675
1676
  builder-path={dataPath()}
1676
1677
  builder-parent-id={props.parent}
@@ -1682,7 +1683,7 @@ function BlocksWrapper(props) {
1682
1683
  {...props.BlocksWrapperProps}
1683
1684
  component={props.BlocksWrapper}
1684
1685
  >{props.children}</Dynamic4>
1685
- <style>{`.dynamic-3c4beb0c {
1686
+ <style>{`.dynamic-3d7ff108 {
1686
1687
  display: flex;
1687
1688
  flex-direction: column;
1688
1689
  align-items: stretch;
@@ -1847,7 +1848,7 @@ function Columns(props) {
1847
1848
  }
1848
1849
  return <>
1849
1850
  <div
1850
- class={getColumnsClass(props.builderBlock?.id) + " div-3e5f33a4"}
1851
+ class={getColumnsClass(props.builderBlock?.id) + " div-6331dfc5"}
1851
1852
  style={columnsCssVars()}
1852
1853
  {...{}}
1853
1854
  >
@@ -1866,17 +1867,17 @@ function Columns(props) {
1866
1867
  ><Blocks_default
1867
1868
  path={`columns.${index}.blocks`}
1868
1869
  parent={props.builderBlock.id}
1869
- styleProp={{
1870
- flexGrow: "1"
1871
- }}
1872
1870
  context={props.builderContext}
1873
1871
  registeredComponents={props.builderComponents}
1874
1872
  linkComponent={props.builderLinkComponent}
1875
1873
  blocks={column.blocks}
1874
+ styleProp={{
1875
+ "flex-grow": "1"
1876
+ }}
1876
1877
  /></Dynamic_renderer_default>;
1877
1878
  }}</For4>
1878
1879
  </div>
1879
- <style>{`.div-3e5f33a4 {
1880
+ <style>{`.div-6331dfc5 {
1880
1881
  display: flex;
1881
1882
  line-height: normal;
1882
1883
  }`}</style>
@@ -1891,7 +1892,7 @@ function FragmentComponent(props) {
1891
1892
  var fragment_default = FragmentComponent;
1892
1893
 
1893
1894
  // src/blocks/image/image.tsx
1894
- import { Show as Show8, onMount as onMount4, createMemo as createMemo8 } from "solid-js";
1895
+ import { Show as Show8, createMemo as createMemo8 } from "solid-js";
1895
1896
 
1896
1897
  // src/blocks/image/image.helpers.ts
1897
1898
  function removeProtocol(path) {
@@ -1981,14 +1982,12 @@ function Image(props) {
1981
1982
  const out = props.aspectRatio ? aspectRatioStyles : void 0;
1982
1983
  return out;
1983
1984
  });
1984
- onMount4(() => {
1985
- });
1986
1985
  return <>
1987
1986
  <>
1988
1987
  <picture>
1989
1988
  <Show8 when={webpSrcSet()}><source type="image/webp" srcset={webpSrcSet()} /></Show8>
1990
1989
  <img
1991
- class={"builder-image" + (props.className ? " " + props.className : "") + " img-56e07140"}
1990
+ class={"builder-image" + (props.className ? " " + props.className : "") + " img-dc6700b4"}
1992
1991
  loading={props.highPriority ? "eager" : "lazy"}
1993
1992
  fetchpriority={props.highPriority ? "high" : "auto"}
1994
1993
  alt={props.altText}
@@ -2006,22 +2005,22 @@ function Image(props) {
2006
2005
  <Show8
2007
2006
  when={props.aspectRatio && !(props.builderBlock?.children?.length && props.fitContent)}
2008
2007
  ><div
2009
- class="builder-image-sizer div-56e07140"
2008
+ class="builder-image-sizer div-dc6700b4"
2010
2009
  style={{
2011
2010
  "padding-top": props.aspectRatio * 100 + "%"
2012
2011
  }}
2013
2012
  /></Show8>
2014
2013
  <Show8 when={props.builderBlock?.children?.length && props.fitContent}>{props.children}</Show8>
2015
- <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-56e07140-2">{props.children}</div></Show8>
2014
+ <Show8 when={!props.fitContent && props.builderBlock?.children?.length}><div class="div-dc6700b4-2">{props.children}</div></Show8>
2016
2015
  </>
2017
- <style>{`.img-56e07140 {
2016
+ <style>{`.img-dc6700b4 {
2018
2017
  opacity: 1;
2019
2018
  transition: opacity 0.2s ease-in-out;
2020
- }.div-56e07140 {
2019
+ }.div-dc6700b4 {
2021
2020
  width: 100%;
2022
2021
  pointer-events: none;
2023
2022
  font-size: 0;
2024
- }.div-56e07140-2 {
2023
+ }.div-dc6700b4-2 {
2025
2024
  display: flex;
2026
2025
  flex-direction: column;
2027
2026
  align-items: stretch;
@@ -2057,10 +2056,10 @@ function SectionComponent(props) {
2057
2056
  var section_default = SectionComponent;
2058
2057
 
2059
2058
  // src/blocks/symbol/symbol.tsx
2060
- import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
2059
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2061
2060
 
2062
2061
  // src/components/content-variants/content-variants.tsx
2063
- import { Show as Show15, For as For9, onMount as onMount7, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
2062
+ import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
2064
2063
 
2065
2064
  // src/helpers/url.ts
2066
2065
  var getTopLevelDomain = (host) => {
@@ -2250,11 +2249,61 @@ var handleABTesting = async ({
2250
2249
  };
2251
2250
  };
2252
2251
 
2252
+ // src/helpers/user-attributes.ts
2253
+ var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
2254
+ function createUserAttributesService() {
2255
+ let canTrack = true;
2256
+ const subscribers = /* @__PURE__ */ new Set();
2257
+ return {
2258
+ setUserAttributes(newAttrs) {
2259
+ if (!isBrowser()) {
2260
+ return;
2261
+ }
2262
+ const userAttributes = {
2263
+ ...this.getUserAttributes(),
2264
+ ...newAttrs
2265
+ };
2266
+ setCookie({
2267
+ name: USER_ATTRIBUTES_COOKIE_NAME,
2268
+ value: JSON.stringify(userAttributes),
2269
+ canTrack
2270
+ });
2271
+ subscribers.forEach((callback) => callback(userAttributes));
2272
+ },
2273
+ getUserAttributes() {
2274
+ if (!isBrowser()) {
2275
+ return {};
2276
+ }
2277
+ return JSON.parse(getCookieSync({
2278
+ name: USER_ATTRIBUTES_COOKIE_NAME,
2279
+ canTrack
2280
+ }) || "{}");
2281
+ },
2282
+ subscribeOnUserAttributesChange(callback) {
2283
+ subscribers.add(callback);
2284
+ return () => {
2285
+ subscribers.delete(callback);
2286
+ };
2287
+ },
2288
+ setCanTrack(value) {
2289
+ canTrack = value;
2290
+ }
2291
+ };
2292
+ }
2293
+ var userAttributesService = createUserAttributesService();
2294
+ var setClientUserAttributes = (attributes) => {
2295
+ userAttributesService.setUserAttributes(attributes);
2296
+ };
2297
+
2253
2298
  // src/helpers/canTrack.ts
2254
- var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2299
+ var getDefaultCanTrack = (canTrack) => {
2300
+ const result = checkIsDefined(canTrack) ? canTrack : true;
2301
+ userAttributesService.setCanTrack(result);
2302
+ return result;
2303
+ };
2255
2304
 
2256
2305
  // src/components/content/content.tsx
2257
- import { Show as Show14, createSignal as createSignal17 } from "solid-js";
2306
+ import { Show as Show15, createSignal as createSignal18 } from "solid-js";
2258
2307
 
2259
2308
  // src/blocks/accordion/component-info.ts
2260
2309
  var defaultTitle = {
@@ -2949,8 +2998,388 @@ var componentInfo5 = {
2949
2998
  }
2950
2999
  };
2951
3000
 
2952
- // src/blocks/section/component-info.ts
3001
+ // src/blocks/personalization-container/component-info.ts
2953
3002
  var componentInfo6 = {
3003
+ name: "PersonalizationContainer",
3004
+ shouldReceiveBuilderProps: {
3005
+ builderBlock: true,
3006
+ builderContext: true
3007
+ },
3008
+ noWrap: true,
3009
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
3010
+ canHaveChildren: true,
3011
+ inputs: [{
3012
+ name: "variants",
3013
+ defaultValue: [],
3014
+ behavior: "personalizationVariantList",
3015
+ type: "list",
3016
+ subFields: [{
3017
+ name: "name",
3018
+ type: "text"
3019
+ }, {
3020
+ name: "query",
3021
+ friendlyName: "Targeting rules",
3022
+ type: "BuilderQuery",
3023
+ defaultValue: []
3024
+ }, {
3025
+ name: "startDate",
3026
+ type: "date"
3027
+ }, {
3028
+ name: "endDate",
3029
+ type: "date"
3030
+ }, {
3031
+ name: "blocks",
3032
+ type: "uiBlocks",
3033
+ hideFromUI: true,
3034
+ defaultValue: []
3035
+ }]
3036
+ }]
3037
+ };
3038
+
3039
+ // src/blocks/personalization-container/personalization-container.tsx
3040
+ import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
3041
+
3042
+ // src/components/inlined-script.tsx
3043
+ function InlinedScript(props) {
3044
+ return <><script
3045
+ innerHTML={props.scriptStr}
3046
+ data-id={props.id}
3047
+ nonce={props.nonce || ""}
3048
+ /></>;
3049
+ }
3050
+ var Inlined_script_default = InlinedScript;
3051
+
3052
+ // src/functions/is-previewing.ts
3053
+ function isPreviewing(_search) {
3054
+ const search = _search || (isBrowser() ? window.location.search : void 0);
3055
+ if (!search) {
3056
+ return false;
3057
+ }
3058
+ const normalizedSearch = getSearchString(search);
3059
+ return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
3060
+ }
3061
+
3062
+ // src/blocks/personalization-container/helpers/inlined-fns.ts
3063
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
3064
+ function isString(val) {
3065
+ return typeof val === "string";
3066
+ }
3067
+ function isNumber(val) {
3068
+ return typeof val === "number";
3069
+ }
3070
+ function objectMatchesQuery(userattr, query2) {
3071
+ const result = (() => {
3072
+ const property = query2.property;
3073
+ const operator = query2.operator;
3074
+ let testValue = query2.value;
3075
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
3076
+ testValue = query2.value.slice(0, -1);
3077
+ }
3078
+ if (!(property && operator)) {
3079
+ return true;
3080
+ }
3081
+ if (Array.isArray(testValue)) {
3082
+ if (operator === "isNot") {
3083
+ return testValue.every((val) => objectMatchesQuery(userattr, {
3084
+ property,
3085
+ operator,
3086
+ value: val
3087
+ }));
3088
+ }
3089
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
3090
+ property,
3091
+ operator,
3092
+ value: val
3093
+ }));
3094
+ }
3095
+ const value = userattr[property];
3096
+ if (Array.isArray(value)) {
3097
+ return value.includes(testValue);
3098
+ }
3099
+ switch (operator) {
3100
+ case "is":
3101
+ return value === testValue;
3102
+ case "isNot":
3103
+ return value !== testValue;
3104
+ case "contains":
3105
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
3106
+ case "startsWith":
3107
+ return isString(value) && value.startsWith(String(testValue));
3108
+ case "endsWith":
3109
+ return isString(value) && value.endsWith(String(testValue));
3110
+ case "greaterThan":
3111
+ return isNumber(value) && isNumber(testValue) && value > testValue;
3112
+ case "lessThan":
3113
+ return isNumber(value) && isNumber(testValue) && value < testValue;
3114
+ case "greaterThanOrEqualTo":
3115
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
3116
+ case "lessThanOrEqualTo":
3117
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
3118
+ default:
3119
+ return false;
3120
+ }
3121
+ })();
3122
+ return result;
3123
+ }
3124
+ const item = {
3125
+ query,
3126
+ startDate,
3127
+ endDate
3128
+ };
3129
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
3130
+ if (item.startDate && new Date(item.startDate) > now) {
3131
+ return false;
3132
+ } else if (item.endDate && new Date(item.endDate) < now) {
3133
+ return false;
3134
+ }
3135
+ if (!item.query || !item.query.length) {
3136
+ return true;
3137
+ }
3138
+ return item.query.every((filter) => {
3139
+ return objectMatchesQuery(userAttributes, filter);
3140
+ });
3141
+ }
3142
+ var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
3143
+ if (!navigator.cookieEnabled) {
3144
+ return;
3145
+ }
3146
+ function getCookie(name) {
3147
+ const nameEQ = name + '=';
3148
+ const ca = document.cookie.split(';');
3149
+ for (let i = 0; i < ca.length; i++) {
3150
+ let c = ca[i];
3151
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
3152
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
3153
+ }
3154
+ return null;
3155
+ }
3156
+ function removeVariants() {
3157
+ variants?.forEach(function (_, index) {
3158
+ document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
3159
+ });
3160
+ document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
3161
+ document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
3162
+ }
3163
+ const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
3164
+ if (locale) {
3165
+ attributes.locale = locale;
3166
+ }
3167
+ const winningVariantIndex = variants?.findIndex(function (variant) {
3168
+ return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
3169
+ });
3170
+ const isDebug = location.href.includes('builder.debug=true');
3171
+ if (isDebug) {
3172
+ console.debug('PersonalizationContainer', {
3173
+ attributes,
3174
+ variants,
3175
+ winningVariantIndex
3176
+ });
3177
+ }
3178
+ if (winningVariantIndex !== -1) {
3179
+ const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
3180
+ if (winningVariant) {
3181
+ const parentNode = winningVariant.parentNode;
3182
+ if (parentNode) {
3183
+ const newParent = parentNode.cloneNode(false);
3184
+ newParent.appendChild(winningVariant.content.firstChild);
3185
+ newParent.appendChild(winningVariant.content.lastChild);
3186
+ parentNode.parentNode?.replaceChild(newParent, parentNode);
3187
+ }
3188
+ if (isDebug) {
3189
+ console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
3190
+ }
3191
+ }
3192
+ } else if (variants && variants.length > 0) {
3193
+ removeVariants();
3194
+ }
3195
+ }`;
3196
+ 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}";
3197
+
3198
+ // src/blocks/personalization-container/helpers.ts
3199
+ function checkShouldRenderVariants(variants, canTrack) {
3200
+ const hasVariants = variants && variants.length > 0;
3201
+ if (TARGET === "reactNative")
3202
+ return false;
3203
+ if (!hasVariants)
3204
+ return false;
3205
+ if (!canTrack)
3206
+ return false;
3207
+ if (TARGET === "vue" || TARGET === "svelte")
3208
+ return true;
3209
+ if (isBrowser())
3210
+ return false;
3211
+ return true;
3212
+ }
3213
+ function getBlocksToRender({
3214
+ variants,
3215
+ previewingIndex,
3216
+ isHydrated,
3217
+ filteredVariants,
3218
+ fallbackBlocks
3219
+ }) {
3220
+ const fallback = {
3221
+ blocks: fallbackBlocks ?? [],
3222
+ path: "this.children"
3223
+ };
3224
+ if (isHydrated && isEditing()) {
3225
+ if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
3226
+ const variant = variants[previewingIndex];
3227
+ return {
3228
+ blocks: variant.blocks,
3229
+ path: `component.options.variants.${previewingIndex}.blocks`
3230
+ };
3231
+ }
3232
+ return fallback;
3233
+ }
3234
+ if (isBrowser()) {
3235
+ const winningVariant = filteredVariants?.[0];
3236
+ if (winningVariant) {
3237
+ return {
3238
+ blocks: winningVariant.blocks,
3239
+ path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
3240
+ };
3241
+ }
3242
+ }
3243
+ return fallback;
3244
+ }
3245
+ var getPersonalizationScript = (variants, blockId, locale) => {
3246
+ return `
3247
+ (function() {
3248
+ ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
3249
+ ${PERSONALIZATION_SCRIPT}
3250
+ getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
3251
+ })();
3252
+ `;
3253
+ };
3254
+
3255
+ // src/blocks/personalization-container/personalization-container.tsx
3256
+ function PersonalizationContainer(props) {
3257
+ const [userAttributes, setUserAttributes] = createSignal10(
3258
+ userAttributesService.getUserAttributes()
3259
+ );
3260
+ const [scriptStr, setScriptStr] = createSignal10(
3261
+ getPersonalizationScript(
3262
+ props.variants,
3263
+ props.builderBlock?.id || "none",
3264
+ props.builderContext?.rootState?.locale
3265
+ )
3266
+ );
3267
+ const [unsubscribers, setUnsubscribers] = createSignal10([]);
3268
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
3269
+ checkShouldRenderVariants(
3270
+ props.variants,
3271
+ getDefaultCanTrack(props.builderContext?.canTrack)
3272
+ )
3273
+ );
3274
+ const [isHydrated, setIsHydrated] = createSignal10(false);
3275
+ const filteredVariants = createMemo10(() => {
3276
+ return (props.variants || []).filter((variant) => {
3277
+ return filterWithCustomTargeting(
3278
+ {
3279
+ ...props.builderContext?.rootState?.locale ? {
3280
+ locale: props.builderContext?.rootState?.locale
3281
+ } : {},
3282
+ ...userAttributes()
3283
+ },
3284
+ variant.query,
3285
+ variant.startDate,
3286
+ variant.endDate
3287
+ );
3288
+ });
3289
+ });
3290
+ const blocksToRender = createMemo10(() => {
3291
+ return getBlocksToRender({
3292
+ variants: props.variants,
3293
+ fallbackBlocks: props.builderBlock?.children,
3294
+ isHydrated: isHydrated(),
3295
+ filteredVariants: filteredVariants(),
3296
+ previewingIndex: props.previewingIndex
3297
+ });
3298
+ });
3299
+ const hideVariantsStyleString = createMemo10(() => {
3300
+ return (props.variants || []).map(
3301
+ (_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
3302
+ ).join("");
3303
+ });
3304
+ let rootRef;
3305
+ onMount4(() => {
3306
+ setIsHydrated(true);
3307
+ const unsub = userAttributesService.subscribeOnUserAttributesChange(
3308
+ (attrs) => {
3309
+ setUserAttributes(attrs);
3310
+ }
3311
+ );
3312
+ if (!(isEditing() || isPreviewing())) {
3313
+ const variant = filteredVariants()[0];
3314
+ if (rootRef) {
3315
+ rootRef.dispatchEvent(
3316
+ new CustomEvent("builder.variantLoaded", {
3317
+ detail: {
3318
+ variant: variant || "default",
3319
+ content: props.builderContext?.content
3320
+ },
3321
+ bubbles: true
3322
+ })
3323
+ );
3324
+ const observer = new IntersectionObserver((entries) => {
3325
+ entries.forEach((entry) => {
3326
+ if (entry.isIntersecting && rootRef) {
3327
+ rootRef.dispatchEvent(
3328
+ new CustomEvent("builder.variantDisplayed", {
3329
+ detail: {
3330
+ variant: variant || "default",
3331
+ content: props.builderContext?.content
3332
+ },
3333
+ bubbles: true
3334
+ })
3335
+ );
3336
+ }
3337
+ });
3338
+ });
3339
+ observer.observe(rootRef);
3340
+ }
3341
+ }
3342
+ unsubscribers().push(unsub);
3343
+ });
3344
+ return <><div
3345
+ class={`builder-personalization-container ${props.attributes?.className || ""}`}
3346
+ ref={rootRef}
3347
+ {...props.attributes}
3348
+ >
3349
+ <Show10 when={shouldRenderVariants()}>
3350
+ <For6 each={props.variants}>{(variant, _index) => {
3351
+ const index = _index();
3352
+ return <template
3353
+ key={index}
3354
+ data-variant-id={`${props.builderBlock?.id}-${index}`}
3355
+ ><Blocks_default
3356
+ blocks={variant.blocks}
3357
+ parent={props.builderBlock?.id}
3358
+ path={`component.options.variants.${index}.blocks`}
3359
+ /></template>;
3360
+ }}</For6>
3361
+ <Inlined_styles_default
3362
+ nonce={props.builderContext?.nonce || ""}
3363
+ styles={hideVariantsStyleString()}
3364
+ id={`variants-styles-${props.builderBlock?.id}`}
3365
+ />
3366
+ <Inlined_script_default
3367
+ nonce={props.builderContext?.nonce || ""}
3368
+ scriptStr={scriptStr()}
3369
+ id={`variants-script-${props.builderBlock?.id}`}
3370
+ />
3371
+ </Show10>
3372
+ <Blocks_default
3373
+ blocks={blocksToRender().blocks}
3374
+ parent={props.builderBlock?.id}
3375
+ path={blocksToRender().path}
3376
+ />
3377
+ </div></>;
3378
+ }
3379
+ var personalization_container_default = PersonalizationContainer;
3380
+
3381
+ // src/blocks/section/component-info.ts
3382
+ var componentInfo7 = {
2954
3383
  name: "Core:Section",
2955
3384
  static: true,
2956
3385
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
@@ -2992,7 +3421,7 @@ var componentInfo6 = {
2992
3421
  };
2993
3422
 
2994
3423
  // src/blocks/slot/component-info.ts
2995
- var componentInfo7 = {
3424
+ var componentInfo8 = {
2996
3425
  name: "Slot",
2997
3426
  isRSC: true,
2998
3427
  description: "Allow child blocks to be inserted into this content when used as a Symbol",
@@ -3031,7 +3460,7 @@ function Slot(props) {
3031
3460
  var slot_default = Slot;
3032
3461
 
3033
3462
  // src/blocks/symbol/component-info.ts
3034
- var componentInfo8 = {
3463
+ var componentInfo9 = {
3035
3464
  name: "Symbol",
3036
3465
  noWrap: true,
3037
3466
  static: true,
@@ -3113,7 +3542,7 @@ var defaultElement = {
3113
3542
  }
3114
3543
  }
3115
3544
  };
3116
- var componentInfo9 = {
3545
+ var componentInfo10 = {
3117
3546
  name: "Builder: Tabs",
3118
3547
  inputs: [{
3119
3548
  name: "tabs",
@@ -3219,9 +3648,9 @@ var componentInfo9 = {
3219
3648
  };
3220
3649
 
3221
3650
  // src/blocks/tabs/tabs.tsx
3222
- import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
3651
+ import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
3223
3652
  function Tabs(props) {
3224
- const [activeTab, setActiveTab] = createSignal10(
3653
+ const [activeTab, setActiveTab] = createSignal11(
3225
3654
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
3226
3655
  );
3227
3656
  function activeTabContent(active) {
@@ -3243,7 +3672,7 @@ function Tabs(props) {
3243
3672
  "justify-content": props.tabHeaderLayout || "flex-start",
3244
3673
  overflow: "auto"
3245
3674
  }}
3246
- ><For6 each={props.tabs}>{(tab, _index) => {
3675
+ ><For7 each={props.tabs}>{(tab, _index) => {
3247
3676
  const index = _index();
3248
3677
  return <span
3249
3678
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
@@ -3260,21 +3689,21 @@ function Tabs(props) {
3260
3689
  registeredComponents={props.builderComponents}
3261
3690
  linkComponent={props.builderLinkComponent}
3262
3691
  /></span>;
3263
- }}</For6></div>
3264
- <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
3692
+ }}</For7></div>
3693
+ <Show11 when={activeTabContent(activeTab())}><div><Blocks_default
3265
3694
  parent={props.builderBlock.id}
3266
3695
  path={`tabs.${activeTab()}.content`}
3267
3696
  blocks={activeTabContent(activeTab())}
3268
3697
  context={props.builderContext}
3269
3698
  registeredComponents={props.builderComponents}
3270
3699
  linkComponent={props.builderLinkComponent}
3271
- /></div></Show10>
3700
+ /></div></Show11>
3272
3701
  </div></>;
3273
3702
  }
3274
3703
  var tabs_default = Tabs;
3275
3704
 
3276
3705
  // src/blocks/text/component-info.ts
3277
- var componentInfo10 = {
3706
+ var componentInfo11 = {
3278
3707
  shouldReceiveBuilderProps: {
3279
3708
  builderBlock: TARGET === "reactNative" ? true : false,
3280
3709
  builderContext: true
@@ -3311,7 +3740,7 @@ function Text(props) {
3311
3740
  var text_default = Text;
3312
3741
 
3313
3742
  // src/blocks/custom-code/component-info.ts
3314
- var componentInfo11 = {
3743
+ var componentInfo12 = {
3315
3744
  name: "Custom Code",
3316
3745
  static: true,
3317
3746
  requiredPermissions: ["editCode"],
@@ -3336,10 +3765,10 @@ var componentInfo11 = {
3336
3765
  };
3337
3766
 
3338
3767
  // src/blocks/custom-code/custom-code.tsx
3339
- import { onMount as onMount5, createSignal as createSignal11 } from "solid-js";
3768
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3340
3769
  function CustomCode(props) {
3341
- const [scriptsInserted, setScriptsInserted] = createSignal11([]);
3342
- const [scriptsRun, setScriptsRun] = createSignal11([]);
3770
+ const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3771
+ const [scriptsRun, setScriptsRun] = createSignal12([]);
3343
3772
  let elementRef;
3344
3773
  onMount5(() => {
3345
3774
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
@@ -3383,7 +3812,7 @@ function CustomCode(props) {
3383
3812
  var custom_code_default = CustomCode;
3384
3813
 
3385
3814
  // src/blocks/embed/component-info.ts
3386
- var componentInfo12 = {
3815
+ var componentInfo13 = {
3387
3816
  name: "Embed",
3388
3817
  static: true,
3389
3818
  inputs: [{
@@ -3401,7 +3830,7 @@ var componentInfo12 = {
3401
3830
  };
3402
3831
 
3403
3832
  // src/blocks/embed/embed.tsx
3404
- import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3833
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3405
3834
 
3406
3835
  // src/blocks/embed/helpers.ts
3407
3836
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3409,9 +3838,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
3409
3838
 
3410
3839
  // src/blocks/embed/embed.tsx
3411
3840
  function Embed(props) {
3412
- const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3413
- const [scriptsRun, setScriptsRun] = createSignal12([]);
3414
- const [ranInitFn, setRanInitFn] = createSignal12(false);
3841
+ const [scriptsInserted, setScriptsInserted] = createSignal13([]);
3842
+ const [scriptsRun, setScriptsRun] = createSignal13([]);
3843
+ const [ranInitFn, setRanInitFn] = createSignal13(false);
3415
3844
  function findAndRunScripts() {
3416
3845
  if (!elem || !elem.getElementsByTagName)
3417
3846
  return;
@@ -3435,8 +3864,8 @@ function Embed(props) {
3435
3864
  }
3436
3865
  }
3437
3866
  let elem;
3438
- const onUpdateFn_0_elem = createMemo12(() => elem);
3439
- const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
3867
+ const onUpdateFn_0_elem = createMemo13(() => elem);
3868
+ const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
3440
3869
  function onUpdateFn_0() {
3441
3870
  if (elem && !ranInitFn()) {
3442
3871
  setRanInitFn(true);
@@ -3451,7 +3880,7 @@ function Embed(props) {
3451
3880
  var embed_default = Embed;
3452
3881
 
3453
3882
  // src/blocks/form/form/component-info.ts
3454
- var componentInfo13 = {
3883
+ var componentInfo14 = {
3455
3884
  name: "Form:Form",
3456
3885
  // editableTags: ['builder-form-error']
3457
3886
  defaults: {
@@ -3691,7 +4120,7 @@ var componentInfo13 = {
3691
4120
  };
3692
4121
 
3693
4122
  // src/blocks/form/form/form.tsx
3694
- import { Show as Show11, For as For7, createSignal as createSignal13 } from "solid-js";
4123
+ import { Show as Show12, createSignal as createSignal14 } from "solid-js";
3695
4124
 
3696
4125
  // src/functions/get-env.ts
3697
4126
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3711,9 +4140,9 @@ function logFetch(url) {
3711
4140
 
3712
4141
  // src/blocks/form/form/form.tsx
3713
4142
  function FormComponent(props) {
3714
- const [formState, setFormState] = createSignal13("unsubmitted");
3715
- const [responseData, setResponseData] = createSignal13(null);
3716
- const [formErrorMessage, setFormErrorMessage] = createSignal13("");
4143
+ const [formState, setFormState] = createSignal14("unsubmitted");
4144
+ const [responseData, setResponseData] = createSignal14(null);
4145
+ const [formErrorMessage, setFormErrorMessage] = createSignal14("");
3717
4146
  function mergeNewRootState(newData) {
3718
4147
  const combinedState = {
3719
4148
  ...props.builderContext.rootState,
@@ -3908,34 +4337,25 @@ function FormComponent(props) {
3908
4337
  {...{}}
3909
4338
  {...props.attributes}
3910
4339
  >
3911
- <Show11 when={props.builderBlock && props.builderBlock.children}><For7 each={props.builderBlock?.children}>{(block, _index) => {
3912
- const idx = _index();
3913
- return <Block_default
3914
- key={`form-block-${idx}`}
3915
- block={block}
3916
- context={props.builderContext}
3917
- registeredComponents={props.builderComponents}
3918
- linkComponent={props.builderLinkComponent}
3919
- />;
3920
- }}</For7></Show11>
3921
- <Show11 when={submissionState() === "error"}><Blocks_default
4340
+ {props.children}
4341
+ <Show12 when={submissionState() === "error"}><Blocks_default
3922
4342
  path="errorMessage"
3923
4343
  blocks={props.errorMessage}
3924
4344
  context={props.builderContext}
3925
- /></Show11>
3926
- <Show11 when={submissionState() === "sending"}><Blocks_default
4345
+ /></Show12>
4346
+ <Show12 when={submissionState() === "sending"}><Blocks_default
3927
4347
  path="sendingMessage"
3928
4348
  blocks={props.sendingMessage}
3929
4349
  context={props.builderContext}
3930
- /></Show11>
3931
- <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-27d18614">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3932
- <Show11 when={submissionState() === "success"}><Blocks_default
4350
+ /></Show12>
4351
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4352
+ <Show12 when={submissionState() === "success"}><Blocks_default
3933
4353
  path="successMessage"
3934
4354
  blocks={props.successMessage}
3935
4355
  context={props.builderContext}
3936
- /></Show11>
4356
+ /></Show12>
3937
4357
  </form>
3938
- <style>{`.pre-27d18614 {
4358
+ <style>{`.pre-04a43b72 {
3939
4359
  padding: 10px;
3940
4360
  color: red;
3941
4361
  text-align: center;
@@ -3945,7 +4365,7 @@ function FormComponent(props) {
3945
4365
  var form_default = FormComponent;
3946
4366
 
3947
4367
  // src/blocks/form/input/component-info.ts
3948
- var componentInfo14 = {
4368
+ var componentInfo15 = {
3949
4369
  name: "Form:Input",
3950
4370
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
3951
4371
  inputs: [
@@ -4015,7 +4435,7 @@ function FormInputComponent(props) {
4015
4435
  var input_default = FormInputComponent;
4016
4436
 
4017
4437
  // src/blocks/form/select/component-info.ts
4018
- var componentInfo15 = {
4438
+ var componentInfo16 = {
4019
4439
  name: "Form:Select",
4020
4440
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
4021
4441
  defaultStyles: {
@@ -4078,7 +4498,7 @@ function SelectComponent(props) {
4078
4498
  var select_default = SelectComponent;
4079
4499
 
4080
4500
  // src/blocks/form/submit-button/component-info.ts
4081
- var componentInfo16 = {
4501
+ var componentInfo17 = {
4082
4502
  name: "Form:SubmitButton",
4083
4503
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
4084
4504
  defaultStyles: {
@@ -4112,7 +4532,7 @@ function SubmitButton(props) {
4112
4532
  var submit_button_default = SubmitButton;
4113
4533
 
4114
4534
  // src/blocks/form/textarea/component-info.ts
4115
- var componentInfo17 = {
4535
+ var componentInfo18 = {
4116
4536
  name: "Form:TextArea",
4117
4537
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
4118
4538
  inputs: [{
@@ -4165,7 +4585,7 @@ function Textarea(props) {
4165
4585
  var textarea_default = Textarea;
4166
4586
 
4167
4587
  // src/blocks/img/component-info.ts
4168
- var componentInfo18 = {
4588
+ var componentInfo19 = {
4169
4589
  // friendlyName?
4170
4590
  name: "Raw:Img",
4171
4591
  hideFromInsertMenu: true,
@@ -4198,7 +4618,7 @@ function ImgComponent(props) {
4198
4618
  var img_default = ImgComponent;
4199
4619
 
4200
4620
  // src/blocks/video/component-info.ts
4201
- var componentInfo19 = {
4621
+ var componentInfo20 = {
4202
4622
  name: "Video",
4203
4623
  canHaveChildren: true,
4204
4624
  defaultStyles: {
@@ -4285,9 +4705,9 @@ var componentInfo19 = {
4285
4705
  };
4286
4706
 
4287
4707
  // src/blocks/video/video.tsx
4288
- import { Show as Show12, createMemo as createMemo14 } from "solid-js";
4708
+ import { Show as Show13, createMemo as createMemo15 } from "solid-js";
4289
4709
  function Video(props) {
4290
- const videoProps = createMemo14(() => {
4710
+ const videoProps = createMemo15(() => {
4291
4711
  return {
4292
4712
  ...props.autoPlay === true ? {
4293
4713
  autoPlay: true
@@ -4306,7 +4726,7 @@ function Video(props) {
4306
4726
  } : {}
4307
4727
  };
4308
4728
  });
4309
- const spreadProps = createMemo14(() => {
4729
+ const spreadProps = createMemo15(() => {
4310
4730
  return {
4311
4731
  ...videoProps()
4312
4732
  };
@@ -4328,7 +4748,6 @@ function Video(props) {
4328
4748
  "object-position": props.position,
4329
4749
  // Hack to get object fit to work as expected and
4330
4750
  // not have the video overflow
4331
- "z-index": 2,
4332
4751
  "border-radius": "1px",
4333
4752
  ...props.aspectRatio ? {
4334
4753
  position: "absolute"
@@ -4336,8 +4755,8 @@ function Video(props) {
4336
4755
  }}
4337
4756
  src={props.video || "no-src"}
4338
4757
  poster={props.posterImage}
4339
- ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4340
- <Show12
4758
+ ><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
4759
+ <Show13
4341
4760
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4342
4761
  ><div
4343
4762
  style={{
@@ -4346,15 +4765,15 @@ function Video(props) {
4346
4765
  "pointer-events": "none",
4347
4766
  "font-size": "0px"
4348
4767
  }}
4349
- /></Show12>
4350
- <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4768
+ /></Show13>
4769
+ <Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
4351
4770
  style={{
4352
4771
  display: "flex",
4353
4772
  "flex-direction": "column",
4354
4773
  "align-items": "stretch"
4355
4774
  }}
4356
- >{props.children}</div></Show12>
4357
- <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4775
+ >{props.children}</div></Show13>
4776
+ <Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
4358
4777
  style={{
4359
4778
  "pointer-events": "none",
4360
4779
  display: "flex",
@@ -4366,7 +4785,7 @@ function Video(props) {
4366
4785
  width: "100%",
4367
4786
  height: "100%"
4368
4787
  }}
4369
- >{props.children}</div></Show12>
4788
+ >{props.children}</div></Show13>
4370
4789
  </div></>;
4371
4790
  }
4372
4791
  var video_default = Video;
@@ -4374,31 +4793,31 @@ var video_default = Video;
4374
4793
  // src/constants/extra-components.ts
4375
4794
  var getExtraComponents = () => [{
4376
4795
  component: custom_code_default,
4377
- ...componentInfo11
4796
+ ...componentInfo12
4378
4797
  }, {
4379
4798
  component: embed_default,
4380
- ...componentInfo12
4799
+ ...componentInfo13
4381
4800
  }, ...TARGET === "rsc" ? [] : [{
4382
4801
  component: form_default,
4383
- ...componentInfo13
4802
+ ...componentInfo14
4384
4803
  }, {
4385
4804
  component: input_default,
4386
- ...componentInfo14
4805
+ ...componentInfo15
4387
4806
  }, {
4388
4807
  component: submit_button_default,
4389
- ...componentInfo16
4808
+ ...componentInfo17
4390
4809
  }, {
4391
4810
  component: select_default,
4392
- ...componentInfo15
4811
+ ...componentInfo16
4393
4812
  }, {
4394
4813
  component: textarea_default,
4395
- ...componentInfo17
4814
+ ...componentInfo18
4396
4815
  }], {
4397
4816
  component: img_default,
4398
- ...componentInfo18
4817
+ ...componentInfo19
4399
4818
  }, {
4400
4819
  component: video_default,
4401
- ...componentInfo19
4820
+ ...componentInfo20
4402
4821
  }];
4403
4822
 
4404
4823
  // src/constants/builder-registered-components.ts
@@ -4416,19 +4835,22 @@ var getDefaultRegisteredComponents = () => [{
4416
4835
  ...componentInfo5
4417
4836
  }, {
4418
4837
  component: section_default,
4419
- ...componentInfo6
4838
+ ...componentInfo7
4420
4839
  }, {
4421
4840
  component: slot_default,
4422
- ...componentInfo7
4841
+ ...componentInfo8
4423
4842
  }, {
4424
4843
  component: symbol_default,
4425
- ...componentInfo8
4844
+ ...componentInfo9
4426
4845
  }, {
4427
4846
  component: text_default,
4428
- ...componentInfo10
4429
- }, ...TARGET === "rsc" ? [] : [{
4847
+ ...componentInfo11
4848
+ }, ...TARGET === "react" ? [{
4849
+ component: personalization_container_default,
4850
+ ...componentInfo6
4851
+ }] : [], ...TARGET === "rsc" ? [] : [{
4430
4852
  component: tabs_default,
4431
- ...componentInfo9
4853
+ ...componentInfo10
4432
4854
  }, {
4433
4855
  component: accordion_default,
4434
4856
  ...componentInfo
@@ -4466,7 +4888,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
4466
4888
  testVariationId: variant.id,
4467
4889
  id: content?.id
4468
4890
  }));
4469
- var checkShouldRenderVariants = ({
4891
+ var checkShouldRenderVariants2 = ({
4470
4892
  canTrack,
4471
4893
  content
4472
4894
  }) => {
@@ -4500,24 +4922,14 @@ var getUpdateVariantVisibilityScript = ({
4500
4922
  "${variationId}", "${contentId}", ${isHydrationTarget}
4501
4923
  )`;
4502
4924
 
4503
- // src/components/inlined-script.tsx
4504
- function InlinedScript(props) {
4505
- return <><script
4506
- innerHTML={props.scriptStr}
4507
- data-id={props.id}
4508
- nonce={props.nonce || ""}
4509
- /></>;
4510
- }
4511
- var Inlined_script_default = InlinedScript;
4512
-
4513
4925
  // src/components/content/components/enable-editor.tsx
4514
4926
  import {
4515
- Show as Show13,
4927
+ Show as Show14,
4516
4928
  onMount as onMount6,
4517
4929
  on as on3,
4518
4930
  createEffect as createEffect3,
4519
- createMemo as createMemo15,
4520
- createSignal as createSignal15
4931
+ createMemo as createMemo16,
4932
+ createSignal as createSignal16
4521
4933
  } from "solid-js";
4522
4934
  import { Dynamic as Dynamic5 } from "solid-js/web";
4523
4935
 
@@ -4527,7 +4939,7 @@ function getPreviewContent(_searchParams) {
4527
4939
  }
4528
4940
 
4529
4941
  // src/constants/sdk-version.ts
4530
- var SDK_VERSION = "3.0.3";
4942
+ var SDK_VERSION = "3.0.6";
4531
4943
 
4532
4944
  // src/helpers/sdk-headers.ts
4533
4945
  var getSdkHeaders = () => ({
@@ -4824,16 +5236,6 @@ async function fetchEntries(options) {
4824
5236
  return _processContentResult(options, content);
4825
5237
  }
4826
5238
 
4827
- // src/functions/is-previewing.ts
4828
- function isPreviewing(_search) {
4829
- const search = _search || (isBrowser() ? window.location.search : void 0);
4830
- if (!search) {
4831
- return false;
4832
- }
4833
- const normalizedSearch = getSearchString(search);
4834
- return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4835
- }
4836
-
4837
5239
  // src/helpers/uuid.ts
4838
5240
  function uuidv4() {
4839
5241
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
@@ -5160,7 +5562,8 @@ var setupBrowserForEditing = (options = {}) => {
5160
5562
  // Supports builder-model="..." attribute which is needed to
5161
5563
  // scope our '+ add block' button styling
5162
5564
  supportsAddBlockScoping: true,
5163
- supportsCustomBreakpoints: true
5565
+ supportsCustomBreakpoints: true,
5566
+ blockLevelPersonalization: true
5164
5567
  }
5165
5568
  }, "*");
5166
5569
  window.parent?.postMessage({
@@ -5375,12 +5778,12 @@ var getWrapperClassName = (variationId) => {
5375
5778
 
5376
5779
  // src/components/content/components/enable-editor.tsx
5377
5780
  function EnableEditor(props) {
5378
- const [ContentWrapper, setContentWrapper] = createSignal15(
5781
+ const [ContentWrapper, setContentWrapper] = createSignal16(
5379
5782
  props.contentWrapper || "div"
5380
5783
  );
5381
- const [httpReqsData, setHttpReqsData] = createSignal15({});
5382
- const [httpReqsPending, setHttpReqsPending] = createSignal15({});
5383
- const [clicked, setClicked] = createSignal15(false);
5784
+ const [httpReqsData, setHttpReqsData] = createSignal16({});
5785
+ const [httpReqsPending, setHttpReqsPending] = createSignal16({});
5786
+ const [clicked, setClicked] = createSignal16(false);
5384
5787
  function mergeNewRootState(newData) {
5385
5788
  const combinedState = {
5386
5789
  ...props.builderContextSignal.rootState,
@@ -5414,7 +5817,7 @@ function EnableEditor(props) {
5414
5817
  content: newContentValue
5415
5818
  }));
5416
5819
  }
5417
- const showContentProps = createMemo15(() => {
5820
+ const showContentProps = createMemo16(() => {
5418
5821
  return props.showContent ? {} : {
5419
5822
  hidden: true,
5420
5823
  "aria-hidden": true
@@ -5590,14 +5993,14 @@ function EnableEditor(props) {
5590
5993
  }
5591
5994
  }
5592
5995
  });
5593
- const onUpdateFn_0_props_content = createMemo15(() => props.content);
5996
+ const onUpdateFn_0_props_content = createMemo16(() => props.content);
5594
5997
  function onUpdateFn_0() {
5595
5998
  if (props.content) {
5596
5999
  mergeNewContent(props.content);
5597
6000
  }
5598
6001
  }
5599
6002
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5600
- const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
6003
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5601
6004
  () => props.builderContextSignal.rootState
5602
6005
  );
5603
6006
  function onUpdateFn_1() {
@@ -5609,14 +6012,14 @@ function EnableEditor(props) {
5609
6012
  onUpdateFn_1
5610
6013
  )
5611
6014
  );
5612
- const onUpdateFn_2_props_data = createMemo15(() => props.data);
6015
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5613
6016
  function onUpdateFn_2() {
5614
6017
  if (props.data) {
5615
6018
  mergeNewRootState(props.data);
5616
6019
  }
5617
6020
  }
5618
6021
  createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5619
- const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
6022
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5620
6023
  function onUpdateFn_3() {
5621
6024
  if (props.locale) {
5622
6025
  mergeNewRootState({
@@ -5625,7 +6028,7 @@ function EnableEditor(props) {
5625
6028
  }
5626
6029
  }
5627
6030
  createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5628
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
6031
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
5629
6032
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
5630
6033
  ><Dynamic5
5631
6034
  class={getWrapperClassName(
@@ -5643,14 +6046,14 @@ function EnableEditor(props) {
5643
6046
  {...showContentProps()}
5644
6047
  {...props.contentWrapperProps}
5645
6048
  component={ContentWrapper()}
5646
- >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
6049
+ >{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
5647
6050
  }
5648
6051
  var Enable_editor_default = EnableEditor;
5649
6052
 
5650
6053
  // src/components/content/components/styles.tsx
5651
- import { createSignal as createSignal16 } from "solid-js";
6054
+ import { createSignal as createSignal17 } from "solid-js";
5652
6055
  function ContentStyles(props) {
5653
- const [injectedStyles, setInjectedStyles] = createSignal16(
6056
+ const [injectedStyles, setInjectedStyles] = createSignal17(
5654
6057
  `
5655
6058
  ${getCss({
5656
6059
  cssCode: props.cssCode,
@@ -5708,7 +6111,7 @@ var getContentInitialValue = ({
5708
6111
 
5709
6112
  // src/components/content/content.tsx
5710
6113
  function ContentComponent(props) {
5711
- const [scriptStr, setScriptStr] = createSignal17(
6114
+ const [scriptStr, setScriptStr] = createSignal18(
5712
6115
  getUpdateVariantVisibilityScript({
5713
6116
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
5714
6117
  variationId: props.content?.testVariationId,
@@ -5716,7 +6119,7 @@ function ContentComponent(props) {
5716
6119
  contentId: props.content?.id
5717
6120
  })
5718
6121
  );
5719
- const [registeredComponents, setRegisteredComponents] = createSignal17(
6122
+ const [registeredComponents, setRegisteredComponents] = createSignal18(
5720
6123
  [
5721
6124
  ...getDefaultRegisteredComponents(),
5722
6125
  ...props.customComponents || []
@@ -5731,7 +6134,7 @@ function ContentComponent(props) {
5731
6134
  {}
5732
6135
  )
5733
6136
  );
5734
- const [builderContextSignal, setBuilderContextSignal] = createSignal17({
6137
+ const [builderContextSignal, setBuilderContextSignal] = createSignal18({
5735
6138
  content: getContentInitialValue({
5736
6139
  content: props.content,
5737
6140
  data: props.data
@@ -5815,18 +6218,18 @@ function ContentComponent(props) {
5815
6218
  setBuilderContextSignal
5816
6219
  }}
5817
6220
  >
5818
- <Show14 when={props.isSsrAbTest}><Inlined_script_default
6221
+ <Show15 when={props.isSsrAbTest}><Inlined_script_default
5819
6222
  id="builderio-variant-visibility"
5820
6223
  scriptStr={scriptStr()}
5821
6224
  nonce={props.nonce || ""}
5822
- /></Show14>
5823
- <Show14 when={TARGET !== "reactNative"}><Styles_default
6225
+ /></Show15>
6226
+ <Show15 when={TARGET !== "reactNative"}><Styles_default
5824
6227
  nonce={props.nonce || ""}
5825
6228
  isNestedRender={props.isNestedRender}
5826
6229
  contentId={builderContextSignal().content?.id}
5827
6230
  cssCode={builderContextSignal().content?.data?.cssCode}
5828
6231
  customFonts={builderContextSignal().content?.data?.customFonts}
5829
- /></Show14>
6232
+ /></Show15>
5830
6233
  <Blocks_default
5831
6234
  blocks={builderContextSignal().content?.data?.blocks}
5832
6235
  context={builderContextSignal()}
@@ -5839,13 +6242,13 @@ var Content_default = ContentComponent;
5839
6242
 
5840
6243
  // src/components/content-variants/content-variants.tsx
5841
6244
  function ContentVariants(props) {
5842
- const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
5843
- checkShouldRenderVariants({
6245
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
6246
+ checkShouldRenderVariants2({
5844
6247
  canTrack: getDefaultCanTrack(props.canTrack),
5845
6248
  content: props.content
5846
6249
  })
5847
6250
  );
5848
- const updateCookieAndStylesScriptStr = createMemo18(() => {
6251
+ const updateCookieAndStylesScriptStr = createMemo19(() => {
5849
6252
  return getUpdateCookieAndStylesScript(
5850
6253
  getVariants(props.content).map((value) => ({
5851
6254
  id: value.testVariationId,
@@ -5854,10 +6257,10 @@ function ContentVariants(props) {
5854
6257
  props.content?.id || ""
5855
6258
  );
5856
6259
  });
5857
- const hideVariantsStyleString = createMemo18(() => {
6260
+ const hideVariantsStyleString = createMemo19(() => {
5858
6261
  return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
5859
6262
  });
5860
- const defaultContent = createMemo18(() => {
6263
+ const defaultContent = createMemo19(() => {
5861
6264
  return shouldRenderVariants() ? {
5862
6265
  ...props.content,
5863
6266
  testVariationId: props.content?.id
@@ -5870,12 +6273,12 @@ function ContentVariants(props) {
5870
6273
  setShouldRenderVariants(false);
5871
6274
  });
5872
6275
  return <><>
5873
- <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
6276
+ <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5874
6277
  id="builderio-init-variants-fns"
5875
6278
  scriptStr={getInitVariantsFnsScriptString()}
5876
6279
  nonce={props.nonce || ""}
5877
- /></Show15>
5878
- <Show15 when={shouldRenderVariants()}>
6280
+ /></Show16>
6281
+ <Show16 when={shouldRenderVariants()}>
5879
6282
  <Inlined_styles_default
5880
6283
  id="builderio-variants"
5881
6284
  styles={hideVariantsStyleString()}
@@ -5914,7 +6317,7 @@ function ContentVariants(props) {
5914
6317
  {...{}}
5915
6318
  />;
5916
6319
  }}</For9>
5917
- </Show15>
6320
+ </Show16>
5918
6321
  <Content_default
5919
6322
  apiHost={props.apiHost}
5920
6323
  nonce={props.nonce}
@@ -5969,14 +6372,14 @@ var fetchSymbolContent = async ({
5969
6372
 
5970
6373
  // src/blocks/symbol/symbol.tsx
5971
6374
  function Symbol(props) {
5972
- const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
5973
- const blocksWrapper = createMemo19(() => {
6375
+ const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
6376
+ const blocksWrapper = createMemo20(() => {
5974
6377
  return "div";
5975
6378
  });
5976
- const contentWrapper = createMemo19(() => {
6379
+ const contentWrapper = createMemo20(() => {
5977
6380
  return "div";
5978
6381
  });
5979
- const className = createMemo19(() => {
6382
+ const className = createMemo20(() => {
5980
6383
  return [
5981
6384
  ...[props.attributes[getClassPropName()]],
5982
6385
  "builder-symbol",
@@ -5998,7 +6401,7 @@ function Symbol(props) {
5998
6401
  }
5999
6402
  onMount8(() => {
6000
6403
  });
6001
- const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
6404
+ const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
6002
6405
  function onUpdateFn_0() {
6003
6406
  setContent();
6004
6407
  }
@@ -6083,6 +6486,7 @@ export {
6083
6486
  isEditing,
6084
6487
  isPreviewing,
6085
6488
  register,
6489
+ setClientUserAttributes,
6086
6490
  setEditorSettings,
6087
6491
  subscribeToEditor,
6088
6492
  track