@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/index.js
CHANGED
|
@@ -930,8 +930,13 @@ var provideBuilderContext = (block, context) => {
|
|
|
930
930
|
|
|
931
931
|
// src/constants/device-sizes.ts
|
|
932
932
|
var SIZES = {
|
|
933
|
+
xsmall: {
|
|
934
|
+
min: 0,
|
|
935
|
+
default: 160,
|
|
936
|
+
max: 320
|
|
937
|
+
},
|
|
933
938
|
small: {
|
|
934
|
-
min:
|
|
939
|
+
min: 321,
|
|
935
940
|
default: 321,
|
|
936
941
|
max: 640
|
|
937
942
|
},
|
|
@@ -947,15 +952,28 @@ var SIZES = {
|
|
|
947
952
|
}
|
|
948
953
|
};
|
|
949
954
|
var getMaxWidthQueryForSize = (size, sizeValues = SIZES) => `@media (max-width: ${sizeValues[size].max}px)`;
|
|
950
|
-
var getSizesForBreakpoints = ({
|
|
951
|
-
small,
|
|
952
|
-
medium
|
|
953
|
-
}) => {
|
|
955
|
+
var getSizesForBreakpoints = (breakpoints) => {
|
|
954
956
|
const newSizes = fastClone(SIZES);
|
|
957
|
+
if (!breakpoints) {
|
|
958
|
+
return newSizes;
|
|
959
|
+
}
|
|
960
|
+
const {
|
|
961
|
+
xsmall,
|
|
962
|
+
small,
|
|
963
|
+
medium
|
|
964
|
+
} = breakpoints;
|
|
965
|
+
if (xsmall) {
|
|
966
|
+
const xsmallMin = Math.floor(xsmall / 2);
|
|
967
|
+
newSizes.xsmall = {
|
|
968
|
+
max: xsmall,
|
|
969
|
+
min: xsmallMin,
|
|
970
|
+
default: xsmallMin + 1
|
|
971
|
+
};
|
|
972
|
+
}
|
|
955
973
|
if (!small || !medium) {
|
|
956
974
|
return newSizes;
|
|
957
975
|
}
|
|
958
|
-
const smallMin = Math.floor(small / 2);
|
|
976
|
+
const smallMin = xsmall ? newSizes.xsmall.max + 1 : Math.floor(small / 2);
|
|
959
977
|
newSizes.small = {
|
|
960
978
|
max: small,
|
|
961
979
|
min: smallMin,
|
|
@@ -1013,9 +1031,11 @@ function BlockStyles(props) {
|
|
|
1013
1031
|
const styles = processedBlock.responsiveStyles;
|
|
1014
1032
|
const content = props.context.content;
|
|
1015
1033
|
const sizesWithUpdatedBreakpoints = getSizesForBreakpoints(content?.meta?.breakpoints || {});
|
|
1034
|
+
const contentHasXSmallBreakpoint = Boolean(content?.meta?.breakpoints?.xsmall);
|
|
1016
1035
|
const largeStyles = styles?.large;
|
|
1017
1036
|
const mediumStyles = styles?.medium;
|
|
1018
1037
|
const smallStyles = styles?.small;
|
|
1038
|
+
const xsmallStyles = styles?.xsmall;
|
|
1019
1039
|
const className = processedBlock.id;
|
|
1020
1040
|
if (!className) {
|
|
1021
1041
|
return "";
|
|
@@ -1034,6 +1054,11 @@ function BlockStyles(props) {
|
|
|
1034
1054
|
styles: smallStyles,
|
|
1035
1055
|
mediaQuery: getMaxWidthQueryForSize("small", sizesWithUpdatedBreakpoints)
|
|
1036
1056
|
}) : "";
|
|
1057
|
+
const xsmallStylesClass = xsmallStyles && contentHasXSmallBreakpoint ? createCssClass({
|
|
1058
|
+
className,
|
|
1059
|
+
styles: xsmallStyles,
|
|
1060
|
+
mediaQuery: getMaxWidthQueryForSize("xsmall", sizesWithUpdatedBreakpoints)
|
|
1061
|
+
}) : "";
|
|
1037
1062
|
const hoverAnimation = processedBlock.animations && processedBlock.animations.find((item) => item.trigger === "hover");
|
|
1038
1063
|
let hoverStylesClass = "";
|
|
1039
1064
|
if (hoverAnimation) {
|
|
@@ -1047,7 +1072,7 @@ function BlockStyles(props) {
|
|
|
1047
1072
|
}
|
|
1048
1073
|
}) || "";
|
|
1049
1074
|
}
|
|
1050
|
-
return [largeStylesClass, mediumStylesClass, smallStylesClass, hoverStylesClass].join(" ");
|
|
1075
|
+
return [largeStylesClass, mediumStylesClass, smallStylesClass, xsmallStylesClass, hoverStylesClass].join(" ");
|
|
1051
1076
|
});
|
|
1052
1077
|
return createComponent(Show, {
|
|
1053
1078
|
get when() {
|
|
@@ -1607,7 +1632,7 @@ function Block(props) {
|
|
|
1607
1632
|
});
|
|
1608
1633
|
}
|
|
1609
1634
|
var block_default = Block;
|
|
1610
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-
|
|
1635
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<style>.dynamic-3d7ff108 {
|
|
1611
1636
|
display: flex;
|
|
1612
1637
|
flex-direction: column;
|
|
1613
1638
|
align-items: stretch;
|
|
@@ -1620,8 +1645,9 @@ function BlocksWrapper(props) {
|
|
|
1620
1645
|
if (!props.path) {
|
|
1621
1646
|
return void 0;
|
|
1622
1647
|
}
|
|
1648
|
+
const thisPrefix = "this.";
|
|
1623
1649
|
const pathPrefix = "component.options.";
|
|
1624
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1650
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1625
1651
|
});
|
|
1626
1652
|
function onClick() {
|
|
1627
1653
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1650,7 +1676,7 @@ function BlocksWrapper(props) {
|
|
|
1650
1676
|
});
|
|
1651
1677
|
return [createComponent(Dynamic, mergeProps({
|
|
1652
1678
|
get ["class"]() {
|
|
1653
|
-
return className() + " dynamic-
|
|
1679
|
+
return className() + " dynamic-3d7ff108";
|
|
1654
1680
|
},
|
|
1655
1681
|
ref(r$) {
|
|
1656
1682
|
const _ref$ = blocksWrapperRef;
|
|
@@ -2343,8 +2369,58 @@ var handleABTesting = async ({
|
|
|
2343
2369
|
};
|
|
2344
2370
|
};
|
|
2345
2371
|
|
|
2372
|
+
// src/helpers/user-attributes.ts
|
|
2373
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2374
|
+
function createUserAttributesService() {
|
|
2375
|
+
let canTrack = true;
|
|
2376
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2377
|
+
return {
|
|
2378
|
+
setUserAttributes(newAttrs) {
|
|
2379
|
+
if (!isBrowser()) {
|
|
2380
|
+
return;
|
|
2381
|
+
}
|
|
2382
|
+
const userAttributes = {
|
|
2383
|
+
...this.getUserAttributes(),
|
|
2384
|
+
...newAttrs
|
|
2385
|
+
};
|
|
2386
|
+
setCookie({
|
|
2387
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2388
|
+
value: JSON.stringify(userAttributes),
|
|
2389
|
+
canTrack
|
|
2390
|
+
});
|
|
2391
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2392
|
+
},
|
|
2393
|
+
getUserAttributes() {
|
|
2394
|
+
if (!isBrowser()) {
|
|
2395
|
+
return {};
|
|
2396
|
+
}
|
|
2397
|
+
return JSON.parse(getCookieSync({
|
|
2398
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2399
|
+
canTrack
|
|
2400
|
+
}) || "{}");
|
|
2401
|
+
},
|
|
2402
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2403
|
+
subscribers.add(callback);
|
|
2404
|
+
return () => {
|
|
2405
|
+
subscribers.delete(callback);
|
|
2406
|
+
};
|
|
2407
|
+
},
|
|
2408
|
+
setCanTrack(value) {
|
|
2409
|
+
canTrack = value;
|
|
2410
|
+
}
|
|
2411
|
+
};
|
|
2412
|
+
}
|
|
2413
|
+
var userAttributesService = createUserAttributesService();
|
|
2414
|
+
var setClientUserAttributes = (attributes) => {
|
|
2415
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2416
|
+
};
|
|
2417
|
+
|
|
2346
2418
|
// src/helpers/canTrack.ts
|
|
2347
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2419
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2420
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2421
|
+
userAttributesService.setCanTrack(result);
|
|
2422
|
+
return result;
|
|
2423
|
+
};
|
|
2348
2424
|
|
|
2349
2425
|
// src/blocks/accordion/component-info.ts
|
|
2350
2426
|
var defaultTitle = {
|
|
@@ -3074,8 +3150,408 @@ var componentInfo5 = {
|
|
|
3074
3150
|
}
|
|
3075
3151
|
};
|
|
3076
3152
|
|
|
3077
|
-
// src/blocks/
|
|
3153
|
+
// src/blocks/personalization-container/component-info.ts
|
|
3078
3154
|
var componentInfo6 = {
|
|
3155
|
+
name: "PersonalizationContainer",
|
|
3156
|
+
shouldReceiveBuilderProps: {
|
|
3157
|
+
builderBlock: true,
|
|
3158
|
+
builderContext: true
|
|
3159
|
+
},
|
|
3160
|
+
noWrap: true,
|
|
3161
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
3162
|
+
canHaveChildren: true,
|
|
3163
|
+
inputs: [{
|
|
3164
|
+
name: "variants",
|
|
3165
|
+
defaultValue: [],
|
|
3166
|
+
behavior: "personalizationVariantList",
|
|
3167
|
+
type: "list",
|
|
3168
|
+
subFields: [{
|
|
3169
|
+
name: "name",
|
|
3170
|
+
type: "text"
|
|
3171
|
+
}, {
|
|
3172
|
+
name: "query",
|
|
3173
|
+
friendlyName: "Targeting rules",
|
|
3174
|
+
type: "BuilderQuery",
|
|
3175
|
+
defaultValue: []
|
|
3176
|
+
}, {
|
|
3177
|
+
name: "startDate",
|
|
3178
|
+
type: "date"
|
|
3179
|
+
}, {
|
|
3180
|
+
name: "endDate",
|
|
3181
|
+
type: "date"
|
|
3182
|
+
}, {
|
|
3183
|
+
name: "blocks",
|
|
3184
|
+
type: "uiBlocks",
|
|
3185
|
+
hideFromUI: true,
|
|
3186
|
+
defaultValue: []
|
|
3187
|
+
}]
|
|
3188
|
+
}]
|
|
3189
|
+
};
|
|
3190
|
+
var _tmpl$8 = /* @__PURE__ */ template(`<script>`);
|
|
3191
|
+
function InlinedScript(props) {
|
|
3192
|
+
return (() => {
|
|
3193
|
+
const _el$ = _tmpl$8();
|
|
3194
|
+
effect((_p$) => {
|
|
3195
|
+
const _v$ = props.scriptStr, _v$2 = props.id, _v$3 = props.nonce || "";
|
|
3196
|
+
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
3197
|
+
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
3198
|
+
_v$3 !== _p$._v$3 && setAttribute(_el$, "nonce", _p$._v$3 = _v$3);
|
|
3199
|
+
return _p$;
|
|
3200
|
+
}, {
|
|
3201
|
+
_v$: void 0,
|
|
3202
|
+
_v$2: void 0,
|
|
3203
|
+
_v$3: void 0
|
|
3204
|
+
});
|
|
3205
|
+
return _el$;
|
|
3206
|
+
})();
|
|
3207
|
+
}
|
|
3208
|
+
var inlined_script_default = InlinedScript;
|
|
3209
|
+
|
|
3210
|
+
// src/functions/is-previewing.ts
|
|
3211
|
+
function isPreviewing(_search) {
|
|
3212
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3213
|
+
if (!search) {
|
|
3214
|
+
return false;
|
|
3215
|
+
}
|
|
3216
|
+
const normalizedSearch = getSearchString(search);
|
|
3217
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3218
|
+
}
|
|
3219
|
+
|
|
3220
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3221
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3222
|
+
function isString(val) {
|
|
3223
|
+
return typeof val === "string";
|
|
3224
|
+
}
|
|
3225
|
+
function isNumber(val) {
|
|
3226
|
+
return typeof val === "number";
|
|
3227
|
+
}
|
|
3228
|
+
function objectMatchesQuery(userattr, query2) {
|
|
3229
|
+
const result = (() => {
|
|
3230
|
+
const property = query2.property;
|
|
3231
|
+
const operator = query2.operator;
|
|
3232
|
+
let testValue = query2.value;
|
|
3233
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3234
|
+
testValue = query2.value.slice(0, -1);
|
|
3235
|
+
}
|
|
3236
|
+
if (!(property && operator)) {
|
|
3237
|
+
return true;
|
|
3238
|
+
}
|
|
3239
|
+
if (Array.isArray(testValue)) {
|
|
3240
|
+
if (operator === "isNot") {
|
|
3241
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3242
|
+
property,
|
|
3243
|
+
operator,
|
|
3244
|
+
value: val
|
|
3245
|
+
}));
|
|
3246
|
+
}
|
|
3247
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3248
|
+
property,
|
|
3249
|
+
operator,
|
|
3250
|
+
value: val
|
|
3251
|
+
}));
|
|
3252
|
+
}
|
|
3253
|
+
const value = userattr[property];
|
|
3254
|
+
if (Array.isArray(value)) {
|
|
3255
|
+
return value.includes(testValue);
|
|
3256
|
+
}
|
|
3257
|
+
switch (operator) {
|
|
3258
|
+
case "is":
|
|
3259
|
+
return value === testValue;
|
|
3260
|
+
case "isNot":
|
|
3261
|
+
return value !== testValue;
|
|
3262
|
+
case "contains":
|
|
3263
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3264
|
+
case "startsWith":
|
|
3265
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
3266
|
+
case "endsWith":
|
|
3267
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
3268
|
+
case "greaterThan":
|
|
3269
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3270
|
+
case "lessThan":
|
|
3271
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3272
|
+
case "greaterThanOrEqualTo":
|
|
3273
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3274
|
+
case "lessThanOrEqualTo":
|
|
3275
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3276
|
+
default:
|
|
3277
|
+
return false;
|
|
3278
|
+
}
|
|
3279
|
+
})();
|
|
3280
|
+
return result;
|
|
3281
|
+
}
|
|
3282
|
+
const item = {
|
|
3283
|
+
query,
|
|
3284
|
+
startDate,
|
|
3285
|
+
endDate
|
|
3286
|
+
};
|
|
3287
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3288
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
3289
|
+
return false;
|
|
3290
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3291
|
+
return false;
|
|
3292
|
+
}
|
|
3293
|
+
if (!item.query || !item.query.length) {
|
|
3294
|
+
return true;
|
|
3295
|
+
}
|
|
3296
|
+
return item.query.every((filter) => {
|
|
3297
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
3298
|
+
});
|
|
3299
|
+
}
|
|
3300
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3301
|
+
if (!navigator.cookieEnabled) {
|
|
3302
|
+
return;
|
|
3303
|
+
}
|
|
3304
|
+
function getCookie(name) {
|
|
3305
|
+
const nameEQ = name + '=';
|
|
3306
|
+
const ca = document.cookie.split(';');
|
|
3307
|
+
for (let i = 0; i < ca.length; i++) {
|
|
3308
|
+
let c = ca[i];
|
|
3309
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3310
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3311
|
+
}
|
|
3312
|
+
return null;
|
|
3313
|
+
}
|
|
3314
|
+
function removeVariants() {
|
|
3315
|
+
variants?.forEach(function (_, index) {
|
|
3316
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3317
|
+
});
|
|
3318
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3319
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3320
|
+
}
|
|
3321
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3322
|
+
if (locale) {
|
|
3323
|
+
attributes.locale = locale;
|
|
3324
|
+
}
|
|
3325
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3326
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3327
|
+
});
|
|
3328
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
3329
|
+
if (isDebug) {
|
|
3330
|
+
console.debug('PersonalizationContainer', {
|
|
3331
|
+
attributes,
|
|
3332
|
+
variants,
|
|
3333
|
+
winningVariantIndex
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
if (winningVariantIndex !== -1) {
|
|
3337
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3338
|
+
if (winningVariant) {
|
|
3339
|
+
const parentNode = winningVariant.parentNode;
|
|
3340
|
+
if (parentNode) {
|
|
3341
|
+
const newParent = parentNode.cloneNode(false);
|
|
3342
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3343
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3344
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3345
|
+
}
|
|
3346
|
+
if (isDebug) {
|
|
3347
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
} else if (variants && variants.length > 0) {
|
|
3351
|
+
removeVariants();
|
|
3352
|
+
}
|
|
3353
|
+
}`;
|
|
3354
|
+
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}";
|
|
3355
|
+
|
|
3356
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3357
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3358
|
+
const hasVariants = variants && variants.length > 0;
|
|
3359
|
+
if (TARGET === "reactNative")
|
|
3360
|
+
return false;
|
|
3361
|
+
if (!hasVariants)
|
|
3362
|
+
return false;
|
|
3363
|
+
if (!canTrack)
|
|
3364
|
+
return false;
|
|
3365
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3366
|
+
return true;
|
|
3367
|
+
if (isBrowser())
|
|
3368
|
+
return false;
|
|
3369
|
+
return true;
|
|
3370
|
+
}
|
|
3371
|
+
function getBlocksToRender({
|
|
3372
|
+
variants,
|
|
3373
|
+
previewingIndex,
|
|
3374
|
+
isHydrated,
|
|
3375
|
+
filteredVariants,
|
|
3376
|
+
fallbackBlocks
|
|
3377
|
+
}) {
|
|
3378
|
+
const fallback = {
|
|
3379
|
+
blocks: fallbackBlocks ?? [],
|
|
3380
|
+
path: "this.children"
|
|
3381
|
+
};
|
|
3382
|
+
if (isHydrated && isEditing()) {
|
|
3383
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3384
|
+
const variant = variants[previewingIndex];
|
|
3385
|
+
return {
|
|
3386
|
+
blocks: variant.blocks,
|
|
3387
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3388
|
+
};
|
|
3389
|
+
}
|
|
3390
|
+
return fallback;
|
|
3391
|
+
}
|
|
3392
|
+
if (isBrowser()) {
|
|
3393
|
+
const winningVariant = filteredVariants?.[0];
|
|
3394
|
+
if (winningVariant) {
|
|
3395
|
+
return {
|
|
3396
|
+
blocks: winningVariant.blocks,
|
|
3397
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3398
|
+
};
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
return fallback;
|
|
3402
|
+
}
|
|
3403
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3404
|
+
return `
|
|
3405
|
+
(function() {
|
|
3406
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3407
|
+
${PERSONALIZATION_SCRIPT}
|
|
3408
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3409
|
+
})();
|
|
3410
|
+
`;
|
|
3411
|
+
};
|
|
3412
|
+
|
|
3413
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3414
|
+
var _tmpl$9 = /* @__PURE__ */ template(`<div>`);
|
|
3415
|
+
var _tmpl$25 = /* @__PURE__ */ template(`<template>`);
|
|
3416
|
+
function PersonalizationContainer(props) {
|
|
3417
|
+
const [userAttributes, setUserAttributes] = createSignal(userAttributesService.getUserAttributes());
|
|
3418
|
+
const [scriptStr, setScriptStr] = createSignal(getPersonalizationScript(props.variants, props.builderBlock?.id || "none", props.builderContext?.rootState?.locale));
|
|
3419
|
+
const [unsubscribers, setUnsubscribers] = createSignal([]);
|
|
3420
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants(props.variants, getDefaultCanTrack(props.builderContext?.canTrack)));
|
|
3421
|
+
const [isHydrated, setIsHydrated] = createSignal(false);
|
|
3422
|
+
const filteredVariants = createMemo(() => {
|
|
3423
|
+
return (props.variants || []).filter((variant) => {
|
|
3424
|
+
return filterWithCustomTargeting({
|
|
3425
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3426
|
+
locale: props.builderContext?.rootState?.locale
|
|
3427
|
+
} : {},
|
|
3428
|
+
...userAttributes()
|
|
3429
|
+
}, variant.query, variant.startDate, variant.endDate);
|
|
3430
|
+
});
|
|
3431
|
+
});
|
|
3432
|
+
const blocksToRender = createMemo(() => {
|
|
3433
|
+
return getBlocksToRender({
|
|
3434
|
+
variants: props.variants,
|
|
3435
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3436
|
+
isHydrated: isHydrated(),
|
|
3437
|
+
filteredVariants: filteredVariants(),
|
|
3438
|
+
previewingIndex: props.previewingIndex
|
|
3439
|
+
});
|
|
3440
|
+
});
|
|
3441
|
+
const hideVariantsStyleString = createMemo(() => {
|
|
3442
|
+
return (props.variants || []).map((_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `).join("");
|
|
3443
|
+
});
|
|
3444
|
+
let rootRef;
|
|
3445
|
+
onMount(() => {
|
|
3446
|
+
setIsHydrated(true);
|
|
3447
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange((attrs) => {
|
|
3448
|
+
setUserAttributes(attrs);
|
|
3449
|
+
});
|
|
3450
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3451
|
+
const variant = filteredVariants()[0];
|
|
3452
|
+
if (rootRef) {
|
|
3453
|
+
rootRef.dispatchEvent(new CustomEvent("builder.variantLoaded", {
|
|
3454
|
+
detail: {
|
|
3455
|
+
variant: variant || "default",
|
|
3456
|
+
content: props.builderContext?.content
|
|
3457
|
+
},
|
|
3458
|
+
bubbles: true
|
|
3459
|
+
}));
|
|
3460
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3461
|
+
entries.forEach((entry) => {
|
|
3462
|
+
if (entry.isIntersecting && rootRef) {
|
|
3463
|
+
rootRef.dispatchEvent(new CustomEvent("builder.variantDisplayed", {
|
|
3464
|
+
detail: {
|
|
3465
|
+
variant: variant || "default",
|
|
3466
|
+
content: props.builderContext?.content
|
|
3467
|
+
},
|
|
3468
|
+
bubbles: true
|
|
3469
|
+
}));
|
|
3470
|
+
}
|
|
3471
|
+
});
|
|
3472
|
+
});
|
|
3473
|
+
observer.observe(rootRef);
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
unsubscribers().push(unsub);
|
|
3477
|
+
});
|
|
3478
|
+
return (() => {
|
|
3479
|
+
const _el$ = _tmpl$9();
|
|
3480
|
+
const _ref$ = rootRef;
|
|
3481
|
+
typeof _ref$ === "function" ? use(_ref$, _el$) : rootRef = _el$;
|
|
3482
|
+
spread(_el$, mergeProps({
|
|
3483
|
+
get ["class"]() {
|
|
3484
|
+
return `builder-personalization-container ${props.attributes?.className || ""}`;
|
|
3485
|
+
}
|
|
3486
|
+
}, () => props.attributes), false, true);
|
|
3487
|
+
insert(_el$, createComponent(Show, {
|
|
3488
|
+
get when() {
|
|
3489
|
+
return shouldRenderVariants();
|
|
3490
|
+
},
|
|
3491
|
+
get children() {
|
|
3492
|
+
return [createComponent(For, {
|
|
3493
|
+
get each() {
|
|
3494
|
+
return props.variants;
|
|
3495
|
+
},
|
|
3496
|
+
children: (variant, _index) => {
|
|
3497
|
+
const index = _index();
|
|
3498
|
+
return (() => {
|
|
3499
|
+
const _el$2 = _tmpl$25();
|
|
3500
|
+
setAttribute(_el$2, "key", index);
|
|
3501
|
+
insert(_el$2, createComponent(blocks_default, {
|
|
3502
|
+
get blocks() {
|
|
3503
|
+
return variant.blocks;
|
|
3504
|
+
},
|
|
3505
|
+
get parent() {
|
|
3506
|
+
return props.builderBlock?.id;
|
|
3507
|
+
},
|
|
3508
|
+
path: `component.options.variants.${index}.blocks`
|
|
3509
|
+
}));
|
|
3510
|
+
effect(() => setAttribute(_el$2, "data-variant-id", `${props.builderBlock?.id}-${index}`));
|
|
3511
|
+
return _el$2;
|
|
3512
|
+
})();
|
|
3513
|
+
}
|
|
3514
|
+
}), createComponent(inlined_styles_default, {
|
|
3515
|
+
get nonce() {
|
|
3516
|
+
return props.builderContext?.nonce || "";
|
|
3517
|
+
},
|
|
3518
|
+
get styles() {
|
|
3519
|
+
return hideVariantsStyleString();
|
|
3520
|
+
},
|
|
3521
|
+
get id() {
|
|
3522
|
+
return `variants-styles-${props.builderBlock?.id}`;
|
|
3523
|
+
}
|
|
3524
|
+
}), createComponent(inlined_script_default, {
|
|
3525
|
+
get nonce() {
|
|
3526
|
+
return props.builderContext?.nonce || "";
|
|
3527
|
+
},
|
|
3528
|
+
get scriptStr() {
|
|
3529
|
+
return scriptStr();
|
|
3530
|
+
},
|
|
3531
|
+
get id() {
|
|
3532
|
+
return `variants-script-${props.builderBlock?.id}`;
|
|
3533
|
+
}
|
|
3534
|
+
})];
|
|
3535
|
+
}
|
|
3536
|
+
}), null);
|
|
3537
|
+
insert(_el$, createComponent(blocks_default, {
|
|
3538
|
+
get blocks() {
|
|
3539
|
+
return blocksToRender().blocks;
|
|
3540
|
+
},
|
|
3541
|
+
get parent() {
|
|
3542
|
+
return props.builderBlock?.id;
|
|
3543
|
+
},
|
|
3544
|
+
get path() {
|
|
3545
|
+
return blocksToRender().path;
|
|
3546
|
+
}
|
|
3547
|
+
}), null);
|
|
3548
|
+
return _el$;
|
|
3549
|
+
})();
|
|
3550
|
+
}
|
|
3551
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3552
|
+
|
|
3553
|
+
// src/blocks/section/component-info.ts
|
|
3554
|
+
var componentInfo7 = {
|
|
3079
3555
|
name: "Core:Section",
|
|
3080
3556
|
static: true,
|
|
3081
3557
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -3117,7 +3593,7 @@ var componentInfo6 = {
|
|
|
3117
3593
|
};
|
|
3118
3594
|
|
|
3119
3595
|
// src/blocks/slot/component-info.ts
|
|
3120
|
-
var
|
|
3596
|
+
var componentInfo8 = {
|
|
3121
3597
|
name: "Slot",
|
|
3122
3598
|
isRSC: true,
|
|
3123
3599
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -3135,10 +3611,10 @@ var componentInfo7 = {
|
|
|
3135
3611
|
builderComponents: true
|
|
3136
3612
|
}
|
|
3137
3613
|
};
|
|
3138
|
-
var _tmpl$
|
|
3614
|
+
var _tmpl$10 = /* @__PURE__ */ template(`<div>`);
|
|
3139
3615
|
function Slot(props) {
|
|
3140
3616
|
return (() => {
|
|
3141
|
-
const _el$ = _tmpl$
|
|
3617
|
+
const _el$ = _tmpl$10();
|
|
3142
3618
|
_el$.style.setProperty("pointer-events", "auto");
|
|
3143
3619
|
spread(_el$, mergeProps(() => !props.builderContext.context?.symbolId && {
|
|
3144
3620
|
"builder-slot": props.name
|
|
@@ -3166,7 +3642,7 @@ function Slot(props) {
|
|
|
3166
3642
|
var slot_default = Slot;
|
|
3167
3643
|
|
|
3168
3644
|
// src/blocks/symbol/component-info.ts
|
|
3169
|
-
var
|
|
3645
|
+
var componentInfo9 = {
|
|
3170
3646
|
name: "Symbol",
|
|
3171
3647
|
noWrap: true,
|
|
3172
3648
|
static: true,
|
|
@@ -3248,7 +3724,7 @@ var defaultElement = {
|
|
|
3248
3724
|
}
|
|
3249
3725
|
}
|
|
3250
3726
|
};
|
|
3251
|
-
var
|
|
3727
|
+
var componentInfo10 = {
|
|
3252
3728
|
name: "Builder: Tabs",
|
|
3253
3729
|
inputs: [{
|
|
3254
3730
|
name: "tabs",
|
|
@@ -3352,8 +3828,8 @@ var componentInfo9 = {
|
|
|
3352
3828
|
builderLinkComponent: true
|
|
3353
3829
|
}
|
|
3354
3830
|
};
|
|
3355
|
-
var _tmpl$
|
|
3356
|
-
var _tmpl$
|
|
3831
|
+
var _tmpl$11 = /* @__PURE__ */ template(`<div>`);
|
|
3832
|
+
var _tmpl$26 = /* @__PURE__ */ template(`<div><div class=builder-tabs-wrap>`);
|
|
3357
3833
|
var _tmpl$33 = /* @__PURE__ */ template(`<span>`);
|
|
3358
3834
|
function Tabs(props) {
|
|
3359
3835
|
const [activeTab, setActiveTab] = createSignal(props.defaultActiveTab ? props.defaultActiveTab - 1 : 0);
|
|
@@ -3368,7 +3844,7 @@ function Tabs(props) {
|
|
|
3368
3844
|
}
|
|
3369
3845
|
}
|
|
3370
3846
|
return (() => {
|
|
3371
|
-
const _el$ = _tmpl$
|
|
3847
|
+
const _el$ = _tmpl$26(), _el$2 = _el$.firstChild;
|
|
3372
3848
|
_el$2.style.setProperty("display", "flex");
|
|
3373
3849
|
_el$2.style.setProperty("flex-direction", "row");
|
|
3374
3850
|
_el$2.style.setProperty("overflow", "auto");
|
|
@@ -3420,7 +3896,7 @@ function Tabs(props) {
|
|
|
3420
3896
|
return activeTabContent(activeTab());
|
|
3421
3897
|
},
|
|
3422
3898
|
get children() {
|
|
3423
|
-
const _el$3 = _tmpl$
|
|
3899
|
+
const _el$3 = _tmpl$11();
|
|
3424
3900
|
insert(_el$3, createComponent(blocks_default, {
|
|
3425
3901
|
get parent() {
|
|
3426
3902
|
return props.builderBlock.id;
|
|
@@ -3452,7 +3928,7 @@ var tabs_default = Tabs;
|
|
|
3452
3928
|
delegateEvents(["click"]);
|
|
3453
3929
|
|
|
3454
3930
|
// src/blocks/text/component-info.ts
|
|
3455
|
-
var
|
|
3931
|
+
var componentInfo11 = {
|
|
3456
3932
|
shouldReceiveBuilderProps: {
|
|
3457
3933
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3458
3934
|
builderContext: true
|
|
@@ -3475,10 +3951,10 @@ var componentInfo10 = {
|
|
|
3475
3951
|
textAlign: "center"
|
|
3476
3952
|
}
|
|
3477
3953
|
};
|
|
3478
|
-
var _tmpl$
|
|
3954
|
+
var _tmpl$12 = /* @__PURE__ */ template(`<div class=builder-text>`);
|
|
3479
3955
|
function Text(props) {
|
|
3480
3956
|
return (() => {
|
|
3481
|
-
const _el$ = _tmpl$
|
|
3957
|
+
const _el$ = _tmpl$12();
|
|
3482
3958
|
_el$.style.setProperty("outline", "none");
|
|
3483
3959
|
effect(() => _el$.innerHTML = props.text?.toString() || "");
|
|
3484
3960
|
return _el$;
|
|
@@ -3487,7 +3963,7 @@ function Text(props) {
|
|
|
3487
3963
|
var text_default = Text;
|
|
3488
3964
|
|
|
3489
3965
|
// src/blocks/custom-code/component-info.ts
|
|
3490
|
-
var
|
|
3966
|
+
var componentInfo12 = {
|
|
3491
3967
|
name: "Custom Code",
|
|
3492
3968
|
static: true,
|
|
3493
3969
|
requiredPermissions: ["editCode"],
|
|
@@ -3510,7 +3986,7 @@ var componentInfo11 = {
|
|
|
3510
3986
|
advanced: true
|
|
3511
3987
|
}]
|
|
3512
3988
|
};
|
|
3513
|
-
var _tmpl$
|
|
3989
|
+
var _tmpl$13 = /* @__PURE__ */ template(`<div>`);
|
|
3514
3990
|
function CustomCode(props) {
|
|
3515
3991
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
3516
3992
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -3544,7 +4020,7 @@ function CustomCode(props) {
|
|
|
3544
4020
|
}
|
|
3545
4021
|
});
|
|
3546
4022
|
return (() => {
|
|
3547
|
-
const _el$ = _tmpl$
|
|
4023
|
+
const _el$ = _tmpl$13();
|
|
3548
4024
|
const _ref$ = elementRef;
|
|
3549
4025
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elementRef = _el$;
|
|
3550
4026
|
effect((_p$) => {
|
|
@@ -3562,7 +4038,7 @@ function CustomCode(props) {
|
|
|
3562
4038
|
var custom_code_default = CustomCode;
|
|
3563
4039
|
|
|
3564
4040
|
// src/blocks/embed/component-info.ts
|
|
3565
|
-
var
|
|
4041
|
+
var componentInfo13 = {
|
|
3566
4042
|
name: "Embed",
|
|
3567
4043
|
static: true,
|
|
3568
4044
|
inputs: [{
|
|
@@ -3584,7 +4060,7 @@ var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "applicati
|
|
|
3584
4060
|
var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
3585
4061
|
|
|
3586
4062
|
// src/blocks/embed/embed.tsx
|
|
3587
|
-
var _tmpl$
|
|
4063
|
+
var _tmpl$14 = /* @__PURE__ */ template(`<div class=builder-embed>`);
|
|
3588
4064
|
function Embed(props) {
|
|
3589
4065
|
const [scriptsInserted, setScriptsInserted] = createSignal([]);
|
|
3590
4066
|
const [scriptsRun, setScriptsRun] = createSignal([]);
|
|
@@ -3621,7 +4097,7 @@ function Embed(props) {
|
|
|
3621
4097
|
}
|
|
3622
4098
|
createEffect(on(() => [onUpdateFn_0_elem(), onUpdateFn_0_ranInitFn__()], onUpdateFn_0));
|
|
3623
4099
|
return (() => {
|
|
3624
|
-
const _el$ = _tmpl$
|
|
4100
|
+
const _el$ = _tmpl$14();
|
|
3625
4101
|
const _ref$ = elem;
|
|
3626
4102
|
typeof _ref$ === "function" ? use(_ref$, _el$) : elem = _el$;
|
|
3627
4103
|
effect(() => _el$.innerHTML = props.content);
|
|
@@ -3631,7 +4107,7 @@ function Embed(props) {
|
|
|
3631
4107
|
var embed_default = Embed;
|
|
3632
4108
|
|
|
3633
4109
|
// src/blocks/form/form/component-info.ts
|
|
3634
|
-
var
|
|
4110
|
+
var componentInfo14 = {
|
|
3635
4111
|
name: "Form:Form",
|
|
3636
4112
|
// editableTags: ['builder-form-error']
|
|
3637
4113
|
defaults: {
|
|
@@ -3887,8 +4363,8 @@ function logFetch(url) {
|
|
|
3887
4363
|
}
|
|
3888
4364
|
|
|
3889
4365
|
// src/blocks/form/form/form.tsx
|
|
3890
|
-
var _tmpl$
|
|
3891
|
-
var _tmpl$
|
|
4366
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-04a43b72">`);
|
|
4367
|
+
var _tmpl$27 = /* @__PURE__ */ template(`<form>`);
|
|
3892
4368
|
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-04a43b72 {
|
|
3893
4369
|
padding: 10px;
|
|
3894
4370
|
color: red;
|
|
@@ -4081,7 +4557,7 @@ function FormComponent(props) {
|
|
|
4081
4557
|
}
|
|
4082
4558
|
let formRef;
|
|
4083
4559
|
return [(() => {
|
|
4084
|
-
const _el$ = _tmpl$
|
|
4560
|
+
const _el$ = _tmpl$27();
|
|
4085
4561
|
_el$.addEventListener("submit", (event) => onSubmit(event));
|
|
4086
4562
|
const _ref$ = formRef;
|
|
4087
4563
|
typeof _ref$ === "function" ? use(_ref$, _el$) : formRef = _el$;
|
|
@@ -4137,7 +4613,7 @@ function FormComponent(props) {
|
|
|
4137
4613
|
return memo(() => submissionState() === "error")() && responseData();
|
|
4138
4614
|
},
|
|
4139
4615
|
get children() {
|
|
4140
|
-
const _el$2 = _tmpl$
|
|
4616
|
+
const _el$2 = _tmpl$15();
|
|
4141
4617
|
insert(_el$2, () => JSON.stringify(responseData(), null, 2));
|
|
4142
4618
|
return _el$2;
|
|
4143
4619
|
}
|
|
@@ -4164,7 +4640,7 @@ function FormComponent(props) {
|
|
|
4164
4640
|
var form_default = FormComponent;
|
|
4165
4641
|
|
|
4166
4642
|
// src/blocks/form/input/component-info.ts
|
|
4167
|
-
var
|
|
4643
|
+
var componentInfo15 = {
|
|
4168
4644
|
name: "Form:Input",
|
|
4169
4645
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
4170
4646
|
inputs: [
|
|
@@ -4216,10 +4692,10 @@ var componentInfo14 = {
|
|
|
4216
4692
|
borderColor: "#ccc"
|
|
4217
4693
|
}
|
|
4218
4694
|
};
|
|
4219
|
-
var _tmpl$
|
|
4695
|
+
var _tmpl$16 = /* @__PURE__ */ template(`<input>`);
|
|
4220
4696
|
function FormInputComponent(props) {
|
|
4221
4697
|
return (() => {
|
|
4222
|
-
const _el$ = _tmpl$
|
|
4698
|
+
const _el$ = _tmpl$16();
|
|
4223
4699
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4224
4700
|
get key() {
|
|
4225
4701
|
return isEditing() && props.defaultValue ? props.defaultValue : "default-key";
|
|
@@ -4249,7 +4725,7 @@ function FormInputComponent(props) {
|
|
|
4249
4725
|
var input_default = FormInputComponent;
|
|
4250
4726
|
|
|
4251
4727
|
// src/blocks/form/select/component-info.ts
|
|
4252
|
-
var
|
|
4728
|
+
var componentInfo16 = {
|
|
4253
4729
|
name: "Form:Select",
|
|
4254
4730
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
4255
4731
|
defaultStyles: {
|
|
@@ -4292,11 +4768,11 @@ var componentInfo15 = {
|
|
|
4292
4768
|
static: true,
|
|
4293
4769
|
noWrap: true
|
|
4294
4770
|
};
|
|
4295
|
-
var _tmpl$
|
|
4296
|
-
var _tmpl$
|
|
4771
|
+
var _tmpl$17 = /* @__PURE__ */ template(`<select>`);
|
|
4772
|
+
var _tmpl$28 = /* @__PURE__ */ template(`<option>`);
|
|
4297
4773
|
function SelectComponent(props) {
|
|
4298
4774
|
return (() => {
|
|
4299
|
-
const _el$ = _tmpl$
|
|
4775
|
+
const _el$ = _tmpl$17();
|
|
4300
4776
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4301
4777
|
get value() {
|
|
4302
4778
|
return props.value;
|
|
@@ -4321,7 +4797,7 @@ function SelectComponent(props) {
|
|
|
4321
4797
|
children: (option, _index) => {
|
|
4322
4798
|
const index = _index();
|
|
4323
4799
|
return (() => {
|
|
4324
|
-
const _el$2 = _tmpl$
|
|
4800
|
+
const _el$2 = _tmpl$28();
|
|
4325
4801
|
insert(_el$2, () => option.name || option.value);
|
|
4326
4802
|
effect(() => setAttribute(_el$2, "key", `${option.name}-${index}`));
|
|
4327
4803
|
effect(() => _el$2.value = option.value);
|
|
@@ -4335,7 +4811,7 @@ function SelectComponent(props) {
|
|
|
4335
4811
|
var select_default = SelectComponent;
|
|
4336
4812
|
|
|
4337
4813
|
// src/blocks/form/submit-button/component-info.ts
|
|
4338
|
-
var
|
|
4814
|
+
var componentInfo17 = {
|
|
4339
4815
|
name: "Form:SubmitButton",
|
|
4340
4816
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
4341
4817
|
defaultStyles: {
|
|
@@ -4361,10 +4837,10 @@ var componentInfo16 = {
|
|
|
4361
4837
|
// TODO: defaultChildren
|
|
4362
4838
|
// canHaveChildren: true,
|
|
4363
4839
|
};
|
|
4364
|
-
var _tmpl$
|
|
4840
|
+
var _tmpl$18 = /* @__PURE__ */ template(`<button type=submit>`);
|
|
4365
4841
|
function SubmitButton(props) {
|
|
4366
4842
|
return (() => {
|
|
4367
|
-
const _el$ = _tmpl$
|
|
4843
|
+
const _el$ = _tmpl$18();
|
|
4368
4844
|
spread(_el$, mergeProps({}, () => props.attributes), false, true);
|
|
4369
4845
|
insert(_el$, () => props.text);
|
|
4370
4846
|
return _el$;
|
|
@@ -4373,7 +4849,7 @@ function SubmitButton(props) {
|
|
|
4373
4849
|
var submit_button_default = SubmitButton;
|
|
4374
4850
|
|
|
4375
4851
|
// src/blocks/form/textarea/component-info.ts
|
|
4376
|
-
var
|
|
4852
|
+
var componentInfo18 = {
|
|
4377
4853
|
name: "Form:TextArea",
|
|
4378
4854
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
4379
4855
|
inputs: [{
|
|
@@ -4410,10 +4886,10 @@ var componentInfo17 = {
|
|
|
4410
4886
|
static: true,
|
|
4411
4887
|
noWrap: true
|
|
4412
4888
|
};
|
|
4413
|
-
var _tmpl$
|
|
4889
|
+
var _tmpl$19 = /* @__PURE__ */ template(`<textarea>`);
|
|
4414
4890
|
function Textarea(props) {
|
|
4415
4891
|
return (() => {
|
|
4416
|
-
const _el$ = _tmpl$
|
|
4892
|
+
const _el$ = _tmpl$19();
|
|
4417
4893
|
spread(_el$, mergeProps({}, () => props.attributes, {
|
|
4418
4894
|
get placeholder() {
|
|
4419
4895
|
return props.placeholder;
|
|
@@ -4437,7 +4913,7 @@ function Textarea(props) {
|
|
|
4437
4913
|
var textarea_default = Textarea;
|
|
4438
4914
|
|
|
4439
4915
|
// src/blocks/img/component-info.ts
|
|
4440
|
-
var
|
|
4916
|
+
var componentInfo19 = {
|
|
4441
4917
|
// friendlyName?
|
|
4442
4918
|
name: "Raw:Img",
|
|
4443
4919
|
hideFromInsertMenu: true,
|
|
@@ -4452,10 +4928,10 @@ var componentInfo18 = {
|
|
|
4452
4928
|
noWrap: true,
|
|
4453
4929
|
static: true
|
|
4454
4930
|
};
|
|
4455
|
-
var _tmpl$
|
|
4931
|
+
var _tmpl$20 = /* @__PURE__ */ template(`<img>`);
|
|
4456
4932
|
function ImgComponent(props) {
|
|
4457
4933
|
return (() => {
|
|
4458
|
-
const _el$ = _tmpl$
|
|
4934
|
+
const _el$ = _tmpl$20();
|
|
4459
4935
|
spread(_el$, mergeProps({
|
|
4460
4936
|
get style() {
|
|
4461
4937
|
return {
|
|
@@ -4479,7 +4955,7 @@ function ImgComponent(props) {
|
|
|
4479
4955
|
var img_default = ImgComponent;
|
|
4480
4956
|
|
|
4481
4957
|
// src/blocks/video/component-info.ts
|
|
4482
|
-
var
|
|
4958
|
+
var componentInfo20 = {
|
|
4483
4959
|
name: "Video",
|
|
4484
4960
|
canHaveChildren: true,
|
|
4485
4961
|
defaultStyles: {
|
|
@@ -4564,8 +5040,8 @@ var componentInfo19 = {
|
|
|
4564
5040
|
builderBlock: true
|
|
4565
5041
|
}
|
|
4566
5042
|
};
|
|
4567
|
-
var _tmpl$
|
|
4568
|
-
var _tmpl$
|
|
5043
|
+
var _tmpl$21 = /* @__PURE__ */ template(`<source type=video/mp4>`);
|
|
5044
|
+
var _tmpl$29 = /* @__PURE__ */ template(`<div>`);
|
|
4569
5045
|
var _tmpl$35 = /* @__PURE__ */ template(`<div><video class=builder-video>`);
|
|
4570
5046
|
function Video(props) {
|
|
4571
5047
|
const videoProps = createMemo(() => {
|
|
@@ -4626,7 +5102,7 @@ function Video(props) {
|
|
|
4626
5102
|
return !props.lazyLoad;
|
|
4627
5103
|
},
|
|
4628
5104
|
get children() {
|
|
4629
|
-
const _el$3 = _tmpl$
|
|
5105
|
+
const _el$3 = _tmpl$21();
|
|
4630
5106
|
effect(() => setAttribute(_el$3, "src", props.video));
|
|
4631
5107
|
return _el$3;
|
|
4632
5108
|
}
|
|
@@ -4636,7 +5112,7 @@ function Video(props) {
|
|
|
4636
5112
|
return props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length);
|
|
4637
5113
|
},
|
|
4638
5114
|
get children() {
|
|
4639
|
-
const _el$4 = _tmpl$
|
|
5115
|
+
const _el$4 = _tmpl$29();
|
|
4640
5116
|
_el$4.style.setProperty("width", "100%");
|
|
4641
5117
|
_el$4.style.setProperty("pointer-events", "none");
|
|
4642
5118
|
_el$4.style.setProperty("font-size", "0px");
|
|
@@ -4649,7 +5125,7 @@ function Video(props) {
|
|
|
4649
5125
|
return props.builderBlock?.children?.length && props.fitContent;
|
|
4650
5126
|
},
|
|
4651
5127
|
get children() {
|
|
4652
|
-
const _el$5 = _tmpl$
|
|
5128
|
+
const _el$5 = _tmpl$29();
|
|
4653
5129
|
_el$5.style.setProperty("display", "flex");
|
|
4654
5130
|
_el$5.style.setProperty("flex-direction", "column");
|
|
4655
5131
|
_el$5.style.setProperty("align-items", "stretch");
|
|
@@ -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$6 = _tmpl$
|
|
5141
|
+
const _el$6 = _tmpl$29();
|
|
4666
5142
|
_el$6.style.setProperty("pointer-events", "none");
|
|
4667
5143
|
_el$6.style.setProperty("display", "flex");
|
|
4668
5144
|
_el$6.style.setProperty("flex-direction", "column");
|
|
@@ -4684,31 +5160,31 @@ var video_default = Video;
|
|
|
4684
5160
|
// src/constants/extra-components.ts
|
|
4685
5161
|
var getExtraComponents = () => [{
|
|
4686
5162
|
component: custom_code_default,
|
|
4687
|
-
...
|
|
5163
|
+
...componentInfo12
|
|
4688
5164
|
}, {
|
|
4689
5165
|
component: embed_default,
|
|
4690
|
-
...
|
|
5166
|
+
...componentInfo13
|
|
4691
5167
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4692
5168
|
component: form_default,
|
|
4693
|
-
...
|
|
5169
|
+
...componentInfo14
|
|
4694
5170
|
}, {
|
|
4695
5171
|
component: input_default,
|
|
4696
|
-
...
|
|
5172
|
+
...componentInfo15
|
|
4697
5173
|
}, {
|
|
4698
5174
|
component: submit_button_default,
|
|
4699
|
-
...
|
|
5175
|
+
...componentInfo17
|
|
4700
5176
|
}, {
|
|
4701
5177
|
component: select_default,
|
|
4702
|
-
...
|
|
5178
|
+
...componentInfo16
|
|
4703
5179
|
}, {
|
|
4704
5180
|
component: textarea_default,
|
|
4705
|
-
...
|
|
5181
|
+
...componentInfo18
|
|
4706
5182
|
}], {
|
|
4707
5183
|
component: img_default,
|
|
4708
|
-
...
|
|
5184
|
+
...componentInfo19
|
|
4709
5185
|
}, {
|
|
4710
5186
|
component: video_default,
|
|
4711
|
-
...
|
|
5187
|
+
...componentInfo20
|
|
4712
5188
|
}];
|
|
4713
5189
|
|
|
4714
5190
|
// src/constants/builder-registered-components.ts
|
|
@@ -4726,19 +5202,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4726
5202
|
...componentInfo5
|
|
4727
5203
|
}, {
|
|
4728
5204
|
component: section_default,
|
|
4729
|
-
...
|
|
5205
|
+
...componentInfo7
|
|
4730
5206
|
}, {
|
|
4731
5207
|
component: slot_default,
|
|
4732
|
-
...
|
|
5208
|
+
...componentInfo8
|
|
4733
5209
|
}, {
|
|
4734
5210
|
component: symbol_default,
|
|
4735
|
-
...
|
|
5211
|
+
...componentInfo9
|
|
4736
5212
|
}, {
|
|
4737
5213
|
component: text_default,
|
|
4738
|
-
...
|
|
4739
|
-
}, ...TARGET === "
|
|
5214
|
+
...componentInfo11
|
|
5215
|
+
}, ...TARGET === "react" ? [{
|
|
5216
|
+
component: personalization_container_default,
|
|
5217
|
+
...componentInfo6
|
|
5218
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4740
5219
|
component: tabs_default,
|
|
4741
|
-
...
|
|
5220
|
+
...componentInfo10
|
|
4742
5221
|
}, {
|
|
4743
5222
|
component: accordion_default,
|
|
4744
5223
|
...componentInfo
|
|
@@ -4776,7 +5255,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4776
5255
|
testVariationId: variant.id,
|
|
4777
5256
|
id: content?.id
|
|
4778
5257
|
}));
|
|
4779
|
-
var
|
|
5258
|
+
var checkShouldRenderVariants2 = ({
|
|
4780
5259
|
canTrack,
|
|
4781
5260
|
content
|
|
4782
5261
|
}) => {
|
|
@@ -4809,25 +5288,6 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4809
5288
|
}) => `window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
4810
5289
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4811
5290
|
)`;
|
|
4812
|
-
var _tmpl$20 = /* @__PURE__ */ template(`<script>`);
|
|
4813
|
-
function InlinedScript(props) {
|
|
4814
|
-
return (() => {
|
|
4815
|
-
const _el$ = _tmpl$20();
|
|
4816
|
-
effect((_p$) => {
|
|
4817
|
-
const _v$ = props.scriptStr, _v$2 = props.id, _v$3 = props.nonce || "";
|
|
4818
|
-
_v$ !== _p$._v$ && (_el$.innerHTML = _p$._v$ = _v$);
|
|
4819
|
-
_v$2 !== _p$._v$2 && setAttribute(_el$, "data-id", _p$._v$2 = _v$2);
|
|
4820
|
-
_v$3 !== _p$._v$3 && setAttribute(_el$, "nonce", _p$._v$3 = _v$3);
|
|
4821
|
-
return _p$;
|
|
4822
|
-
}, {
|
|
4823
|
-
_v$: void 0,
|
|
4824
|
-
_v$2: void 0,
|
|
4825
|
-
_v$3: void 0
|
|
4826
|
-
});
|
|
4827
|
-
return _el$;
|
|
4828
|
-
})();
|
|
4829
|
-
}
|
|
4830
|
-
var inlined_script_default = InlinedScript;
|
|
4831
5291
|
|
|
4832
5292
|
// src/helpers/preview-lru-cache/get.ts
|
|
4833
5293
|
function getPreviewContent(_searchParams) {
|
|
@@ -4835,7 +5295,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4835
5295
|
}
|
|
4836
5296
|
|
|
4837
5297
|
// src/constants/sdk-version.ts
|
|
4838
|
-
var SDK_VERSION = "3.0.
|
|
5298
|
+
var SDK_VERSION = "3.0.7";
|
|
4839
5299
|
|
|
4840
5300
|
// src/helpers/sdk-headers.ts
|
|
4841
5301
|
var getSdkHeaders = () => ({
|
|
@@ -5130,16 +5590,6 @@ async function fetchEntries(options) {
|
|
|
5130
5590
|
return _processContentResult(options, content);
|
|
5131
5591
|
}
|
|
5132
5592
|
|
|
5133
|
-
// src/functions/is-previewing.ts
|
|
5134
|
-
function isPreviewing(_search) {
|
|
5135
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
5136
|
-
if (!search) {
|
|
5137
|
-
return false;
|
|
5138
|
-
}
|
|
5139
|
-
const normalizedSearch = getSearchString(search);
|
|
5140
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
5141
|
-
}
|
|
5142
|
-
|
|
5143
5593
|
// src/helpers/uuid.ts
|
|
5144
5594
|
function uuidv4() {
|
|
5145
5595
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -5462,7 +5912,9 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5462
5912
|
// Supports builder-model="..." attribute which is needed to
|
|
5463
5913
|
// scope our '+ add block' button styling
|
|
5464
5914
|
supportsAddBlockScoping: true,
|
|
5465
|
-
supportsCustomBreakpoints: true
|
|
5915
|
+
supportsCustomBreakpoints: true,
|
|
5916
|
+
supportsXSmallBreakpoint: TARGET === "reactNative" ? false : true,
|
|
5917
|
+
blockLevelPersonalization: true
|
|
5466
5918
|
}
|
|
5467
5919
|
}, "*");
|
|
5468
5920
|
window.parent?.postMessage({
|
|
@@ -6198,7 +6650,7 @@ var content_default = ContentComponent;
|
|
|
6198
6650
|
|
|
6199
6651
|
// src/components/content-variants/content-variants.tsx
|
|
6200
6652
|
function ContentVariants(props) {
|
|
6201
|
-
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(
|
|
6653
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal(checkShouldRenderVariants2({
|
|
6202
6654
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
6203
6655
|
content: props.content
|
|
6204
6656
|
}));
|
|
@@ -6424,7 +6876,7 @@ var fetchSymbolContent = async ({
|
|
|
6424
6876
|
};
|
|
6425
6877
|
|
|
6426
6878
|
// src/blocks/symbol/symbol.tsx
|
|
6427
|
-
var _tmpl$
|
|
6879
|
+
var _tmpl$30 = /* @__PURE__ */ template(`<div>`);
|
|
6428
6880
|
function Symbol(props) {
|
|
6429
6881
|
const [contentToUse, setContentToUse] = createSignal(props.symbol?.content);
|
|
6430
6882
|
const blocksWrapper = createMemo(() => {
|
|
@@ -6456,7 +6908,7 @@ function Symbol(props) {
|
|
|
6456
6908
|
}
|
|
6457
6909
|
createEffect(on(() => [onUpdateFn_0_props_symbol()], onUpdateFn_0));
|
|
6458
6910
|
return (() => {
|
|
6459
|
-
const _el$ = _tmpl$
|
|
6911
|
+
const _el$ = _tmpl$30();
|
|
6460
6912
|
spread(_el$, mergeProps({
|
|
6461
6913
|
get ["class"]() {
|
|
6462
6914
|
return className();
|
|
@@ -6548,4 +7000,4 @@ var fetchBuilderProps = async (_args) => {
|
|
|
6548
7000
|
};
|
|
6549
7001
|
};
|
|
6550
7002
|
|
|
6551
|
-
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 };
|
|
7003
|
+
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 };
|