@builder.io/sdk-solid 3.0.5 → 3.0.7

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
@@ -1106,8 +1106,13 @@ import { Show as Show2, createMemo } from "solid-js";
1106
1106
 
1107
1107
  // src/constants/device-sizes.ts
1108
1108
  var SIZES = {
1109
+ xsmall: {
1110
+ min: 0,
1111
+ default: 160,
1112
+ max: 320
1113
+ },
1109
1114
  small: {
1110
- min: 320,
1115
+ min: 321,
1111
1116
  default: 321,
1112
1117
  max: 640
1113
1118
  },
@@ -1123,15 +1128,28 @@ var SIZES = {
1123
1128
  }
1124
1129
  };
1125
1130
  var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
1126
- var getSizesForBreakpoints = ({
1127
- small,
1128
- medium
1129
- }) => {
1131
+ var getSizesForBreakpoints = (breakpoints) => {
1130
1132
  const newSizes = fastClone(SIZES);
1133
+ if (!breakpoints) {
1134
+ return newSizes;
1135
+ }
1136
+ const {
1137
+ xsmall,
1138
+ small,
1139
+ medium
1140
+ } = breakpoints;
1141
+ if (xsmall) {
1142
+ const xsmallMin = Math.floor(xsmall / 2);
1143
+ newSizes.xsmall = {
1144
+ max: xsmall,
1145
+ min: xsmallMin,
1146
+ default: xsmallMin + 1
1147
+ };
1148
+ }
1131
1149
  if (!small || !medium) {
1132
1150
  return newSizes;
1133
1151
  }
1134
- const smallMin = Math.floor(small / 2);
1152
+ const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
1135
1153
  newSizes.small = {
1136
1154
  max: small,
1137
1155
  min: smallMin,
@@ -1182,9 +1200,13 @@ function BlockStyles(props) {
1182
1200
  const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(
1183
1201
  content?.meta?.breakpoints || {}
1184
1202
  );
1203
+ const contentHasXSmallBreakpoint = Boolean(
1204
+ content?.meta?.breakpoints?.xsmall
1205
+ );
1185
1206
  const largeStyles = styles?.large;
1186
1207
  const mediumStyles = styles?.medium;
1187
1208
  const smallStyles = styles?.small;
1209
+ const xsmallStyles = styles?.xsmall;
1188
1210
  const className = processedBlock.id;
1189
1211
  if (!className) {
1190
1212
  return "";
@@ -1209,6 +1231,14 @@ function BlockStyles(props) {
1209
1231
  sizesWithUpdatedBreakpoints
1210
1232
  )
1211
1233
  }) : "";
1234
+ const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
1235
+ className,
1236
+ styles: xsmallStyles,
1237
+ mediaQuery: getMaxWidthQueryForSize(
1238
+ "xsmall",
1239
+ sizesWithUpdatedBreakpoints
1240
+ )
1241
+ }) : "";
1212
1242
  const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
1213
1243
  let hoverStylesClass = "";
1214
1244
  if (hoverAnimation) {
@@ -1228,6 +1258,7 @@ function BlockStyles(props) {
1228
1258
  largeStylesClass,
1229
1259
  mediumStylesClass,
1230
1260
  smallStylesClass,
1261
+ xsmallStylesClass,
1231
1262
  hoverStylesClass
1232
1263
  ].join(" ");
1233
1264
  });
@@ -1634,8 +1665,9 @@ function BlocksWrapper(props) {
1634
1665
  if (!props.path) {
1635
1666
  return void 0;
1636
1667
  }
1668
+ const thisPrefix = "this.";
1637
1669
  const pathPrefix = "component.options.";
1638
- return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
1670
+ return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
1639
1671
  });
1640
1672
  function onClick() {
1641
1673
  if (isEditing() && !props.blocks?.length) {
@@ -1670,7 +1702,7 @@ function BlocksWrapper(props) {
1670
1702
  });
1671
1703
  return <>
1672
1704
  <Dynamic4
1673
- class={className() + " dynamic-3c4beb0c"}
1705
+ class={className() + " dynamic-3d7ff108"}
1674
1706
  ref={blocksWrapperRef}
1675
1707
  builder-path={dataPath()}
1676
1708
  builder-parent-id={props.parent}
@@ -1682,7 +1714,7 @@ function BlocksWrapper(props) {
1682
1714
  {...props.BlocksWrapperProps}
1683
1715
  component={props.BlocksWrapper}
1684
1716
  >{props.children}</Dynamic4>
1685
- <style>{`.dynamic-3c4beb0c {
1717
+ <style>{`.dynamic-3d7ff108 {
1686
1718
  display: flex;
1687
1719
  flex-direction: column;
1688
1720
  align-items: stretch;
@@ -2055,10 +2087,10 @@ function SectionComponent(props) {
2055
2087
  var section_default = SectionComponent;
2056
2088
 
2057
2089
  // src/blocks/symbol/symbol.tsx
2058
- import { onMount as onMount7, on as on4, createEffect as createEffect4, createMemo as createMemo19, createSignal as createSignal19 } from "solid-js";
2090
+ import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
2059
2091
 
2060
2092
  // src/components/content-variants/content-variants.tsx
2061
- import { Show as Show15, For as For8, onMount as onMount6, createSignal as createSignal18, createMemo as createMemo18 } from "solid-js";
2093
+ import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
2062
2094
 
2063
2095
  // src/helpers/url.ts
2064
2096
  var getTopLevelDomain = (host) => {
@@ -2248,11 +2280,61 @@ var handleABTesting = async ({
2248
2280
  };
2249
2281
  };
2250
2282
 
2283
+ // src/helpers/user-attributes.ts
2284
+ var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
2285
+ function createUserAttributesService() {
2286
+ let canTrack = true;
2287
+ const subscribers = /* @__PURE__ */ new Set();
2288
+ return {
2289
+ setUserAttributes(newAttrs) {
2290
+ if (!isBrowser()) {
2291
+ return;
2292
+ }
2293
+ const userAttributes = {
2294
+ ...this.getUserAttributes(),
2295
+ ...newAttrs
2296
+ };
2297
+ setCookie({
2298
+ name: USER_ATTRIBUTES_COOKIE_NAME,
2299
+ value: JSON.stringify(userAttributes),
2300
+ canTrack
2301
+ });
2302
+ subscribers.forEach((callback) => callback(userAttributes));
2303
+ },
2304
+ getUserAttributes() {
2305
+ if (!isBrowser()) {
2306
+ return {};
2307
+ }
2308
+ return JSON.parse(getCookieSync({
2309
+ name: USER_ATTRIBUTES_COOKIE_NAME,
2310
+ canTrack
2311
+ }) || "{}");
2312
+ },
2313
+ subscribeOnUserAttributesChange(callback) {
2314
+ subscribers.add(callback);
2315
+ return () => {
2316
+ subscribers.delete(callback);
2317
+ };
2318
+ },
2319
+ setCanTrack(value) {
2320
+ canTrack = value;
2321
+ }
2322
+ };
2323
+ }
2324
+ var userAttributesService = createUserAttributesService();
2325
+ var setClientUserAttributes = (attributes) => {
2326
+ userAttributesService.setUserAttributes(attributes);
2327
+ };
2328
+
2251
2329
  // src/helpers/canTrack.ts
2252
- var getDefaultCanTrack = (canTrack) => checkIsDefined(canTrack) ? canTrack : true;
2330
+ var getDefaultCanTrack = (canTrack) => {
2331
+ const result = checkIsDefined(canTrack) ? canTrack : true;
2332
+ userAttributesService.setCanTrack(result);
2333
+ return result;
2334
+ };
2253
2335
 
2254
2336
  // src/components/content/content.tsx
2255
- import { Show as Show14, createSignal as createSignal17 } from "solid-js";
2337
+ import { Show as Show15, createSignal as createSignal18 } from "solid-js";
2256
2338
 
2257
2339
  // src/blocks/accordion/component-info.ts
2258
2340
  var defaultTitle = {
@@ -2947,8 +3029,388 @@ var componentInfo5 = {
2947
3029
  }
2948
3030
  };
2949
3031
 
2950
- // src/blocks/section/component-info.ts
3032
+ // src/blocks/personalization-container/component-info.ts
2951
3033
  var componentInfo6 = {
3034
+ name: "PersonalizationContainer",
3035
+ shouldReceiveBuilderProps: {
3036
+ builderBlock: true,
3037
+ builderContext: true
3038
+ },
3039
+ noWrap: true,
3040
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
3041
+ canHaveChildren: true,
3042
+ inputs: [{
3043
+ name: "variants",
3044
+ defaultValue: [],
3045
+ behavior: "personalizationVariantList",
3046
+ type: "list",
3047
+ subFields: [{
3048
+ name: "name",
3049
+ type: "text"
3050
+ }, {
3051
+ name: "query",
3052
+ friendlyName: "Targeting rules",
3053
+ type: "BuilderQuery",
3054
+ defaultValue: []
3055
+ }, {
3056
+ name: "startDate",
3057
+ type: "date"
3058
+ }, {
3059
+ name: "endDate",
3060
+ type: "date"
3061
+ }, {
3062
+ name: "blocks",
3063
+ type: "uiBlocks",
3064
+ hideFromUI: true,
3065
+ defaultValue: []
3066
+ }]
3067
+ }]
3068
+ };
3069
+
3070
+ // src/blocks/personalization-container/personalization-container.tsx
3071
+ import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
3072
+
3073
+ // src/components/inlined-script.tsx
3074
+ function InlinedScript(props) {
3075
+ return <><script
3076
+ innerHTML={props.scriptStr}
3077
+ data-id={props.id}
3078
+ nonce={props.nonce || ""}
3079
+ /></>;
3080
+ }
3081
+ var Inlined_script_default = InlinedScript;
3082
+
3083
+ // src/functions/is-previewing.ts
3084
+ function isPreviewing(_search) {
3085
+ const search = _search || (isBrowser() ? window.location.search : void 0);
3086
+ if (!search) {
3087
+ return false;
3088
+ }
3089
+ const normalizedSearch = getSearchString(search);
3090
+ return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
3091
+ }
3092
+
3093
+ // src/blocks/personalization-container/helpers/inlined-fns.ts
3094
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
3095
+ function isString(val) {
3096
+ return typeof val === "string";
3097
+ }
3098
+ function isNumber(val) {
3099
+ return typeof val === "number";
3100
+ }
3101
+ function objectMatchesQuery(userattr, query2) {
3102
+ const result = (() => {
3103
+ const property = query2.property;
3104
+ const operator = query2.operator;
3105
+ let testValue = query2.value;
3106
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
3107
+ testValue = query2.value.slice(0, -1);
3108
+ }
3109
+ if (!(property && operator)) {
3110
+ return true;
3111
+ }
3112
+ if (Array.isArray(testValue)) {
3113
+ if (operator === "isNot") {
3114
+ return testValue.every((val) => objectMatchesQuery(userattr, {
3115
+ property,
3116
+ operator,
3117
+ value: val
3118
+ }));
3119
+ }
3120
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
3121
+ property,
3122
+ operator,
3123
+ value: val
3124
+ }));
3125
+ }
3126
+ const value = userattr[property];
3127
+ if (Array.isArray(value)) {
3128
+ return value.includes(testValue);
3129
+ }
3130
+ switch (operator) {
3131
+ case "is":
3132
+ return value === testValue;
3133
+ case "isNot":
3134
+ return value !== testValue;
3135
+ case "contains":
3136
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
3137
+ case "startsWith":
3138
+ return isString(value) && value.startsWith(String(testValue));
3139
+ case "endsWith":
3140
+ return isString(value) && value.endsWith(String(testValue));
3141
+ case "greaterThan":
3142
+ return isNumber(value) && isNumber(testValue) && value > testValue;
3143
+ case "lessThan":
3144
+ return isNumber(value) && isNumber(testValue) && value < testValue;
3145
+ case "greaterThanOrEqualTo":
3146
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
3147
+ case "lessThanOrEqualTo":
3148
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
3149
+ default:
3150
+ return false;
3151
+ }
3152
+ })();
3153
+ return result;
3154
+ }
3155
+ const item = {
3156
+ query,
3157
+ startDate,
3158
+ endDate
3159
+ };
3160
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
3161
+ if (item.startDate && new Date(item.startDate) > now) {
3162
+ return false;
3163
+ } else if (item.endDate && new Date(item.endDate) < now) {
3164
+ return false;
3165
+ }
3166
+ if (!item.query || !item.query.length) {
3167
+ return true;
3168
+ }
3169
+ return item.query.every((filter) => {
3170
+ return objectMatchesQuery(userAttributes, filter);
3171
+ });
3172
+ }
3173
+ var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
3174
+ if (!navigator.cookieEnabled) {
3175
+ return;
3176
+ }
3177
+ function getCookie(name) {
3178
+ const nameEQ = name + '=';
3179
+ const ca = document.cookie.split(';');
3180
+ for (let i = 0; i < ca.length; i++) {
3181
+ let c = ca[i];
3182
+ while (c.charAt(0) == ' ') c = c.substring(1, c.length);
3183
+ if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
3184
+ }
3185
+ return null;
3186
+ }
3187
+ function removeVariants() {
3188
+ variants?.forEach(function (_, index) {
3189
+ document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
3190
+ });
3191
+ document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
3192
+ document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
3193
+ }
3194
+ const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
3195
+ if (locale) {
3196
+ attributes.locale = locale;
3197
+ }
3198
+ const winningVariantIndex = variants?.findIndex(function (variant) {
3199
+ return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
3200
+ });
3201
+ const isDebug = location.href.includes('builder.debug=true');
3202
+ if (isDebug) {
3203
+ console.debug('PersonalizationContainer', {
3204
+ attributes,
3205
+ variants,
3206
+ winningVariantIndex
3207
+ });
3208
+ }
3209
+ if (winningVariantIndex !== -1) {
3210
+ const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
3211
+ if (winningVariant) {
3212
+ const parentNode = winningVariant.parentNode;
3213
+ if (parentNode) {
3214
+ const newParent = parentNode.cloneNode(false);
3215
+ newParent.appendChild(winningVariant.content.firstChild);
3216
+ newParent.appendChild(winningVariant.content.lastChild);
3217
+ parentNode.parentNode?.replaceChild(newParent, parentNode);
3218
+ }
3219
+ if (isDebug) {
3220
+ console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
3221
+ }
3222
+ }
3223
+ } else if (variants && variants.length > 0) {
3224
+ removeVariants();
3225
+ }
3226
+ }`;
3227
+ 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}";
3228
+
3229
+ // src/blocks/personalization-container/helpers.ts
3230
+ function checkShouldRenderVariants(variants, canTrack) {
3231
+ const hasVariants = variants && variants.length > 0;
3232
+ if (TARGET === "reactNative")
3233
+ return false;
3234
+ if (!hasVariants)
3235
+ return false;
3236
+ if (!canTrack)
3237
+ return false;
3238
+ if (TARGET === "vue" || TARGET === "svelte")
3239
+ return true;
3240
+ if (isBrowser())
3241
+ return false;
3242
+ return true;
3243
+ }
3244
+ function getBlocksToRender({
3245
+ variants,
3246
+ previewingIndex,
3247
+ isHydrated,
3248
+ filteredVariants,
3249
+ fallbackBlocks
3250
+ }) {
3251
+ const fallback = {
3252
+ blocks: fallbackBlocks ?? [],
3253
+ path: "this.children"
3254
+ };
3255
+ if (isHydrated && isEditing()) {
3256
+ if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
3257
+ const variant = variants[previewingIndex];
3258
+ return {
3259
+ blocks: variant.blocks,
3260
+ path: `component.options.variants.${previewingIndex}.blocks`
3261
+ };
3262
+ }
3263
+ return fallback;
3264
+ }
3265
+ if (isBrowser()) {
3266
+ const winningVariant = filteredVariants?.[0];
3267
+ if (winningVariant) {
3268
+ return {
3269
+ blocks: winningVariant.blocks,
3270
+ path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
3271
+ };
3272
+ }
3273
+ }
3274
+ return fallback;
3275
+ }
3276
+ var getPersonalizationScript = (variants, blockId, locale) => {
3277
+ return `
3278
+ (function() {
3279
+ ${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
3280
+ ${PERSONALIZATION_SCRIPT}
3281
+ getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
3282
+ })();
3283
+ `;
3284
+ };
3285
+
3286
+ // src/blocks/personalization-container/personalization-container.tsx
3287
+ function PersonalizationContainer(props) {
3288
+ const [userAttributes, setUserAttributes] = createSignal10(
3289
+ userAttributesService.getUserAttributes()
3290
+ );
3291
+ const [scriptStr, setScriptStr] = createSignal10(
3292
+ getPersonalizationScript(
3293
+ props.variants,
3294
+ props.builderBlock?.id || "none",
3295
+ props.builderContext?.rootState?.locale
3296
+ )
3297
+ );
3298
+ const [unsubscribers, setUnsubscribers] = createSignal10([]);
3299
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
3300
+ checkShouldRenderVariants(
3301
+ props.variants,
3302
+ getDefaultCanTrack(props.builderContext?.canTrack)
3303
+ )
3304
+ );
3305
+ const [isHydrated, setIsHydrated] = createSignal10(false);
3306
+ const filteredVariants = createMemo10(() => {
3307
+ return (props.variants || []).filter((variant) => {
3308
+ return filterWithCustomTargeting(
3309
+ {
3310
+ ...props.builderContext?.rootState?.locale ? {
3311
+ locale: props.builderContext?.rootState?.locale
3312
+ } : {},
3313
+ ...userAttributes()
3314
+ },
3315
+ variant.query,
3316
+ variant.startDate,
3317
+ variant.endDate
3318
+ );
3319
+ });
3320
+ });
3321
+ const blocksToRender = createMemo10(() => {
3322
+ return getBlocksToRender({
3323
+ variants: props.variants,
3324
+ fallbackBlocks: props.builderBlock?.children,
3325
+ isHydrated: isHydrated(),
3326
+ filteredVariants: filteredVariants(),
3327
+ previewingIndex: props.previewingIndex
3328
+ });
3329
+ });
3330
+ const hideVariantsStyleString = createMemo10(() => {
3331
+ return (props.variants || []).map(
3332
+ (_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
3333
+ ).join("");
3334
+ });
3335
+ let rootRef;
3336
+ onMount4(() => {
3337
+ setIsHydrated(true);
3338
+ const unsub = userAttributesService.subscribeOnUserAttributesChange(
3339
+ (attrs) => {
3340
+ setUserAttributes(attrs);
3341
+ }
3342
+ );
3343
+ if (!(isEditing() || isPreviewing())) {
3344
+ const variant = filteredVariants()[0];
3345
+ if (rootRef) {
3346
+ rootRef.dispatchEvent(
3347
+ new CustomEvent("builder.variantLoaded", {
3348
+ detail: {
3349
+ variant: variant || "default",
3350
+ content: props.builderContext?.content
3351
+ },
3352
+ bubbles: true
3353
+ })
3354
+ );
3355
+ const observer = new IntersectionObserver((entries) => {
3356
+ entries.forEach((entry) => {
3357
+ if (entry.isIntersecting && rootRef) {
3358
+ rootRef.dispatchEvent(
3359
+ new CustomEvent("builder.variantDisplayed", {
3360
+ detail: {
3361
+ variant: variant || "default",
3362
+ content: props.builderContext?.content
3363
+ },
3364
+ bubbles: true
3365
+ })
3366
+ );
3367
+ }
3368
+ });
3369
+ });
3370
+ observer.observe(rootRef);
3371
+ }
3372
+ }
3373
+ unsubscribers().push(unsub);
3374
+ });
3375
+ return <><div
3376
+ class={`builder-personalization-container ${props.attributes?.className || ""}`}
3377
+ ref={rootRef}
3378
+ {...props.attributes}
3379
+ >
3380
+ <Show10 when={shouldRenderVariants()}>
3381
+ <For6 each={props.variants}>{(variant, _index) => {
3382
+ const index = _index();
3383
+ return <template
3384
+ key={index}
3385
+ data-variant-id={`${props.builderBlock?.id}-${index}`}
3386
+ ><Blocks_default
3387
+ blocks={variant.blocks}
3388
+ parent={props.builderBlock?.id}
3389
+ path={`component.options.variants.${index}.blocks`}
3390
+ /></template>;
3391
+ }}</For6>
3392
+ <Inlined_styles_default
3393
+ nonce={props.builderContext?.nonce || ""}
3394
+ styles={hideVariantsStyleString()}
3395
+ id={`variants-styles-${props.builderBlock?.id}`}
3396
+ />
3397
+ <Inlined_script_default
3398
+ nonce={props.builderContext?.nonce || ""}
3399
+ scriptStr={scriptStr()}
3400
+ id={`variants-script-${props.builderBlock?.id}`}
3401
+ />
3402
+ </Show10>
3403
+ <Blocks_default
3404
+ blocks={blocksToRender().blocks}
3405
+ parent={props.builderBlock?.id}
3406
+ path={blocksToRender().path}
3407
+ />
3408
+ </div></>;
3409
+ }
3410
+ var personalization_container_default = PersonalizationContainer;
3411
+
3412
+ // src/blocks/section/component-info.ts
3413
+ var componentInfo7 = {
2952
3414
  name: "Core:Section",
2953
3415
  static: true,
2954
3416
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
@@ -2990,7 +3452,7 @@ var componentInfo6 = {
2990
3452
  };
2991
3453
 
2992
3454
  // src/blocks/slot/component-info.ts
2993
- var componentInfo7 = {
3455
+ var componentInfo8 = {
2994
3456
  name: "Slot",
2995
3457
  isRSC: true,
2996
3458
  description: "Allow child blocks to be inserted into this content when used as a Symbol",
@@ -3029,7 +3491,7 @@ function Slot(props) {
3029
3491
  var slot_default = Slot;
3030
3492
 
3031
3493
  // src/blocks/symbol/component-info.ts
3032
- var componentInfo8 = {
3494
+ var componentInfo9 = {
3033
3495
  name: "Symbol",
3034
3496
  noWrap: true,
3035
3497
  static: true,
@@ -3111,7 +3573,7 @@ var defaultElement = {
3111
3573
  }
3112
3574
  }
3113
3575
  };
3114
- var componentInfo9 = {
3576
+ var componentInfo10 = {
3115
3577
  name: "Builder: Tabs",
3116
3578
  inputs: [{
3117
3579
  name: "tabs",
@@ -3217,9 +3679,9 @@ var componentInfo9 = {
3217
3679
  };
3218
3680
 
3219
3681
  // src/blocks/tabs/tabs.tsx
3220
- import { Show as Show10, For as For6, createSignal as createSignal10 } from "solid-js";
3682
+ import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
3221
3683
  function Tabs(props) {
3222
- const [activeTab, setActiveTab] = createSignal10(
3684
+ const [activeTab, setActiveTab] = createSignal11(
3223
3685
  props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
3224
3686
  );
3225
3687
  function activeTabContent(active) {
@@ -3241,7 +3703,7 @@ function Tabs(props) {
3241
3703
  "justify-content": props.tabHeaderLayout || "flex-start",
3242
3704
  overflow: "auto"
3243
3705
  }}
3244
- ><For6 each={props.tabs}>{(tab, _index) => {
3706
+ ><For7 each={props.tabs}>{(tab, _index) => {
3245
3707
  const index = _index();
3246
3708
  return <span
3247
3709
  class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
@@ -3258,21 +3720,21 @@ function Tabs(props) {
3258
3720
  registeredComponents={props.builderComponents}
3259
3721
  linkComponent={props.builderLinkComponent}
3260
3722
  /></span>;
3261
- }}</For6></div>
3262
- <Show10 when={activeTabContent(activeTab())}><div><Blocks_default
3723
+ }}</For7></div>
3724
+ <Show11 when={activeTabContent(activeTab())}><div><Blocks_default
3263
3725
  parent={props.builderBlock.id}
3264
3726
  path={`tabs.${activeTab()}.content`}
3265
3727
  blocks={activeTabContent(activeTab())}
3266
3728
  context={props.builderContext}
3267
3729
  registeredComponents={props.builderComponents}
3268
3730
  linkComponent={props.builderLinkComponent}
3269
- /></div></Show10>
3731
+ /></div></Show11>
3270
3732
  </div></>;
3271
3733
  }
3272
3734
  var tabs_default = Tabs;
3273
3735
 
3274
3736
  // src/blocks/text/component-info.ts
3275
- var componentInfo10 = {
3737
+ var componentInfo11 = {
3276
3738
  shouldReceiveBuilderProps: {
3277
3739
  builderBlock: TARGET === "reactNative" ? true : false,
3278
3740
  builderContext: true
@@ -3309,7 +3771,7 @@ function Text(props) {
3309
3771
  var text_default = Text;
3310
3772
 
3311
3773
  // src/blocks/custom-code/component-info.ts
3312
- var componentInfo11 = {
3774
+ var componentInfo12 = {
3313
3775
  name: "Custom Code",
3314
3776
  static: true,
3315
3777
  requiredPermissions: ["editCode"],
@@ -3334,12 +3796,12 @@ var componentInfo11 = {
3334
3796
  };
3335
3797
 
3336
3798
  // src/blocks/custom-code/custom-code.tsx
3337
- import { onMount as onMount4, createSignal as createSignal11 } from "solid-js";
3799
+ import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
3338
3800
  function CustomCode(props) {
3339
- const [scriptsInserted, setScriptsInserted] = createSignal11([]);
3340
- const [scriptsRun, setScriptsRun] = createSignal11([]);
3801
+ const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3802
+ const [scriptsRun, setScriptsRun] = createSignal12([]);
3341
3803
  let elementRef;
3342
- onMount4(() => {
3804
+ onMount5(() => {
3343
3805
  if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
3344
3806
  return;
3345
3807
  }
@@ -3381,7 +3843,7 @@ function CustomCode(props) {
3381
3843
  var custom_code_default = CustomCode;
3382
3844
 
3383
3845
  // src/blocks/embed/component-info.ts
3384
- var componentInfo12 = {
3846
+ var componentInfo13 = {
3385
3847
  name: "Embed",
3386
3848
  static: true,
3387
3849
  inputs: [{
@@ -3399,7 +3861,7 @@ var componentInfo12 = {
3399
3861
  };
3400
3862
 
3401
3863
  // src/blocks/embed/embed.tsx
3402
- import { on as on2, createEffect as createEffect2, createMemo as createMemo12, createSignal as createSignal12 } from "solid-js";
3864
+ import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
3403
3865
 
3404
3866
  // src/blocks/embed/helpers.ts
3405
3867
  var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
@@ -3407,9 +3869,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
3407
3869
 
3408
3870
  // src/blocks/embed/embed.tsx
3409
3871
  function Embed(props) {
3410
- const [scriptsInserted, setScriptsInserted] = createSignal12([]);
3411
- const [scriptsRun, setScriptsRun] = createSignal12([]);
3412
- const [ranInitFn, setRanInitFn] = createSignal12(false);
3872
+ const [scriptsInserted, setScriptsInserted] = createSignal13([]);
3873
+ const [scriptsRun, setScriptsRun] = createSignal13([]);
3874
+ const [ranInitFn, setRanInitFn] = createSignal13(false);
3413
3875
  function findAndRunScripts() {
3414
3876
  if (!elem || !elem.getElementsByTagName)
3415
3877
  return;
@@ -3433,8 +3895,8 @@ function Embed(props) {
3433
3895
  }
3434
3896
  }
3435
3897
  let elem;
3436
- const onUpdateFn_0_elem = createMemo12(() => elem);
3437
- const onUpdateFn_0_ranInitFn__ = createMemo12(() => ranInitFn());
3898
+ const onUpdateFn_0_elem = createMemo13(() => elem);
3899
+ const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
3438
3900
  function onUpdateFn_0() {
3439
3901
  if (elem && !ranInitFn()) {
3440
3902
  setRanInitFn(true);
@@ -3449,7 +3911,7 @@ function Embed(props) {
3449
3911
  var embed_default = Embed;
3450
3912
 
3451
3913
  // src/blocks/form/form/component-info.ts
3452
- var componentInfo13 = {
3914
+ var componentInfo14 = {
3453
3915
  name: "Form:Form",
3454
3916
  // editableTags: ['builder-form-error']
3455
3917
  defaults: {
@@ -3689,7 +4151,7 @@ var componentInfo13 = {
3689
4151
  };
3690
4152
 
3691
4153
  // src/blocks/form/form/form.tsx
3692
- import { Show as Show11, createSignal as createSignal13 } from "solid-js";
4154
+ import { Show as Show12, createSignal as createSignal14 } from "solid-js";
3693
4155
 
3694
4156
  // src/functions/get-env.ts
3695
4157
  var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
@@ -3709,9 +4171,9 @@ function logFetch(url) {
3709
4171
 
3710
4172
  // src/blocks/form/form/form.tsx
3711
4173
  function FormComponent(props) {
3712
- const [formState, setFormState] = createSignal13("unsubmitted");
3713
- const [responseData, setResponseData] = createSignal13(null);
3714
- const [formErrorMessage, setFormErrorMessage] = createSignal13("");
4174
+ const [formState, setFormState] = createSignal14("unsubmitted");
4175
+ const [responseData, setResponseData] = createSignal14(null);
4176
+ const [formErrorMessage, setFormErrorMessage] = createSignal14("");
3715
4177
  function mergeNewRootState(newData) {
3716
4178
  const combinedState = {
3717
4179
  ...props.builderContext.rootState,
@@ -3907,22 +4369,22 @@ function FormComponent(props) {
3907
4369
  {...props.attributes}
3908
4370
  >
3909
4371
  {props.children}
3910
- <Show11 when={submissionState() === "error"}><Blocks_default
4372
+ <Show12 when={submissionState() === "error"}><Blocks_default
3911
4373
  path="errorMessage"
3912
4374
  blocks={props.errorMessage}
3913
4375
  context={props.builderContext}
3914
- /></Show11>
3915
- <Show11 when={submissionState() === "sending"}><Blocks_default
4376
+ /></Show12>
4377
+ <Show12 when={submissionState() === "sending"}><Blocks_default
3916
4378
  path="sendingMessage"
3917
4379
  blocks={props.sendingMessage}
3918
4380
  context={props.builderContext}
3919
- /></Show11>
3920
- <Show11 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show11>
3921
- <Show11 when={submissionState() === "success"}><Blocks_default
4381
+ /></Show12>
4382
+ <Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
4383
+ <Show12 when={submissionState() === "success"}><Blocks_default
3922
4384
  path="successMessage"
3923
4385
  blocks={props.successMessage}
3924
4386
  context={props.builderContext}
3925
- /></Show11>
4387
+ /></Show12>
3926
4388
  </form>
3927
4389
  <style>{`.pre-04a43b72 {
3928
4390
  padding: 10px;
@@ -3934,7 +4396,7 @@ function FormComponent(props) {
3934
4396
  var form_default = FormComponent;
3935
4397
 
3936
4398
  // src/blocks/form/input/component-info.ts
3937
- var componentInfo14 = {
4399
+ var componentInfo15 = {
3938
4400
  name: "Form:Input",
3939
4401
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
3940
4402
  inputs: [
@@ -4004,7 +4466,7 @@ function FormInputComponent(props) {
4004
4466
  var input_default = FormInputComponent;
4005
4467
 
4006
4468
  // src/blocks/form/select/component-info.ts
4007
- var componentInfo15 = {
4469
+ var componentInfo16 = {
4008
4470
  name: "Form:Select",
4009
4471
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
4010
4472
  defaultStyles: {
@@ -4049,7 +4511,7 @@ var componentInfo15 = {
4049
4511
  };
4050
4512
 
4051
4513
  // src/blocks/form/select/select.tsx
4052
- import { For as For7 } from "solid-js";
4514
+ import { For as For8 } from "solid-js";
4053
4515
  function SelectComponent(props) {
4054
4516
  return <><select
4055
4517
  {...{}}
@@ -4059,15 +4521,15 @@ function SelectComponent(props) {
4059
4521
  defaultValue={props.defaultValue}
4060
4522
  name={props.name}
4061
4523
  required={props.required}
4062
- ><For7 each={props.options}>{(option, _index) => {
4524
+ ><For8 each={props.options}>{(option, _index) => {
4063
4525
  const index = _index();
4064
4526
  return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
4065
- }}</For7></select></>;
4527
+ }}</For8></select></>;
4066
4528
  }
4067
4529
  var select_default = SelectComponent;
4068
4530
 
4069
4531
  // src/blocks/form/submit-button/component-info.ts
4070
- var componentInfo16 = {
4532
+ var componentInfo17 = {
4071
4533
  name: "Form:SubmitButton",
4072
4534
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
4073
4535
  defaultStyles: {
@@ -4101,7 +4563,7 @@ function SubmitButton(props) {
4101
4563
  var submit_button_default = SubmitButton;
4102
4564
 
4103
4565
  // src/blocks/form/textarea/component-info.ts
4104
- var componentInfo17 = {
4566
+ var componentInfo18 = {
4105
4567
  name: "Form:TextArea",
4106
4568
  image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
4107
4569
  inputs: [{
@@ -4154,7 +4616,7 @@ function Textarea(props) {
4154
4616
  var textarea_default = Textarea;
4155
4617
 
4156
4618
  // src/blocks/img/component-info.ts
4157
- var componentInfo18 = {
4619
+ var componentInfo19 = {
4158
4620
  // friendlyName?
4159
4621
  name: "Raw:Img",
4160
4622
  hideFromInsertMenu: true,
@@ -4187,7 +4649,7 @@ function ImgComponent(props) {
4187
4649
  var img_default = ImgComponent;
4188
4650
 
4189
4651
  // src/blocks/video/component-info.ts
4190
- var componentInfo19 = {
4652
+ var componentInfo20 = {
4191
4653
  name: "Video",
4192
4654
  canHaveChildren: true,
4193
4655
  defaultStyles: {
@@ -4274,9 +4736,9 @@ var componentInfo19 = {
4274
4736
  };
4275
4737
 
4276
4738
  // src/blocks/video/video.tsx
4277
- import { Show as Show12, createMemo as createMemo14 } from "solid-js";
4739
+ import { Show as Show13, createMemo as createMemo15 } from "solid-js";
4278
4740
  function Video(props) {
4279
- const videoProps = createMemo14(() => {
4741
+ const videoProps = createMemo15(() => {
4280
4742
  return {
4281
4743
  ...props.autoPlay === true ? {
4282
4744
  autoPlay: true
@@ -4295,7 +4757,7 @@ function Video(props) {
4295
4757
  } : {}
4296
4758
  };
4297
4759
  });
4298
- const spreadProps = createMemo14(() => {
4760
+ const spreadProps = createMemo15(() => {
4299
4761
  return {
4300
4762
  ...videoProps()
4301
4763
  };
@@ -4324,8 +4786,8 @@ function Video(props) {
4324
4786
  }}
4325
4787
  src={props.video || "no-src"}
4326
4788
  poster={props.posterImage}
4327
- ><Show12 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show12></video>
4328
- <Show12
4789
+ ><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
4790
+ <Show13
4329
4791
  when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
4330
4792
  ><div
4331
4793
  style={{
@@ -4334,15 +4796,15 @@ function Video(props) {
4334
4796
  "pointer-events": "none",
4335
4797
  "font-size": "0px"
4336
4798
  }}
4337
- /></Show12>
4338
- <Show12 when={props.builderBlock?.children?.length && props.fitContent}><div
4799
+ /></Show13>
4800
+ <Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
4339
4801
  style={{
4340
4802
  display: "flex",
4341
4803
  "flex-direction": "column",
4342
4804
  "align-items": "stretch"
4343
4805
  }}
4344
- >{props.children}</div></Show12>
4345
- <Show12 when={props.builderBlock?.children?.length && !props.fitContent}><div
4806
+ >{props.children}</div></Show13>
4807
+ <Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
4346
4808
  style={{
4347
4809
  "pointer-events": "none",
4348
4810
  display: "flex",
@@ -4354,7 +4816,7 @@ function Video(props) {
4354
4816
  width: "100%",
4355
4817
  height: "100%"
4356
4818
  }}
4357
- >{props.children}</div></Show12>
4819
+ >{props.children}</div></Show13>
4358
4820
  </div></>;
4359
4821
  }
4360
4822
  var video_default = Video;
@@ -4362,31 +4824,31 @@ var video_default = Video;
4362
4824
  // src/constants/extra-components.ts
4363
4825
  var getExtraComponents = () => [{
4364
4826
  component: custom_code_default,
4365
- ...componentInfo11
4827
+ ...componentInfo12
4366
4828
  }, {
4367
4829
  component: embed_default,
4368
- ...componentInfo12
4830
+ ...componentInfo13
4369
4831
  }, ...TARGET === "rsc" ? [] : [{
4370
4832
  component: form_default,
4371
- ...componentInfo13
4833
+ ...componentInfo14
4372
4834
  }, {
4373
4835
  component: input_default,
4374
- ...componentInfo14
4836
+ ...componentInfo15
4375
4837
  }, {
4376
4838
  component: submit_button_default,
4377
- ...componentInfo16
4839
+ ...componentInfo17
4378
4840
  }, {
4379
4841
  component: select_default,
4380
- ...componentInfo15
4842
+ ...componentInfo16
4381
4843
  }, {
4382
4844
  component: textarea_default,
4383
- ...componentInfo17
4845
+ ...componentInfo18
4384
4846
  }], {
4385
4847
  component: img_default,
4386
- ...componentInfo18
4848
+ ...componentInfo19
4387
4849
  }, {
4388
4850
  component: video_default,
4389
- ...componentInfo19
4851
+ ...componentInfo20
4390
4852
  }];
4391
4853
 
4392
4854
  // src/constants/builder-registered-components.ts
@@ -4404,19 +4866,22 @@ var getDefaultRegisteredComponents = () => [{
4404
4866
  ...componentInfo5
4405
4867
  }, {
4406
4868
  component: section_default,
4407
- ...componentInfo6
4869
+ ...componentInfo7
4408
4870
  }, {
4409
4871
  component: slot_default,
4410
- ...componentInfo7
4872
+ ...componentInfo8
4411
4873
  }, {
4412
4874
  component: symbol_default,
4413
- ...componentInfo8
4875
+ ...componentInfo9
4414
4876
  }, {
4415
4877
  component: text_default,
4416
- ...componentInfo10
4417
- }, ...TARGET === "rsc" ? [] : [{
4878
+ ...componentInfo11
4879
+ }, ...TARGET === "react" ? [{
4880
+ component: personalization_container_default,
4881
+ ...componentInfo6
4882
+ }] : [], ...TARGET === "rsc" ? [] : [{
4418
4883
  component: tabs_default,
4419
- ...componentInfo9
4884
+ ...componentInfo10
4420
4885
  }, {
4421
4886
  component: accordion_default,
4422
4887
  ...componentInfo
@@ -4454,7 +4919,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
4454
4919
  testVariationId: variant.id,
4455
4920
  id: content?.id
4456
4921
  }));
4457
- var checkShouldRenderVariants = ({
4922
+ var checkShouldRenderVariants2 = ({
4458
4923
  canTrack,
4459
4924
  content
4460
4925
  }) => {
@@ -4488,24 +4953,14 @@ var getUpdateVariantVisibilityScript = ({
4488
4953
  "${variationId}", "${contentId}", ${isHydrationTarget}
4489
4954
  )`;
4490
4955
 
4491
- // src/components/inlined-script.tsx
4492
- function InlinedScript(props) {
4493
- return <><script
4494
- innerHTML={props.scriptStr}
4495
- data-id={props.id}
4496
- nonce={props.nonce || ""}
4497
- /></>;
4498
- }
4499
- var Inlined_script_default = InlinedScript;
4500
-
4501
4956
  // src/components/content/components/enable-editor.tsx
4502
4957
  import {
4503
- Show as Show13,
4504
- onMount as onMount5,
4958
+ Show as Show14,
4959
+ onMount as onMount6,
4505
4960
  on as on3,
4506
4961
  createEffect as createEffect3,
4507
- createMemo as createMemo15,
4508
- createSignal as createSignal15
4962
+ createMemo as createMemo16,
4963
+ createSignal as createSignal16
4509
4964
  } from "solid-js";
4510
4965
  import { Dynamic as Dynamic5 } from "solid-js/web";
4511
4966
 
@@ -4515,7 +4970,7 @@ function getPreviewContent(_searchParams) {
4515
4970
  }
4516
4971
 
4517
4972
  // src/constants/sdk-version.ts
4518
- var SDK_VERSION = "3.0.5";
4973
+ var SDK_VERSION = "3.0.7";
4519
4974
 
4520
4975
  // src/helpers/sdk-headers.ts
4521
4976
  var getSdkHeaders = () => ({
@@ -4812,16 +5267,6 @@ async function fetchEntries(options) {
4812
5267
  return _processContentResult(options, content);
4813
5268
  }
4814
5269
 
4815
- // src/functions/is-previewing.ts
4816
- function isPreviewing(_search) {
4817
- const search = _search || (isBrowser() ? window.location.search : void 0);
4818
- if (!search) {
4819
- return false;
4820
- }
4821
- const normalizedSearch = getSearchString(search);
4822
- return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
4823
- }
4824
-
4825
5270
  // src/helpers/uuid.ts
4826
5271
  function uuidv4() {
4827
5272
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
@@ -5148,7 +5593,9 @@ var setupBrowserForEditing = (options = {}) => {
5148
5593
  // Supports builder-model="..." attribute which is needed to
5149
5594
  // scope our '+ add block' button styling
5150
5595
  supportsAddBlockScoping: true,
5151
- supportsCustomBreakpoints: true
5596
+ supportsCustomBreakpoints: true,
5597
+ supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
5598
+ blockLevelPersonalization: true
5152
5599
  }
5153
5600
  }, "*");
5154
5601
  window.parent?.postMessage({
@@ -5363,12 +5810,12 @@ var getWrapperClassName = (variationId) => {
5363
5810
 
5364
5811
  // src/components/content/components/enable-editor.tsx
5365
5812
  function EnableEditor(props) {
5366
- const [ContentWrapper, setContentWrapper] = createSignal15(
5813
+ const [ContentWrapper, setContentWrapper] = createSignal16(
5367
5814
  props.contentWrapper || "div"
5368
5815
  );
5369
- const [httpReqsData, setHttpReqsData] = createSignal15({});
5370
- const [httpReqsPending, setHttpReqsPending] = createSignal15({});
5371
- const [clicked, setClicked] = createSignal15(false);
5816
+ const [httpReqsData, setHttpReqsData] = createSignal16({});
5817
+ const [httpReqsPending, setHttpReqsPending] = createSignal16({});
5818
+ const [clicked, setClicked] = createSignal16(false);
5372
5819
  function mergeNewRootState(newData) {
5373
5820
  const combinedState = {
5374
5821
  ...props.builderContextSignal.rootState,
@@ -5402,7 +5849,7 @@ function EnableEditor(props) {
5402
5849
  content: newContentValue
5403
5850
  }));
5404
5851
  }
5405
- const showContentProps = createMemo15(() => {
5852
+ const showContentProps = createMemo16(() => {
5406
5853
  return props.showContent ? {} : {
5407
5854
  hidden: true,
5408
5855
  "aria-hidden": true
@@ -5509,7 +5956,7 @@ function EnableEditor(props) {
5509
5956
  let elementRef;
5510
5957
  runHttpRequests();
5511
5958
  emitStateUpdate();
5512
- onMount5(() => {
5959
+ onMount6(() => {
5513
5960
  if (isBrowser()) {
5514
5961
  if (isEditing() && !props.isNestedRender) {
5515
5962
  window.addEventListener("message", processMessage);
@@ -5578,14 +6025,14 @@ function EnableEditor(props) {
5578
6025
  }
5579
6026
  }
5580
6027
  });
5581
- const onUpdateFn_0_props_content = createMemo15(() => props.content);
6028
+ const onUpdateFn_0_props_content = createMemo16(() => props.content);
5582
6029
  function onUpdateFn_0() {
5583
6030
  if (props.content) {
5584
6031
  mergeNewContent(props.content);
5585
6032
  }
5586
6033
  }
5587
6034
  createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
5588
- const onUpdateFn_1_props_builderContextSignal_rootState = createMemo15(
6035
+ const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
5589
6036
  () => props.builderContextSignal.rootState
5590
6037
  );
5591
6038
  function onUpdateFn_1() {
@@ -5597,14 +6044,14 @@ function EnableEditor(props) {
5597
6044
  onUpdateFn_1
5598
6045
  )
5599
6046
  );
5600
- const onUpdateFn_2_props_data = createMemo15(() => props.data);
6047
+ const onUpdateFn_2_props_data = createMemo16(() => props.data);
5601
6048
  function onUpdateFn_2() {
5602
6049
  if (props.data) {
5603
6050
  mergeNewRootState(props.data);
5604
6051
  }
5605
6052
  }
5606
6053
  createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
5607
- const onUpdateFn_3_props_locale = createMemo15(() => props.locale);
6054
+ const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
5608
6055
  function onUpdateFn_3() {
5609
6056
  if (props.locale) {
5610
6057
  mergeNewRootState({
@@ -5613,7 +6060,7 @@ function EnableEditor(props) {
5613
6060
  }
5614
6061
  }
5615
6062
  createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
5616
- return <><builder_context_default.Provider value={props.builderContextSignal}><Show13
6063
+ return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
5617
6064
  when={props.builderContextSignal.content || needsElementRefDivForEditing()}
5618
6065
  ><Dynamic5
5619
6066
  class={getWrapperClassName(
@@ -5631,14 +6078,14 @@ function EnableEditor(props) {
5631
6078
  {...showContentProps()}
5632
6079
  {...props.contentWrapperProps}
5633
6080
  component={ContentWrapper()}
5634
- >{props.children}</Dynamic5></Show13></builder_context_default.Provider></>;
6081
+ >{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
5635
6082
  }
5636
6083
  var Enable_editor_default = EnableEditor;
5637
6084
 
5638
6085
  // src/components/content/components/styles.tsx
5639
- import { createSignal as createSignal16 } from "solid-js";
6086
+ import { createSignal as createSignal17 } from "solid-js";
5640
6087
  function ContentStyles(props) {
5641
- const [injectedStyles, setInjectedStyles] = createSignal16(
6088
+ const [injectedStyles, setInjectedStyles] = createSignal17(
5642
6089
  `
5643
6090
  ${getCss({
5644
6091
  cssCode: props.cssCode,
@@ -5696,7 +6143,7 @@ var getContentInitialValue = ({
5696
6143
 
5697
6144
  // src/components/content/content.tsx
5698
6145
  function ContentComponent(props) {
5699
- const [scriptStr, setScriptStr] = createSignal17(
6146
+ const [scriptStr, setScriptStr] = createSignal18(
5700
6147
  getUpdateVariantVisibilityScript({
5701
6148
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
5702
6149
  variationId: props.content?.testVariationId,
@@ -5704,7 +6151,7 @@ function ContentComponent(props) {
5704
6151
  contentId: props.content?.id
5705
6152
  })
5706
6153
  );
5707
- const [registeredComponents, setRegisteredComponents] = createSignal17(
6154
+ const [registeredComponents, setRegisteredComponents] = createSignal18(
5708
6155
  [
5709
6156
  ...getDefaultRegisteredComponents(),
5710
6157
  ...props.customComponents || []
@@ -5719,7 +6166,7 @@ function ContentComponent(props) {
5719
6166
  {}
5720
6167
  )
5721
6168
  );
5722
- const [builderContextSignal, setBuilderContextSignal] = createSignal17({
6169
+ const [builderContextSignal, setBuilderContextSignal] = createSignal18({
5723
6170
  content: getContentInitialValue({
5724
6171
  content: props.content,
5725
6172
  data: props.data
@@ -5803,18 +6250,18 @@ function ContentComponent(props) {
5803
6250
  setBuilderContextSignal
5804
6251
  }}
5805
6252
  >
5806
- <Show14 when={props.isSsrAbTest}><Inlined_script_default
6253
+ <Show15 when={props.isSsrAbTest}><Inlined_script_default
5807
6254
  id="builderio-variant-visibility"
5808
6255
  scriptStr={scriptStr()}
5809
6256
  nonce={props.nonce || ""}
5810
- /></Show14>
5811
- <Show14 when={TARGET !== "reactNative"}><Styles_default
6257
+ /></Show15>
6258
+ <Show15 when={TARGET !== "reactNative"}><Styles_default
5812
6259
  nonce={props.nonce || ""}
5813
6260
  isNestedRender={props.isNestedRender}
5814
6261
  contentId={builderContextSignal().content?.id}
5815
6262
  cssCode={builderContextSignal().content?.data?.cssCode}
5816
6263
  customFonts={builderContextSignal().content?.data?.customFonts}
5817
- /></Show14>
6264
+ /></Show15>
5818
6265
  <Blocks_default
5819
6266
  blocks={builderContextSignal().content?.data?.blocks}
5820
6267
  context={builderContextSignal()}
@@ -5827,13 +6274,13 @@ var Content_default = ContentComponent;
5827
6274
 
5828
6275
  // src/components/content-variants/content-variants.tsx
5829
6276
  function ContentVariants(props) {
5830
- const [shouldRenderVariants, setShouldRenderVariants] = createSignal18(
5831
- checkShouldRenderVariants({
6277
+ const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
6278
+ checkShouldRenderVariants2({
5832
6279
  canTrack: getDefaultCanTrack(props.canTrack),
5833
6280
  content: props.content
5834
6281
  })
5835
6282
  );
5836
- const updateCookieAndStylesScriptStr = createMemo18(() => {
6283
+ const updateCookieAndStylesScriptStr = createMemo19(() => {
5837
6284
  return getUpdateCookieAndStylesScript(
5838
6285
  getVariants(props.content).map((value) => ({
5839
6286
  id: value.testVariationId,
@@ -5842,10 +6289,10 @@ function ContentVariants(props) {
5842
6289
  props.content?.id || ""
5843
6290
  );
5844
6291
  });
5845
- const hideVariantsStyleString = createMemo18(() => {
6292
+ const hideVariantsStyleString = createMemo19(() => {
5846
6293
  return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
5847
6294
  });
5848
- const defaultContent = createMemo18(() => {
6295
+ const defaultContent = createMemo19(() => {
5849
6296
  return shouldRenderVariants() ? {
5850
6297
  ...props.content,
5851
6298
  testVariationId: props.content?.id
@@ -5854,16 +6301,16 @@ function ContentVariants(props) {
5854
6301
  canTrack: getDefaultCanTrack(props.canTrack)
5855
6302
  });
5856
6303
  });
5857
- onMount6(() => {
6304
+ onMount7(() => {
5858
6305
  setShouldRenderVariants(false);
5859
6306
  });
5860
6307
  return <><>
5861
- <Show15 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
6308
+ <Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
5862
6309
  id="builderio-init-variants-fns"
5863
6310
  scriptStr={getInitVariantsFnsScriptString()}
5864
6311
  nonce={props.nonce || ""}
5865
- /></Show15>
5866
- <Show15 when={shouldRenderVariants()}>
6312
+ /></Show16>
6313
+ <Show16 when={shouldRenderVariants()}>
5867
6314
  <Inlined_styles_default
5868
6315
  id="builderio-variants"
5869
6316
  styles={hideVariantsStyleString()}
@@ -5874,7 +6321,7 @@ function ContentVariants(props) {
5874
6321
  scriptStr={updateCookieAndStylesScriptStr()}
5875
6322
  nonce={props.nonce || ""}
5876
6323
  />
5877
- <For8 each={getVariants(props.content)}>{(variant, _index) => {
6324
+ <For9 each={getVariants(props.content)}>{(variant, _index) => {
5878
6325
  const index = _index();
5879
6326
  return <Content_default
5880
6327
  apiHost={props.apiHost}
@@ -5901,8 +6348,8 @@ function ContentVariants(props) {
5901
6348
  trustedHosts={props.trustedHosts}
5902
6349
  {...{}}
5903
6350
  />;
5904
- }}</For8>
5905
- </Show15>
6351
+ }}</For9>
6352
+ </Show16>
5906
6353
  <Content_default
5907
6354
  apiHost={props.apiHost}
5908
6355
  nonce={props.nonce}
@@ -5957,14 +6404,14 @@ var fetchSymbolContent = async ({
5957
6404
 
5958
6405
  // src/blocks/symbol/symbol.tsx
5959
6406
  function Symbol(props) {
5960
- const [contentToUse, setContentToUse] = createSignal19(props.symbol?.content);
5961
- const blocksWrapper = createMemo19(() => {
6407
+ const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
6408
+ const blocksWrapper = createMemo20(() => {
5962
6409
  return "div";
5963
6410
  });
5964
- const contentWrapper = createMemo19(() => {
6411
+ const contentWrapper = createMemo20(() => {
5965
6412
  return "div";
5966
6413
  });
5967
- const className = createMemo19(() => {
6414
+ const className = createMemo20(() => {
5968
6415
  return [
5969
6416
  ...[props.attributes[getClassPropName()]],
5970
6417
  "builder-symbol",
@@ -5984,9 +6431,9 @@ function Symbol(props) {
5984
6431
  }
5985
6432
  });
5986
6433
  }
5987
- onMount7(() => {
6434
+ onMount8(() => {
5988
6435
  });
5989
- const onUpdateFn_0_props_symbol = createMemo19(() => props.symbol);
6436
+ const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
5990
6437
  function onUpdateFn_0() {
5991
6438
  setContent();
5992
6439
  }
@@ -6071,6 +6518,7 @@ export {
6071
6518
  isEditing,
6072
6519
  isPreviewing,
6073
6520
  register,
6521
+ setClientUserAttributes,
6074
6522
  setEditorSettings,
6075
6523
  subscribeToEditor,
6076
6524
  track