@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/dist/index.d.ts +8 -2
- package/lib/browser/dev.js +562 -110
- package/lib/browser/dev.jsx +596 -148
- package/lib/browser/index.js +562 -110
- package/lib/browser/index.jsx +596 -148
- package/lib/edge/dev.js +562 -110
- package/lib/edge/dev.jsx +596 -148
- package/lib/edge/index.js +562 -110
- package/lib/edge/index.jsx +596 -148
- package/lib/node/dev.js +562 -110
- package/lib/node/dev.jsx +596 -148
- package/lib/node/index.js +562 -110
- package/lib/node/index.jsx +596 -148
- package/package.json +1 -1
package/lib/browser/dev.js
CHANGED
|
@@ -939,8 +939,13 @@ var provideBuilderContext = (block, context) => {
|
|
|
939
939
|
|
|
940
940
|
// src/constants/device-sizes.ts
|
|
941
941
|
var SIZES = {
|
|
942
|
+
xsmall: {
|
|
943
|
+
min: 0,
|
|
944
|
+
default: 160,
|
|
945
|
+
max: 320
|
|
946
|
+
},
|
|
942
947
|
small: {
|
|
943
|
-
min:
|
|
948
|
+
min: 321,
|
|
944
949
|
default: 321,
|
|
945
950
|
max: 640
|
|
946
951
|
},
|
|
@@ -956,15 +961,28 @@ var SIZES = {
|
|
|
956
961
|
}
|
|
957
962
|
};
|
|
958
963
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
959
|
-
var getSizesForBreakpoints = ({
|
|
960
|
-
small,
|
|
961
|
-
medium
|
|
962
|
-
}) => {
|
|
964
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
963
965
|
const newSizes = fastClone(SIZES);
|
|
966
|
+
if (!breakpoints) {
|
|
967
|
+
return newSizes;
|
|
968
|
+
}
|
|
969
|
+
const {
|
|
970
|
+
xsmall,
|
|
971
|
+
small,
|
|
972
|
+
medium
|
|
973
|
+
} = breakpoints;
|
|
974
|
+
if (xsmall) {
|
|
975
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
976
|
+
newSizes.xsmall = {
|
|
977
|
+
max: xsmall,
|
|
978
|
+
min: xsmallMin,
|
|
979
|
+
default: xsmallMin + 1
|
|
980
|
+
};
|
|
981
|
+
}
|
|
964
982
|
if (!small || !medium) {
|
|
965
983
|
return newSizes;
|
|
966
984
|
}
|
|
967
|
-
const smallMin = Math.floor(small / 2);
|
|
985
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
968
986
|
newSizes.small = {
|
|
969
987
|
max: small,
|
|
970
988
|
min: smallMin,
|
|
@@ -1022,9 +1040,11 @@ function BlockStyles(props) {
|
|
|
1022
1040
|
const styles = processedBlock.responsiveStyles;
|
|
1023
1041
|
const content = props.context.content;
|
|
1024
1042
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
1043
|
+
const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
|
|
1025
1044
|
const largeStyles = styles?.large;
|
|
1026
1045
|
const mediumStyles = styles?.medium;
|
|
1027
1046
|
const smallStyles = styles?.small;
|
|
1047
|
+
const xsmallStyles = styles?.xsmall;
|
|
1028
1048
|
const className = processedBlock.id;
|
|
1029
1049
|
if (!className) {
|
|
1030
1050
|
return "";
|
|
@@ -1043,6 +1063,11 @@ function BlockStyles(props) {
|
|
|
1043
1063
|
styles: smallStyles,
|
|
1044
1064
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
1045
1065
|
}) : "";
|
|
1066
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
1067
|
+
className,
|
|
1068
|
+
styles: xsmallStyles,
|
|
1069
|
+
mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
|
|
1070
|
+
}) : "";
|
|
1046
1071
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1047
1072
|
let hoverStylesClass = "";
|
|
1048
1073
|
if (hoverAnimation) {
|
|
@@ -1056,7 +1081,7 @@ function BlockStyles(props) {
|
|
|
1056
1081
|
}
|
|
1057
1082
|
}) || "";
|
|
1058
1083
|
}
|
|
1059
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
1084
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
|
|
1060
1085
|
});
|
|
1061
1086
|
return createComponent(Show, {
|
|
1062
1087
|
get when() {
|
|
@@ -1616,7 +1641,7 @@ function Block(props) {
|
|
|
1616
1641
|
});
|
|
1617
1642
|
}
|
|
1618
1643
|
var block_default = Block;
|
|
1619
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1644
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-3d7ff108 {
|
|
1620
1645
|
display: flex;
|
|
1621
1646
|
flex-direction: column;
|
|
1622
1647
|
align-items: stretch;
|
|
@@ -1629,8 +1654,9 @@ function BlocksWrapper(props) {
|
|
|
1629
1654
|
if (!props.path) {
|
|
1630
1655
|
return void 0;
|
|
1631
1656
|
}
|
|
1657
|
+
const thisPrefix = "this.";
|
|
1632
1658
|
const pathPrefix = "component.options.";
|
|
1633
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1659
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1634
1660
|
});
|
|
1635
1661
|
function onClick() {
|
|
1636
1662
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1659,7 +1685,7 @@ function BlocksWrapper(props) {
|
|
|
1659
1685
|
});
|
|
1660
1686
|
return [createComponent(Dynamic, mergeProps({
|
|
1661
1687
|
get ["class"]() {
|
|
1662
|
-
return className() + " dynamic-
|
|
1688
|
+
return className() + " dynamic-3d7ff108";
|
|
1663
1689
|
},
|
|
1664
1690
|
ref(r$) {
|
|
1665
1691
|
const _ref$ = blocksWrapperRef;
|
|
@@ -2353,8 +2379,58 @@ var handleABTesting = async ({
|
|
|
2353
2379
|
};
|
|
2354
2380
|
};
|
|
2355
2381
|
|
|
2382
|
+
// src/helpers/user-attributes.ts
|
|
2383
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2384
|
+
function createUserAttributesService() {
|
|
2385
|
+
let canTrack = true;
|
|
2386
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2387
|
+
return {
|
|
2388
|
+
setUserAttributes(newAttrs) {
|
|
2389
|
+
if (!isBrowser()) {
|
|
2390
|
+
return;
|
|
2391
|
+
}
|
|
2392
|
+
const userAttributes = {
|
|
2393
|
+
...this.getUserAttributes(),
|
|
2394
|
+
...newAttrs
|
|
2395
|
+
};
|
|
2396
|
+
setCookie({
|
|
2397
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2398
|
+
value: JSON.stringify(userAttributes),
|
|
2399
|
+
canTrack
|
|
2400
|
+
});
|
|
2401
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2402
|
+
},
|
|
2403
|
+
getUserAttributes() {
|
|
2404
|
+
if (!isBrowser()) {
|
|
2405
|
+
return {};
|
|
2406
|
+
}
|
|
2407
|
+
return JSON.parse(getCookieSync({
|
|
2408
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2409
|
+
canTrack
|
|
2410
|
+
}) || "{}");
|
|
2411
|
+
},
|
|
2412
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2413
|
+
subscribers.add(callback);
|
|
2414
|
+
return () => {
|
|
2415
|
+
subscribers.delete(callback);
|
|
2416
|
+
};
|
|
2417
|
+
},
|
|
2418
|
+
setCanTrack(value) {
|
|
2419
|
+
canTrack = value;
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
}
|
|
2423
|
+
var userAttributesService = createUserAttributesService();
|
|
2424
|
+
var setClientUserAttributes = (attributes) => {
|
|
2425
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2426
|
+
};
|
|
2427
|
+
|
|
2356
2428
|
// src/helpers/canTrack.ts
|
|
2357
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2429
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2430
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2431
|
+
userAttributesService.setCanTrack(result);
|
|
2432
|
+
return result;
|
|
2433
|
+
};
|
|
2358
2434
|
|
|
2359
2435
|
// src/blocks/accordion/component-info.ts
|
|
2360
2436
|
var defaultTitle = {
|
|
@@ -3085,8 +3161,408 @@ var componentInfo5 = {
|
|
|
3085
3161
|
}
|
|
3086
3162
|
};
|
|
3087
3163
|
|
|
3088
|
-
// src/blocks/
|
|
3164
|
+
// src/blocks/personalization-container/component-info.ts
|
|
3089
3165
|
var componentInfo6 = {
|
|
3166
|
+
name: "PersonalizationContainer",
|
|
3167
|
+
shouldReceiveBuilderProps: {
|
|
3168
|
+
builderBlock: true,
|
|
3169
|
+
builderContext: true
|
|
3170
|
+
},
|
|
3171
|
+
noWrap: true,
|
|
3172
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
3173
|
+
canHaveChildren: true,
|
|
3174
|
+
inputs: [{
|
|
3175
|
+
name: "variants",
|
|
3176
|
+
defaultValue: [],
|
|
3177
|
+
behavior: "personalizationVariantList",
|
|
3178
|
+
type: "list",
|
|
3179
|
+
subFields: [{
|
|
3180
|
+
name: "name",
|
|
3181
|
+
type: "text"
|
|
3182
|
+
}, {
|
|
3183
|
+
name: "query",
|
|
3184
|
+
friendlyName: "Targeting rules",
|
|
3185
|
+
type: "BuilderQuery",
|
|
3186
|
+
defaultValue: []
|
|
3187
|
+
}, {
|
|
3188
|
+
name: "startDate",
|
|
3189
|
+
type: "date"
|
|
3190
|
+
}, {
|
|
3191
|
+
name: "endDate",
|
|
3192
|
+
type: "date"
|
|
3193
|
+
}, {
|
|
3194
|
+
name: "blocks",
|
|
3195
|
+
type: "uiBlocks",
|
|
3196
|
+
hideFromUI: true,
|
|
3197
|
+
defaultValue: []
|
|
3198
|
+
}]
|
|
3199
|
+
}]
|
|
3200
|
+
};
|
|
3201
|
+
var _tmpl$8 = /* @__PURE__ */ template(`<script>`);
|
|
3202
|
+
function InlinedScript(props) {
|
|
3203
|
+
return (() => {
|
|
3204
|
+
const _el$ = _tmpl$8();
|
|
3205
|
+
effect((_p$) => {
|
|
3206
|
+
const _v$ = props.scriptStr, _v$2 = props.id, _v$3 = props.nonce || "";
|
|
3207
|
+
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
3208
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
3209
|
+
_v$3 !== _p$._v$3 && setAttribute(_el$, "nonce", _p$._v$3 = _v$3);
|
|
3210
|
+
return _p$;
|
|
3211
|
+
}, {
|
|
3212
|
+
_v$: void 0,
|
|
3213
|
+
_v$2: void 0,
|
|
3214
|
+
_v$3: void 0
|
|
3215
|
+
});
|
|
3216
|
+
return _el$;
|
|
3217
|
+
})();
|
|
3218
|
+
}
|
|
3219
|
+
var inlined_script_default = InlinedScript;
|
|
3220
|
+
|
|
3221
|
+
// src/functions/is-previewing.ts
|
|
3222
|
+
function isPreviewing(_search) {
|
|
3223
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3224
|
+
if (!search) {
|
|
3225
|
+
return false;
|
|
3226
|
+
}
|
|
3227
|
+
const normalizedSearch = getSearchString(search);
|
|
3228
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3232
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3233
|
+
function isString(val) {
|
|
3234
|
+
return typeof val === "string";
|
|
3235
|
+
}
|
|
3236
|
+
function isNumber(val) {
|
|
3237
|
+
return typeof val === "number";
|
|
3238
|
+
}
|
|
3239
|
+
function objectMatchesQuery(userattr, query2) {
|
|
3240
|
+
const result = (() => {
|
|
3241
|
+
const property = query2.property;
|
|
3242
|
+
const operator = query2.operator;
|
|
3243
|
+
let testValue = query2.value;
|
|
3244
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3245
|
+
testValue = query2.value.slice(0, -1);
|
|
3246
|
+
}
|
|
3247
|
+
if (!(property && operator)) {
|
|
3248
|
+
return true;
|
|
3249
|
+
}
|
|
3250
|
+
if (Array.isArray(testValue)) {
|
|
3251
|
+
if (operator === "isNot") {
|
|
3252
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3253
|
+
property,
|
|
3254
|
+
operator,
|
|
3255
|
+
value: val
|
|
3256
|
+
}));
|
|
3257
|
+
}
|
|
3258
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3259
|
+
property,
|
|
3260
|
+
operator,
|
|
3261
|
+
value: val
|
|
3262
|
+
}));
|
|
3263
|
+
}
|
|
3264
|
+
const value = userattr[property];
|
|
3265
|
+
if (Array.isArray(value)) {
|
|
3266
|
+
return value.includes(testValue);
|
|
3267
|
+
}
|
|
3268
|
+
switch (operator) {
|
|
3269
|
+
case "is":
|
|
3270
|
+
return value === testValue;
|
|
3271
|
+
case "isNot":
|
|
3272
|
+
return value !== testValue;
|
|
3273
|
+
case "contains":
|
|
3274
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3275
|
+
case "startsWith":
|
|
3276
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
3277
|
+
case "endsWith":
|
|
3278
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
3279
|
+
case "greaterThan":
|
|
3280
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3281
|
+
case "lessThan":
|
|
3282
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3283
|
+
case "greaterThanOrEqualTo":
|
|
3284
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3285
|
+
case "lessThanOrEqualTo":
|
|
3286
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3287
|
+
default:
|
|
3288
|
+
return false;
|
|
3289
|
+
}
|
|
3290
|
+
})();
|
|
3291
|
+
return result;
|
|
3292
|
+
}
|
|
3293
|
+
const item = {
|
|
3294
|
+
query,
|
|
3295
|
+
startDate,
|
|
3296
|
+
endDate
|
|
3297
|
+
};
|
|
3298
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3299
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
3300
|
+
return false;
|
|
3301
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3302
|
+
return false;
|
|
3303
|
+
}
|
|
3304
|
+
if (!item.query || !item.query.length) {
|
|
3305
|
+
return true;
|
|
3306
|
+
}
|
|
3307
|
+
return item.query.every((filter) => {
|
|
3308
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
3309
|
+
});
|
|
3310
|
+
}
|
|
3311
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3312
|
+
if (!navigator.cookieEnabled) {
|
|
3313
|
+
return;
|
|
3314
|
+
}
|
|
3315
|
+
function getCookie(name) {
|
|
3316
|
+
const nameEQ = name + '=';
|
|
3317
|
+
const ca = document.cookie.split(';');
|
|
3318
|
+
for (let i = 0; i < ca.length; i++) {
|
|
3319
|
+
let c = ca[i];
|
|
3320
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3321
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3322
|
+
}
|
|
3323
|
+
return null;
|
|
3324
|
+
}
|
|
3325
|
+
function removeVariants() {
|
|
3326
|
+
variants?.forEach(function (_, index) {
|
|
3327
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3328
|
+
});
|
|
3329
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3330
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3331
|
+
}
|
|
3332
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3333
|
+
if (locale) {
|
|
3334
|
+
attributes.locale = locale;
|
|
3335
|
+
}
|
|
3336
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3337
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3338
|
+
});
|
|
3339
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
3340
|
+
if (isDebug) {
|
|
3341
|
+
console.debug('PersonalizationContainer', {
|
|
3342
|
+
attributes,
|
|
3343
|
+
variants,
|
|
3344
|
+
winningVariantIndex
|
|
3345
|
+
});
|
|
3346
|
+
}
|
|
3347
|
+
if (winningVariantIndex !== -1) {
|
|
3348
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3349
|
+
if (winningVariant) {
|
|
3350
|
+
const parentNode = winningVariant.parentNode;
|
|
3351
|
+
if (parentNode) {
|
|
3352
|
+
const newParent = parentNode.cloneNode(false);
|
|
3353
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3354
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3355
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3356
|
+
}
|
|
3357
|
+
if (isDebug) {
|
|
3358
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
} else if (variants && variants.length > 0) {
|
|
3362
|
+
removeVariants();
|
|
3363
|
+
}
|
|
3364
|
+
}`;
|
|
3365
|
+
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}";
|
|
3366
|
+
|
|
3367
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3368
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3369
|
+
const hasVariants = variants && variants.length > 0;
|
|
3370
|
+
if (TARGET === "reactNative")
|
|
3371
|
+
return false;
|
|
3372
|
+
if (!hasVariants)
|
|
3373
|
+
return false;
|
|
3374
|
+
if (!canTrack)
|
|
3375
|
+
return false;
|
|
3376
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3377
|
+
return true;
|
|
3378
|
+
if (isBrowser())
|
|
3379
|
+
return false;
|
|
3380
|
+
return true;
|
|
3381
|
+
}
|
|
3382
|
+
function getBlocksToRender({
|
|
3383
|
+
variants,
|
|
3384
|
+
previewingIndex,
|
|
3385
|
+
isHydrated,
|
|
3386
|
+
filteredVariants,
|
|
3387
|
+
fallbackBlocks
|
|
3388
|
+
}) {
|
|
3389
|
+
const fallback = {
|
|
3390
|
+
blocks: fallbackBlocks ?? [],
|
|
3391
|
+
path: "this.children"
|
|
3392
|
+
};
|
|
3393
|
+
if (isHydrated && isEditing()) {
|
|
3394
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3395
|
+
const variant = variants[previewingIndex];
|
|
3396
|
+
return {
|
|
3397
|
+
blocks: variant.blocks,
|
|
3398
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3399
|
+
};
|
|
3400
|
+
}
|
|
3401
|
+
return fallback;
|
|
3402
|
+
}
|
|
3403
|
+
if (isBrowser()) {
|
|
3404
|
+
const winningVariant = filteredVariants?.[0];
|
|
3405
|
+
if (winningVariant) {
|
|
3406
|
+
return {
|
|
3407
|
+
blocks: winningVariant.blocks,
|
|
3408
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3409
|
+
};
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
return fallback;
|
|
3413
|
+
}
|
|
3414
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3415
|
+
return `
|
|
3416
|
+
(function() {
|
|
3417
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3418
|
+
${PERSONALIZATION_SCRIPT}
|
|
3419
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3420
|
+
})();
|
|
3421
|
+
`;
|
|
3422
|
+
};
|
|
3423
|
+
|
|
3424
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3425
|
+
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
3426
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
3427
|
+
function PersonalizationContainer(props) {
|
|
3428
|
+
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
3429
|
+
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3430
|
+
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
3431
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
3432
|
+
const [isHydrated, setIsHydrated] = createSignal(false);
|
|
3433
|
+
const filteredVariants = createMemo(() => {
|
|
3434
|
+
return (props.variants || []).filter((variant) => {
|
|
3435
|
+
return filterWithCustomTargeting({
|
|
3436
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3437
|
+
locale: props.builderContext?.rootState?.locale
|
|
3438
|
+
} : {},
|
|
3439
|
+
...userAttributes()
|
|
3440
|
+
}, variant.query, variant.startDate, variant.endDate);
|
|
3441
|
+
});
|
|
3442
|
+
});
|
|
3443
|
+
const blocksToRender = createMemo(() => {
|
|
3444
|
+
return getBlocksToRender({
|
|
3445
|
+
variants: props.variants,
|
|
3446
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3447
|
+
isHydrated: isHydrated(),
|
|
3448
|
+
filteredVariants: filteredVariants(),
|
|
3449
|
+
previewingIndex: props.previewingIndex
|
|
3450
|
+
});
|
|
3451
|
+
});
|
|
3452
|
+
const hideVariantsStyleString = createMemo(() => {
|
|
3453
|
+
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
3454
|
+
});
|
|
3455
|
+
let rootRef;
|
|
3456
|
+
onMount(() => {
|
|
3457
|
+
setIsHydrated(true);
|
|
3458
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs) => {
|
|
3459
|
+
setUserAttributes(attrs);
|
|
3460
|
+
});
|
|
3461
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3462
|
+
const variant = filteredVariants()[0];
|
|
3463
|
+
if (rootRef) {
|
|
3464
|
+
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
3465
|
+
detail: {
|
|
3466
|
+
variant: variant || "default",
|
|
3467
|
+
content: props.builderContext?.content
|
|
3468
|
+
},
|
|
3469
|
+
bubbles: true
|
|
3470
|
+
}));
|
|
3471
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3472
|
+
entries.forEach((entry) => {
|
|
3473
|
+
if (entry.isIntersecting && rootRef) {
|
|
3474
|
+
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
3475
|
+
detail: {
|
|
3476
|
+
variant: variant || "default",
|
|
3477
|
+
content: props.builderContext?.content
|
|
3478
|
+
},
|
|
3479
|
+
bubbles: true
|
|
3480
|
+
}));
|
|
3481
|
+
}
|
|
3482
|
+
});
|
|
3483
|
+
});
|
|
3484
|
+
observer.observe(rootRef);
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
unsubscribers().push(unsub);
|
|
3488
|
+
});
|
|
3489
|
+
return (() => {
|
|
3490
|
+
const _el$ = _tmpl$9();
|
|
3491
|
+
const _ref$ = rootRef;
|
|
3492
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
3493
|
+
spread(_el$, mergeProps({
|
|
3494
|
+
get ["class"]() {
|
|
3495
|
+
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
3496
|
+
}
|
|
3497
|
+
}, () => props.attributes), false, true);
|
|
3498
|
+
insert(_el$, createComponent(Show, {
|
|
3499
|
+
get when() {
|
|
3500
|
+
return shouldRenderVariants();
|
|
3501
|
+
},
|
|
3502
|
+
get children() {
|
|
3503
|
+
return [createComponent(For, {
|
|
3504
|
+
get each() {
|
|
3505
|
+
return props.variants;
|
|
3506
|
+
},
|
|
3507
|
+
children: (variant, _index) => {
|
|
3508
|
+
const index = _index();
|
|
3509
|
+
return (() => {
|
|
3510
|
+
const _el$2 = _tmpl$25();
|
|
3511
|
+
setAttribute(_el$2, "key", index);
|
|
3512
|
+
insert(_el$2, createComponent(blocks_default, {
|
|
3513
|
+
get blocks() {
|
|
3514
|
+
return variant.blocks;
|
|
3515
|
+
},
|
|
3516
|
+
get parent() {
|
|
3517
|
+
return props.builderBlock?.id;
|
|
3518
|
+
},
|
|
3519
|
+
path: `component.options.variants.${index}.blocks`
|
|
3520
|
+
}));
|
|
3521
|
+
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
3522
|
+
return _el$2;
|
|
3523
|
+
})();
|
|
3524
|
+
}
|
|
3525
|
+
}), createComponent(inlined_styles_default, {
|
|
3526
|
+
get nonce() {
|
|
3527
|
+
return props.builderContext?.nonce || "";
|
|
3528
|
+
},
|
|
3529
|
+
get styles() {
|
|
3530
|
+
return hideVariantsStyleString();
|
|
3531
|
+
},
|
|
3532
|
+
get id() {
|
|
3533
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
3534
|
+
}
|
|
3535
|
+
}), createComponent(inlined_script_default, {
|
|
3536
|
+
get nonce() {
|
|
3537
|
+
return props.builderContext?.nonce || "";
|
|
3538
|
+
},
|
|
3539
|
+
get scriptStr() {
|
|
3540
|
+
return scriptStr();
|
|
3541
|
+
},
|
|
3542
|
+
get id() {
|
|
3543
|
+
return `variants-script-${props.builderBlock?.id}`;
|
|
3544
|
+
}
|
|
3545
|
+
})];
|
|
3546
|
+
}
|
|
3547
|
+
}), null);
|
|
3548
|
+
insert(_el$, createComponent(blocks_default, {
|
|
3549
|
+
get blocks() {
|
|
3550
|
+
return blocksToRender().blocks;
|
|
3551
|
+
},
|
|
3552
|
+
get parent() {
|
|
3553
|
+
return props.builderBlock?.id;
|
|
3554
|
+
},
|
|
3555
|
+
get path() {
|
|
3556
|
+
return blocksToRender().path;
|
|
3557
|
+
}
|
|
3558
|
+
}), null);
|
|
3559
|
+
return _el$;
|
|
3560
|
+
})();
|
|
3561
|
+
}
|
|
3562
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3563
|
+
|
|
3564
|
+
// src/blocks/section/component-info.ts
|
|
3565
|
+
var componentInfo7 = {
|
|
3090
3566
|
name: "Core:Section",
|
|
3091
3567
|
static: true,
|
|
3092
3568
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -3128,7 +3604,7 @@ var componentInfo6 = {
|
|
|
3128
3604
|
};
|
|
3129
3605
|
|
|
3130
3606
|
// src/blocks/slot/component-info.ts
|
|
3131
|
-
var
|
|
3607
|
+
var componentInfo8 = {
|
|
3132
3608
|
name: "Slot",
|
|
3133
3609
|
isRSC: true,
|
|
3134
3610
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -3146,10 +3622,10 @@ var componentInfo7 = {
|
|
|
3146
3622
|
builderComponents: true
|
|
3147
3623
|
}
|
|
3148
3624
|
};
|
|
3149
|
-
var _tmpl$
|
|
3625
|
+
var _tmpl$10 = /* @__PURE__ */ template(`<div>`);
|
|
3150
3626
|
function Slot(props) {
|
|
3151
3627
|
return (() => {
|
|
3152
|
-
const _el$ = _tmpl$
|
|
3628
|
+
const _el$ = _tmpl$10();
|
|
3153
3629
|
_el$.style.setProperty("pointer-events", "auto");
|
|
3154
3630
|
spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
|
|
3155
3631
|
"builder-slot": props.name
|
|
@@ -3177,7 +3653,7 @@ function Slot(props) {
|
|
|
3177
3653
|
var slot_default = Slot;
|
|
3178
3654
|
|
|
3179
3655
|
// src/blocks/symbol/component-info.ts
|
|
3180
|
-
var
|
|
3656
|
+
var componentInfo9 = {
|
|
3181
3657
|
name: "Symbol",
|
|
3182
3658
|
noWrap: true,
|
|
3183
3659
|
static: true,
|
|
@@ -3259,7 +3735,7 @@ var defaultElement = {
|
|
|
3259
3735
|
}
|
|
3260
3736
|
}
|
|
3261
3737
|
};
|
|
3262
|
-
var
|
|
3738
|
+
var componentInfo10 = {
|
|
3263
3739
|
name: "Builder: Tabs",
|
|
3264
3740
|
inputs: [{
|
|
3265
3741
|
name: "tabs",
|
|
@@ -3363,8 +3839,8 @@ var componentInfo9 = {
|
|
|
3363
3839
|
builderLinkComponent: true
|
|
3364
3840
|
}
|
|
3365
3841
|
};
|
|
3366
|
-
var _tmpl$
|
|
3367
|
-
var _tmpl$
|
|
3842
|
+
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
3843
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
3368
3844
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
3369
3845
|
function Tabs(props) {
|
|
3370
3846
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -3379,7 +3855,7 @@ function Tabs(props) {
|
|
|
3379
3855
|
}
|
|
3380
3856
|
}
|
|
3381
3857
|
return (() => {
|
|
3382
|
-
const _el$ = _tmpl$
|
|
3858
|
+
const _el$ = _tmpl$26(), _el$2 = _el$.firstChild;
|
|
3383
3859
|
_el$2.style.setProperty("display", "flex");
|
|
3384
3860
|
_el$2.style.setProperty("flex-direction", "row");
|
|
3385
3861
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -3431,7 +3907,7 @@ function Tabs(props) {
|
|
|
3431
3907
|
return activeTabContent(activeTab());
|
|
3432
3908
|
},
|
|
3433
3909
|
get children() {
|
|
3434
|
-
const _el$3 = _tmpl$
|
|
3910
|
+
const _el$3 = _tmpl$11();
|
|
3435
3911
|
insert(_el$3, createComponent(blocks_default, {
|
|
3436
3912
|
get parent() {
|
|
3437
3913
|
return props.builderBlock.id;
|
|
@@ -3463,7 +3939,7 @@ var tabs_default = Tabs;
|
|
|
3463
3939
|
delegateEvents(["click"]);
|
|
3464
3940
|
|
|
3465
3941
|
// src/blocks/text/component-info.ts
|
|
3466
|
-
var
|
|
3942
|
+
var componentInfo11 = {
|
|
3467
3943
|
shouldReceiveBuilderProps: {
|
|
3468
3944
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3469
3945
|
builderContext: true
|
|
@@ -3486,10 +3962,10 @@ var componentInfo10 = {
|
|
|
3486
3962
|
textAlign: "center"
|
|
3487
3963
|
}
|
|
3488
3964
|
};
|
|
3489
|
-
var _tmpl$
|
|
3965
|
+
var _tmpl$12 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
3490
3966
|
function Text(props) {
|
|
3491
3967
|
return (() => {
|
|
3492
|
-
const _el$ = _tmpl$
|
|
3968
|
+
const _el$ = _tmpl$12();
|
|
3493
3969
|
_el$.style.setProperty("outline", "none");
|
|
3494
3970
|
effect(() => _el$.innerHTML = props.text?.toString() || "");
|
|
3495
3971
|
return _el$;
|
|
@@ -3498,7 +3974,7 @@ function Text(props) {
|
|
|
3498
3974
|
var text_default = Text;
|
|
3499
3975
|
|
|
3500
3976
|
// src/blocks/custom-code/component-info.ts
|
|
3501
|
-
var
|
|
3977
|
+
var componentInfo12 = {
|
|
3502
3978
|
name: "Custom Code",
|
|
3503
3979
|
static: true,
|
|
3504
3980
|
requiredPermissions: ["editCode"],
|
|
@@ -3521,7 +3997,7 @@ var componentInfo11 = {
|
|
|
3521
3997
|
advanced: true
|
|
3522
3998
|
}]
|
|
3523
3999
|
};
|
|
3524
|
-
var _tmpl$
|
|
4000
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
|
|
3525
4001
|
function CustomCode(props) {
|
|
3526
4002
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
3527
4003
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -3556,7 +4032,7 @@ function CustomCode(props) {
|
|
|
3556
4032
|
}
|
|
3557
4033
|
});
|
|
3558
4034
|
return (() => {
|
|
3559
|
-
const _el$ = _tmpl$
|
|
4035
|
+
const _el$ = _tmpl$13();
|
|
3560
4036
|
const _ref$ = elementRef;
|
|
3561
4037
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3562
4038
|
effect((_p$) => {
|
|
@@ -3574,7 +4050,7 @@ function CustomCode(props) {
|
|
|
3574
4050
|
var custom_code_default = CustomCode;
|
|
3575
4051
|
|
|
3576
4052
|
// src/blocks/embed/component-info.ts
|
|
3577
|
-
var
|
|
4053
|
+
var componentInfo13 = {
|
|
3578
4054
|
name: "Embed",
|
|
3579
4055
|
static: true,
|
|
3580
4056
|
inputs: [{
|
|
@@ -3596,7 +4072,7 @@ var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "applicati
|
|
|
3596
4072
|
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
3597
4073
|
|
|
3598
4074
|
// src/blocks/embed/embed.tsx
|
|
3599
|
-
var _tmpl$
|
|
4075
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<div class=builder-embed>`);
|
|
3600
4076
|
function Embed(props) {
|
|
3601
4077
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
3602
4078
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -3634,7 +4110,7 @@ function Embed(props) {
|
|
|
3634
4110
|
}
|
|
3635
4111
|
createEffect(on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0));
|
|
3636
4112
|
return (() => {
|
|
3637
|
-
const _el$ = _tmpl$
|
|
4113
|
+
const _el$ = _tmpl$14();
|
|
3638
4114
|
const _ref$ = elem;
|
|
3639
4115
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
|
|
3640
4116
|
effect(() => _el$.innerHTML = props.content);
|
|
@@ -3644,7 +4120,7 @@ function Embed(props) {
|
|
|
3644
4120
|
var embed_default = Embed;
|
|
3645
4121
|
|
|
3646
4122
|
// src/blocks/form/form/component-info.ts
|
|
3647
|
-
var
|
|
4123
|
+
var componentInfo14 = {
|
|
3648
4124
|
name: "Form:Form",
|
|
3649
4125
|
// editableTags: ['builder-form-error']
|
|
3650
4126
|
defaults: {
|
|
@@ -3900,8 +4376,8 @@ function logFetch(url) {
|
|
|
3900
4376
|
}
|
|
3901
4377
|
|
|
3902
4378
|
// src/blocks/form/form/form.tsx
|
|
3903
|
-
var _tmpl$
|
|
3904
|
-
var _tmpl$
|
|
4379
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
4380
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<form>`);
|
|
3905
4381
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
3906
4382
|
padding: 10px;
|
|
3907
4383
|
color: red;
|
|
@@ -4094,7 +4570,7 @@ function FormComponent(props) {
|
|
|
4094
4570
|
}
|
|
4095
4571
|
let formRef;
|
|
4096
4572
|
return [(() => {
|
|
4097
|
-
const _el$ = _tmpl$
|
|
4573
|
+
const _el$ = _tmpl$27();
|
|
4098
4574
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
4099
4575
|
const _ref$ = formRef;
|
|
4100
4576
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -4150,7 +4626,7 @@ function FormComponent(props) {
|
|
|
4150
4626
|
return memo(() => submissionState() === "error")() && responseData();
|
|
4151
4627
|
},
|
|
4152
4628
|
get children() {
|
|
4153
|
-
const _el$2 = _tmpl$
|
|
4629
|
+
const _el$2 = _tmpl$15();
|
|
4154
4630
|
insert(_el$2, () => JSON.stringify(responseData(), null, 2));
|
|
4155
4631
|
return _el$2;
|
|
4156
4632
|
}
|
|
@@ -4177,7 +4653,7 @@ function FormComponent(props) {
|
|
|
4177
4653
|
var form_default = FormComponent;
|
|
4178
4654
|
|
|
4179
4655
|
// src/blocks/form/input/component-info.ts
|
|
4180
|
-
var
|
|
4656
|
+
var componentInfo15 = {
|
|
4181
4657
|
name: "Form:Input",
|
|
4182
4658
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
4183
4659
|
inputs: [
|
|
@@ -4229,10 +4705,10 @@ var componentInfo14 = {
|
|
|
4229
4705
|
borderColor: "#ccc"
|
|
4230
4706
|
}
|
|
4231
4707
|
};
|
|
4232
|
-
var _tmpl$
|
|
4708
|
+
var _tmpl$16 = /* @__PURE__ */ template(`<input>`);
|
|
4233
4709
|
function FormInputComponent(props) {
|
|
4234
4710
|
return (() => {
|
|
4235
|
-
const _el$ = _tmpl$
|
|
4711
|
+
const _el$ = _tmpl$16();
|
|
4236
4712
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4237
4713
|
get key() {
|
|
4238
4714
|
return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
|
|
@@ -4262,7 +4738,7 @@ function FormInputComponent(props) {
|
|
|
4262
4738
|
var input_default = FormInputComponent;
|
|
4263
4739
|
|
|
4264
4740
|
// src/blocks/form/select/component-info.ts
|
|
4265
|
-
var
|
|
4741
|
+
var componentInfo16 = {
|
|
4266
4742
|
name: "Form:Select",
|
|
4267
4743
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
4268
4744
|
defaultStyles: {
|
|
@@ -4305,11 +4781,11 @@ var componentInfo15 = {
|
|
|
4305
4781
|
static: true,
|
|
4306
4782
|
noWrap: true
|
|
4307
4783
|
};
|
|
4308
|
-
var _tmpl$
|
|
4309
|
-
var _tmpl$
|
|
4784
|
+
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
4785
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<option>`);
|
|
4310
4786
|
function SelectComponent(props) {
|
|
4311
4787
|
return (() => {
|
|
4312
|
-
const _el$ = _tmpl$
|
|
4788
|
+
const _el$ = _tmpl$17();
|
|
4313
4789
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4314
4790
|
get value() {
|
|
4315
4791
|
return props.value;
|
|
@@ -4334,7 +4810,7 @@ function SelectComponent(props) {
|
|
|
4334
4810
|
children: (option, _index) => {
|
|
4335
4811
|
const index = _index();
|
|
4336
4812
|
return (() => {
|
|
4337
|
-
const _el$2 = _tmpl$
|
|
4813
|
+
const _el$2 = _tmpl$28();
|
|
4338
4814
|
insert(_el$2, () => option.name || option.value);
|
|
4339
4815
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
4340
4816
|
effect(() => _el$2.value = option.value);
|
|
@@ -4348,7 +4824,7 @@ function SelectComponent(props) {
|
|
|
4348
4824
|
var select_default = SelectComponent;
|
|
4349
4825
|
|
|
4350
4826
|
// src/blocks/form/submit-button/component-info.ts
|
|
4351
|
-
var
|
|
4827
|
+
var componentInfo17 = {
|
|
4352
4828
|
name: "Form:SubmitButton",
|
|
4353
4829
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
4354
4830
|
defaultStyles: {
|
|
@@ -4374,10 +4850,10 @@ var componentInfo16 = {
|
|
|
4374
4850
|
// TODO: defaultChildren
|
|
4375
4851
|
// canHaveChildren: true,
|
|
4376
4852
|
};
|
|
4377
|
-
var _tmpl$
|
|
4853
|
+
var _tmpl$18 = /* @__PURE__ */ template(`<button type=submit>`);
|
|
4378
4854
|
function SubmitButton(props) {
|
|
4379
4855
|
return (() => {
|
|
4380
|
-
const _el$ = _tmpl$
|
|
4856
|
+
const _el$ = _tmpl$18();
|
|
4381
4857
|
spread(_el$, mergeProps({}, () => props.attributes), false, true);
|
|
4382
4858
|
insert(_el$, () => props.text);
|
|
4383
4859
|
return _el$;
|
|
@@ -4386,7 +4862,7 @@ function SubmitButton(props) {
|
|
|
4386
4862
|
var submit_button_default = SubmitButton;
|
|
4387
4863
|
|
|
4388
4864
|
// src/blocks/form/textarea/component-info.ts
|
|
4389
|
-
var
|
|
4865
|
+
var componentInfo18 = {
|
|
4390
4866
|
name: "Form:TextArea",
|
|
4391
4867
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
4392
4868
|
inputs: [{
|
|
@@ -4423,10 +4899,10 @@ var componentInfo17 = {
|
|
|
4423
4899
|
static: true,
|
|
4424
4900
|
noWrap: true
|
|
4425
4901
|
};
|
|
4426
|
-
var _tmpl$
|
|
4902
|
+
var _tmpl$19 = /* @__PURE__ */ template(`<textarea>`);
|
|
4427
4903
|
function Textarea(props) {
|
|
4428
4904
|
return (() => {
|
|
4429
|
-
const _el$ = _tmpl$
|
|
4905
|
+
const _el$ = _tmpl$19();
|
|
4430
4906
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4431
4907
|
get placeholder() {
|
|
4432
4908
|
return props.placeholder;
|
|
@@ -4450,7 +4926,7 @@ function Textarea(props) {
|
|
|
4450
4926
|
var textarea_default = Textarea;
|
|
4451
4927
|
|
|
4452
4928
|
// src/blocks/img/component-info.ts
|
|
4453
|
-
var
|
|
4929
|
+
var componentInfo19 = {
|
|
4454
4930
|
// friendlyName?
|
|
4455
4931
|
name: "Raw:Img",
|
|
4456
4932
|
hideFromInsertMenu: true,
|
|
@@ -4465,10 +4941,10 @@ var componentInfo18 = {
|
|
|
4465
4941
|
noWrap: true,
|
|
4466
4942
|
static: true
|
|
4467
4943
|
};
|
|
4468
|
-
var _tmpl$
|
|
4944
|
+
var _tmpl$20 = /* @__PURE__ */ template(`<img>`);
|
|
4469
4945
|
function ImgComponent(props) {
|
|
4470
4946
|
return (() => {
|
|
4471
|
-
const _el$ = _tmpl$
|
|
4947
|
+
const _el$ = _tmpl$20();
|
|
4472
4948
|
spread(_el$, mergeProps({
|
|
4473
4949
|
get style() {
|
|
4474
4950
|
return {
|
|
@@ -4492,7 +4968,7 @@ function ImgComponent(props) {
|
|
|
4492
4968
|
var img_default = ImgComponent;
|
|
4493
4969
|
|
|
4494
4970
|
// src/blocks/video/component-info.ts
|
|
4495
|
-
var
|
|
4971
|
+
var componentInfo20 = {
|
|
4496
4972
|
name: "Video",
|
|
4497
4973
|
canHaveChildren: true,
|
|
4498
4974
|
defaultStyles: {
|
|
@@ -4577,8 +5053,8 @@ var componentInfo19 = {
|
|
|
4577
5053
|
builderBlock: true
|
|
4578
5054
|
}
|
|
4579
5055
|
};
|
|
4580
|
-
var _tmpl$
|
|
4581
|
-
var _tmpl$
|
|
5056
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
5057
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
4582
5058
|
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
4583
5059
|
function Video(props) {
|
|
4584
5060
|
const videoProps = createMemo(() => {
|
|
@@ -4639,7 +5115,7 @@ function Video(props) {
|
|
|
4639
5115
|
return !props.lazyLoad;
|
|
4640
5116
|
},
|
|
4641
5117
|
get children() {
|
|
4642
|
-
const _el$3 = _tmpl$
|
|
5118
|
+
const _el$3 = _tmpl$21();
|
|
4643
5119
|
effect(() => setAttribute(_el$3, "src", props.video));
|
|
4644
5120
|
return _el$3;
|
|
4645
5121
|
}
|
|
@@ -4649,7 +5125,7 @@ function Video(props) {
|
|
|
4649
5125
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
4650
5126
|
},
|
|
4651
5127
|
get children() {
|
|
4652
|
-
const _el$4 = _tmpl$
|
|
5128
|
+
const _el$4 = _tmpl$29();
|
|
4653
5129
|
_el$4.style.setProperty("width", "100%");
|
|
4654
5130
|
_el$4.style.setProperty("pointer-events", "none");
|
|
4655
5131
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -4662,7 +5138,7 @@ function Video(props) {
|
|
|
4662
5138
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
4663
5139
|
},
|
|
4664
5140
|
get children() {
|
|
4665
|
-
const _el$5 = _tmpl$
|
|
5141
|
+
const _el$5 = _tmpl$29();
|
|
4666
5142
|
_el$5.style.setProperty("display", "flex");
|
|
4667
5143
|
_el$5.style.setProperty("flex-direction", "column");
|
|
4668
5144
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -4675,7 +5151,7 @@ function Video(props) {
|
|
|
4675
5151
|
return props.builderBlock?.children?.length && !props.fitContent;
|
|
4676
5152
|
},
|
|
4677
5153
|
get children() {
|
|
4678
|
-
const _el$6 = _tmpl$
|
|
5154
|
+
const _el$6 = _tmpl$29();
|
|
4679
5155
|
_el$6.style.setProperty("pointer-events", "none");
|
|
4680
5156
|
_el$6.style.setProperty("display", "flex");
|
|
4681
5157
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -4697,31 +5173,31 @@ var video_default = Video;
|
|
|
4697
5173
|
// src/constants/extra-components.ts
|
|
4698
5174
|
var getExtraComponents = () => [{
|
|
4699
5175
|
component: custom_code_default,
|
|
4700
|
-
...
|
|
5176
|
+
...componentInfo12
|
|
4701
5177
|
}, {
|
|
4702
5178
|
component: embed_default,
|
|
4703
|
-
...
|
|
5179
|
+
...componentInfo13
|
|
4704
5180
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4705
5181
|
component: form_default,
|
|
4706
|
-
...
|
|
5182
|
+
...componentInfo14
|
|
4707
5183
|
}, {
|
|
4708
5184
|
component: input_default,
|
|
4709
|
-
...
|
|
5185
|
+
...componentInfo15
|
|
4710
5186
|
}, {
|
|
4711
5187
|
component: submit_button_default,
|
|
4712
|
-
...
|
|
5188
|
+
...componentInfo17
|
|
4713
5189
|
}, {
|
|
4714
5190
|
component: select_default,
|
|
4715
|
-
...
|
|
5191
|
+
...componentInfo16
|
|
4716
5192
|
}, {
|
|
4717
5193
|
component: textarea_default,
|
|
4718
|
-
...
|
|
5194
|
+
...componentInfo18
|
|
4719
5195
|
}], {
|
|
4720
5196
|
component: img_default,
|
|
4721
|
-
...
|
|
5197
|
+
...componentInfo19
|
|
4722
5198
|
}, {
|
|
4723
5199
|
component: video_default,
|
|
4724
|
-
...
|
|
5200
|
+
...componentInfo20
|
|
4725
5201
|
}];
|
|
4726
5202
|
|
|
4727
5203
|
// src/constants/builder-registered-components.ts
|
|
@@ -4739,19 +5215,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4739
5215
|
...componentInfo5
|
|
4740
5216
|
}, {
|
|
4741
5217
|
component: section_default,
|
|
4742
|
-
...
|
|
5218
|
+
...componentInfo7
|
|
4743
5219
|
}, {
|
|
4744
5220
|
component: slot_default,
|
|
4745
|
-
...
|
|
5221
|
+
...componentInfo8
|
|
4746
5222
|
}, {
|
|
4747
5223
|
component: symbol_default,
|
|
4748
|
-
...
|
|
5224
|
+
...componentInfo9
|
|
4749
5225
|
}, {
|
|
4750
5226
|
component: text_default,
|
|
4751
|
-
...
|
|
4752
|
-
}, ...TARGET === "
|
|
5227
|
+
...componentInfo11
|
|
5228
|
+
}, ...TARGET === "react" ? [{
|
|
5229
|
+
component: personalization_container_default,
|
|
5230
|
+
...componentInfo6
|
|
5231
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4753
5232
|
component: tabs_default,
|
|
4754
|
-
...
|
|
5233
|
+
...componentInfo10
|
|
4755
5234
|
}, {
|
|
4756
5235
|
component: accordion_default,
|
|
4757
5236
|
...componentInfo
|
|
@@ -4789,7 +5268,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4789
5268
|
testVariationId: variant.id,
|
|
4790
5269
|
id: content?.id
|
|
4791
5270
|
}));
|
|
4792
|
-
var
|
|
5271
|
+
var checkShouldRenderVariants2 = ({
|
|
4793
5272
|
canTrack,
|
|
4794
5273
|
content
|
|
4795
5274
|
}) => {
|
|
@@ -4822,25 +5301,6 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4822
5301
|
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
4823
5302
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4824
5303
|
)`;
|
|
4825
|
-
var _tmpl$20 = /* @__PURE__ */ template(`<script>`);
|
|
4826
|
-
function InlinedScript(props) {
|
|
4827
|
-
return (() => {
|
|
4828
|
-
const _el$ = _tmpl$20();
|
|
4829
|
-
effect((_p$) => {
|
|
4830
|
-
const _v$ = props.scriptStr, _v$2 = props.id, _v$3 = props.nonce || "";
|
|
4831
|
-
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
4832
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
4833
|
-
_v$3 !== _p$._v$3 && setAttribute(_el$, "nonce", _p$._v$3 = _v$3);
|
|
4834
|
-
return _p$;
|
|
4835
|
-
}, {
|
|
4836
|
-
_v$: void 0,
|
|
4837
|
-
_v$2: void 0,
|
|
4838
|
-
_v$3: void 0
|
|
4839
|
-
});
|
|
4840
|
-
return _el$;
|
|
4841
|
-
})();
|
|
4842
|
-
}
|
|
4843
|
-
var inlined_script_default = InlinedScript;
|
|
4844
5304
|
|
|
4845
5305
|
// src/helpers/preview-lru-cache/get.ts
|
|
4846
5306
|
function getPreviewContent(_searchParams) {
|
|
@@ -4848,7 +5308,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4848
5308
|
}
|
|
4849
5309
|
|
|
4850
5310
|
// src/constants/sdk-version.ts
|
|
4851
|
-
var SDK_VERSION = "3.0.
|
|
5311
|
+
var SDK_VERSION = "3.0.7";
|
|
4852
5312
|
|
|
4853
5313
|
// src/helpers/sdk-headers.ts
|
|
4854
5314
|
var getSdkHeaders = () => ({
|
|
@@ -5145,16 +5605,6 @@ async function fetchEntries(options) {
|
|
|
5145
5605
|
return _processContentResult(options, content);
|
|
5146
5606
|
}
|
|
5147
5607
|
|
|
5148
|
-
// src/functions/is-previewing.ts
|
|
5149
|
-
function isPreviewing(_search) {
|
|
5150
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
5151
|
-
if (!search) {
|
|
5152
|
-
return false;
|
|
5153
|
-
}
|
|
5154
|
-
const normalizedSearch = getSearchString(search);
|
|
5155
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
5156
|
-
}
|
|
5157
|
-
|
|
5158
5608
|
// src/helpers/uuid.ts
|
|
5159
5609
|
function uuidv4() {
|
|
5160
5610
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -5481,7 +5931,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5481
5931
|
// Supports builder-model="..." attribute which is needed to
|
|
5482
5932
|
// scope our '+ add block' button styling
|
|
5483
5933
|
supportsAddBlockScoping: true,
|
|
5484
|
-
supportsCustomBreakpoints: true
|
|
5934
|
+
supportsCustomBreakpoints: true,
|
|
5935
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5936
|
+
blockLevelPersonalization: true
|
|
5485
5937
|
}
|
|
5486
5938
|
}, "*");
|
|
5487
5939
|
window.parent?.postMessage({
|
|
@@ -6218,7 +6670,7 @@ var content_default = ContentComponent;
|
|
|
6218
6670
|
|
|
6219
6671
|
// src/components/content-variants/content-variants.tsx
|
|
6220
6672
|
function ContentVariants(props) {
|
|
6221
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
6673
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants2({
|
|
6222
6674
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
6223
6675
|
content: props.content
|
|
6224
6676
|
}));
|
|
@@ -6444,7 +6896,7 @@ var fetchSymbolContent = async ({
|
|
|
6444
6896
|
};
|
|
6445
6897
|
|
|
6446
6898
|
// src/blocks/symbol/symbol.tsx
|
|
6447
|
-
var _tmpl$
|
|
6899
|
+
var _tmpl$30 = /* @__PURE__ */ template(`<div>`);
|
|
6448
6900
|
function Symbol(props) {
|
|
6449
6901
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
6450
6902
|
const blocksWrapper = createMemo(() => {
|
|
@@ -6476,7 +6928,7 @@ function Symbol(props) {
|
|
|
6476
6928
|
}
|
|
6477
6929
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
6478
6930
|
return (() => {
|
|
6479
|
-
const _el$ = _tmpl$
|
|
6931
|
+
const _el$ = _tmpl$30();
|
|
6480
6932
|
spread(_el$, mergeProps({
|
|
6481
6933
|
get ["class"]() {
|
|
6482
6934
|
return className();
|
|
@@ -6568,4 +7020,4 @@ var fetchBuilderProps = async (_args) => {
|
|
|
6568
7020
|
};
|
|
6569
7021
|
};
|
|
6570
7022
|
|
|
6571
|
-
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setEditorSettings, subscribeToEditor, track };
|
|
7023
|
+
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|