@builder.io/sdk-solid 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -1
- package/lib/browser/dev.js +529 -103
- package/lib/browser/dev.jsx +558 -142
- package/lib/browser/index.js +529 -103
- package/lib/browser/index.jsx +558 -142
- package/lib/edge/dev.js +529 -103
- package/lib/edge/dev.jsx +558 -142
- package/lib/edge/index.js +529 -103
- package/lib/edge/index.jsx +558 -142
- package/lib/node/dev.js +529 -103
- package/lib/node/dev.jsx +558 -142
- package/lib/node/index.js +529 -103
- package/lib/node/index.jsx +558 -142
- package/package.json +1 -1
package/lib/node/index.jsx
CHANGED
|
@@ -1627,8 +1627,9 @@ function BlocksWrapper(props) {
|
|
|
1627
1627
|
if (!props.path) {
|
|
1628
1628
|
return void 0;
|
|
1629
1629
|
}
|
|
1630
|
+
const thisPrefix = "this.";
|
|
1630
1631
|
const pathPrefix = "component.options.";
|
|
1631
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1632
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1632
1633
|
});
|
|
1633
1634
|
function onClick() {
|
|
1634
1635
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1663,7 +1664,7 @@ function BlocksWrapper(props) {
|
|
|
1663
1664
|
});
|
|
1664
1665
|
return <>
|
|
1665
1666
|
<Dynamic4
|
|
1666
|
-
class={className() + " dynamic-
|
|
1667
|
+
class={className() + " dynamic-3d7ff108"}
|
|
1667
1668
|
ref={blocksWrapperRef}
|
|
1668
1669
|
builder-path={dataPath()}
|
|
1669
1670
|
builder-parent-id={props.parent}
|
|
@@ -1675,7 +1676,7 @@ function BlocksWrapper(props) {
|
|
|
1675
1676
|
{...props.BlocksWrapperProps}
|
|
1676
1677
|
component={props.BlocksWrapper}
|
|
1677
1678
|
>{props.children}</Dynamic4>
|
|
1678
|
-
<style>{`.dynamic-
|
|
1679
|
+
<style>{`.dynamic-3d7ff108 {
|
|
1679
1680
|
display: flex;
|
|
1680
1681
|
flex-direction: column;
|
|
1681
1682
|
align-items: stretch;
|
|
@@ -2047,10 +2048,10 @@ function SectionComponent(props) {
|
|
|
2047
2048
|
var section_default = SectionComponent;
|
|
2048
2049
|
|
|
2049
2050
|
// src/blocks/symbol/symbol.tsx
|
|
2050
|
-
import { onMount as
|
|
2051
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2051
2052
|
|
|
2052
2053
|
// src/components/content-variants/content-variants.tsx
|
|
2053
|
-
import { Show as
|
|
2054
|
+
import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
2054
2055
|
|
|
2055
2056
|
// src/helpers/url.ts
|
|
2056
2057
|
var getTopLevelDomain = (host) => {
|
|
@@ -2240,11 +2241,61 @@ var handleABTesting = async ({
|
|
|
2240
2241
|
};
|
|
2241
2242
|
};
|
|
2242
2243
|
|
|
2244
|
+
// src/helpers/user-attributes.ts
|
|
2245
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2246
|
+
function createUserAttributesService() {
|
|
2247
|
+
let canTrack = true;
|
|
2248
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2249
|
+
return {
|
|
2250
|
+
setUserAttributes(newAttrs) {
|
|
2251
|
+
if (!isBrowser()) {
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
const userAttributes = {
|
|
2255
|
+
...this.getUserAttributes(),
|
|
2256
|
+
...newAttrs
|
|
2257
|
+
};
|
|
2258
|
+
setCookie({
|
|
2259
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2260
|
+
value: JSON.stringify(userAttributes),
|
|
2261
|
+
canTrack
|
|
2262
|
+
});
|
|
2263
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2264
|
+
},
|
|
2265
|
+
getUserAttributes() {
|
|
2266
|
+
if (!isBrowser()) {
|
|
2267
|
+
return {};
|
|
2268
|
+
}
|
|
2269
|
+
return JSON.parse(getCookieSync({
|
|
2270
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2271
|
+
canTrack
|
|
2272
|
+
}) || "{}");
|
|
2273
|
+
},
|
|
2274
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2275
|
+
subscribers.add(callback);
|
|
2276
|
+
return () => {
|
|
2277
|
+
subscribers.delete(callback);
|
|
2278
|
+
};
|
|
2279
|
+
},
|
|
2280
|
+
setCanTrack(value) {
|
|
2281
|
+
canTrack = value;
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
}
|
|
2285
|
+
var userAttributesService = createUserAttributesService();
|
|
2286
|
+
var setClientUserAttributes = (attributes) => {
|
|
2287
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2243
2290
|
// src/helpers/canTrack.ts
|
|
2244
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2291
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2292
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2293
|
+
userAttributesService.setCanTrack(result);
|
|
2294
|
+
return result;
|
|
2295
|
+
};
|
|
2245
2296
|
|
|
2246
2297
|
// src/components/content/content.tsx
|
|
2247
|
-
import { Show as
|
|
2298
|
+
import { Show as Show15, createSignal as createSignal18 } from "solid-js";
|
|
2248
2299
|
|
|
2249
2300
|
// src/blocks/accordion/component-info.ts
|
|
2250
2301
|
var defaultTitle = {
|
|
@@ -2938,8 +2989,388 @@ var componentInfo5 = {
|
|
|
2938
2989
|
}
|
|
2939
2990
|
};
|
|
2940
2991
|
|
|
2941
|
-
// src/blocks/
|
|
2992
|
+
// src/blocks/personalization-container/component-info.ts
|
|
2942
2993
|
var componentInfo6 = {
|
|
2994
|
+
name: "PersonalizationContainer",
|
|
2995
|
+
shouldReceiveBuilderProps: {
|
|
2996
|
+
builderBlock: true,
|
|
2997
|
+
builderContext: true
|
|
2998
|
+
},
|
|
2999
|
+
noWrap: true,
|
|
3000
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
3001
|
+
canHaveChildren: true,
|
|
3002
|
+
inputs: [{
|
|
3003
|
+
name: "variants",
|
|
3004
|
+
defaultValue: [],
|
|
3005
|
+
behavior: "personalizationVariantList",
|
|
3006
|
+
type: "list",
|
|
3007
|
+
subFields: [{
|
|
3008
|
+
name: "name",
|
|
3009
|
+
type: "text"
|
|
3010
|
+
}, {
|
|
3011
|
+
name: "query",
|
|
3012
|
+
friendlyName: "Targeting rules",
|
|
3013
|
+
type: "BuilderQuery",
|
|
3014
|
+
defaultValue: []
|
|
3015
|
+
}, {
|
|
3016
|
+
name: "startDate",
|
|
3017
|
+
type: "date"
|
|
3018
|
+
}, {
|
|
3019
|
+
name: "endDate",
|
|
3020
|
+
type: "date"
|
|
3021
|
+
}, {
|
|
3022
|
+
name: "blocks",
|
|
3023
|
+
type: "uiBlocks",
|
|
3024
|
+
hideFromUI: true,
|
|
3025
|
+
defaultValue: []
|
|
3026
|
+
}]
|
|
3027
|
+
}]
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3031
|
+
import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
|
|
3032
|
+
|
|
3033
|
+
// src/components/inlined-script.tsx
|
|
3034
|
+
function InlinedScript(props) {
|
|
3035
|
+
return <><script
|
|
3036
|
+
innerHTML={props.scriptStr}
|
|
3037
|
+
data-id={props.id}
|
|
3038
|
+
nonce={props.nonce || ""}
|
|
3039
|
+
/></>;
|
|
3040
|
+
}
|
|
3041
|
+
var Inlined_script_default = InlinedScript;
|
|
3042
|
+
|
|
3043
|
+
// src/functions/is-previewing.ts
|
|
3044
|
+
function isPreviewing(_search) {
|
|
3045
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3046
|
+
if (!search) {
|
|
3047
|
+
return false;
|
|
3048
|
+
}
|
|
3049
|
+
const normalizedSearch = getSearchString(search);
|
|
3050
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3054
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3055
|
+
function isString(val) {
|
|
3056
|
+
return typeof val === "string";
|
|
3057
|
+
}
|
|
3058
|
+
function isNumber(val) {
|
|
3059
|
+
return typeof val === "number";
|
|
3060
|
+
}
|
|
3061
|
+
function objectMatchesQuery(userattr, query2) {
|
|
3062
|
+
const result = (() => {
|
|
3063
|
+
const property = query2.property;
|
|
3064
|
+
const operator = query2.operator;
|
|
3065
|
+
let testValue = query2.value;
|
|
3066
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3067
|
+
testValue = query2.value.slice(0, -1);
|
|
3068
|
+
}
|
|
3069
|
+
if (!(property && operator)) {
|
|
3070
|
+
return true;
|
|
3071
|
+
}
|
|
3072
|
+
if (Array.isArray(testValue)) {
|
|
3073
|
+
if (operator === "isNot") {
|
|
3074
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3075
|
+
property,
|
|
3076
|
+
operator,
|
|
3077
|
+
value: val
|
|
3078
|
+
}));
|
|
3079
|
+
}
|
|
3080
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3081
|
+
property,
|
|
3082
|
+
operator,
|
|
3083
|
+
value: val
|
|
3084
|
+
}));
|
|
3085
|
+
}
|
|
3086
|
+
const value = userattr[property];
|
|
3087
|
+
if (Array.isArray(value)) {
|
|
3088
|
+
return value.includes(testValue);
|
|
3089
|
+
}
|
|
3090
|
+
switch (operator) {
|
|
3091
|
+
case "is":
|
|
3092
|
+
return value === testValue;
|
|
3093
|
+
case "isNot":
|
|
3094
|
+
return value !== testValue;
|
|
3095
|
+
case "contains":
|
|
3096
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3097
|
+
case "startsWith":
|
|
3098
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
3099
|
+
case "endsWith":
|
|
3100
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
3101
|
+
case "greaterThan":
|
|
3102
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3103
|
+
case "lessThan":
|
|
3104
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3105
|
+
case "greaterThanOrEqualTo":
|
|
3106
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3107
|
+
case "lessThanOrEqualTo":
|
|
3108
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3109
|
+
default:
|
|
3110
|
+
return false;
|
|
3111
|
+
}
|
|
3112
|
+
})();
|
|
3113
|
+
return result;
|
|
3114
|
+
}
|
|
3115
|
+
const item = {
|
|
3116
|
+
query,
|
|
3117
|
+
startDate,
|
|
3118
|
+
endDate
|
|
3119
|
+
};
|
|
3120
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3121
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
3122
|
+
return false;
|
|
3123
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3124
|
+
return false;
|
|
3125
|
+
}
|
|
3126
|
+
if (!item.query || !item.query.length) {
|
|
3127
|
+
return true;
|
|
3128
|
+
}
|
|
3129
|
+
return item.query.every((filter) => {
|
|
3130
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3134
|
+
if (!navigator.cookieEnabled) {
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
function getCookie(name) {
|
|
3138
|
+
const nameEQ = name + '=';
|
|
3139
|
+
const ca = document.cookie.split(';');
|
|
3140
|
+
for (let i = 0; i < ca.length; i++) {
|
|
3141
|
+
let c = ca[i];
|
|
3142
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3143
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3144
|
+
}
|
|
3145
|
+
return null;
|
|
3146
|
+
}
|
|
3147
|
+
function removeVariants() {
|
|
3148
|
+
variants?.forEach(function (_, index) {
|
|
3149
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3150
|
+
});
|
|
3151
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3152
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3153
|
+
}
|
|
3154
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3155
|
+
if (locale) {
|
|
3156
|
+
attributes.locale = locale;
|
|
3157
|
+
}
|
|
3158
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3159
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3160
|
+
});
|
|
3161
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
3162
|
+
if (isDebug) {
|
|
3163
|
+
console.debug('PersonalizationContainer', {
|
|
3164
|
+
attributes,
|
|
3165
|
+
variants,
|
|
3166
|
+
winningVariantIndex
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3169
|
+
if (winningVariantIndex !== -1) {
|
|
3170
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3171
|
+
if (winningVariant) {
|
|
3172
|
+
const parentNode = winningVariant.parentNode;
|
|
3173
|
+
if (parentNode) {
|
|
3174
|
+
const newParent = parentNode.cloneNode(false);
|
|
3175
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3176
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3177
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3178
|
+
}
|
|
3179
|
+
if (isDebug) {
|
|
3180
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
} else if (variants && variants.length > 0) {
|
|
3184
|
+
removeVariants();
|
|
3185
|
+
}
|
|
3186
|
+
}`;
|
|
3187
|
+
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}";
|
|
3188
|
+
|
|
3189
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3190
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3191
|
+
const hasVariants = variants && variants.length > 0;
|
|
3192
|
+
if (TARGET === "reactNative")
|
|
3193
|
+
return false;
|
|
3194
|
+
if (!hasVariants)
|
|
3195
|
+
return false;
|
|
3196
|
+
if (!canTrack)
|
|
3197
|
+
return false;
|
|
3198
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3199
|
+
return true;
|
|
3200
|
+
if (isBrowser())
|
|
3201
|
+
return false;
|
|
3202
|
+
return true;
|
|
3203
|
+
}
|
|
3204
|
+
function getBlocksToRender({
|
|
3205
|
+
variants,
|
|
3206
|
+
previewingIndex,
|
|
3207
|
+
isHydrated,
|
|
3208
|
+
filteredVariants,
|
|
3209
|
+
fallbackBlocks
|
|
3210
|
+
}) {
|
|
3211
|
+
const fallback = {
|
|
3212
|
+
blocks: fallbackBlocks ?? [],
|
|
3213
|
+
path: "this.children"
|
|
3214
|
+
};
|
|
3215
|
+
if (isHydrated && isEditing()) {
|
|
3216
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3217
|
+
const variant = variants[previewingIndex];
|
|
3218
|
+
return {
|
|
3219
|
+
blocks: variant.blocks,
|
|
3220
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3221
|
+
};
|
|
3222
|
+
}
|
|
3223
|
+
return fallback;
|
|
3224
|
+
}
|
|
3225
|
+
if (isBrowser()) {
|
|
3226
|
+
const winningVariant = filteredVariants?.[0];
|
|
3227
|
+
if (winningVariant) {
|
|
3228
|
+
return {
|
|
3229
|
+
blocks: winningVariant.blocks,
|
|
3230
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3231
|
+
};
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
return fallback;
|
|
3235
|
+
}
|
|
3236
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3237
|
+
return `
|
|
3238
|
+
(function() {
|
|
3239
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3240
|
+
${PERSONALIZATION_SCRIPT}
|
|
3241
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3242
|
+
})();
|
|
3243
|
+
`;
|
|
3244
|
+
};
|
|
3245
|
+
|
|
3246
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3247
|
+
function PersonalizationContainer(props) {
|
|
3248
|
+
const [userAttributes, setUserAttributes] = createSignal10(
|
|
3249
|
+
userAttributesService.getUserAttributes()
|
|
3250
|
+
);
|
|
3251
|
+
const [scriptStr, setScriptStr] = createSignal10(
|
|
3252
|
+
getPersonalizationScript(
|
|
3253
|
+
props.variants,
|
|
3254
|
+
props.builderBlock?.id || "none",
|
|
3255
|
+
props.builderContext?.rootState?.locale
|
|
3256
|
+
)
|
|
3257
|
+
);
|
|
3258
|
+
const [unsubscribers, setUnsubscribers] = createSignal10([]);
|
|
3259
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
|
|
3260
|
+
checkShouldRenderVariants(
|
|
3261
|
+
props.variants,
|
|
3262
|
+
getDefaultCanTrack(props.builderContext?.canTrack)
|
|
3263
|
+
)
|
|
3264
|
+
);
|
|
3265
|
+
const [isHydrated, setIsHydrated] = createSignal10(false);
|
|
3266
|
+
const filteredVariants = createMemo10(() => {
|
|
3267
|
+
return (props.variants || []).filter((variant) => {
|
|
3268
|
+
return filterWithCustomTargeting(
|
|
3269
|
+
{
|
|
3270
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3271
|
+
locale: props.builderContext?.rootState?.locale
|
|
3272
|
+
} : {},
|
|
3273
|
+
...userAttributes()
|
|
3274
|
+
},
|
|
3275
|
+
variant.query,
|
|
3276
|
+
variant.startDate,
|
|
3277
|
+
variant.endDate
|
|
3278
|
+
);
|
|
3279
|
+
});
|
|
3280
|
+
});
|
|
3281
|
+
const blocksToRender = createMemo10(() => {
|
|
3282
|
+
return getBlocksToRender({
|
|
3283
|
+
variants: props.variants,
|
|
3284
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3285
|
+
isHydrated: isHydrated(),
|
|
3286
|
+
filteredVariants: filteredVariants(),
|
|
3287
|
+
previewingIndex: props.previewingIndex
|
|
3288
|
+
});
|
|
3289
|
+
});
|
|
3290
|
+
const hideVariantsStyleString = createMemo10(() => {
|
|
3291
|
+
return (props.variants || []).map(
|
|
3292
|
+
(_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
|
|
3293
|
+
).join("");
|
|
3294
|
+
});
|
|
3295
|
+
let rootRef;
|
|
3296
|
+
onMount4(() => {
|
|
3297
|
+
setIsHydrated(true);
|
|
3298
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange(
|
|
3299
|
+
(attrs) => {
|
|
3300
|
+
setUserAttributes(attrs);
|
|
3301
|
+
}
|
|
3302
|
+
);
|
|
3303
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3304
|
+
const variant = filteredVariants()[0];
|
|
3305
|
+
if (rootRef) {
|
|
3306
|
+
rootRef.dispatchEvent(
|
|
3307
|
+
new CustomEvent("builder.variantLoaded", {
|
|
3308
|
+
detail: {
|
|
3309
|
+
variant: variant || "default",
|
|
3310
|
+
content: props.builderContext?.content
|
|
3311
|
+
},
|
|
3312
|
+
bubbles: true
|
|
3313
|
+
})
|
|
3314
|
+
);
|
|
3315
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3316
|
+
entries.forEach((entry) => {
|
|
3317
|
+
if (entry.isIntersecting && rootRef) {
|
|
3318
|
+
rootRef.dispatchEvent(
|
|
3319
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
3320
|
+
detail: {
|
|
3321
|
+
variant: variant || "default",
|
|
3322
|
+
content: props.builderContext?.content
|
|
3323
|
+
},
|
|
3324
|
+
bubbles: true
|
|
3325
|
+
})
|
|
3326
|
+
);
|
|
3327
|
+
}
|
|
3328
|
+
});
|
|
3329
|
+
});
|
|
3330
|
+
observer.observe(rootRef);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
unsubscribers().push(unsub);
|
|
3334
|
+
});
|
|
3335
|
+
return <><div
|
|
3336
|
+
class={`builder-personalization-container ${props.attributes?.className || ""}`}
|
|
3337
|
+
ref={rootRef}
|
|
3338
|
+
{...props.attributes}
|
|
3339
|
+
>
|
|
3340
|
+
<Show10 when={shouldRenderVariants()}>
|
|
3341
|
+
<For6 each={props.variants}>{(variant, _index) => {
|
|
3342
|
+
const index = _index();
|
|
3343
|
+
return <template
|
|
3344
|
+
key={index}
|
|
3345
|
+
data-variant-id={`${props.builderBlock?.id}-${index}`}
|
|
3346
|
+
><Blocks_default
|
|
3347
|
+
blocks={variant.blocks}
|
|
3348
|
+
parent={props.builderBlock?.id}
|
|
3349
|
+
path={`component.options.variants.${index}.blocks`}
|
|
3350
|
+
/></template>;
|
|
3351
|
+
}}</For6>
|
|
3352
|
+
<Inlined_styles_default
|
|
3353
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3354
|
+
styles={hideVariantsStyleString()}
|
|
3355
|
+
id={`variants-styles-${props.builderBlock?.id}`}
|
|
3356
|
+
/>
|
|
3357
|
+
<Inlined_script_default
|
|
3358
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3359
|
+
scriptStr={scriptStr()}
|
|
3360
|
+
id={`variants-script-${props.builderBlock?.id}`}
|
|
3361
|
+
/>
|
|
3362
|
+
</Show10>
|
|
3363
|
+
<Blocks_default
|
|
3364
|
+
blocks={blocksToRender().blocks}
|
|
3365
|
+
parent={props.builderBlock?.id}
|
|
3366
|
+
path={blocksToRender().path}
|
|
3367
|
+
/>
|
|
3368
|
+
</div></>;
|
|
3369
|
+
}
|
|
3370
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3371
|
+
|
|
3372
|
+
// src/blocks/section/component-info.ts
|
|
3373
|
+
var componentInfo7 = {
|
|
2943
3374
|
name: "Core:Section",
|
|
2944
3375
|
static: true,
|
|
2945
3376
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2981,7 +3412,7 @@ var componentInfo6 = {
|
|
|
2981
3412
|
};
|
|
2982
3413
|
|
|
2983
3414
|
// src/blocks/slot/component-info.ts
|
|
2984
|
-
var
|
|
3415
|
+
var componentInfo8 = {
|
|
2985
3416
|
name: "Slot",
|
|
2986
3417
|
isRSC: true,
|
|
2987
3418
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -3020,7 +3451,7 @@ function Slot(props) {
|
|
|
3020
3451
|
var slot_default = Slot;
|
|
3021
3452
|
|
|
3022
3453
|
// src/blocks/symbol/component-info.ts
|
|
3023
|
-
var
|
|
3454
|
+
var componentInfo9 = {
|
|
3024
3455
|
name: "Symbol",
|
|
3025
3456
|
noWrap: true,
|
|
3026
3457
|
static: true,
|
|
@@ -3102,7 +3533,7 @@ var defaultElement = {
|
|
|
3102
3533
|
}
|
|
3103
3534
|
}
|
|
3104
3535
|
};
|
|
3105
|
-
var
|
|
3536
|
+
var componentInfo10 = {
|
|
3106
3537
|
name: "Builder: Tabs",
|
|
3107
3538
|
inputs: [{
|
|
3108
3539
|
name: "tabs",
|
|
@@ -3208,9 +3639,9 @@ var componentInfo9 = {
|
|
|
3208
3639
|
};
|
|
3209
3640
|
|
|
3210
3641
|
// src/blocks/tabs/tabs.tsx
|
|
3211
|
-
import { Show as
|
|
3642
|
+
import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
|
|
3212
3643
|
function Tabs(props) {
|
|
3213
|
-
const [activeTab, setActiveTab] =
|
|
3644
|
+
const [activeTab, setActiveTab] = createSignal11(
|
|
3214
3645
|
props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
|
|
3215
3646
|
);
|
|
3216
3647
|
function activeTabContent(active) {
|
|
@@ -3232,7 +3663,7 @@ function Tabs(props) {
|
|
|
3232
3663
|
"justify-content": props.tabHeaderLayout || "flex-start",
|
|
3233
3664
|
overflow: "auto"
|
|
3234
3665
|
}}
|
|
3235
|
-
><
|
|
3666
|
+
><For7 each={props.tabs}>{(tab, _index) => {
|
|
3236
3667
|
const index = _index();
|
|
3237
3668
|
return <span
|
|
3238
3669
|
class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
|
|
@@ -3249,21 +3680,21 @@ function Tabs(props) {
|
|
|
3249
3680
|
registeredComponents={props.builderComponents}
|
|
3250
3681
|
linkComponent={props.builderLinkComponent}
|
|
3251
3682
|
/></span>;
|
|
3252
|
-
}}</
|
|
3253
|
-
<
|
|
3683
|
+
}}</For7></div>
|
|
3684
|
+
<Show11 when={activeTabContent(activeTab())}><div><Blocks_default
|
|
3254
3685
|
parent={props.builderBlock.id}
|
|
3255
3686
|
path={`tabs.${activeTab()}.content`}
|
|
3256
3687
|
blocks={activeTabContent(activeTab())}
|
|
3257
3688
|
context={props.builderContext}
|
|
3258
3689
|
registeredComponents={props.builderComponents}
|
|
3259
3690
|
linkComponent={props.builderLinkComponent}
|
|
3260
|
-
/></div></
|
|
3691
|
+
/></div></Show11>
|
|
3261
3692
|
</div></>;
|
|
3262
3693
|
}
|
|
3263
3694
|
var tabs_default = Tabs;
|
|
3264
3695
|
|
|
3265
3696
|
// src/blocks/text/component-info.ts
|
|
3266
|
-
var
|
|
3697
|
+
var componentInfo11 = {
|
|
3267
3698
|
shouldReceiveBuilderProps: {
|
|
3268
3699
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3269
3700
|
builderContext: true
|
|
@@ -3300,7 +3731,7 @@ function Text(props) {
|
|
|
3300
3731
|
var text_default = Text;
|
|
3301
3732
|
|
|
3302
3733
|
// src/blocks/custom-code/component-info.ts
|
|
3303
|
-
var
|
|
3734
|
+
var componentInfo12 = {
|
|
3304
3735
|
name: "Custom Code",
|
|
3305
3736
|
static: true,
|
|
3306
3737
|
requiredPermissions: ["editCode"],
|
|
@@ -3325,12 +3756,12 @@ var componentInfo11 = {
|
|
|
3325
3756
|
};
|
|
3326
3757
|
|
|
3327
3758
|
// src/blocks/custom-code/custom-code.tsx
|
|
3328
|
-
import { onMount as
|
|
3759
|
+
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
3329
3760
|
function CustomCode(props) {
|
|
3330
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3331
|
-
const [scriptsRun, setScriptsRun] =
|
|
3761
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3762
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3332
3763
|
let elementRef;
|
|
3333
|
-
|
|
3764
|
+
onMount5(() => {
|
|
3334
3765
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3335
3766
|
return;
|
|
3336
3767
|
}
|
|
@@ -3371,7 +3802,7 @@ function CustomCode(props) {
|
|
|
3371
3802
|
var custom_code_default = CustomCode;
|
|
3372
3803
|
|
|
3373
3804
|
// src/blocks/embed/component-info.ts
|
|
3374
|
-
var
|
|
3805
|
+
var componentInfo13 = {
|
|
3375
3806
|
name: "Embed",
|
|
3376
3807
|
static: true,
|
|
3377
3808
|
inputs: [{
|
|
@@ -3389,7 +3820,7 @@ var componentInfo12 = {
|
|
|
3389
3820
|
};
|
|
3390
3821
|
|
|
3391
3822
|
// src/blocks/embed/embed.tsx
|
|
3392
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3823
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3393
3824
|
|
|
3394
3825
|
// src/blocks/embed/helpers.ts
|
|
3395
3826
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3397,9 +3828,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3397
3828
|
|
|
3398
3829
|
// src/blocks/embed/embed.tsx
|
|
3399
3830
|
function Embed(props) {
|
|
3400
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3401
|
-
const [scriptsRun, setScriptsRun] =
|
|
3402
|
-
const [ranInitFn, setRanInitFn] =
|
|
3831
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
3832
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
3833
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
3403
3834
|
function findAndRunScripts() {
|
|
3404
3835
|
if (!elem || !elem.getElementsByTagName)
|
|
3405
3836
|
return;
|
|
@@ -3422,8 +3853,8 @@ function Embed(props) {
|
|
|
3422
3853
|
}
|
|
3423
3854
|
}
|
|
3424
3855
|
let elem;
|
|
3425
|
-
const onUpdateFn_0_elem =
|
|
3426
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3856
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
3857
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
3427
3858
|
function onUpdateFn_0() {
|
|
3428
3859
|
if (elem && !ranInitFn()) {
|
|
3429
3860
|
setRanInitFn(true);
|
|
@@ -3438,7 +3869,7 @@ function Embed(props) {
|
|
|
3438
3869
|
var embed_default = Embed;
|
|
3439
3870
|
|
|
3440
3871
|
// src/blocks/form/form/component-info.ts
|
|
3441
|
-
var
|
|
3872
|
+
var componentInfo14 = {
|
|
3442
3873
|
name: "Form:Form",
|
|
3443
3874
|
// editableTags: ['builder-form-error']
|
|
3444
3875
|
defaults: {
|
|
@@ -3678,7 +4109,7 @@ var componentInfo13 = {
|
|
|
3678
4109
|
};
|
|
3679
4110
|
|
|
3680
4111
|
// src/blocks/form/form/form.tsx
|
|
3681
|
-
import { Show as
|
|
4112
|
+
import { Show as Show12, createSignal as createSignal14 } from "solid-js";
|
|
3682
4113
|
|
|
3683
4114
|
// src/functions/get-env.ts
|
|
3684
4115
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3698,9 +4129,9 @@ function logFetch(url) {
|
|
|
3698
4129
|
|
|
3699
4130
|
// src/blocks/form/form/form.tsx
|
|
3700
4131
|
function FormComponent(props) {
|
|
3701
|
-
const [formState, setFormState] =
|
|
3702
|
-
const [responseData, setResponseData] =
|
|
3703
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
4132
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
4133
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
4134
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
3704
4135
|
function mergeNewRootState(newData) {
|
|
3705
4136
|
const combinedState = {
|
|
3706
4137
|
...props.builderContext.rootState,
|
|
@@ -3896,22 +4327,22 @@ function FormComponent(props) {
|
|
|
3896
4327
|
{...props.attributes}
|
|
3897
4328
|
>
|
|
3898
4329
|
{props.children}
|
|
3899
|
-
<
|
|
4330
|
+
<Show12 when={submissionState() === "error"}><Blocks_default
|
|
3900
4331
|
path="errorMessage"
|
|
3901
4332
|
blocks={props.errorMessage}
|
|
3902
4333
|
context={props.builderContext}
|
|
3903
|
-
/></
|
|
3904
|
-
<
|
|
4334
|
+
/></Show12>
|
|
4335
|
+
<Show12 when={submissionState() === "sending"}><Blocks_default
|
|
3905
4336
|
path="sendingMessage"
|
|
3906
4337
|
blocks={props.sendingMessage}
|
|
3907
4338
|
context={props.builderContext}
|
|
3908
|
-
/></
|
|
3909
|
-
<
|
|
3910
|
-
<
|
|
4339
|
+
/></Show12>
|
|
4340
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
4341
|
+
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
3911
4342
|
path="successMessage"
|
|
3912
4343
|
blocks={props.successMessage}
|
|
3913
4344
|
context={props.builderContext}
|
|
3914
|
-
/></
|
|
4345
|
+
/></Show12>
|
|
3915
4346
|
</form>
|
|
3916
4347
|
<style>{`.pre-04a43b72 {
|
|
3917
4348
|
padding: 10px;
|
|
@@ -3923,7 +4354,7 @@ function FormComponent(props) {
|
|
|
3923
4354
|
var form_default = FormComponent;
|
|
3924
4355
|
|
|
3925
4356
|
// src/blocks/form/input/component-info.ts
|
|
3926
|
-
var
|
|
4357
|
+
var componentInfo15 = {
|
|
3927
4358
|
name: "Form:Input",
|
|
3928
4359
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
3929
4360
|
inputs: [
|
|
@@ -3993,7 +4424,7 @@ function FormInputComponent(props) {
|
|
|
3993
4424
|
var input_default = FormInputComponent;
|
|
3994
4425
|
|
|
3995
4426
|
// src/blocks/form/select/component-info.ts
|
|
3996
|
-
var
|
|
4427
|
+
var componentInfo16 = {
|
|
3997
4428
|
name: "Form:Select",
|
|
3998
4429
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
3999
4430
|
defaultStyles: {
|
|
@@ -4038,7 +4469,7 @@ var componentInfo15 = {
|
|
|
4038
4469
|
};
|
|
4039
4470
|
|
|
4040
4471
|
// src/blocks/form/select/select.tsx
|
|
4041
|
-
import { For as
|
|
4472
|
+
import { For as For8 } from "solid-js";
|
|
4042
4473
|
function SelectComponent(props) {
|
|
4043
4474
|
return <><select
|
|
4044
4475
|
{...{}}
|
|
@@ -4048,15 +4479,15 @@ function SelectComponent(props) {
|
|
|
4048
4479
|
defaultValue={props.defaultValue}
|
|
4049
4480
|
name={props.name}
|
|
4050
4481
|
required={props.required}
|
|
4051
|
-
><
|
|
4482
|
+
><For8 each={props.options}>{(option, _index) => {
|
|
4052
4483
|
const index = _index();
|
|
4053
4484
|
return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
|
|
4054
|
-
}}</
|
|
4485
|
+
}}</For8></select></>;
|
|
4055
4486
|
}
|
|
4056
4487
|
var select_default = SelectComponent;
|
|
4057
4488
|
|
|
4058
4489
|
// src/blocks/form/submit-button/component-info.ts
|
|
4059
|
-
var
|
|
4490
|
+
var componentInfo17 = {
|
|
4060
4491
|
name: "Form:SubmitButton",
|
|
4061
4492
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
4062
4493
|
defaultStyles: {
|
|
@@ -4090,7 +4521,7 @@ function SubmitButton(props) {
|
|
|
4090
4521
|
var submit_button_default = SubmitButton;
|
|
4091
4522
|
|
|
4092
4523
|
// src/blocks/form/textarea/component-info.ts
|
|
4093
|
-
var
|
|
4524
|
+
var componentInfo18 = {
|
|
4094
4525
|
name: "Form:TextArea",
|
|
4095
4526
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
4096
4527
|
inputs: [{
|
|
@@ -4143,7 +4574,7 @@ function Textarea(props) {
|
|
|
4143
4574
|
var textarea_default = Textarea;
|
|
4144
4575
|
|
|
4145
4576
|
// src/blocks/img/component-info.ts
|
|
4146
|
-
var
|
|
4577
|
+
var componentInfo19 = {
|
|
4147
4578
|
// friendlyName?
|
|
4148
4579
|
name: "Raw:Img",
|
|
4149
4580
|
hideFromInsertMenu: true,
|
|
@@ -4176,7 +4607,7 @@ function ImgComponent(props) {
|
|
|
4176
4607
|
var img_default = ImgComponent;
|
|
4177
4608
|
|
|
4178
4609
|
// src/blocks/video/component-info.ts
|
|
4179
|
-
var
|
|
4610
|
+
var componentInfo20 = {
|
|
4180
4611
|
name: "Video",
|
|
4181
4612
|
canHaveChildren: true,
|
|
4182
4613
|
defaultStyles: {
|
|
@@ -4263,9 +4694,9 @@ var componentInfo19 = {
|
|
|
4263
4694
|
};
|
|
4264
4695
|
|
|
4265
4696
|
// src/blocks/video/video.tsx
|
|
4266
|
-
import { Show as
|
|
4697
|
+
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4267
4698
|
function Video(props) {
|
|
4268
|
-
const videoProps =
|
|
4699
|
+
const videoProps = createMemo15(() => {
|
|
4269
4700
|
return {
|
|
4270
4701
|
...props.autoPlay === true ? {
|
|
4271
4702
|
autoPlay: true
|
|
@@ -4284,7 +4715,7 @@ function Video(props) {
|
|
|
4284
4715
|
} : {}
|
|
4285
4716
|
};
|
|
4286
4717
|
});
|
|
4287
|
-
const spreadProps =
|
|
4718
|
+
const spreadProps = createMemo15(() => {
|
|
4288
4719
|
return {
|
|
4289
4720
|
...videoProps()
|
|
4290
4721
|
};
|
|
@@ -4313,8 +4744,8 @@ function Video(props) {
|
|
|
4313
4744
|
}}
|
|
4314
4745
|
src={props.video || "no-src"}
|
|
4315
4746
|
poster={props.posterImage}
|
|
4316
|
-
><
|
|
4317
|
-
<
|
|
4747
|
+
><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
|
|
4748
|
+
<Show13
|
|
4318
4749
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4319
4750
|
><div
|
|
4320
4751
|
style={{
|
|
@@ -4323,15 +4754,15 @@ function Video(props) {
|
|
|
4323
4754
|
"pointer-events": "none",
|
|
4324
4755
|
"font-size": "0px"
|
|
4325
4756
|
}}
|
|
4326
|
-
/></
|
|
4327
|
-
<
|
|
4757
|
+
/></Show13>
|
|
4758
|
+
<Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
4328
4759
|
style={{
|
|
4329
4760
|
display: "flex",
|
|
4330
4761
|
"flex-direction": "column",
|
|
4331
4762
|
"align-items": "stretch"
|
|
4332
4763
|
}}
|
|
4333
|
-
>{props.children}</div></
|
|
4334
|
-
<
|
|
4764
|
+
>{props.children}</div></Show13>
|
|
4765
|
+
<Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
4335
4766
|
style={{
|
|
4336
4767
|
"pointer-events": "none",
|
|
4337
4768
|
display: "flex",
|
|
@@ -4343,7 +4774,7 @@ function Video(props) {
|
|
|
4343
4774
|
width: "100%",
|
|
4344
4775
|
height: "100%"
|
|
4345
4776
|
}}
|
|
4346
|
-
>{props.children}</div></
|
|
4777
|
+
>{props.children}</div></Show13>
|
|
4347
4778
|
</div></>;
|
|
4348
4779
|
}
|
|
4349
4780
|
var video_default = Video;
|
|
@@ -4351,31 +4782,31 @@ var video_default = Video;
|
|
|
4351
4782
|
// src/constants/extra-components.ts
|
|
4352
4783
|
var getExtraComponents = () => [{
|
|
4353
4784
|
component: custom_code_default,
|
|
4354
|
-
...
|
|
4785
|
+
...componentInfo12
|
|
4355
4786
|
}, {
|
|
4356
4787
|
component: embed_default,
|
|
4357
|
-
...
|
|
4788
|
+
...componentInfo13
|
|
4358
4789
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4359
4790
|
component: form_default,
|
|
4360
|
-
...
|
|
4791
|
+
...componentInfo14
|
|
4361
4792
|
}, {
|
|
4362
4793
|
component: input_default,
|
|
4363
|
-
...
|
|
4794
|
+
...componentInfo15
|
|
4364
4795
|
}, {
|
|
4365
4796
|
component: submit_button_default,
|
|
4366
|
-
...
|
|
4797
|
+
...componentInfo17
|
|
4367
4798
|
}, {
|
|
4368
4799
|
component: select_default,
|
|
4369
|
-
...
|
|
4800
|
+
...componentInfo16
|
|
4370
4801
|
}, {
|
|
4371
4802
|
component: textarea_default,
|
|
4372
|
-
...
|
|
4803
|
+
...componentInfo18
|
|
4373
4804
|
}], {
|
|
4374
4805
|
component: img_default,
|
|
4375
|
-
...
|
|
4806
|
+
...componentInfo19
|
|
4376
4807
|
}, {
|
|
4377
4808
|
component: video_default,
|
|
4378
|
-
...
|
|
4809
|
+
...componentInfo20
|
|
4379
4810
|
}];
|
|
4380
4811
|
|
|
4381
4812
|
// src/constants/builder-registered-components.ts
|
|
@@ -4393,19 +4824,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4393
4824
|
...componentInfo5
|
|
4394
4825
|
}, {
|
|
4395
4826
|
component: section_default,
|
|
4396
|
-
...
|
|
4827
|
+
...componentInfo7
|
|
4397
4828
|
}, {
|
|
4398
4829
|
component: slot_default,
|
|
4399
|
-
...
|
|
4830
|
+
...componentInfo8
|
|
4400
4831
|
}, {
|
|
4401
4832
|
component: symbol_default,
|
|
4402
|
-
...
|
|
4833
|
+
...componentInfo9
|
|
4403
4834
|
}, {
|
|
4404
4835
|
component: text_default,
|
|
4405
|
-
...
|
|
4406
|
-
}, ...TARGET === "
|
|
4836
|
+
...componentInfo11
|
|
4837
|
+
}, ...TARGET === "react" ? [{
|
|
4838
|
+
component: personalization_container_default,
|
|
4839
|
+
...componentInfo6
|
|
4840
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4407
4841
|
component: tabs_default,
|
|
4408
|
-
...
|
|
4842
|
+
...componentInfo10
|
|
4409
4843
|
}, {
|
|
4410
4844
|
component: accordion_default,
|
|
4411
4845
|
...componentInfo
|
|
@@ -4443,7 +4877,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4443
4877
|
testVariationId: variant.id,
|
|
4444
4878
|
id: content?.id
|
|
4445
4879
|
}));
|
|
4446
|
-
var
|
|
4880
|
+
var checkShouldRenderVariants2 = ({
|
|
4447
4881
|
canTrack,
|
|
4448
4882
|
content
|
|
4449
4883
|
}) => {
|
|
@@ -4477,24 +4911,14 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4477
4911
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4478
4912
|
)`;
|
|
4479
4913
|
|
|
4480
|
-
// src/components/inlined-script.tsx
|
|
4481
|
-
function InlinedScript(props) {
|
|
4482
|
-
return <><script
|
|
4483
|
-
innerHTML={props.scriptStr}
|
|
4484
|
-
data-id={props.id}
|
|
4485
|
-
nonce={props.nonce || ""}
|
|
4486
|
-
/></>;
|
|
4487
|
-
}
|
|
4488
|
-
var Inlined_script_default = InlinedScript;
|
|
4489
|
-
|
|
4490
4914
|
// src/components/content/components/enable-editor.tsx
|
|
4491
4915
|
import {
|
|
4492
|
-
Show as
|
|
4493
|
-
onMount as
|
|
4916
|
+
Show as Show14,
|
|
4917
|
+
onMount as onMount6,
|
|
4494
4918
|
on as on3,
|
|
4495
4919
|
createEffect as createEffect3,
|
|
4496
|
-
createMemo as
|
|
4497
|
-
createSignal as
|
|
4920
|
+
createMemo as createMemo16,
|
|
4921
|
+
createSignal as createSignal16
|
|
4498
4922
|
} from "solid-js";
|
|
4499
4923
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4500
4924
|
|
|
@@ -4504,7 +4928,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4504
4928
|
}
|
|
4505
4929
|
|
|
4506
4930
|
// src/constants/sdk-version.ts
|
|
4507
|
-
var SDK_VERSION = "3.0.
|
|
4931
|
+
var SDK_VERSION = "3.0.6";
|
|
4508
4932
|
|
|
4509
4933
|
// src/helpers/sdk-headers.ts
|
|
4510
4934
|
var getSdkHeaders = () => ({
|
|
@@ -4799,16 +5223,6 @@ async function fetchEntries(options) {
|
|
|
4799
5223
|
return _processContentResult(options, content);
|
|
4800
5224
|
}
|
|
4801
5225
|
|
|
4802
|
-
// src/functions/is-previewing.ts
|
|
4803
|
-
function isPreviewing(_search) {
|
|
4804
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4805
|
-
if (!search) {
|
|
4806
|
-
return false;
|
|
4807
|
-
}
|
|
4808
|
-
const normalizedSearch = getSearchString(search);
|
|
4809
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4810
|
-
}
|
|
4811
|
-
|
|
4812
5226
|
// src/helpers/uuid.ts
|
|
4813
5227
|
function uuidv4() {
|
|
4814
5228
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -5131,7 +5545,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5131
5545
|
// Supports builder-model="..." attribute which is needed to
|
|
5132
5546
|
// scope our '+ add block' button styling
|
|
5133
5547
|
supportsAddBlockScoping: true,
|
|
5134
|
-
supportsCustomBreakpoints: true
|
|
5548
|
+
supportsCustomBreakpoints: true,
|
|
5549
|
+
blockLevelPersonalization: true
|
|
5135
5550
|
}
|
|
5136
5551
|
}, "*");
|
|
5137
5552
|
window.parent?.postMessage({
|
|
@@ -5346,12 +5761,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5346
5761
|
|
|
5347
5762
|
// src/components/content/components/enable-editor.tsx
|
|
5348
5763
|
function EnableEditor(props) {
|
|
5349
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5764
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
5350
5765
|
props.contentWrapper || "div"
|
|
5351
5766
|
);
|
|
5352
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5353
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5354
|
-
const [clicked, setClicked] =
|
|
5767
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
5768
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
5769
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
5355
5770
|
function mergeNewRootState(newData) {
|
|
5356
5771
|
const combinedState = {
|
|
5357
5772
|
...props.builderContextSignal.rootState,
|
|
@@ -5385,7 +5800,7 @@ function EnableEditor(props) {
|
|
|
5385
5800
|
content: newContentValue
|
|
5386
5801
|
}));
|
|
5387
5802
|
}
|
|
5388
|
-
const showContentProps =
|
|
5803
|
+
const showContentProps = createMemo16(() => {
|
|
5389
5804
|
return props.showContent ? {} : {
|
|
5390
5805
|
hidden: true,
|
|
5391
5806
|
"aria-hidden": true
|
|
@@ -5491,7 +5906,7 @@ function EnableEditor(props) {
|
|
|
5491
5906
|
let elementRef;
|
|
5492
5907
|
runHttpRequests();
|
|
5493
5908
|
emitStateUpdate();
|
|
5494
|
-
|
|
5909
|
+
onMount6(() => {
|
|
5495
5910
|
if (isBrowser()) {
|
|
5496
5911
|
if (isEditing() && !props.isNestedRender) {
|
|
5497
5912
|
window.addEventListener("message", processMessage);
|
|
@@ -5560,14 +5975,14 @@ function EnableEditor(props) {
|
|
|
5560
5975
|
}
|
|
5561
5976
|
}
|
|
5562
5977
|
});
|
|
5563
|
-
const onUpdateFn_0_props_content =
|
|
5978
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
5564
5979
|
function onUpdateFn_0() {
|
|
5565
5980
|
if (props.content) {
|
|
5566
5981
|
mergeNewContent(props.content);
|
|
5567
5982
|
}
|
|
5568
5983
|
}
|
|
5569
5984
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5570
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
5985
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
5571
5986
|
() => props.builderContextSignal.rootState
|
|
5572
5987
|
);
|
|
5573
5988
|
function onUpdateFn_1() {
|
|
@@ -5579,14 +5994,14 @@ function EnableEditor(props) {
|
|
|
5579
5994
|
onUpdateFn_1
|
|
5580
5995
|
)
|
|
5581
5996
|
);
|
|
5582
|
-
const onUpdateFn_2_props_data =
|
|
5997
|
+
const onUpdateFn_2_props_data = createMemo16(() => props.data);
|
|
5583
5998
|
function onUpdateFn_2() {
|
|
5584
5999
|
if (props.data) {
|
|
5585
6000
|
mergeNewRootState(props.data);
|
|
5586
6001
|
}
|
|
5587
6002
|
}
|
|
5588
6003
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5589
|
-
const onUpdateFn_3_props_locale =
|
|
6004
|
+
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
5590
6005
|
function onUpdateFn_3() {
|
|
5591
6006
|
if (props.locale) {
|
|
5592
6007
|
mergeNewRootState({
|
|
@@ -5595,7 +6010,7 @@ function EnableEditor(props) {
|
|
|
5595
6010
|
}
|
|
5596
6011
|
}
|
|
5597
6012
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5598
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><
|
|
6013
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
5599
6014
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5600
6015
|
><Dynamic5
|
|
5601
6016
|
class={getWrapperClassName(
|
|
@@ -5613,14 +6028,14 @@ function EnableEditor(props) {
|
|
|
5613
6028
|
{...showContentProps()}
|
|
5614
6029
|
{...props.contentWrapperProps}
|
|
5615
6030
|
component={ContentWrapper()}
|
|
5616
|
-
>{props.children}</Dynamic5></
|
|
6031
|
+
>{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
|
|
5617
6032
|
}
|
|
5618
6033
|
var Enable_editor_default = EnableEditor;
|
|
5619
6034
|
|
|
5620
6035
|
// src/components/content/components/styles.tsx
|
|
5621
|
-
import { createSignal as
|
|
6036
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
5622
6037
|
function ContentStyles(props) {
|
|
5623
|
-
const [injectedStyles, setInjectedStyles] =
|
|
6038
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
5624
6039
|
`
|
|
5625
6040
|
${getCss({
|
|
5626
6041
|
cssCode: props.cssCode,
|
|
@@ -5678,7 +6093,7 @@ var getContentInitialValue = ({
|
|
|
5678
6093
|
|
|
5679
6094
|
// src/components/content/content.tsx
|
|
5680
6095
|
function ContentComponent(props) {
|
|
5681
|
-
const [scriptStr, setScriptStr] =
|
|
6096
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
5682
6097
|
getUpdateVariantVisibilityScript({
|
|
5683
6098
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5684
6099
|
variationId: props.content?.testVariationId,
|
|
@@ -5686,7 +6101,7 @@ function ContentComponent(props) {
|
|
|
5686
6101
|
contentId: props.content?.id
|
|
5687
6102
|
})
|
|
5688
6103
|
);
|
|
5689
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
6104
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
5690
6105
|
[
|
|
5691
6106
|
...getDefaultRegisteredComponents(),
|
|
5692
6107
|
...props.customComponents || []
|
|
@@ -5701,7 +6116,7 @@ function ContentComponent(props) {
|
|
|
5701
6116
|
{}
|
|
5702
6117
|
)
|
|
5703
6118
|
);
|
|
5704
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
6119
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
5705
6120
|
content: getContentInitialValue({
|
|
5706
6121
|
content: props.content,
|
|
5707
6122
|
data: props.data
|
|
@@ -5785,18 +6200,18 @@ function ContentComponent(props) {
|
|
|
5785
6200
|
setBuilderContextSignal
|
|
5786
6201
|
}}
|
|
5787
6202
|
>
|
|
5788
|
-
<
|
|
6203
|
+
<Show15 when={props.isSsrAbTest}><Inlined_script_default
|
|
5789
6204
|
id="builderio-variant-visibility"
|
|
5790
6205
|
scriptStr={scriptStr()}
|
|
5791
6206
|
nonce={props.nonce || ""}
|
|
5792
|
-
/></
|
|
5793
|
-
<
|
|
6207
|
+
/></Show15>
|
|
6208
|
+
<Show15 when={TARGET !== "reactNative"}><Styles_default
|
|
5794
6209
|
nonce={props.nonce || ""}
|
|
5795
6210
|
isNestedRender={props.isNestedRender}
|
|
5796
6211
|
contentId={builderContextSignal().content?.id}
|
|
5797
6212
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
5798
6213
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
5799
|
-
/></
|
|
6214
|
+
/></Show15>
|
|
5800
6215
|
<Blocks_default
|
|
5801
6216
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
5802
6217
|
context={builderContextSignal()}
|
|
@@ -5809,13 +6224,13 @@ var Content_default = ContentComponent;
|
|
|
5809
6224
|
|
|
5810
6225
|
// src/components/content-variants/content-variants.tsx
|
|
5811
6226
|
function ContentVariants(props) {
|
|
5812
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5813
|
-
|
|
6227
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
6228
|
+
checkShouldRenderVariants2({
|
|
5814
6229
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5815
6230
|
content: props.content
|
|
5816
6231
|
})
|
|
5817
6232
|
);
|
|
5818
|
-
const updateCookieAndStylesScriptStr =
|
|
6233
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
5819
6234
|
return getUpdateCookieAndStylesScript(
|
|
5820
6235
|
getVariants(props.content).map((value) => ({
|
|
5821
6236
|
id: value.testVariationId,
|
|
@@ -5824,10 +6239,10 @@ function ContentVariants(props) {
|
|
|
5824
6239
|
props.content?.id || ""
|
|
5825
6240
|
);
|
|
5826
6241
|
});
|
|
5827
|
-
const hideVariantsStyleString =
|
|
6242
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
5828
6243
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5829
6244
|
});
|
|
5830
|
-
const defaultContent =
|
|
6245
|
+
const defaultContent = createMemo19(() => {
|
|
5831
6246
|
return shouldRenderVariants() ? {
|
|
5832
6247
|
...props.content,
|
|
5833
6248
|
testVariationId: props.content?.id
|
|
@@ -5836,16 +6251,16 @@ function ContentVariants(props) {
|
|
|
5836
6251
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5837
6252
|
});
|
|
5838
6253
|
});
|
|
5839
|
-
|
|
6254
|
+
onMount7(() => {
|
|
5840
6255
|
setShouldRenderVariants(false);
|
|
5841
6256
|
});
|
|
5842
6257
|
return <><>
|
|
5843
|
-
<
|
|
6258
|
+
<Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
5844
6259
|
id="builderio-init-variants-fns"
|
|
5845
6260
|
scriptStr={getInitVariantsFnsScriptString()}
|
|
5846
6261
|
nonce={props.nonce || ""}
|
|
5847
|
-
/></
|
|
5848
|
-
<
|
|
6262
|
+
/></Show16>
|
|
6263
|
+
<Show16 when={shouldRenderVariants()}>
|
|
5849
6264
|
<Inlined_styles_default
|
|
5850
6265
|
id="builderio-variants"
|
|
5851
6266
|
styles={hideVariantsStyleString()}
|
|
@@ -5856,7 +6271,7 @@ function ContentVariants(props) {
|
|
|
5856
6271
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
5857
6272
|
nonce={props.nonce || ""}
|
|
5858
6273
|
/>
|
|
5859
|
-
<
|
|
6274
|
+
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
5860
6275
|
const index = _index();
|
|
5861
6276
|
return <Content_default
|
|
5862
6277
|
apiHost={props.apiHost}
|
|
@@ -5883,8 +6298,8 @@ function ContentVariants(props) {
|
|
|
5883
6298
|
trustedHosts={props.trustedHosts}
|
|
5884
6299
|
{...{}}
|
|
5885
6300
|
/>;
|
|
5886
|
-
}}</
|
|
5887
|
-
</
|
|
6301
|
+
}}</For9>
|
|
6302
|
+
</Show16>
|
|
5888
6303
|
<Content_default
|
|
5889
6304
|
apiHost={props.apiHost}
|
|
5890
6305
|
nonce={props.nonce}
|
|
@@ -5939,14 +6354,14 @@ var fetchSymbolContent = async ({
|
|
|
5939
6354
|
|
|
5940
6355
|
// src/blocks/symbol/symbol.tsx
|
|
5941
6356
|
function Symbol(props) {
|
|
5942
|
-
const [contentToUse, setContentToUse] =
|
|
5943
|
-
const blocksWrapper =
|
|
6357
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
6358
|
+
const blocksWrapper = createMemo20(() => {
|
|
5944
6359
|
return "div";
|
|
5945
6360
|
});
|
|
5946
|
-
const contentWrapper =
|
|
6361
|
+
const contentWrapper = createMemo20(() => {
|
|
5947
6362
|
return "div";
|
|
5948
6363
|
});
|
|
5949
|
-
const className =
|
|
6364
|
+
const className = createMemo20(() => {
|
|
5950
6365
|
return [
|
|
5951
6366
|
...[props.attributes[getClassPropName()]],
|
|
5952
6367
|
"builder-symbol",
|
|
@@ -5966,9 +6381,9 @@ function Symbol(props) {
|
|
|
5966
6381
|
}
|
|
5967
6382
|
});
|
|
5968
6383
|
}
|
|
5969
|
-
|
|
6384
|
+
onMount8(() => {
|
|
5970
6385
|
});
|
|
5971
|
-
const onUpdateFn_0_props_symbol =
|
|
6386
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
5972
6387
|
function onUpdateFn_0() {
|
|
5973
6388
|
setContent();
|
|
5974
6389
|
}
|
|
@@ -6053,6 +6468,7 @@ export {
|
|
|
6053
6468
|
isEditing,
|
|
6054
6469
|
isPreviewing,
|
|
6055
6470
|
register,
|
|
6471
|
+
setClientUserAttributes,
|
|
6056
6472
|
setEditorSettings,
|
|
6057
6473
|
subscribeToEditor,
|
|
6058
6474
|
track
|