@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/dev.jsx
CHANGED
|
@@ -1634,8 +1634,9 @@ function BlocksWrapper(props) {
|
|
|
1634
1634
|
if (!props.path) {
|
|
1635
1635
|
return void 0;
|
|
1636
1636
|
}
|
|
1637
|
+
const thisPrefix = "this.";
|
|
1637
1638
|
const pathPrefix = "component.options.";
|
|
1638
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1639
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
1639
1640
|
});
|
|
1640
1641
|
function onClick() {
|
|
1641
1642
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -1670,7 +1671,7 @@ function BlocksWrapper(props) {
|
|
|
1670
1671
|
});
|
|
1671
1672
|
return <>
|
|
1672
1673
|
<Dynamic4
|
|
1673
|
-
class={className() + " dynamic-
|
|
1674
|
+
class={className() + " dynamic-3d7ff108"}
|
|
1674
1675
|
ref={blocksWrapperRef}
|
|
1675
1676
|
builder-path={dataPath()}
|
|
1676
1677
|
builder-parent-id={props.parent}
|
|
@@ -1682,7 +1683,7 @@ function BlocksWrapper(props) {
|
|
|
1682
1683
|
{...props.BlocksWrapperProps}
|
|
1683
1684
|
component={props.BlocksWrapper}
|
|
1684
1685
|
>{props.children}</Dynamic4>
|
|
1685
|
-
<style>{`.dynamic-
|
|
1686
|
+
<style>{`.dynamic-3d7ff108 {
|
|
1686
1687
|
display: flex;
|
|
1687
1688
|
flex-direction: column;
|
|
1688
1689
|
align-items: stretch;
|
|
@@ -2055,10 +2056,10 @@ function SectionComponent(props) {
|
|
|
2055
2056
|
var section_default = SectionComponent;
|
|
2056
2057
|
|
|
2057
2058
|
// src/blocks/symbol/symbol.tsx
|
|
2058
|
-
import { onMount as
|
|
2059
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
2059
2060
|
|
|
2060
2061
|
// src/components/content-variants/content-variants.tsx
|
|
2061
|
-
import { Show as
|
|
2062
|
+
import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
2062
2063
|
|
|
2063
2064
|
// src/helpers/url.ts
|
|
2064
2065
|
var getTopLevelDomain = (host) => {
|
|
@@ -2248,11 +2249,61 @@ var handleABTesting = async ({
|
|
|
2248
2249
|
};
|
|
2249
2250
|
};
|
|
2250
2251
|
|
|
2252
|
+
// src/helpers/user-attributes.ts
|
|
2253
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
2254
|
+
function createUserAttributesService() {
|
|
2255
|
+
let canTrack = true;
|
|
2256
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
2257
|
+
return {
|
|
2258
|
+
setUserAttributes(newAttrs) {
|
|
2259
|
+
if (!isBrowser()) {
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
const userAttributes = {
|
|
2263
|
+
...this.getUserAttributes(),
|
|
2264
|
+
...newAttrs
|
|
2265
|
+
};
|
|
2266
|
+
setCookie({
|
|
2267
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2268
|
+
value: JSON.stringify(userAttributes),
|
|
2269
|
+
canTrack
|
|
2270
|
+
});
|
|
2271
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
2272
|
+
},
|
|
2273
|
+
getUserAttributes() {
|
|
2274
|
+
if (!isBrowser()) {
|
|
2275
|
+
return {};
|
|
2276
|
+
}
|
|
2277
|
+
return JSON.parse(getCookieSync({
|
|
2278
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
2279
|
+
canTrack
|
|
2280
|
+
}) || "{}");
|
|
2281
|
+
},
|
|
2282
|
+
subscribeOnUserAttributesChange(callback) {
|
|
2283
|
+
subscribers.add(callback);
|
|
2284
|
+
return () => {
|
|
2285
|
+
subscribers.delete(callback);
|
|
2286
|
+
};
|
|
2287
|
+
},
|
|
2288
|
+
setCanTrack(value) {
|
|
2289
|
+
canTrack = value;
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
}
|
|
2293
|
+
var userAttributesService = createUserAttributesService();
|
|
2294
|
+
var setClientUserAttributes = (attributes) => {
|
|
2295
|
+
userAttributesService.setUserAttributes(attributes);
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2251
2298
|
// src/helpers/canTrack.ts
|
|
2252
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
2299
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
2300
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
2301
|
+
userAttributesService.setCanTrack(result);
|
|
2302
|
+
return result;
|
|
2303
|
+
};
|
|
2253
2304
|
|
|
2254
2305
|
// src/components/content/content.tsx
|
|
2255
|
-
import { Show as
|
|
2306
|
+
import { Show as Show15, createSignal as createSignal18 } from "solid-js";
|
|
2256
2307
|
|
|
2257
2308
|
// src/blocks/accordion/component-info.ts
|
|
2258
2309
|
var defaultTitle = {
|
|
@@ -2947,8 +2998,388 @@ var componentInfo5 = {
|
|
|
2947
2998
|
}
|
|
2948
2999
|
};
|
|
2949
3000
|
|
|
2950
|
-
// src/blocks/
|
|
3001
|
+
// src/blocks/personalization-container/component-info.ts
|
|
2951
3002
|
var componentInfo6 = {
|
|
3003
|
+
name: "PersonalizationContainer",
|
|
3004
|
+
shouldReceiveBuilderProps: {
|
|
3005
|
+
builderBlock: true,
|
|
3006
|
+
builderContext: true
|
|
3007
|
+
},
|
|
3008
|
+
noWrap: true,
|
|
3009
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
3010
|
+
canHaveChildren: true,
|
|
3011
|
+
inputs: [{
|
|
3012
|
+
name: "variants",
|
|
3013
|
+
defaultValue: [],
|
|
3014
|
+
behavior: "personalizationVariantList",
|
|
3015
|
+
type: "list",
|
|
3016
|
+
subFields: [{
|
|
3017
|
+
name: "name",
|
|
3018
|
+
type: "text"
|
|
3019
|
+
}, {
|
|
3020
|
+
name: "query",
|
|
3021
|
+
friendlyName: "Targeting rules",
|
|
3022
|
+
type: "BuilderQuery",
|
|
3023
|
+
defaultValue: []
|
|
3024
|
+
}, {
|
|
3025
|
+
name: "startDate",
|
|
3026
|
+
type: "date"
|
|
3027
|
+
}, {
|
|
3028
|
+
name: "endDate",
|
|
3029
|
+
type: "date"
|
|
3030
|
+
}, {
|
|
3031
|
+
name: "blocks",
|
|
3032
|
+
type: "uiBlocks",
|
|
3033
|
+
hideFromUI: true,
|
|
3034
|
+
defaultValue: []
|
|
3035
|
+
}]
|
|
3036
|
+
}]
|
|
3037
|
+
};
|
|
3038
|
+
|
|
3039
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3040
|
+
import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
|
|
3041
|
+
|
|
3042
|
+
// src/components/inlined-script.tsx
|
|
3043
|
+
function InlinedScript(props) {
|
|
3044
|
+
return <><script
|
|
3045
|
+
innerHTML={props.scriptStr}
|
|
3046
|
+
data-id={props.id}
|
|
3047
|
+
nonce={props.nonce || ""}
|
|
3048
|
+
/></>;
|
|
3049
|
+
}
|
|
3050
|
+
var Inlined_script_default = InlinedScript;
|
|
3051
|
+
|
|
3052
|
+
// src/functions/is-previewing.ts
|
|
3053
|
+
function isPreviewing(_search) {
|
|
3054
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
3055
|
+
if (!search) {
|
|
3056
|
+
return false;
|
|
3057
|
+
}
|
|
3058
|
+
const normalizedSearch = getSearchString(search);
|
|
3059
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
3063
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
3064
|
+
function isString(val) {
|
|
3065
|
+
return typeof val === "string";
|
|
3066
|
+
}
|
|
3067
|
+
function isNumber(val) {
|
|
3068
|
+
return typeof val === "number";
|
|
3069
|
+
}
|
|
3070
|
+
function objectMatchesQuery(userattr, query2) {
|
|
3071
|
+
const result = (() => {
|
|
3072
|
+
const property = query2.property;
|
|
3073
|
+
const operator = query2.operator;
|
|
3074
|
+
let testValue = query2.value;
|
|
3075
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
3076
|
+
testValue = query2.value.slice(0, -1);
|
|
3077
|
+
}
|
|
3078
|
+
if (!(property && operator)) {
|
|
3079
|
+
return true;
|
|
3080
|
+
}
|
|
3081
|
+
if (Array.isArray(testValue)) {
|
|
3082
|
+
if (operator === "isNot") {
|
|
3083
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
3084
|
+
property,
|
|
3085
|
+
operator,
|
|
3086
|
+
value: val
|
|
3087
|
+
}));
|
|
3088
|
+
}
|
|
3089
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
3090
|
+
property,
|
|
3091
|
+
operator,
|
|
3092
|
+
value: val
|
|
3093
|
+
}));
|
|
3094
|
+
}
|
|
3095
|
+
const value = userattr[property];
|
|
3096
|
+
if (Array.isArray(value)) {
|
|
3097
|
+
return value.includes(testValue);
|
|
3098
|
+
}
|
|
3099
|
+
switch (operator) {
|
|
3100
|
+
case "is":
|
|
3101
|
+
return value === testValue;
|
|
3102
|
+
case "isNot":
|
|
3103
|
+
return value !== testValue;
|
|
3104
|
+
case "contains":
|
|
3105
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
3106
|
+
case "startsWith":
|
|
3107
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
3108
|
+
case "endsWith":
|
|
3109
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
3110
|
+
case "greaterThan":
|
|
3111
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
3112
|
+
case "lessThan":
|
|
3113
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
3114
|
+
case "greaterThanOrEqualTo":
|
|
3115
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
3116
|
+
case "lessThanOrEqualTo":
|
|
3117
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
3118
|
+
default:
|
|
3119
|
+
return false;
|
|
3120
|
+
}
|
|
3121
|
+
})();
|
|
3122
|
+
return result;
|
|
3123
|
+
}
|
|
3124
|
+
const item = {
|
|
3125
|
+
query,
|
|
3126
|
+
startDate,
|
|
3127
|
+
endDate
|
|
3128
|
+
};
|
|
3129
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
3130
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
3131
|
+
return false;
|
|
3132
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
3133
|
+
return false;
|
|
3134
|
+
}
|
|
3135
|
+
if (!item.query || !item.query.length) {
|
|
3136
|
+
return true;
|
|
3137
|
+
}
|
|
3138
|
+
return item.query.every((filter) => {
|
|
3139
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
3143
|
+
if (!navigator.cookieEnabled) {
|
|
3144
|
+
return;
|
|
3145
|
+
}
|
|
3146
|
+
function getCookie(name) {
|
|
3147
|
+
const nameEQ = name + '=';
|
|
3148
|
+
const ca = document.cookie.split(';');
|
|
3149
|
+
for (let i = 0; i < ca.length; i++) {
|
|
3150
|
+
let c = ca[i];
|
|
3151
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
3152
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
3153
|
+
}
|
|
3154
|
+
return null;
|
|
3155
|
+
}
|
|
3156
|
+
function removeVariants() {
|
|
3157
|
+
variants?.forEach(function (_, index) {
|
|
3158
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
3159
|
+
});
|
|
3160
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
3161
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
3162
|
+
}
|
|
3163
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
3164
|
+
if (locale) {
|
|
3165
|
+
attributes.locale = locale;
|
|
3166
|
+
}
|
|
3167
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
3168
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
3169
|
+
});
|
|
3170
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
3171
|
+
if (isDebug) {
|
|
3172
|
+
console.debug('PersonalizationContainer', {
|
|
3173
|
+
attributes,
|
|
3174
|
+
variants,
|
|
3175
|
+
winningVariantIndex
|
|
3176
|
+
});
|
|
3177
|
+
}
|
|
3178
|
+
if (winningVariantIndex !== -1) {
|
|
3179
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
3180
|
+
if (winningVariant) {
|
|
3181
|
+
const parentNode = winningVariant.parentNode;
|
|
3182
|
+
if (parentNode) {
|
|
3183
|
+
const newParent = parentNode.cloneNode(false);
|
|
3184
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
3185
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
3186
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
3187
|
+
}
|
|
3188
|
+
if (isDebug) {
|
|
3189
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
3190
|
+
}
|
|
3191
|
+
}
|
|
3192
|
+
} else if (variants && variants.length > 0) {
|
|
3193
|
+
removeVariants();
|
|
3194
|
+
}
|
|
3195
|
+
}`;
|
|
3196
|
+
var FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
|
|
3197
|
+
|
|
3198
|
+
// src/blocks/personalization-container/helpers.ts
|
|
3199
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
3200
|
+
const hasVariants = variants && variants.length > 0;
|
|
3201
|
+
if (TARGET === "reactNative")
|
|
3202
|
+
return false;
|
|
3203
|
+
if (!hasVariants)
|
|
3204
|
+
return false;
|
|
3205
|
+
if (!canTrack)
|
|
3206
|
+
return false;
|
|
3207
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
3208
|
+
return true;
|
|
3209
|
+
if (isBrowser())
|
|
3210
|
+
return false;
|
|
3211
|
+
return true;
|
|
3212
|
+
}
|
|
3213
|
+
function getBlocksToRender({
|
|
3214
|
+
variants,
|
|
3215
|
+
previewingIndex,
|
|
3216
|
+
isHydrated,
|
|
3217
|
+
filteredVariants,
|
|
3218
|
+
fallbackBlocks
|
|
3219
|
+
}) {
|
|
3220
|
+
const fallback = {
|
|
3221
|
+
blocks: fallbackBlocks ?? [],
|
|
3222
|
+
path: "this.children"
|
|
3223
|
+
};
|
|
3224
|
+
if (isHydrated && isEditing()) {
|
|
3225
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
3226
|
+
const variant = variants[previewingIndex];
|
|
3227
|
+
return {
|
|
3228
|
+
blocks: variant.blocks,
|
|
3229
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
3230
|
+
};
|
|
3231
|
+
}
|
|
3232
|
+
return fallback;
|
|
3233
|
+
}
|
|
3234
|
+
if (isBrowser()) {
|
|
3235
|
+
const winningVariant = filteredVariants?.[0];
|
|
3236
|
+
if (winningVariant) {
|
|
3237
|
+
return {
|
|
3238
|
+
blocks: winningVariant.blocks,
|
|
3239
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
3240
|
+
};
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
return fallback;
|
|
3244
|
+
}
|
|
3245
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
3246
|
+
return `
|
|
3247
|
+
(function() {
|
|
3248
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3249
|
+
${PERSONALIZATION_SCRIPT}
|
|
3250
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
3251
|
+
})();
|
|
3252
|
+
`;
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3255
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
3256
|
+
function PersonalizationContainer(props) {
|
|
3257
|
+
const [userAttributes, setUserAttributes] = createSignal10(
|
|
3258
|
+
userAttributesService.getUserAttributes()
|
|
3259
|
+
);
|
|
3260
|
+
const [scriptStr, setScriptStr] = createSignal10(
|
|
3261
|
+
getPersonalizationScript(
|
|
3262
|
+
props.variants,
|
|
3263
|
+
props.builderBlock?.id || "none",
|
|
3264
|
+
props.builderContext?.rootState?.locale
|
|
3265
|
+
)
|
|
3266
|
+
);
|
|
3267
|
+
const [unsubscribers, setUnsubscribers] = createSignal10([]);
|
|
3268
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
|
|
3269
|
+
checkShouldRenderVariants(
|
|
3270
|
+
props.variants,
|
|
3271
|
+
getDefaultCanTrack(props.builderContext?.canTrack)
|
|
3272
|
+
)
|
|
3273
|
+
);
|
|
3274
|
+
const [isHydrated, setIsHydrated] = createSignal10(false);
|
|
3275
|
+
const filteredVariants = createMemo10(() => {
|
|
3276
|
+
return (props.variants || []).filter((variant) => {
|
|
3277
|
+
return filterWithCustomTargeting(
|
|
3278
|
+
{
|
|
3279
|
+
...props.builderContext?.rootState?.locale ? {
|
|
3280
|
+
locale: props.builderContext?.rootState?.locale
|
|
3281
|
+
} : {},
|
|
3282
|
+
...userAttributes()
|
|
3283
|
+
},
|
|
3284
|
+
variant.query,
|
|
3285
|
+
variant.startDate,
|
|
3286
|
+
variant.endDate
|
|
3287
|
+
);
|
|
3288
|
+
});
|
|
3289
|
+
});
|
|
3290
|
+
const blocksToRender = createMemo10(() => {
|
|
3291
|
+
return getBlocksToRender({
|
|
3292
|
+
variants: props.variants,
|
|
3293
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
3294
|
+
isHydrated: isHydrated(),
|
|
3295
|
+
filteredVariants: filteredVariants(),
|
|
3296
|
+
previewingIndex: props.previewingIndex
|
|
3297
|
+
});
|
|
3298
|
+
});
|
|
3299
|
+
const hideVariantsStyleString = createMemo10(() => {
|
|
3300
|
+
return (props.variants || []).map(
|
|
3301
|
+
(_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
|
|
3302
|
+
).join("");
|
|
3303
|
+
});
|
|
3304
|
+
let rootRef;
|
|
3305
|
+
onMount4(() => {
|
|
3306
|
+
setIsHydrated(true);
|
|
3307
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange(
|
|
3308
|
+
(attrs) => {
|
|
3309
|
+
setUserAttributes(attrs);
|
|
3310
|
+
}
|
|
3311
|
+
);
|
|
3312
|
+
if (!(isEditing() || isPreviewing())) {
|
|
3313
|
+
const variant = filteredVariants()[0];
|
|
3314
|
+
if (rootRef) {
|
|
3315
|
+
rootRef.dispatchEvent(
|
|
3316
|
+
new CustomEvent("builder.variantLoaded", {
|
|
3317
|
+
detail: {
|
|
3318
|
+
variant: variant || "default",
|
|
3319
|
+
content: props.builderContext?.content
|
|
3320
|
+
},
|
|
3321
|
+
bubbles: true
|
|
3322
|
+
})
|
|
3323
|
+
);
|
|
3324
|
+
const observer = new IntersectionObserver((entries) => {
|
|
3325
|
+
entries.forEach((entry) => {
|
|
3326
|
+
if (entry.isIntersecting && rootRef) {
|
|
3327
|
+
rootRef.dispatchEvent(
|
|
3328
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
3329
|
+
detail: {
|
|
3330
|
+
variant: variant || "default",
|
|
3331
|
+
content: props.builderContext?.content
|
|
3332
|
+
},
|
|
3333
|
+
bubbles: true
|
|
3334
|
+
})
|
|
3335
|
+
);
|
|
3336
|
+
}
|
|
3337
|
+
});
|
|
3338
|
+
});
|
|
3339
|
+
observer.observe(rootRef);
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
unsubscribers().push(unsub);
|
|
3343
|
+
});
|
|
3344
|
+
return <><div
|
|
3345
|
+
class={`builder-personalization-container ${props.attributes?.className || ""}`}
|
|
3346
|
+
ref={rootRef}
|
|
3347
|
+
{...props.attributes}
|
|
3348
|
+
>
|
|
3349
|
+
<Show10 when={shouldRenderVariants()}>
|
|
3350
|
+
<For6 each={props.variants}>{(variant, _index) => {
|
|
3351
|
+
const index = _index();
|
|
3352
|
+
return <template
|
|
3353
|
+
key={index}
|
|
3354
|
+
data-variant-id={`${props.builderBlock?.id}-${index}`}
|
|
3355
|
+
><Blocks_default
|
|
3356
|
+
blocks={variant.blocks}
|
|
3357
|
+
parent={props.builderBlock?.id}
|
|
3358
|
+
path={`component.options.variants.${index}.blocks`}
|
|
3359
|
+
/></template>;
|
|
3360
|
+
}}</For6>
|
|
3361
|
+
<Inlined_styles_default
|
|
3362
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3363
|
+
styles={hideVariantsStyleString()}
|
|
3364
|
+
id={`variants-styles-${props.builderBlock?.id}`}
|
|
3365
|
+
/>
|
|
3366
|
+
<Inlined_script_default
|
|
3367
|
+
nonce={props.builderContext?.nonce || ""}
|
|
3368
|
+
scriptStr={scriptStr()}
|
|
3369
|
+
id={`variants-script-${props.builderBlock?.id}`}
|
|
3370
|
+
/>
|
|
3371
|
+
</Show10>
|
|
3372
|
+
<Blocks_default
|
|
3373
|
+
blocks={blocksToRender().blocks}
|
|
3374
|
+
parent={props.builderBlock?.id}
|
|
3375
|
+
path={blocksToRender().path}
|
|
3376
|
+
/>
|
|
3377
|
+
</div></>;
|
|
3378
|
+
}
|
|
3379
|
+
var personalization_container_default = PersonalizationContainer;
|
|
3380
|
+
|
|
3381
|
+
// src/blocks/section/component-info.ts
|
|
3382
|
+
var componentInfo7 = {
|
|
2952
3383
|
name: "Core:Section",
|
|
2953
3384
|
static: true,
|
|
2954
3385
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -2990,7 +3421,7 @@ var componentInfo6 = {
|
|
|
2990
3421
|
};
|
|
2991
3422
|
|
|
2992
3423
|
// src/blocks/slot/component-info.ts
|
|
2993
|
-
var
|
|
3424
|
+
var componentInfo8 = {
|
|
2994
3425
|
name: "Slot",
|
|
2995
3426
|
isRSC: true,
|
|
2996
3427
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -3029,7 +3460,7 @@ function Slot(props) {
|
|
|
3029
3460
|
var slot_default = Slot;
|
|
3030
3461
|
|
|
3031
3462
|
// src/blocks/symbol/component-info.ts
|
|
3032
|
-
var
|
|
3463
|
+
var componentInfo9 = {
|
|
3033
3464
|
name: "Symbol",
|
|
3034
3465
|
noWrap: true,
|
|
3035
3466
|
static: true,
|
|
@@ -3111,7 +3542,7 @@ var defaultElement = {
|
|
|
3111
3542
|
}
|
|
3112
3543
|
}
|
|
3113
3544
|
};
|
|
3114
|
-
var
|
|
3545
|
+
var componentInfo10 = {
|
|
3115
3546
|
name: "Builder: Tabs",
|
|
3116
3547
|
inputs: [{
|
|
3117
3548
|
name: "tabs",
|
|
@@ -3217,9 +3648,9 @@ var componentInfo9 = {
|
|
|
3217
3648
|
};
|
|
3218
3649
|
|
|
3219
3650
|
// src/blocks/tabs/tabs.tsx
|
|
3220
|
-
import { Show as
|
|
3651
|
+
import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
|
|
3221
3652
|
function Tabs(props) {
|
|
3222
|
-
const [activeTab, setActiveTab] =
|
|
3653
|
+
const [activeTab, setActiveTab] = createSignal11(
|
|
3223
3654
|
props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
|
|
3224
3655
|
);
|
|
3225
3656
|
function activeTabContent(active) {
|
|
@@ -3241,7 +3672,7 @@ function Tabs(props) {
|
|
|
3241
3672
|
"justify-content": props.tabHeaderLayout || "flex-start",
|
|
3242
3673
|
overflow: "auto"
|
|
3243
3674
|
}}
|
|
3244
|
-
><
|
|
3675
|
+
><For7 each={props.tabs}>{(tab, _index) => {
|
|
3245
3676
|
const index = _index();
|
|
3246
3677
|
return <span
|
|
3247
3678
|
class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
|
|
@@ -3258,21 +3689,21 @@ function Tabs(props) {
|
|
|
3258
3689
|
registeredComponents={props.builderComponents}
|
|
3259
3690
|
linkComponent={props.builderLinkComponent}
|
|
3260
3691
|
/></span>;
|
|
3261
|
-
}}</
|
|
3262
|
-
<
|
|
3692
|
+
}}</For7></div>
|
|
3693
|
+
<Show11 when={activeTabContent(activeTab())}><div><Blocks_default
|
|
3263
3694
|
parent={props.builderBlock.id}
|
|
3264
3695
|
path={`tabs.${activeTab()}.content`}
|
|
3265
3696
|
blocks={activeTabContent(activeTab())}
|
|
3266
3697
|
context={props.builderContext}
|
|
3267
3698
|
registeredComponents={props.builderComponents}
|
|
3268
3699
|
linkComponent={props.builderLinkComponent}
|
|
3269
|
-
/></div></
|
|
3700
|
+
/></div></Show11>
|
|
3270
3701
|
</div></>;
|
|
3271
3702
|
}
|
|
3272
3703
|
var tabs_default = Tabs;
|
|
3273
3704
|
|
|
3274
3705
|
// src/blocks/text/component-info.ts
|
|
3275
|
-
var
|
|
3706
|
+
var componentInfo11 = {
|
|
3276
3707
|
shouldReceiveBuilderProps: {
|
|
3277
3708
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
3278
3709
|
builderContext: true
|
|
@@ -3309,7 +3740,7 @@ function Text(props) {
|
|
|
3309
3740
|
var text_default = Text;
|
|
3310
3741
|
|
|
3311
3742
|
// src/blocks/custom-code/component-info.ts
|
|
3312
|
-
var
|
|
3743
|
+
var componentInfo12 = {
|
|
3313
3744
|
name: "Custom Code",
|
|
3314
3745
|
static: true,
|
|
3315
3746
|
requiredPermissions: ["editCode"],
|
|
@@ -3334,12 +3765,12 @@ var componentInfo11 = {
|
|
|
3334
3765
|
};
|
|
3335
3766
|
|
|
3336
3767
|
// src/blocks/custom-code/custom-code.tsx
|
|
3337
|
-
import { onMount as
|
|
3768
|
+
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
3338
3769
|
function CustomCode(props) {
|
|
3339
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3340
|
-
const [scriptsRun, setScriptsRun] =
|
|
3770
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
3771
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
3341
3772
|
let elementRef;
|
|
3342
|
-
|
|
3773
|
+
onMount5(() => {
|
|
3343
3774
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
3344
3775
|
return;
|
|
3345
3776
|
}
|
|
@@ -3381,7 +3812,7 @@ function CustomCode(props) {
|
|
|
3381
3812
|
var custom_code_default = CustomCode;
|
|
3382
3813
|
|
|
3383
3814
|
// src/blocks/embed/component-info.ts
|
|
3384
|
-
var
|
|
3815
|
+
var componentInfo13 = {
|
|
3385
3816
|
name: "Embed",
|
|
3386
3817
|
static: true,
|
|
3387
3818
|
inputs: [{
|
|
@@ -3399,7 +3830,7 @@ var componentInfo12 = {
|
|
|
3399
3830
|
};
|
|
3400
3831
|
|
|
3401
3832
|
// src/blocks/embed/embed.tsx
|
|
3402
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
3833
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
3403
3834
|
|
|
3404
3835
|
// src/blocks/embed/helpers.ts
|
|
3405
3836
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -3407,9 +3838,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
3407
3838
|
|
|
3408
3839
|
// src/blocks/embed/embed.tsx
|
|
3409
3840
|
function Embed(props) {
|
|
3410
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
3411
|
-
const [scriptsRun, setScriptsRun] =
|
|
3412
|
-
const [ranInitFn, setRanInitFn] =
|
|
3841
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
3842
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
3843
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
3413
3844
|
function findAndRunScripts() {
|
|
3414
3845
|
if (!elem || !elem.getElementsByTagName)
|
|
3415
3846
|
return;
|
|
@@ -3433,8 +3864,8 @@ function Embed(props) {
|
|
|
3433
3864
|
}
|
|
3434
3865
|
}
|
|
3435
3866
|
let elem;
|
|
3436
|
-
const onUpdateFn_0_elem =
|
|
3437
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
3867
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
3868
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
3438
3869
|
function onUpdateFn_0() {
|
|
3439
3870
|
if (elem && !ranInitFn()) {
|
|
3440
3871
|
setRanInitFn(true);
|
|
@@ -3449,7 +3880,7 @@ function Embed(props) {
|
|
|
3449
3880
|
var embed_default = Embed;
|
|
3450
3881
|
|
|
3451
3882
|
// src/blocks/form/form/component-info.ts
|
|
3452
|
-
var
|
|
3883
|
+
var componentInfo14 = {
|
|
3453
3884
|
name: "Form:Form",
|
|
3454
3885
|
// editableTags: ['builder-form-error']
|
|
3455
3886
|
defaults: {
|
|
@@ -3689,7 +4120,7 @@ var componentInfo13 = {
|
|
|
3689
4120
|
};
|
|
3690
4121
|
|
|
3691
4122
|
// src/blocks/form/form/form.tsx
|
|
3692
|
-
import { Show as
|
|
4123
|
+
import { Show as Show12, createSignal as createSignal14 } from "solid-js";
|
|
3693
4124
|
|
|
3694
4125
|
// src/functions/get-env.ts
|
|
3695
4126
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -3709,9 +4140,9 @@ function logFetch(url) {
|
|
|
3709
4140
|
|
|
3710
4141
|
// src/blocks/form/form/form.tsx
|
|
3711
4142
|
function FormComponent(props) {
|
|
3712
|
-
const [formState, setFormState] =
|
|
3713
|
-
const [responseData, setResponseData] =
|
|
3714
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
4143
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
4144
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
4145
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
3715
4146
|
function mergeNewRootState(newData) {
|
|
3716
4147
|
const combinedState = {
|
|
3717
4148
|
...props.builderContext.rootState,
|
|
@@ -3907,22 +4338,22 @@ function FormComponent(props) {
|
|
|
3907
4338
|
{...props.attributes}
|
|
3908
4339
|
>
|
|
3909
4340
|
{props.children}
|
|
3910
|
-
<
|
|
4341
|
+
<Show12 when={submissionState() === "error"}><Blocks_default
|
|
3911
4342
|
path="errorMessage"
|
|
3912
4343
|
blocks={props.errorMessage}
|
|
3913
4344
|
context={props.builderContext}
|
|
3914
|
-
/></
|
|
3915
|
-
<
|
|
4345
|
+
/></Show12>
|
|
4346
|
+
<Show12 when={submissionState() === "sending"}><Blocks_default
|
|
3916
4347
|
path="sendingMessage"
|
|
3917
4348
|
blocks={props.sendingMessage}
|
|
3918
4349
|
context={props.builderContext}
|
|
3919
|
-
/></
|
|
3920
|
-
<
|
|
3921
|
-
<
|
|
4350
|
+
/></Show12>
|
|
4351
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
4352
|
+
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
3922
4353
|
path="successMessage"
|
|
3923
4354
|
blocks={props.successMessage}
|
|
3924
4355
|
context={props.builderContext}
|
|
3925
|
-
/></
|
|
4356
|
+
/></Show12>
|
|
3926
4357
|
</form>
|
|
3927
4358
|
<style>{`.pre-04a43b72 {
|
|
3928
4359
|
padding: 10px;
|
|
@@ -3934,7 +4365,7 @@ function FormComponent(props) {
|
|
|
3934
4365
|
var form_default = FormComponent;
|
|
3935
4366
|
|
|
3936
4367
|
// src/blocks/form/input/component-info.ts
|
|
3937
|
-
var
|
|
4368
|
+
var componentInfo15 = {
|
|
3938
4369
|
name: "Form:Input",
|
|
3939
4370
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
3940
4371
|
inputs: [
|
|
@@ -4004,7 +4435,7 @@ function FormInputComponent(props) {
|
|
|
4004
4435
|
var input_default = FormInputComponent;
|
|
4005
4436
|
|
|
4006
4437
|
// src/blocks/form/select/component-info.ts
|
|
4007
|
-
var
|
|
4438
|
+
var componentInfo16 = {
|
|
4008
4439
|
name: "Form:Select",
|
|
4009
4440
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
4010
4441
|
defaultStyles: {
|
|
@@ -4049,7 +4480,7 @@ var componentInfo15 = {
|
|
|
4049
4480
|
};
|
|
4050
4481
|
|
|
4051
4482
|
// src/blocks/form/select/select.tsx
|
|
4052
|
-
import { For as
|
|
4483
|
+
import { For as For8 } from "solid-js";
|
|
4053
4484
|
function SelectComponent(props) {
|
|
4054
4485
|
return <><select
|
|
4055
4486
|
{...{}}
|
|
@@ -4059,15 +4490,15 @@ function SelectComponent(props) {
|
|
|
4059
4490
|
defaultValue={props.defaultValue}
|
|
4060
4491
|
name={props.name}
|
|
4061
4492
|
required={props.required}
|
|
4062
|
-
><
|
|
4493
|
+
><For8 each={props.options}>{(option, _index) => {
|
|
4063
4494
|
const index = _index();
|
|
4064
4495
|
return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
|
|
4065
|
-
}}</
|
|
4496
|
+
}}</For8></select></>;
|
|
4066
4497
|
}
|
|
4067
4498
|
var select_default = SelectComponent;
|
|
4068
4499
|
|
|
4069
4500
|
// src/blocks/form/submit-button/component-info.ts
|
|
4070
|
-
var
|
|
4501
|
+
var componentInfo17 = {
|
|
4071
4502
|
name: "Form:SubmitButton",
|
|
4072
4503
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
4073
4504
|
defaultStyles: {
|
|
@@ -4101,7 +4532,7 @@ function SubmitButton(props) {
|
|
|
4101
4532
|
var submit_button_default = SubmitButton;
|
|
4102
4533
|
|
|
4103
4534
|
// src/blocks/form/textarea/component-info.ts
|
|
4104
|
-
var
|
|
4535
|
+
var componentInfo18 = {
|
|
4105
4536
|
name: "Form:TextArea",
|
|
4106
4537
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
4107
4538
|
inputs: [{
|
|
@@ -4154,7 +4585,7 @@ function Textarea(props) {
|
|
|
4154
4585
|
var textarea_default = Textarea;
|
|
4155
4586
|
|
|
4156
4587
|
// src/blocks/img/component-info.ts
|
|
4157
|
-
var
|
|
4588
|
+
var componentInfo19 = {
|
|
4158
4589
|
// friendlyName?
|
|
4159
4590
|
name: "Raw:Img",
|
|
4160
4591
|
hideFromInsertMenu: true,
|
|
@@ -4187,7 +4618,7 @@ function ImgComponent(props) {
|
|
|
4187
4618
|
var img_default = ImgComponent;
|
|
4188
4619
|
|
|
4189
4620
|
// src/blocks/video/component-info.ts
|
|
4190
|
-
var
|
|
4621
|
+
var componentInfo20 = {
|
|
4191
4622
|
name: "Video",
|
|
4192
4623
|
canHaveChildren: true,
|
|
4193
4624
|
defaultStyles: {
|
|
@@ -4274,9 +4705,9 @@ var componentInfo19 = {
|
|
|
4274
4705
|
};
|
|
4275
4706
|
|
|
4276
4707
|
// src/blocks/video/video.tsx
|
|
4277
|
-
import { Show as
|
|
4708
|
+
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
4278
4709
|
function Video(props) {
|
|
4279
|
-
const videoProps =
|
|
4710
|
+
const videoProps = createMemo15(() => {
|
|
4280
4711
|
return {
|
|
4281
4712
|
...props.autoPlay === true ? {
|
|
4282
4713
|
autoPlay: true
|
|
@@ -4295,7 +4726,7 @@ function Video(props) {
|
|
|
4295
4726
|
} : {}
|
|
4296
4727
|
};
|
|
4297
4728
|
});
|
|
4298
|
-
const spreadProps =
|
|
4729
|
+
const spreadProps = createMemo15(() => {
|
|
4299
4730
|
return {
|
|
4300
4731
|
...videoProps()
|
|
4301
4732
|
};
|
|
@@ -4324,8 +4755,8 @@ function Video(props) {
|
|
|
4324
4755
|
}}
|
|
4325
4756
|
src={props.video || "no-src"}
|
|
4326
4757
|
poster={props.posterImage}
|
|
4327
|
-
><
|
|
4328
|
-
<
|
|
4758
|
+
><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
|
|
4759
|
+
<Show13
|
|
4329
4760
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
4330
4761
|
><div
|
|
4331
4762
|
style={{
|
|
@@ -4334,15 +4765,15 @@ function Video(props) {
|
|
|
4334
4765
|
"pointer-events": "none",
|
|
4335
4766
|
"font-size": "0px"
|
|
4336
4767
|
}}
|
|
4337
|
-
/></
|
|
4338
|
-
<
|
|
4768
|
+
/></Show13>
|
|
4769
|
+
<Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
4339
4770
|
style={{
|
|
4340
4771
|
display: "flex",
|
|
4341
4772
|
"flex-direction": "column",
|
|
4342
4773
|
"align-items": "stretch"
|
|
4343
4774
|
}}
|
|
4344
|
-
>{props.children}</div></
|
|
4345
|
-
<
|
|
4775
|
+
>{props.children}</div></Show13>
|
|
4776
|
+
<Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
4346
4777
|
style={{
|
|
4347
4778
|
"pointer-events": "none",
|
|
4348
4779
|
display: "flex",
|
|
@@ -4354,7 +4785,7 @@ function Video(props) {
|
|
|
4354
4785
|
width: "100%",
|
|
4355
4786
|
height: "100%"
|
|
4356
4787
|
}}
|
|
4357
|
-
>{props.children}</div></
|
|
4788
|
+
>{props.children}</div></Show13>
|
|
4358
4789
|
</div></>;
|
|
4359
4790
|
}
|
|
4360
4791
|
var video_default = Video;
|
|
@@ -4362,31 +4793,31 @@ var video_default = Video;
|
|
|
4362
4793
|
// src/constants/extra-components.ts
|
|
4363
4794
|
var getExtraComponents = () => [{
|
|
4364
4795
|
component: custom_code_default,
|
|
4365
|
-
...
|
|
4796
|
+
...componentInfo12
|
|
4366
4797
|
}, {
|
|
4367
4798
|
component: embed_default,
|
|
4368
|
-
...
|
|
4799
|
+
...componentInfo13
|
|
4369
4800
|
}, ...TARGET === "rsc" ? [] : [{
|
|
4370
4801
|
component: form_default,
|
|
4371
|
-
...
|
|
4802
|
+
...componentInfo14
|
|
4372
4803
|
}, {
|
|
4373
4804
|
component: input_default,
|
|
4374
|
-
...
|
|
4805
|
+
...componentInfo15
|
|
4375
4806
|
}, {
|
|
4376
4807
|
component: submit_button_default,
|
|
4377
|
-
...
|
|
4808
|
+
...componentInfo17
|
|
4378
4809
|
}, {
|
|
4379
4810
|
component: select_default,
|
|
4380
|
-
...
|
|
4811
|
+
...componentInfo16
|
|
4381
4812
|
}, {
|
|
4382
4813
|
component: textarea_default,
|
|
4383
|
-
...
|
|
4814
|
+
...componentInfo18
|
|
4384
4815
|
}], {
|
|
4385
4816
|
component: img_default,
|
|
4386
|
-
...
|
|
4817
|
+
...componentInfo19
|
|
4387
4818
|
}, {
|
|
4388
4819
|
component: video_default,
|
|
4389
|
-
...
|
|
4820
|
+
...componentInfo20
|
|
4390
4821
|
}];
|
|
4391
4822
|
|
|
4392
4823
|
// src/constants/builder-registered-components.ts
|
|
@@ -4404,19 +4835,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
4404
4835
|
...componentInfo5
|
|
4405
4836
|
}, {
|
|
4406
4837
|
component: section_default,
|
|
4407
|
-
...
|
|
4838
|
+
...componentInfo7
|
|
4408
4839
|
}, {
|
|
4409
4840
|
component: slot_default,
|
|
4410
|
-
...
|
|
4841
|
+
...componentInfo8
|
|
4411
4842
|
}, {
|
|
4412
4843
|
component: symbol_default,
|
|
4413
|
-
...
|
|
4844
|
+
...componentInfo9
|
|
4414
4845
|
}, {
|
|
4415
4846
|
component: text_default,
|
|
4416
|
-
...
|
|
4417
|
-
}, ...TARGET === "
|
|
4847
|
+
...componentInfo11
|
|
4848
|
+
}, ...TARGET === "react" ? [{
|
|
4849
|
+
component: personalization_container_default,
|
|
4850
|
+
...componentInfo6
|
|
4851
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
4418
4852
|
component: tabs_default,
|
|
4419
|
-
...
|
|
4853
|
+
...componentInfo10
|
|
4420
4854
|
}, {
|
|
4421
4855
|
component: accordion_default,
|
|
4422
4856
|
...componentInfo
|
|
@@ -4454,7 +4888,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
4454
4888
|
testVariationId: variant.id,
|
|
4455
4889
|
id: content?.id
|
|
4456
4890
|
}));
|
|
4457
|
-
var
|
|
4891
|
+
var checkShouldRenderVariants2 = ({
|
|
4458
4892
|
canTrack,
|
|
4459
4893
|
content
|
|
4460
4894
|
}) => {
|
|
@@ -4488,24 +4922,14 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
4488
4922
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
4489
4923
|
)`;
|
|
4490
4924
|
|
|
4491
|
-
// src/components/inlined-script.tsx
|
|
4492
|
-
function InlinedScript(props) {
|
|
4493
|
-
return <><script
|
|
4494
|
-
innerHTML={props.scriptStr}
|
|
4495
|
-
data-id={props.id}
|
|
4496
|
-
nonce={props.nonce || ""}
|
|
4497
|
-
/></>;
|
|
4498
|
-
}
|
|
4499
|
-
var Inlined_script_default = InlinedScript;
|
|
4500
|
-
|
|
4501
4925
|
// src/components/content/components/enable-editor.tsx
|
|
4502
4926
|
import {
|
|
4503
|
-
Show as
|
|
4504
|
-
onMount as
|
|
4927
|
+
Show as Show14,
|
|
4928
|
+
onMount as onMount6,
|
|
4505
4929
|
on as on3,
|
|
4506
4930
|
createEffect as createEffect3,
|
|
4507
|
-
createMemo as
|
|
4508
|
-
createSignal as
|
|
4931
|
+
createMemo as createMemo16,
|
|
4932
|
+
createSignal as createSignal16
|
|
4509
4933
|
} from "solid-js";
|
|
4510
4934
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
4511
4935
|
|
|
@@ -4515,7 +4939,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4515
4939
|
}
|
|
4516
4940
|
|
|
4517
4941
|
// src/constants/sdk-version.ts
|
|
4518
|
-
var SDK_VERSION = "3.0.
|
|
4942
|
+
var SDK_VERSION = "3.0.6";
|
|
4519
4943
|
|
|
4520
4944
|
// src/helpers/sdk-headers.ts
|
|
4521
4945
|
var getSdkHeaders = () => ({
|
|
@@ -4812,16 +5236,6 @@ async function fetchEntries(options) {
|
|
|
4812
5236
|
return _processContentResult(options, content);
|
|
4813
5237
|
}
|
|
4814
5238
|
|
|
4815
|
-
// src/functions/is-previewing.ts
|
|
4816
|
-
function isPreviewing(_search) {
|
|
4817
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
4818
|
-
if (!search) {
|
|
4819
|
-
return false;
|
|
4820
|
-
}
|
|
4821
|
-
const normalizedSearch = getSearchString(search);
|
|
4822
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
4823
|
-
}
|
|
4824
|
-
|
|
4825
5239
|
// src/helpers/uuid.ts
|
|
4826
5240
|
function uuidv4() {
|
|
4827
5241
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -5148,7 +5562,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
5148
5562
|
// Supports builder-model="..." attribute which is needed to
|
|
5149
5563
|
// scope our '+ add block' button styling
|
|
5150
5564
|
supportsAddBlockScoping: true,
|
|
5151
|
-
supportsCustomBreakpoints: true
|
|
5565
|
+
supportsCustomBreakpoints: true,
|
|
5566
|
+
blockLevelPersonalization: true
|
|
5152
5567
|
}
|
|
5153
5568
|
}, "*");
|
|
5154
5569
|
window.parent?.postMessage({
|
|
@@ -5363,12 +5778,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
5363
5778
|
|
|
5364
5779
|
// src/components/content/components/enable-editor.tsx
|
|
5365
5780
|
function EnableEditor(props) {
|
|
5366
|
-
const [ContentWrapper, setContentWrapper] =
|
|
5781
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
5367
5782
|
props.contentWrapper || "div"
|
|
5368
5783
|
);
|
|
5369
|
-
const [httpReqsData, setHttpReqsData] =
|
|
5370
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
5371
|
-
const [clicked, setClicked] =
|
|
5784
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
5785
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
5786
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
5372
5787
|
function mergeNewRootState(newData) {
|
|
5373
5788
|
const combinedState = {
|
|
5374
5789
|
...props.builderContextSignal.rootState,
|
|
@@ -5402,7 +5817,7 @@ function EnableEditor(props) {
|
|
|
5402
5817
|
content: newContentValue
|
|
5403
5818
|
}));
|
|
5404
5819
|
}
|
|
5405
|
-
const showContentProps =
|
|
5820
|
+
const showContentProps = createMemo16(() => {
|
|
5406
5821
|
return props.showContent ? {} : {
|
|
5407
5822
|
hidden: true,
|
|
5408
5823
|
"aria-hidden": true
|
|
@@ -5509,7 +5924,7 @@ function EnableEditor(props) {
|
|
|
5509
5924
|
let elementRef;
|
|
5510
5925
|
runHttpRequests();
|
|
5511
5926
|
emitStateUpdate();
|
|
5512
|
-
|
|
5927
|
+
onMount6(() => {
|
|
5513
5928
|
if (isBrowser()) {
|
|
5514
5929
|
if (isEditing() && !props.isNestedRender) {
|
|
5515
5930
|
window.addEventListener("message", processMessage);
|
|
@@ -5578,14 +5993,14 @@ function EnableEditor(props) {
|
|
|
5578
5993
|
}
|
|
5579
5994
|
}
|
|
5580
5995
|
});
|
|
5581
|
-
const onUpdateFn_0_props_content =
|
|
5996
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
5582
5997
|
function onUpdateFn_0() {
|
|
5583
5998
|
if (props.content) {
|
|
5584
5999
|
mergeNewContent(props.content);
|
|
5585
6000
|
}
|
|
5586
6001
|
}
|
|
5587
6002
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
5588
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
6003
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
5589
6004
|
() => props.builderContextSignal.rootState
|
|
5590
6005
|
);
|
|
5591
6006
|
function onUpdateFn_1() {
|
|
@@ -5597,14 +6012,14 @@ function EnableEditor(props) {
|
|
|
5597
6012
|
onUpdateFn_1
|
|
5598
6013
|
)
|
|
5599
6014
|
);
|
|
5600
|
-
const onUpdateFn_2_props_data =
|
|
6015
|
+
const onUpdateFn_2_props_data = createMemo16(() => props.data);
|
|
5601
6016
|
function onUpdateFn_2() {
|
|
5602
6017
|
if (props.data) {
|
|
5603
6018
|
mergeNewRootState(props.data);
|
|
5604
6019
|
}
|
|
5605
6020
|
}
|
|
5606
6021
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
5607
|
-
const onUpdateFn_3_props_locale =
|
|
6022
|
+
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
5608
6023
|
function onUpdateFn_3() {
|
|
5609
6024
|
if (props.locale) {
|
|
5610
6025
|
mergeNewRootState({
|
|
@@ -5613,7 +6028,7 @@ function EnableEditor(props) {
|
|
|
5613
6028
|
}
|
|
5614
6029
|
}
|
|
5615
6030
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
5616
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><
|
|
6031
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
5617
6032
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
5618
6033
|
><Dynamic5
|
|
5619
6034
|
class={getWrapperClassName(
|
|
@@ -5631,14 +6046,14 @@ function EnableEditor(props) {
|
|
|
5631
6046
|
{...showContentProps()}
|
|
5632
6047
|
{...props.contentWrapperProps}
|
|
5633
6048
|
component={ContentWrapper()}
|
|
5634
|
-
>{props.children}</Dynamic5></
|
|
6049
|
+
>{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
|
|
5635
6050
|
}
|
|
5636
6051
|
var Enable_editor_default = EnableEditor;
|
|
5637
6052
|
|
|
5638
6053
|
// src/components/content/components/styles.tsx
|
|
5639
|
-
import { createSignal as
|
|
6054
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
5640
6055
|
function ContentStyles(props) {
|
|
5641
|
-
const [injectedStyles, setInjectedStyles] =
|
|
6056
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
5642
6057
|
`
|
|
5643
6058
|
${getCss({
|
|
5644
6059
|
cssCode: props.cssCode,
|
|
@@ -5696,7 +6111,7 @@ var getContentInitialValue = ({
|
|
|
5696
6111
|
|
|
5697
6112
|
// src/components/content/content.tsx
|
|
5698
6113
|
function ContentComponent(props) {
|
|
5699
|
-
const [scriptStr, setScriptStr] =
|
|
6114
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
5700
6115
|
getUpdateVariantVisibilityScript({
|
|
5701
6116
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
5702
6117
|
variationId: props.content?.testVariationId,
|
|
@@ -5704,7 +6119,7 @@ function ContentComponent(props) {
|
|
|
5704
6119
|
contentId: props.content?.id
|
|
5705
6120
|
})
|
|
5706
6121
|
);
|
|
5707
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
6122
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
5708
6123
|
[
|
|
5709
6124
|
...getDefaultRegisteredComponents(),
|
|
5710
6125
|
...props.customComponents || []
|
|
@@ -5719,7 +6134,7 @@ function ContentComponent(props) {
|
|
|
5719
6134
|
{}
|
|
5720
6135
|
)
|
|
5721
6136
|
);
|
|
5722
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
6137
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
5723
6138
|
content: getContentInitialValue({
|
|
5724
6139
|
content: props.content,
|
|
5725
6140
|
data: props.data
|
|
@@ -5803,18 +6218,18 @@ function ContentComponent(props) {
|
|
|
5803
6218
|
setBuilderContextSignal
|
|
5804
6219
|
}}
|
|
5805
6220
|
>
|
|
5806
|
-
<
|
|
6221
|
+
<Show15 when={props.isSsrAbTest}><Inlined_script_default
|
|
5807
6222
|
id="builderio-variant-visibility"
|
|
5808
6223
|
scriptStr={scriptStr()}
|
|
5809
6224
|
nonce={props.nonce || ""}
|
|
5810
|
-
/></
|
|
5811
|
-
<
|
|
6225
|
+
/></Show15>
|
|
6226
|
+
<Show15 when={TARGET !== "reactNative"}><Styles_default
|
|
5812
6227
|
nonce={props.nonce || ""}
|
|
5813
6228
|
isNestedRender={props.isNestedRender}
|
|
5814
6229
|
contentId={builderContextSignal().content?.id}
|
|
5815
6230
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
5816
6231
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
5817
|
-
/></
|
|
6232
|
+
/></Show15>
|
|
5818
6233
|
<Blocks_default
|
|
5819
6234
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
5820
6235
|
context={builderContextSignal()}
|
|
@@ -5827,13 +6242,13 @@ var Content_default = ContentComponent;
|
|
|
5827
6242
|
|
|
5828
6243
|
// src/components/content-variants/content-variants.tsx
|
|
5829
6244
|
function ContentVariants(props) {
|
|
5830
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
5831
|
-
|
|
6245
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
6246
|
+
checkShouldRenderVariants2({
|
|
5832
6247
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
5833
6248
|
content: props.content
|
|
5834
6249
|
})
|
|
5835
6250
|
);
|
|
5836
|
-
const updateCookieAndStylesScriptStr =
|
|
6251
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
5837
6252
|
return getUpdateCookieAndStylesScript(
|
|
5838
6253
|
getVariants(props.content).map((value) => ({
|
|
5839
6254
|
id: value.testVariationId,
|
|
@@ -5842,10 +6257,10 @@ function ContentVariants(props) {
|
|
|
5842
6257
|
props.content?.id || ""
|
|
5843
6258
|
);
|
|
5844
6259
|
});
|
|
5845
|
-
const hideVariantsStyleString =
|
|
6260
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
5846
6261
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
5847
6262
|
});
|
|
5848
|
-
const defaultContent =
|
|
6263
|
+
const defaultContent = createMemo19(() => {
|
|
5849
6264
|
return shouldRenderVariants() ? {
|
|
5850
6265
|
...props.content,
|
|
5851
6266
|
testVariationId: props.content?.id
|
|
@@ -5854,16 +6269,16 @@ function ContentVariants(props) {
|
|
|
5854
6269
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
5855
6270
|
});
|
|
5856
6271
|
});
|
|
5857
|
-
|
|
6272
|
+
onMount7(() => {
|
|
5858
6273
|
setShouldRenderVariants(false);
|
|
5859
6274
|
});
|
|
5860
6275
|
return <><>
|
|
5861
|
-
<
|
|
6276
|
+
<Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
5862
6277
|
id="builderio-init-variants-fns"
|
|
5863
6278
|
scriptStr={getInitVariantsFnsScriptString()}
|
|
5864
6279
|
nonce={props.nonce || ""}
|
|
5865
|
-
/></
|
|
5866
|
-
<
|
|
6280
|
+
/></Show16>
|
|
6281
|
+
<Show16 when={shouldRenderVariants()}>
|
|
5867
6282
|
<Inlined_styles_default
|
|
5868
6283
|
id="builderio-variants"
|
|
5869
6284
|
styles={hideVariantsStyleString()}
|
|
@@ -5874,7 +6289,7 @@ function ContentVariants(props) {
|
|
|
5874
6289
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
5875
6290
|
nonce={props.nonce || ""}
|
|
5876
6291
|
/>
|
|
5877
|
-
<
|
|
6292
|
+
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
5878
6293
|
const index = _index();
|
|
5879
6294
|
return <Content_default
|
|
5880
6295
|
apiHost={props.apiHost}
|
|
@@ -5901,8 +6316,8 @@ function ContentVariants(props) {
|
|
|
5901
6316
|
trustedHosts={props.trustedHosts}
|
|
5902
6317
|
{...{}}
|
|
5903
6318
|
/>;
|
|
5904
|
-
}}</
|
|
5905
|
-
</
|
|
6319
|
+
}}</For9>
|
|
6320
|
+
</Show16>
|
|
5906
6321
|
<Content_default
|
|
5907
6322
|
apiHost={props.apiHost}
|
|
5908
6323
|
nonce={props.nonce}
|
|
@@ -5957,14 +6372,14 @@ var fetchSymbolContent = async ({
|
|
|
5957
6372
|
|
|
5958
6373
|
// src/blocks/symbol/symbol.tsx
|
|
5959
6374
|
function Symbol(props) {
|
|
5960
|
-
const [contentToUse, setContentToUse] =
|
|
5961
|
-
const blocksWrapper =
|
|
6375
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
6376
|
+
const blocksWrapper = createMemo20(() => {
|
|
5962
6377
|
return "div";
|
|
5963
6378
|
});
|
|
5964
|
-
const contentWrapper =
|
|
6379
|
+
const contentWrapper = createMemo20(() => {
|
|
5965
6380
|
return "div";
|
|
5966
6381
|
});
|
|
5967
|
-
const className =
|
|
6382
|
+
const className = createMemo20(() => {
|
|
5968
6383
|
return [
|
|
5969
6384
|
...[props.attributes[getClassPropName()]],
|
|
5970
6385
|
"builder-symbol",
|
|
@@ -5984,9 +6399,9 @@ function Symbol(props) {
|
|
|
5984
6399
|
}
|
|
5985
6400
|
});
|
|
5986
6401
|
}
|
|
5987
|
-
|
|
6402
|
+
onMount8(() => {
|
|
5988
6403
|
});
|
|
5989
|
-
const onUpdateFn_0_props_symbol =
|
|
6404
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
5990
6405
|
function onUpdateFn_0() {
|
|
5991
6406
|
setContent();
|
|
5992
6407
|
}
|
|
@@ -6071,6 +6486,7 @@ export {
|
|
|
6071
6486
|
isEditing,
|
|
6072
6487
|
isPreviewing,
|
|
6073
6488
|
register,
|
|
6489
|
+
setClientUserAttributes,
|
|
6074
6490
|
setEditorSettings,
|
|
6075
6491
|
subscribeToEditor,
|
|
6076
6492
|
track
|