@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/edge/dev.jsx
CHANGED
|
@@ -4646,8 +4646,9 @@ function BlocksWrapper(props) {
|
|
|
4646
4646
|
if (!props.path) {
|
|
4647
4647
|
return void 0;
|
|
4648
4648
|
}
|
|
4649
|
+
const thisPrefix = "this.";
|
|
4649
4650
|
const pathPrefix = "component.options.";
|
|
4650
|
-
return props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
4651
|
+
return props.path.startsWith(thisPrefix) ? props.path.replace(thisPrefix, "") : props.path.startsWith(pathPrefix) ? props.path : `${pathPrefix}${props.path || ""}`;
|
|
4651
4652
|
});
|
|
4652
4653
|
function onClick() {
|
|
4653
4654
|
if (isEditing() && !props.blocks?.length) {
|
|
@@ -4682,7 +4683,7 @@ function BlocksWrapper(props) {
|
|
|
4682
4683
|
});
|
|
4683
4684
|
return <>
|
|
4684
4685
|
<Dynamic4
|
|
4685
|
-
class={className() + " dynamic-
|
|
4686
|
+
class={className() + " dynamic-3d7ff108"}
|
|
4686
4687
|
ref={blocksWrapperRef}
|
|
4687
4688
|
builder-path={dataPath()}
|
|
4688
4689
|
builder-parent-id={props.parent}
|
|
@@ -4694,7 +4695,7 @@ function BlocksWrapper(props) {
|
|
|
4694
4695
|
{...props.BlocksWrapperProps}
|
|
4695
4696
|
component={props.BlocksWrapper}
|
|
4696
4697
|
>{props.children}</Dynamic4>
|
|
4697
|
-
<style>{`.dynamic-
|
|
4698
|
+
<style>{`.dynamic-3d7ff108 {
|
|
4698
4699
|
display: flex;
|
|
4699
4700
|
flex-direction: column;
|
|
4700
4701
|
align-items: stretch;
|
|
@@ -5067,10 +5068,10 @@ function SectionComponent(props) {
|
|
|
5067
5068
|
var section_default = SectionComponent;
|
|
5068
5069
|
|
|
5069
5070
|
// src/blocks/symbol/symbol.tsx
|
|
5070
|
-
import { onMount as
|
|
5071
|
+
import { onMount as onMount8, on as on4, createEffect as createEffect4, createMemo as createMemo20, createSignal as createSignal20 } from "solid-js";
|
|
5071
5072
|
|
|
5072
5073
|
// src/components/content-variants/content-variants.tsx
|
|
5073
|
-
import { Show as
|
|
5074
|
+
import { Show as Show16, For as For9, onMount as onMount7, createSignal as createSignal19, createMemo as createMemo19 } from "solid-js";
|
|
5074
5075
|
|
|
5075
5076
|
// src/helpers/url.ts
|
|
5076
5077
|
var getTopLevelDomain = (host) => {
|
|
@@ -5260,11 +5261,61 @@ var handleABTesting = async ({
|
|
|
5260
5261
|
};
|
|
5261
5262
|
};
|
|
5262
5263
|
|
|
5264
|
+
// src/helpers/user-attributes.ts
|
|
5265
|
+
var USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
5266
|
+
function createUserAttributesService() {
|
|
5267
|
+
let canTrack = true;
|
|
5268
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
5269
|
+
return {
|
|
5270
|
+
setUserAttributes(newAttrs) {
|
|
5271
|
+
if (!isBrowser()) {
|
|
5272
|
+
return;
|
|
5273
|
+
}
|
|
5274
|
+
const userAttributes = {
|
|
5275
|
+
...this.getUserAttributes(),
|
|
5276
|
+
...newAttrs
|
|
5277
|
+
};
|
|
5278
|
+
setCookie({
|
|
5279
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
5280
|
+
value: JSON.stringify(userAttributes),
|
|
5281
|
+
canTrack
|
|
5282
|
+
});
|
|
5283
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
5284
|
+
},
|
|
5285
|
+
getUserAttributes() {
|
|
5286
|
+
if (!isBrowser()) {
|
|
5287
|
+
return {};
|
|
5288
|
+
}
|
|
5289
|
+
return JSON.parse(getCookieSync({
|
|
5290
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
5291
|
+
canTrack
|
|
5292
|
+
}) || "{}");
|
|
5293
|
+
},
|
|
5294
|
+
subscribeOnUserAttributesChange(callback) {
|
|
5295
|
+
subscribers.add(callback);
|
|
5296
|
+
return () => {
|
|
5297
|
+
subscribers.delete(callback);
|
|
5298
|
+
};
|
|
5299
|
+
},
|
|
5300
|
+
setCanTrack(value) {
|
|
5301
|
+
canTrack = value;
|
|
5302
|
+
}
|
|
5303
|
+
};
|
|
5304
|
+
}
|
|
5305
|
+
var userAttributesService = createUserAttributesService();
|
|
5306
|
+
var setClientUserAttributes = (attributes) => {
|
|
5307
|
+
userAttributesService.setUserAttributes(attributes);
|
|
5308
|
+
};
|
|
5309
|
+
|
|
5263
5310
|
// src/helpers/canTrack.ts
|
|
5264
|
-
var getDefaultCanTrack = (canTrack) =>
|
|
5311
|
+
var getDefaultCanTrack = (canTrack) => {
|
|
5312
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
5313
|
+
userAttributesService.setCanTrack(result);
|
|
5314
|
+
return result;
|
|
5315
|
+
};
|
|
5265
5316
|
|
|
5266
5317
|
// src/components/content/content.tsx
|
|
5267
|
-
import { Show as
|
|
5318
|
+
import { Show as Show15, createSignal as createSignal18 } from "solid-js";
|
|
5268
5319
|
|
|
5269
5320
|
// src/blocks/accordion/component-info.ts
|
|
5270
5321
|
var defaultTitle = {
|
|
@@ -5959,8 +6010,388 @@ var componentInfo5 = {
|
|
|
5959
6010
|
}
|
|
5960
6011
|
};
|
|
5961
6012
|
|
|
5962
|
-
// src/blocks/
|
|
6013
|
+
// src/blocks/personalization-container/component-info.ts
|
|
5963
6014
|
var componentInfo6 = {
|
|
6015
|
+
name: "PersonalizationContainer",
|
|
6016
|
+
shouldReceiveBuilderProps: {
|
|
6017
|
+
builderBlock: true,
|
|
6018
|
+
builderContext: true
|
|
6019
|
+
},
|
|
6020
|
+
noWrap: true,
|
|
6021
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
6022
|
+
canHaveChildren: true,
|
|
6023
|
+
inputs: [{
|
|
6024
|
+
name: "variants",
|
|
6025
|
+
defaultValue: [],
|
|
6026
|
+
behavior: "personalizationVariantList",
|
|
6027
|
+
type: "list",
|
|
6028
|
+
subFields: [{
|
|
6029
|
+
name: "name",
|
|
6030
|
+
type: "text"
|
|
6031
|
+
}, {
|
|
6032
|
+
name: "query",
|
|
6033
|
+
friendlyName: "Targeting rules",
|
|
6034
|
+
type: "BuilderQuery",
|
|
6035
|
+
defaultValue: []
|
|
6036
|
+
}, {
|
|
6037
|
+
name: "startDate",
|
|
6038
|
+
type: "date"
|
|
6039
|
+
}, {
|
|
6040
|
+
name: "endDate",
|
|
6041
|
+
type: "date"
|
|
6042
|
+
}, {
|
|
6043
|
+
name: "blocks",
|
|
6044
|
+
type: "uiBlocks",
|
|
6045
|
+
hideFromUI: true,
|
|
6046
|
+
defaultValue: []
|
|
6047
|
+
}]
|
|
6048
|
+
}]
|
|
6049
|
+
};
|
|
6050
|
+
|
|
6051
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
6052
|
+
import { Show as Show10, For as For6, onMount as onMount4, createSignal as createSignal10, createMemo as createMemo10 } from "solid-js";
|
|
6053
|
+
|
|
6054
|
+
// src/components/inlined-script.tsx
|
|
6055
|
+
function InlinedScript(props) {
|
|
6056
|
+
return <><script
|
|
6057
|
+
innerHTML={props.scriptStr}
|
|
6058
|
+
data-id={props.id}
|
|
6059
|
+
nonce={props.nonce || ""}
|
|
6060
|
+
/></>;
|
|
6061
|
+
}
|
|
6062
|
+
var Inlined_script_default = InlinedScript;
|
|
6063
|
+
|
|
6064
|
+
// src/functions/is-previewing.ts
|
|
6065
|
+
function isPreviewing(_search) {
|
|
6066
|
+
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
6067
|
+
if (!search) {
|
|
6068
|
+
return false;
|
|
6069
|
+
}
|
|
6070
|
+
const normalizedSearch = getSearchString(search);
|
|
6071
|
+
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
6072
|
+
}
|
|
6073
|
+
|
|
6074
|
+
// src/blocks/personalization-container/helpers/inlined-fns.ts
|
|
6075
|
+
function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
6076
|
+
function isString(val) {
|
|
6077
|
+
return typeof val === "string";
|
|
6078
|
+
}
|
|
6079
|
+
function isNumber(val) {
|
|
6080
|
+
return typeof val === "number";
|
|
6081
|
+
}
|
|
6082
|
+
function objectMatchesQuery(userattr, query2) {
|
|
6083
|
+
const result = (() => {
|
|
6084
|
+
const property = query2.property;
|
|
6085
|
+
const operator = query2.operator;
|
|
6086
|
+
let testValue = query2.value;
|
|
6087
|
+
if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/")) {
|
|
6088
|
+
testValue = query2.value.slice(0, -1);
|
|
6089
|
+
}
|
|
6090
|
+
if (!(property && operator)) {
|
|
6091
|
+
return true;
|
|
6092
|
+
}
|
|
6093
|
+
if (Array.isArray(testValue)) {
|
|
6094
|
+
if (operator === "isNot") {
|
|
6095
|
+
return testValue.every((val) => objectMatchesQuery(userattr, {
|
|
6096
|
+
property,
|
|
6097
|
+
operator,
|
|
6098
|
+
value: val
|
|
6099
|
+
}));
|
|
6100
|
+
}
|
|
6101
|
+
return !!testValue.find((val) => objectMatchesQuery(userattr, {
|
|
6102
|
+
property,
|
|
6103
|
+
operator,
|
|
6104
|
+
value: val
|
|
6105
|
+
}));
|
|
6106
|
+
}
|
|
6107
|
+
const value = userattr[property];
|
|
6108
|
+
if (Array.isArray(value)) {
|
|
6109
|
+
return value.includes(testValue);
|
|
6110
|
+
}
|
|
6111
|
+
switch (operator) {
|
|
6112
|
+
case "is":
|
|
6113
|
+
return value === testValue;
|
|
6114
|
+
case "isNot":
|
|
6115
|
+
return value !== testValue;
|
|
6116
|
+
case "contains":
|
|
6117
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
6118
|
+
case "startsWith":
|
|
6119
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
6120
|
+
case "endsWith":
|
|
6121
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
6122
|
+
case "greaterThan":
|
|
6123
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
6124
|
+
case "lessThan":
|
|
6125
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
6126
|
+
case "greaterThanOrEqualTo":
|
|
6127
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
6128
|
+
case "lessThanOrEqualTo":
|
|
6129
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
6130
|
+
default:
|
|
6131
|
+
return false;
|
|
6132
|
+
}
|
|
6133
|
+
})();
|
|
6134
|
+
return result;
|
|
6135
|
+
}
|
|
6136
|
+
const item = {
|
|
6137
|
+
query,
|
|
6138
|
+
startDate,
|
|
6139
|
+
endDate
|
|
6140
|
+
};
|
|
6141
|
+
const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
|
|
6142
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
6143
|
+
return false;
|
|
6144
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
6145
|
+
return false;
|
|
6146
|
+
}
|
|
6147
|
+
if (!item.query || !item.query.length) {
|
|
6148
|
+
return true;
|
|
6149
|
+
}
|
|
6150
|
+
return item.query.every((filter) => {
|
|
6151
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
6152
|
+
});
|
|
6153
|
+
}
|
|
6154
|
+
var PERSONALIZATION_SCRIPT = `function getPersonalizedVariant(variants, blockId, locale) {
|
|
6155
|
+
if (!navigator.cookieEnabled) {
|
|
6156
|
+
return;
|
|
6157
|
+
}
|
|
6158
|
+
function getCookie(name) {
|
|
6159
|
+
const nameEQ = name + '=';
|
|
6160
|
+
const ca = document.cookie.split(';');
|
|
6161
|
+
for (let i = 0; i < ca.length; i++) {
|
|
6162
|
+
let c = ca[i];
|
|
6163
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
6164
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
6165
|
+
}
|
|
6166
|
+
return null;
|
|
6167
|
+
}
|
|
6168
|
+
function removeVariants() {
|
|
6169
|
+
variants?.forEach(function (_, index) {
|
|
6170
|
+
document.querySelector('template[data-variant-id="' + blockId + '-' + index + '"]')?.remove();
|
|
6171
|
+
});
|
|
6172
|
+
document.querySelector('script[data-id="variants-script-' + blockId + '"]')?.remove();
|
|
6173
|
+
document.querySelector('style[data-id="variants-styles-' + blockId + '"]')?.remove();
|
|
6174
|
+
}
|
|
6175
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
6176
|
+
if (locale) {
|
|
6177
|
+
attributes.locale = locale;
|
|
6178
|
+
}
|
|
6179
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
6180
|
+
return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
6181
|
+
});
|
|
6182
|
+
const isDebug = location.href.includes('builder.debug=true');
|
|
6183
|
+
if (isDebug) {
|
|
6184
|
+
console.debug('PersonalizationContainer', {
|
|
6185
|
+
attributes,
|
|
6186
|
+
variants,
|
|
6187
|
+
winningVariantIndex
|
|
6188
|
+
});
|
|
6189
|
+
}
|
|
6190
|
+
if (winningVariantIndex !== -1) {
|
|
6191
|
+
const winningVariant = document.querySelector('template[data-variant-id="' + blockId + '-' + winningVariantIndex + '"]');
|
|
6192
|
+
if (winningVariant) {
|
|
6193
|
+
const parentNode = winningVariant.parentNode;
|
|
6194
|
+
if (parentNode) {
|
|
6195
|
+
const newParent = parentNode.cloneNode(false);
|
|
6196
|
+
newParent.appendChild(winningVariant.content.firstChild);
|
|
6197
|
+
newParent.appendChild(winningVariant.content.lastChild);
|
|
6198
|
+
parentNode.parentNode?.replaceChild(newParent, parentNode);
|
|
6199
|
+
}
|
|
6200
|
+
if (isDebug) {
|
|
6201
|
+
console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);
|
|
6202
|
+
}
|
|
6203
|
+
}
|
|
6204
|
+
} else if (variants && variants.length > 0) {
|
|
6205
|
+
removeVariants();
|
|
6206
|
+
}
|
|
6207
|
+
}`;
|
|
6208
|
+
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}";
|
|
6209
|
+
|
|
6210
|
+
// src/blocks/personalization-container/helpers.ts
|
|
6211
|
+
function checkShouldRenderVariants(variants, canTrack) {
|
|
6212
|
+
const hasVariants = variants && variants.length > 0;
|
|
6213
|
+
if (TARGET === "reactNative")
|
|
6214
|
+
return false;
|
|
6215
|
+
if (!hasVariants)
|
|
6216
|
+
return false;
|
|
6217
|
+
if (!canTrack)
|
|
6218
|
+
return false;
|
|
6219
|
+
if (TARGET === "vue" || TARGET === "svelte")
|
|
6220
|
+
return true;
|
|
6221
|
+
if (isBrowser())
|
|
6222
|
+
return false;
|
|
6223
|
+
return true;
|
|
6224
|
+
}
|
|
6225
|
+
function getBlocksToRender({
|
|
6226
|
+
variants,
|
|
6227
|
+
previewingIndex,
|
|
6228
|
+
isHydrated,
|
|
6229
|
+
filteredVariants,
|
|
6230
|
+
fallbackBlocks
|
|
6231
|
+
}) {
|
|
6232
|
+
const fallback = {
|
|
6233
|
+
blocks: fallbackBlocks ?? [],
|
|
6234
|
+
path: "this.children"
|
|
6235
|
+
};
|
|
6236
|
+
if (isHydrated && isEditing()) {
|
|
6237
|
+
if (typeof previewingIndex === "number" && previewingIndex < (variants?.length ?? 0)) {
|
|
6238
|
+
const variant = variants[previewingIndex];
|
|
6239
|
+
return {
|
|
6240
|
+
blocks: variant.blocks,
|
|
6241
|
+
path: `component.options.variants.${previewingIndex}.blocks`
|
|
6242
|
+
};
|
|
6243
|
+
}
|
|
6244
|
+
return fallback;
|
|
6245
|
+
}
|
|
6246
|
+
if (isBrowser()) {
|
|
6247
|
+
const winningVariant = filteredVariants?.[0];
|
|
6248
|
+
if (winningVariant) {
|
|
6249
|
+
return {
|
|
6250
|
+
blocks: winningVariant.blocks,
|
|
6251
|
+
path: `component.options.variants.${variants?.indexOf(winningVariant)}.blocks`
|
|
6252
|
+
};
|
|
6253
|
+
}
|
|
6254
|
+
}
|
|
6255
|
+
return fallback;
|
|
6256
|
+
}
|
|
6257
|
+
var getPersonalizationScript = (variants, blockId, locale) => {
|
|
6258
|
+
return `
|
|
6259
|
+
(function() {
|
|
6260
|
+
${FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
6261
|
+
${PERSONALIZATION_SCRIPT}
|
|
6262
|
+
getPersonalizedVariant(${JSON.stringify(variants)}, "${blockId}"${locale ? `, "${locale}"` : ""})
|
|
6263
|
+
})();
|
|
6264
|
+
`;
|
|
6265
|
+
};
|
|
6266
|
+
|
|
6267
|
+
// src/blocks/personalization-container/personalization-container.tsx
|
|
6268
|
+
function PersonalizationContainer(props) {
|
|
6269
|
+
const [userAttributes, setUserAttributes] = createSignal10(
|
|
6270
|
+
userAttributesService.getUserAttributes()
|
|
6271
|
+
);
|
|
6272
|
+
const [scriptStr, setScriptStr] = createSignal10(
|
|
6273
|
+
getPersonalizationScript(
|
|
6274
|
+
props.variants,
|
|
6275
|
+
props.builderBlock?.id || "none",
|
|
6276
|
+
props.builderContext?.rootState?.locale
|
|
6277
|
+
)
|
|
6278
|
+
);
|
|
6279
|
+
const [unsubscribers, setUnsubscribers] = createSignal10([]);
|
|
6280
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal10(
|
|
6281
|
+
checkShouldRenderVariants(
|
|
6282
|
+
props.variants,
|
|
6283
|
+
getDefaultCanTrack(props.builderContext?.canTrack)
|
|
6284
|
+
)
|
|
6285
|
+
);
|
|
6286
|
+
const [isHydrated, setIsHydrated] = createSignal10(false);
|
|
6287
|
+
const filteredVariants = createMemo10(() => {
|
|
6288
|
+
return (props.variants || []).filter((variant) => {
|
|
6289
|
+
return filterWithCustomTargeting(
|
|
6290
|
+
{
|
|
6291
|
+
...props.builderContext?.rootState?.locale ? {
|
|
6292
|
+
locale: props.builderContext?.rootState?.locale
|
|
6293
|
+
} : {},
|
|
6294
|
+
...userAttributes()
|
|
6295
|
+
},
|
|
6296
|
+
variant.query,
|
|
6297
|
+
variant.startDate,
|
|
6298
|
+
variant.endDate
|
|
6299
|
+
);
|
|
6300
|
+
});
|
|
6301
|
+
});
|
|
6302
|
+
const blocksToRender = createMemo10(() => {
|
|
6303
|
+
return getBlocksToRender({
|
|
6304
|
+
variants: props.variants,
|
|
6305
|
+
fallbackBlocks: props.builderBlock?.children,
|
|
6306
|
+
isHydrated: isHydrated(),
|
|
6307
|
+
filteredVariants: filteredVariants(),
|
|
6308
|
+
previewingIndex: props.previewingIndex
|
|
6309
|
+
});
|
|
6310
|
+
});
|
|
6311
|
+
const hideVariantsStyleString = createMemo10(() => {
|
|
6312
|
+
return (props.variants || []).map(
|
|
6313
|
+
(_, index) => `[data-variant-id="${props.builderBlock?.id}-${index}"] { display: none; } `
|
|
6314
|
+
).join("");
|
|
6315
|
+
});
|
|
6316
|
+
let rootRef;
|
|
6317
|
+
onMount4(() => {
|
|
6318
|
+
setIsHydrated(true);
|
|
6319
|
+
const unsub = userAttributesService.subscribeOnUserAttributesChange(
|
|
6320
|
+
(attrs) => {
|
|
6321
|
+
setUserAttributes(attrs);
|
|
6322
|
+
}
|
|
6323
|
+
);
|
|
6324
|
+
if (!(isEditing() || isPreviewing())) {
|
|
6325
|
+
const variant = filteredVariants()[0];
|
|
6326
|
+
if (rootRef) {
|
|
6327
|
+
rootRef.dispatchEvent(
|
|
6328
|
+
new CustomEvent("builder.variantLoaded", {
|
|
6329
|
+
detail: {
|
|
6330
|
+
variant: variant || "default",
|
|
6331
|
+
content: props.builderContext?.content
|
|
6332
|
+
},
|
|
6333
|
+
bubbles: true
|
|
6334
|
+
})
|
|
6335
|
+
);
|
|
6336
|
+
const observer = new IntersectionObserver((entries) => {
|
|
6337
|
+
entries.forEach((entry) => {
|
|
6338
|
+
if (entry.isIntersecting && rootRef) {
|
|
6339
|
+
rootRef.dispatchEvent(
|
|
6340
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
6341
|
+
detail: {
|
|
6342
|
+
variant: variant || "default",
|
|
6343
|
+
content: props.builderContext?.content
|
|
6344
|
+
},
|
|
6345
|
+
bubbles: true
|
|
6346
|
+
})
|
|
6347
|
+
);
|
|
6348
|
+
}
|
|
6349
|
+
});
|
|
6350
|
+
});
|
|
6351
|
+
observer.observe(rootRef);
|
|
6352
|
+
}
|
|
6353
|
+
}
|
|
6354
|
+
unsubscribers().push(unsub);
|
|
6355
|
+
});
|
|
6356
|
+
return <><div
|
|
6357
|
+
class={`builder-personalization-container ${props.attributes?.className || ""}`}
|
|
6358
|
+
ref={rootRef}
|
|
6359
|
+
{...props.attributes}
|
|
6360
|
+
>
|
|
6361
|
+
<Show10 when={shouldRenderVariants()}>
|
|
6362
|
+
<For6 each={props.variants}>{(variant, _index) => {
|
|
6363
|
+
const index = _index();
|
|
6364
|
+
return <template
|
|
6365
|
+
key={index}
|
|
6366
|
+
data-variant-id={`${props.builderBlock?.id}-${index}`}
|
|
6367
|
+
><Blocks_default
|
|
6368
|
+
blocks={variant.blocks}
|
|
6369
|
+
parent={props.builderBlock?.id}
|
|
6370
|
+
path={`component.options.variants.${index}.blocks`}
|
|
6371
|
+
/></template>;
|
|
6372
|
+
}}</For6>
|
|
6373
|
+
<Inlined_styles_default
|
|
6374
|
+
nonce={props.builderContext?.nonce || ""}
|
|
6375
|
+
styles={hideVariantsStyleString()}
|
|
6376
|
+
id={`variants-styles-${props.builderBlock?.id}`}
|
|
6377
|
+
/>
|
|
6378
|
+
<Inlined_script_default
|
|
6379
|
+
nonce={props.builderContext?.nonce || ""}
|
|
6380
|
+
scriptStr={scriptStr()}
|
|
6381
|
+
id={`variants-script-${props.builderBlock?.id}`}
|
|
6382
|
+
/>
|
|
6383
|
+
</Show10>
|
|
6384
|
+
<Blocks_default
|
|
6385
|
+
blocks={blocksToRender().blocks}
|
|
6386
|
+
parent={props.builderBlock?.id}
|
|
6387
|
+
path={blocksToRender().path}
|
|
6388
|
+
/>
|
|
6389
|
+
</div></>;
|
|
6390
|
+
}
|
|
6391
|
+
var personalization_container_default = PersonalizationContainer;
|
|
6392
|
+
|
|
6393
|
+
// src/blocks/section/component-info.ts
|
|
6394
|
+
var componentInfo7 = {
|
|
5964
6395
|
name: "Core:Section",
|
|
5965
6396
|
static: true,
|
|
5966
6397
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -6002,7 +6433,7 @@ var componentInfo6 = {
|
|
|
6002
6433
|
};
|
|
6003
6434
|
|
|
6004
6435
|
// src/blocks/slot/component-info.ts
|
|
6005
|
-
var
|
|
6436
|
+
var componentInfo8 = {
|
|
6006
6437
|
name: "Slot",
|
|
6007
6438
|
isRSC: true,
|
|
6008
6439
|
description: "Allow child blocks to be inserted into this content when used as a Symbol",
|
|
@@ -6041,7 +6472,7 @@ function Slot(props) {
|
|
|
6041
6472
|
var slot_default = Slot;
|
|
6042
6473
|
|
|
6043
6474
|
// src/blocks/symbol/component-info.ts
|
|
6044
|
-
var
|
|
6475
|
+
var componentInfo9 = {
|
|
6045
6476
|
name: "Symbol",
|
|
6046
6477
|
noWrap: true,
|
|
6047
6478
|
static: true,
|
|
@@ -6123,7 +6554,7 @@ var defaultElement = {
|
|
|
6123
6554
|
}
|
|
6124
6555
|
}
|
|
6125
6556
|
};
|
|
6126
|
-
var
|
|
6557
|
+
var componentInfo10 = {
|
|
6127
6558
|
name: "Builder: Tabs",
|
|
6128
6559
|
inputs: [{
|
|
6129
6560
|
name: "tabs",
|
|
@@ -6229,9 +6660,9 @@ var componentInfo9 = {
|
|
|
6229
6660
|
};
|
|
6230
6661
|
|
|
6231
6662
|
// src/blocks/tabs/tabs.tsx
|
|
6232
|
-
import { Show as
|
|
6663
|
+
import { Show as Show11, For as For7, createSignal as createSignal11 } from "solid-js";
|
|
6233
6664
|
function Tabs(props) {
|
|
6234
|
-
const [activeTab, setActiveTab] =
|
|
6665
|
+
const [activeTab, setActiveTab] = createSignal11(
|
|
6235
6666
|
props.defaultActiveTab ? props.defaultActiveTab - 1 : 0
|
|
6236
6667
|
);
|
|
6237
6668
|
function activeTabContent(active) {
|
|
@@ -6253,7 +6684,7 @@ function Tabs(props) {
|
|
|
6253
6684
|
"justify-content": props.tabHeaderLayout || "flex-start",
|
|
6254
6685
|
overflow: "auto"
|
|
6255
6686
|
}}
|
|
6256
|
-
><
|
|
6687
|
+
><For7 each={props.tabs}>{(tab, _index) => {
|
|
6257
6688
|
const index = _index();
|
|
6258
6689
|
return <span
|
|
6259
6690
|
class={`builder-tab-wrap ${activeTab() === index ? "builder-tab-active" : ""}`}
|
|
@@ -6270,21 +6701,21 @@ function Tabs(props) {
|
|
|
6270
6701
|
registeredComponents={props.builderComponents}
|
|
6271
6702
|
linkComponent={props.builderLinkComponent}
|
|
6272
6703
|
/></span>;
|
|
6273
|
-
}}</
|
|
6274
|
-
<
|
|
6704
|
+
}}</For7></div>
|
|
6705
|
+
<Show11 when={activeTabContent(activeTab())}><div><Blocks_default
|
|
6275
6706
|
parent={props.builderBlock.id}
|
|
6276
6707
|
path={`tabs.${activeTab()}.content`}
|
|
6277
6708
|
blocks={activeTabContent(activeTab())}
|
|
6278
6709
|
context={props.builderContext}
|
|
6279
6710
|
registeredComponents={props.builderComponents}
|
|
6280
6711
|
linkComponent={props.builderLinkComponent}
|
|
6281
|
-
/></div></
|
|
6712
|
+
/></div></Show11>
|
|
6282
6713
|
</div></>;
|
|
6283
6714
|
}
|
|
6284
6715
|
var tabs_default = Tabs;
|
|
6285
6716
|
|
|
6286
6717
|
// src/blocks/text/component-info.ts
|
|
6287
|
-
var
|
|
6718
|
+
var componentInfo11 = {
|
|
6288
6719
|
shouldReceiveBuilderProps: {
|
|
6289
6720
|
builderBlock: TARGET === "reactNative" ? true : false,
|
|
6290
6721
|
builderContext: true
|
|
@@ -6321,7 +6752,7 @@ function Text(props) {
|
|
|
6321
6752
|
var text_default = Text;
|
|
6322
6753
|
|
|
6323
6754
|
// src/blocks/custom-code/component-info.ts
|
|
6324
|
-
var
|
|
6755
|
+
var componentInfo12 = {
|
|
6325
6756
|
name: "Custom Code",
|
|
6326
6757
|
static: true,
|
|
6327
6758
|
requiredPermissions: ["editCode"],
|
|
@@ -6346,12 +6777,12 @@ var componentInfo11 = {
|
|
|
6346
6777
|
};
|
|
6347
6778
|
|
|
6348
6779
|
// src/blocks/custom-code/custom-code.tsx
|
|
6349
|
-
import { onMount as
|
|
6780
|
+
import { onMount as onMount5, createSignal as createSignal12 } from "solid-js";
|
|
6350
6781
|
function CustomCode(props) {
|
|
6351
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6352
|
-
const [scriptsRun, setScriptsRun] =
|
|
6782
|
+
const [scriptsInserted, setScriptsInserted] = createSignal12([]);
|
|
6783
|
+
const [scriptsRun, setScriptsRun] = createSignal12([]);
|
|
6353
6784
|
let elementRef;
|
|
6354
|
-
|
|
6785
|
+
onMount5(() => {
|
|
6355
6786
|
if (!elementRef?.getElementsByTagName || typeof window === "undefined") {
|
|
6356
6787
|
return;
|
|
6357
6788
|
}
|
|
@@ -6393,7 +6824,7 @@ function CustomCode(props) {
|
|
|
6393
6824
|
var custom_code_default = CustomCode;
|
|
6394
6825
|
|
|
6395
6826
|
// src/blocks/embed/component-info.ts
|
|
6396
|
-
var
|
|
6827
|
+
var componentInfo13 = {
|
|
6397
6828
|
name: "Embed",
|
|
6398
6829
|
static: true,
|
|
6399
6830
|
inputs: [{
|
|
@@ -6411,7 +6842,7 @@ var componentInfo12 = {
|
|
|
6411
6842
|
};
|
|
6412
6843
|
|
|
6413
6844
|
// src/blocks/embed/embed.tsx
|
|
6414
|
-
import { on as on2, createEffect as createEffect2, createMemo as
|
|
6845
|
+
import { on as on2, createEffect as createEffect2, createMemo as createMemo13, createSignal as createSignal13 } from "solid-js";
|
|
6415
6846
|
|
|
6416
6847
|
// src/blocks/embed/helpers.ts
|
|
6417
6848
|
var SCRIPT_MIME_TYPES = ["text/javascript", "application/javascript", "application/ecmascript"];
|
|
@@ -6419,9 +6850,9 @@ var isJsScript = (script) => SCRIPT_MIME_TYPES.includes(script.type);
|
|
|
6419
6850
|
|
|
6420
6851
|
// src/blocks/embed/embed.tsx
|
|
6421
6852
|
function Embed(props) {
|
|
6422
|
-
const [scriptsInserted, setScriptsInserted] =
|
|
6423
|
-
const [scriptsRun, setScriptsRun] =
|
|
6424
|
-
const [ranInitFn, setRanInitFn] =
|
|
6853
|
+
const [scriptsInserted, setScriptsInserted] = createSignal13([]);
|
|
6854
|
+
const [scriptsRun, setScriptsRun] = createSignal13([]);
|
|
6855
|
+
const [ranInitFn, setRanInitFn] = createSignal13(false);
|
|
6425
6856
|
function findAndRunScripts() {
|
|
6426
6857
|
if (!elem || !elem.getElementsByTagName)
|
|
6427
6858
|
return;
|
|
@@ -6445,8 +6876,8 @@ function Embed(props) {
|
|
|
6445
6876
|
}
|
|
6446
6877
|
}
|
|
6447
6878
|
let elem;
|
|
6448
|
-
const onUpdateFn_0_elem =
|
|
6449
|
-
const onUpdateFn_0_ranInitFn__ =
|
|
6879
|
+
const onUpdateFn_0_elem = createMemo13(() => elem);
|
|
6880
|
+
const onUpdateFn_0_ranInitFn__ = createMemo13(() => ranInitFn());
|
|
6450
6881
|
function onUpdateFn_0() {
|
|
6451
6882
|
if (elem && !ranInitFn()) {
|
|
6452
6883
|
setRanInitFn(true);
|
|
@@ -6461,7 +6892,7 @@ function Embed(props) {
|
|
|
6461
6892
|
var embed_default = Embed;
|
|
6462
6893
|
|
|
6463
6894
|
// src/blocks/form/form/component-info.ts
|
|
6464
|
-
var
|
|
6895
|
+
var componentInfo14 = {
|
|
6465
6896
|
name: "Form:Form",
|
|
6466
6897
|
// editableTags: ['builder-form-error']
|
|
6467
6898
|
defaults: {
|
|
@@ -6701,7 +7132,7 @@ var componentInfo13 = {
|
|
|
6701
7132
|
};
|
|
6702
7133
|
|
|
6703
7134
|
// src/blocks/form/form/form.tsx
|
|
6704
|
-
import { Show as
|
|
7135
|
+
import { Show as Show12, createSignal as createSignal14 } from "solid-js";
|
|
6705
7136
|
|
|
6706
7137
|
// src/functions/get-env.ts
|
|
6707
7138
|
var validEnvList = ["production", "qa", "test", "development", "dev", "cdn-qa", "cloud", "fast", "cdn2", "cdn-prod"];
|
|
@@ -6721,9 +7152,9 @@ function logFetch(url) {
|
|
|
6721
7152
|
|
|
6722
7153
|
// src/blocks/form/form/form.tsx
|
|
6723
7154
|
function FormComponent(props) {
|
|
6724
|
-
const [formState, setFormState] =
|
|
6725
|
-
const [responseData, setResponseData] =
|
|
6726
|
-
const [formErrorMessage, setFormErrorMessage] =
|
|
7155
|
+
const [formState, setFormState] = createSignal14("unsubmitted");
|
|
7156
|
+
const [responseData, setResponseData] = createSignal14(null);
|
|
7157
|
+
const [formErrorMessage, setFormErrorMessage] = createSignal14("");
|
|
6727
7158
|
function mergeNewRootState(newData) {
|
|
6728
7159
|
const combinedState = {
|
|
6729
7160
|
...props.builderContext.rootState,
|
|
@@ -6919,22 +7350,22 @@ function FormComponent(props) {
|
|
|
6919
7350
|
{...props.attributes}
|
|
6920
7351
|
>
|
|
6921
7352
|
{props.children}
|
|
6922
|
-
<
|
|
7353
|
+
<Show12 when={submissionState() === "error"}><Blocks_default
|
|
6923
7354
|
path="errorMessage"
|
|
6924
7355
|
blocks={props.errorMessage}
|
|
6925
7356
|
context={props.builderContext}
|
|
6926
|
-
/></
|
|
6927
|
-
<
|
|
7357
|
+
/></Show12>
|
|
7358
|
+
<Show12 when={submissionState() === "sending"}><Blocks_default
|
|
6928
7359
|
path="sendingMessage"
|
|
6929
7360
|
blocks={props.sendingMessage}
|
|
6930
7361
|
context={props.builderContext}
|
|
6931
|
-
/></
|
|
6932
|
-
<
|
|
6933
|
-
<
|
|
7362
|
+
/></Show12>
|
|
7363
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-04a43b72">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
7364
|
+
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
6934
7365
|
path="successMessage"
|
|
6935
7366
|
blocks={props.successMessage}
|
|
6936
7367
|
context={props.builderContext}
|
|
6937
|
-
/></
|
|
7368
|
+
/></Show12>
|
|
6938
7369
|
</form>
|
|
6939
7370
|
<style>{`.pre-04a43b72 {
|
|
6940
7371
|
padding: 10px;
|
|
@@ -6946,7 +7377,7 @@ function FormComponent(props) {
|
|
|
6946
7377
|
var form_default = FormComponent;
|
|
6947
7378
|
|
|
6948
7379
|
// src/blocks/form/input/component-info.ts
|
|
6949
|
-
var
|
|
7380
|
+
var componentInfo15 = {
|
|
6950
7381
|
name: "Form:Input",
|
|
6951
7382
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
6952
7383
|
inputs: [
|
|
@@ -7016,7 +7447,7 @@ function FormInputComponent(props) {
|
|
|
7016
7447
|
var input_default = FormInputComponent;
|
|
7017
7448
|
|
|
7018
7449
|
// src/blocks/form/select/component-info.ts
|
|
7019
|
-
var
|
|
7450
|
+
var componentInfo16 = {
|
|
7020
7451
|
name: "Form:Select",
|
|
7021
7452
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
7022
7453
|
defaultStyles: {
|
|
@@ -7061,7 +7492,7 @@ var componentInfo15 = {
|
|
|
7061
7492
|
};
|
|
7062
7493
|
|
|
7063
7494
|
// src/blocks/form/select/select.tsx
|
|
7064
|
-
import { For as
|
|
7495
|
+
import { For as For8 } from "solid-js";
|
|
7065
7496
|
function SelectComponent(props) {
|
|
7066
7497
|
return <><select
|
|
7067
7498
|
{...{}}
|
|
@@ -7071,15 +7502,15 @@ function SelectComponent(props) {
|
|
|
7071
7502
|
defaultValue={props.defaultValue}
|
|
7072
7503
|
name={props.name}
|
|
7073
7504
|
required={props.required}
|
|
7074
|
-
><
|
|
7505
|
+
><For8 each={props.options}>{(option, _index) => {
|
|
7075
7506
|
const index = _index();
|
|
7076
7507
|
return <option key={`${option.name}-${index}`} value={option.value}>{option.name || option.value}</option>;
|
|
7077
|
-
}}</
|
|
7508
|
+
}}</For8></select></>;
|
|
7078
7509
|
}
|
|
7079
7510
|
var select_default = SelectComponent;
|
|
7080
7511
|
|
|
7081
7512
|
// src/blocks/form/submit-button/component-info.ts
|
|
7082
|
-
var
|
|
7513
|
+
var componentInfo17 = {
|
|
7083
7514
|
name: "Form:SubmitButton",
|
|
7084
7515
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
7085
7516
|
defaultStyles: {
|
|
@@ -7113,7 +7544,7 @@ function SubmitButton(props) {
|
|
|
7113
7544
|
var submit_button_default = SubmitButton;
|
|
7114
7545
|
|
|
7115
7546
|
// src/blocks/form/textarea/component-info.ts
|
|
7116
|
-
var
|
|
7547
|
+
var componentInfo18 = {
|
|
7117
7548
|
name: "Form:TextArea",
|
|
7118
7549
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
7119
7550
|
inputs: [{
|
|
@@ -7166,7 +7597,7 @@ function Textarea(props) {
|
|
|
7166
7597
|
var textarea_default = Textarea;
|
|
7167
7598
|
|
|
7168
7599
|
// src/blocks/img/component-info.ts
|
|
7169
|
-
var
|
|
7600
|
+
var componentInfo19 = {
|
|
7170
7601
|
// friendlyName?
|
|
7171
7602
|
name: "Raw:Img",
|
|
7172
7603
|
hideFromInsertMenu: true,
|
|
@@ -7199,7 +7630,7 @@ function ImgComponent(props) {
|
|
|
7199
7630
|
var img_default = ImgComponent;
|
|
7200
7631
|
|
|
7201
7632
|
// src/blocks/video/component-info.ts
|
|
7202
|
-
var
|
|
7633
|
+
var componentInfo20 = {
|
|
7203
7634
|
name: "Video",
|
|
7204
7635
|
canHaveChildren: true,
|
|
7205
7636
|
defaultStyles: {
|
|
@@ -7286,9 +7717,9 @@ var componentInfo19 = {
|
|
|
7286
7717
|
};
|
|
7287
7718
|
|
|
7288
7719
|
// src/blocks/video/video.tsx
|
|
7289
|
-
import { Show as
|
|
7720
|
+
import { Show as Show13, createMemo as createMemo15 } from "solid-js";
|
|
7290
7721
|
function Video(props) {
|
|
7291
|
-
const videoProps =
|
|
7722
|
+
const videoProps = createMemo15(() => {
|
|
7292
7723
|
return {
|
|
7293
7724
|
...props.autoPlay === true ? {
|
|
7294
7725
|
autoPlay: true
|
|
@@ -7307,7 +7738,7 @@ function Video(props) {
|
|
|
7307
7738
|
} : {}
|
|
7308
7739
|
};
|
|
7309
7740
|
});
|
|
7310
|
-
const spreadProps =
|
|
7741
|
+
const spreadProps = createMemo15(() => {
|
|
7311
7742
|
return {
|
|
7312
7743
|
...videoProps()
|
|
7313
7744
|
};
|
|
@@ -7336,8 +7767,8 @@ function Video(props) {
|
|
|
7336
7767
|
}}
|
|
7337
7768
|
src={props.video || "no-src"}
|
|
7338
7769
|
poster={props.posterImage}
|
|
7339
|
-
><
|
|
7340
|
-
<
|
|
7770
|
+
><Show13 when={!props.lazyLoad}><source type="video/mp4" src={props.video} /></Show13></video>
|
|
7771
|
+
<Show13
|
|
7341
7772
|
when={props.aspectRatio && !(props.fitContent && props.builderBlock?.children?.length)}
|
|
7342
7773
|
><div
|
|
7343
7774
|
style={{
|
|
@@ -7346,15 +7777,15 @@ function Video(props) {
|
|
|
7346
7777
|
"pointer-events": "none",
|
|
7347
7778
|
"font-size": "0px"
|
|
7348
7779
|
}}
|
|
7349
|
-
/></
|
|
7350
|
-
<
|
|
7780
|
+
/></Show13>
|
|
7781
|
+
<Show13 when={props.builderBlock?.children?.length && props.fitContent}><div
|
|
7351
7782
|
style={{
|
|
7352
7783
|
display: "flex",
|
|
7353
7784
|
"flex-direction": "column",
|
|
7354
7785
|
"align-items": "stretch"
|
|
7355
7786
|
}}
|
|
7356
|
-
>{props.children}</div></
|
|
7357
|
-
<
|
|
7787
|
+
>{props.children}</div></Show13>
|
|
7788
|
+
<Show13 when={props.builderBlock?.children?.length && !props.fitContent}><div
|
|
7358
7789
|
style={{
|
|
7359
7790
|
"pointer-events": "none",
|
|
7360
7791
|
display: "flex",
|
|
@@ -7366,7 +7797,7 @@ function Video(props) {
|
|
|
7366
7797
|
width: "100%",
|
|
7367
7798
|
height: "100%"
|
|
7368
7799
|
}}
|
|
7369
|
-
>{props.children}</div></
|
|
7800
|
+
>{props.children}</div></Show13>
|
|
7370
7801
|
</div></>;
|
|
7371
7802
|
}
|
|
7372
7803
|
var video_default = Video;
|
|
@@ -7374,31 +7805,31 @@ var video_default = Video;
|
|
|
7374
7805
|
// src/constants/extra-components.ts
|
|
7375
7806
|
var getExtraComponents = () => [{
|
|
7376
7807
|
component: custom_code_default,
|
|
7377
|
-
...
|
|
7808
|
+
...componentInfo12
|
|
7378
7809
|
}, {
|
|
7379
7810
|
component: embed_default,
|
|
7380
|
-
...
|
|
7811
|
+
...componentInfo13
|
|
7381
7812
|
}, ...TARGET === "rsc" ? [] : [{
|
|
7382
7813
|
component: form_default,
|
|
7383
|
-
...
|
|
7814
|
+
...componentInfo14
|
|
7384
7815
|
}, {
|
|
7385
7816
|
component: input_default,
|
|
7386
|
-
...
|
|
7817
|
+
...componentInfo15
|
|
7387
7818
|
}, {
|
|
7388
7819
|
component: submit_button_default,
|
|
7389
|
-
...
|
|
7820
|
+
...componentInfo17
|
|
7390
7821
|
}, {
|
|
7391
7822
|
component: select_default,
|
|
7392
|
-
...
|
|
7823
|
+
...componentInfo16
|
|
7393
7824
|
}, {
|
|
7394
7825
|
component: textarea_default,
|
|
7395
|
-
...
|
|
7826
|
+
...componentInfo18
|
|
7396
7827
|
}], {
|
|
7397
7828
|
component: img_default,
|
|
7398
|
-
...
|
|
7829
|
+
...componentInfo19
|
|
7399
7830
|
}, {
|
|
7400
7831
|
component: video_default,
|
|
7401
|
-
...
|
|
7832
|
+
...componentInfo20
|
|
7402
7833
|
}];
|
|
7403
7834
|
|
|
7404
7835
|
// src/constants/builder-registered-components.ts
|
|
@@ -7416,19 +7847,22 @@ var getDefaultRegisteredComponents = () => [{
|
|
|
7416
7847
|
...componentInfo5
|
|
7417
7848
|
}, {
|
|
7418
7849
|
component: section_default,
|
|
7419
|
-
...
|
|
7850
|
+
...componentInfo7
|
|
7420
7851
|
}, {
|
|
7421
7852
|
component: slot_default,
|
|
7422
|
-
...
|
|
7853
|
+
...componentInfo8
|
|
7423
7854
|
}, {
|
|
7424
7855
|
component: symbol_default,
|
|
7425
|
-
...
|
|
7856
|
+
...componentInfo9
|
|
7426
7857
|
}, {
|
|
7427
7858
|
component: text_default,
|
|
7428
|
-
...
|
|
7429
|
-
}, ...TARGET === "
|
|
7859
|
+
...componentInfo11
|
|
7860
|
+
}, ...TARGET === "react" ? [{
|
|
7861
|
+
component: personalization_container_default,
|
|
7862
|
+
...componentInfo6
|
|
7863
|
+
}] : [], ...TARGET === "rsc" ? [] : [{
|
|
7430
7864
|
component: tabs_default,
|
|
7431
|
-
...
|
|
7865
|
+
...componentInfo10
|
|
7432
7866
|
}, {
|
|
7433
7867
|
component: accordion_default,
|
|
7434
7868
|
...componentInfo
|
|
@@ -7466,7 +7900,7 @@ var getVariants = (content) => Object.values(content?.variations || {}).map((var
|
|
|
7466
7900
|
testVariationId: variant.id,
|
|
7467
7901
|
id: content?.id
|
|
7468
7902
|
}));
|
|
7469
|
-
var
|
|
7903
|
+
var checkShouldRenderVariants2 = ({
|
|
7470
7904
|
canTrack,
|
|
7471
7905
|
content
|
|
7472
7906
|
}) => {
|
|
@@ -7500,24 +7934,14 @@ var getUpdateVariantVisibilityScript = ({
|
|
|
7500
7934
|
"${variationId}", "${contentId}", ${isHydrationTarget}
|
|
7501
7935
|
)`;
|
|
7502
7936
|
|
|
7503
|
-
// src/components/inlined-script.tsx
|
|
7504
|
-
function InlinedScript(props) {
|
|
7505
|
-
return <><script
|
|
7506
|
-
innerHTML={props.scriptStr}
|
|
7507
|
-
data-id={props.id}
|
|
7508
|
-
nonce={props.nonce || ""}
|
|
7509
|
-
/></>;
|
|
7510
|
-
}
|
|
7511
|
-
var Inlined_script_default = InlinedScript;
|
|
7512
|
-
|
|
7513
7937
|
// src/components/content/components/enable-editor.tsx
|
|
7514
7938
|
import {
|
|
7515
|
-
Show as
|
|
7516
|
-
onMount as
|
|
7939
|
+
Show as Show14,
|
|
7940
|
+
onMount as onMount6,
|
|
7517
7941
|
on as on3,
|
|
7518
7942
|
createEffect as createEffect3,
|
|
7519
|
-
createMemo as
|
|
7520
|
-
createSignal as
|
|
7943
|
+
createMemo as createMemo16,
|
|
7944
|
+
createSignal as createSignal16
|
|
7521
7945
|
} from "solid-js";
|
|
7522
7946
|
import { Dynamic as Dynamic5 } from "solid-js/web";
|
|
7523
7947
|
|
|
@@ -7527,7 +7951,7 @@ function getPreviewContent(_searchParams) {
|
|
|
7527
7951
|
}
|
|
7528
7952
|
|
|
7529
7953
|
// src/constants/sdk-version.ts
|
|
7530
|
-
var SDK_VERSION = "3.0.
|
|
7954
|
+
var SDK_VERSION = "3.0.6";
|
|
7531
7955
|
|
|
7532
7956
|
// src/helpers/sdk-headers.ts
|
|
7533
7957
|
var getSdkHeaders = () => ({
|
|
@@ -7824,16 +8248,6 @@ async function fetchEntries(options) {
|
|
|
7824
8248
|
return _processContentResult(options, content);
|
|
7825
8249
|
}
|
|
7826
8250
|
|
|
7827
|
-
// src/functions/is-previewing.ts
|
|
7828
|
-
function isPreviewing(_search) {
|
|
7829
|
-
const search = _search || (isBrowser() ? window.location.search : void 0);
|
|
7830
|
-
if (!search) {
|
|
7831
|
-
return false;
|
|
7832
|
-
}
|
|
7833
|
-
const normalizedSearch = getSearchString(search);
|
|
7834
|
-
return Boolean(normalizedSearch.indexOf("builder.preview=") !== -1);
|
|
7835
|
-
}
|
|
7836
|
-
|
|
7837
8251
|
// src/helpers/uuid.ts
|
|
7838
8252
|
function uuidv4() {
|
|
7839
8253
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
@@ -8160,7 +8574,8 @@ var setupBrowserForEditing = (options = {}) => {
|
|
|
8160
8574
|
// Supports builder-model="..." attribute which is needed to
|
|
8161
8575
|
// scope our '+ add block' button styling
|
|
8162
8576
|
supportsAddBlockScoping: true,
|
|
8163
|
-
supportsCustomBreakpoints: true
|
|
8577
|
+
supportsCustomBreakpoints: true,
|
|
8578
|
+
blockLevelPersonalization: true
|
|
8164
8579
|
}
|
|
8165
8580
|
}, "*");
|
|
8166
8581
|
window.parent?.postMessage({
|
|
@@ -8375,12 +8790,12 @@ var getWrapperClassName = (variationId) => {
|
|
|
8375
8790
|
|
|
8376
8791
|
// src/components/content/components/enable-editor.tsx
|
|
8377
8792
|
function EnableEditor(props) {
|
|
8378
|
-
const [ContentWrapper, setContentWrapper] =
|
|
8793
|
+
const [ContentWrapper, setContentWrapper] = createSignal16(
|
|
8379
8794
|
props.contentWrapper || "div"
|
|
8380
8795
|
);
|
|
8381
|
-
const [httpReqsData, setHttpReqsData] =
|
|
8382
|
-
const [httpReqsPending, setHttpReqsPending] =
|
|
8383
|
-
const [clicked, setClicked] =
|
|
8796
|
+
const [httpReqsData, setHttpReqsData] = createSignal16({});
|
|
8797
|
+
const [httpReqsPending, setHttpReqsPending] = createSignal16({});
|
|
8798
|
+
const [clicked, setClicked] = createSignal16(false);
|
|
8384
8799
|
function mergeNewRootState(newData) {
|
|
8385
8800
|
const combinedState = {
|
|
8386
8801
|
...props.builderContextSignal.rootState,
|
|
@@ -8414,7 +8829,7 @@ function EnableEditor(props) {
|
|
|
8414
8829
|
content: newContentValue
|
|
8415
8830
|
}));
|
|
8416
8831
|
}
|
|
8417
|
-
const showContentProps =
|
|
8832
|
+
const showContentProps = createMemo16(() => {
|
|
8418
8833
|
return props.showContent ? {} : {
|
|
8419
8834
|
hidden: true,
|
|
8420
8835
|
"aria-hidden": true
|
|
@@ -8521,7 +8936,7 @@ function EnableEditor(props) {
|
|
|
8521
8936
|
let elementRef;
|
|
8522
8937
|
runHttpRequests();
|
|
8523
8938
|
emitStateUpdate();
|
|
8524
|
-
|
|
8939
|
+
onMount6(() => {
|
|
8525
8940
|
if (isBrowser()) {
|
|
8526
8941
|
if (isEditing() && !props.isNestedRender) {
|
|
8527
8942
|
window.addEventListener("message", processMessage);
|
|
@@ -8590,14 +9005,14 @@ function EnableEditor(props) {
|
|
|
8590
9005
|
}
|
|
8591
9006
|
}
|
|
8592
9007
|
});
|
|
8593
|
-
const onUpdateFn_0_props_content =
|
|
9008
|
+
const onUpdateFn_0_props_content = createMemo16(() => props.content);
|
|
8594
9009
|
function onUpdateFn_0() {
|
|
8595
9010
|
if (props.content) {
|
|
8596
9011
|
mergeNewContent(props.content);
|
|
8597
9012
|
}
|
|
8598
9013
|
}
|
|
8599
9014
|
createEffect3(on3(() => [onUpdateFn_0_props_content()], onUpdateFn_0));
|
|
8600
|
-
const onUpdateFn_1_props_builderContextSignal_rootState =
|
|
9015
|
+
const onUpdateFn_1_props_builderContextSignal_rootState = createMemo16(
|
|
8601
9016
|
() => props.builderContextSignal.rootState
|
|
8602
9017
|
);
|
|
8603
9018
|
function onUpdateFn_1() {
|
|
@@ -8609,14 +9024,14 @@ function EnableEditor(props) {
|
|
|
8609
9024
|
onUpdateFn_1
|
|
8610
9025
|
)
|
|
8611
9026
|
);
|
|
8612
|
-
const onUpdateFn_2_props_data =
|
|
9027
|
+
const onUpdateFn_2_props_data = createMemo16(() => props.data);
|
|
8613
9028
|
function onUpdateFn_2() {
|
|
8614
9029
|
if (props.data) {
|
|
8615
9030
|
mergeNewRootState(props.data);
|
|
8616
9031
|
}
|
|
8617
9032
|
}
|
|
8618
9033
|
createEffect3(on3(() => [onUpdateFn_2_props_data()], onUpdateFn_2));
|
|
8619
|
-
const onUpdateFn_3_props_locale =
|
|
9034
|
+
const onUpdateFn_3_props_locale = createMemo16(() => props.locale);
|
|
8620
9035
|
function onUpdateFn_3() {
|
|
8621
9036
|
if (props.locale) {
|
|
8622
9037
|
mergeNewRootState({
|
|
@@ -8625,7 +9040,7 @@ function EnableEditor(props) {
|
|
|
8625
9040
|
}
|
|
8626
9041
|
}
|
|
8627
9042
|
createEffect3(on3(() => [onUpdateFn_3_props_locale()], onUpdateFn_3));
|
|
8628
|
-
return <><builder_context_default.Provider value={props.builderContextSignal}><
|
|
9043
|
+
return <><builder_context_default.Provider value={props.builderContextSignal}><Show14
|
|
8629
9044
|
when={props.builderContextSignal.content || needsElementRefDivForEditing()}
|
|
8630
9045
|
><Dynamic5
|
|
8631
9046
|
class={getWrapperClassName(
|
|
@@ -8643,14 +9058,14 @@ function EnableEditor(props) {
|
|
|
8643
9058
|
{...showContentProps()}
|
|
8644
9059
|
{...props.contentWrapperProps}
|
|
8645
9060
|
component={ContentWrapper()}
|
|
8646
|
-
>{props.children}</Dynamic5></
|
|
9061
|
+
>{props.children}</Dynamic5></Show14></builder_context_default.Provider></>;
|
|
8647
9062
|
}
|
|
8648
9063
|
var Enable_editor_default = EnableEditor;
|
|
8649
9064
|
|
|
8650
9065
|
// src/components/content/components/styles.tsx
|
|
8651
|
-
import { createSignal as
|
|
9066
|
+
import { createSignal as createSignal17 } from "solid-js";
|
|
8652
9067
|
function ContentStyles(props) {
|
|
8653
|
-
const [injectedStyles, setInjectedStyles] =
|
|
9068
|
+
const [injectedStyles, setInjectedStyles] = createSignal17(
|
|
8654
9069
|
`
|
|
8655
9070
|
${getCss({
|
|
8656
9071
|
cssCode: props.cssCode,
|
|
@@ -8708,7 +9123,7 @@ var getContentInitialValue = ({
|
|
|
8708
9123
|
|
|
8709
9124
|
// src/components/content/content.tsx
|
|
8710
9125
|
function ContentComponent(props) {
|
|
8711
|
-
const [scriptStr, setScriptStr] =
|
|
9126
|
+
const [scriptStr, setScriptStr] = createSignal18(
|
|
8712
9127
|
getUpdateVariantVisibilityScript({
|
|
8713
9128
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
8714
9129
|
variationId: props.content?.testVariationId,
|
|
@@ -8716,7 +9131,7 @@ function ContentComponent(props) {
|
|
|
8716
9131
|
contentId: props.content?.id
|
|
8717
9132
|
})
|
|
8718
9133
|
);
|
|
8719
|
-
const [registeredComponents, setRegisteredComponents] =
|
|
9134
|
+
const [registeredComponents, setRegisteredComponents] = createSignal18(
|
|
8720
9135
|
[
|
|
8721
9136
|
...getDefaultRegisteredComponents(),
|
|
8722
9137
|
...props.customComponents || []
|
|
@@ -8731,7 +9146,7 @@ function ContentComponent(props) {
|
|
|
8731
9146
|
{}
|
|
8732
9147
|
)
|
|
8733
9148
|
);
|
|
8734
|
-
const [builderContextSignal, setBuilderContextSignal] =
|
|
9149
|
+
const [builderContextSignal, setBuilderContextSignal] = createSignal18({
|
|
8735
9150
|
content: getContentInitialValue({
|
|
8736
9151
|
content: props.content,
|
|
8737
9152
|
data: props.data
|
|
@@ -8815,18 +9230,18 @@ function ContentComponent(props) {
|
|
|
8815
9230
|
setBuilderContextSignal
|
|
8816
9231
|
}}
|
|
8817
9232
|
>
|
|
8818
|
-
<
|
|
9233
|
+
<Show15 when={props.isSsrAbTest}><Inlined_script_default
|
|
8819
9234
|
id="builderio-variant-visibility"
|
|
8820
9235
|
scriptStr={scriptStr()}
|
|
8821
9236
|
nonce={props.nonce || ""}
|
|
8822
|
-
/></
|
|
8823
|
-
<
|
|
9237
|
+
/></Show15>
|
|
9238
|
+
<Show15 when={TARGET !== "reactNative"}><Styles_default
|
|
8824
9239
|
nonce={props.nonce || ""}
|
|
8825
9240
|
isNestedRender={props.isNestedRender}
|
|
8826
9241
|
contentId={builderContextSignal().content?.id}
|
|
8827
9242
|
cssCode={builderContextSignal().content?.data?.cssCode}
|
|
8828
9243
|
customFonts={builderContextSignal().content?.data?.customFonts}
|
|
8829
|
-
/></
|
|
9244
|
+
/></Show15>
|
|
8830
9245
|
<Blocks_default
|
|
8831
9246
|
blocks={builderContextSignal().content?.data?.blocks}
|
|
8832
9247
|
context={builderContextSignal()}
|
|
@@ -8839,13 +9254,13 @@ var Content_default = ContentComponent;
|
|
|
8839
9254
|
|
|
8840
9255
|
// src/components/content-variants/content-variants.tsx
|
|
8841
9256
|
function ContentVariants(props) {
|
|
8842
|
-
const [shouldRenderVariants, setShouldRenderVariants] =
|
|
8843
|
-
|
|
9257
|
+
const [shouldRenderVariants, setShouldRenderVariants] = createSignal19(
|
|
9258
|
+
checkShouldRenderVariants2({
|
|
8844
9259
|
canTrack: getDefaultCanTrack(props.canTrack),
|
|
8845
9260
|
content: props.content
|
|
8846
9261
|
})
|
|
8847
9262
|
);
|
|
8848
|
-
const updateCookieAndStylesScriptStr =
|
|
9263
|
+
const updateCookieAndStylesScriptStr = createMemo19(() => {
|
|
8849
9264
|
return getUpdateCookieAndStylesScript(
|
|
8850
9265
|
getVariants(props.content).map((value) => ({
|
|
8851
9266
|
id: value.testVariationId,
|
|
@@ -8854,10 +9269,10 @@ function ContentVariants(props) {
|
|
|
8854
9269
|
props.content?.id || ""
|
|
8855
9270
|
);
|
|
8856
9271
|
});
|
|
8857
|
-
const hideVariantsStyleString =
|
|
9272
|
+
const hideVariantsStyleString = createMemo19(() => {
|
|
8858
9273
|
return getVariants(props.content).map((value) => `.variant-${value.testVariationId} { display: none; } `).join("");
|
|
8859
9274
|
});
|
|
8860
|
-
const defaultContent =
|
|
9275
|
+
const defaultContent = createMemo19(() => {
|
|
8861
9276
|
return shouldRenderVariants() ? {
|
|
8862
9277
|
...props.content,
|
|
8863
9278
|
testVariationId: props.content?.id
|
|
@@ -8866,16 +9281,16 @@ function ContentVariants(props) {
|
|
|
8866
9281
|
canTrack: getDefaultCanTrack(props.canTrack)
|
|
8867
9282
|
});
|
|
8868
9283
|
});
|
|
8869
|
-
|
|
9284
|
+
onMount7(() => {
|
|
8870
9285
|
setShouldRenderVariants(false);
|
|
8871
9286
|
});
|
|
8872
9287
|
return <><>
|
|
8873
|
-
<
|
|
9288
|
+
<Show16 when={!props.isNestedRender && TARGET !== "reactNative"}><Inlined_script_default
|
|
8874
9289
|
id="builderio-init-variants-fns"
|
|
8875
9290
|
scriptStr={getInitVariantsFnsScriptString()}
|
|
8876
9291
|
nonce={props.nonce || ""}
|
|
8877
|
-
/></
|
|
8878
|
-
<
|
|
9292
|
+
/></Show16>
|
|
9293
|
+
<Show16 when={shouldRenderVariants()}>
|
|
8879
9294
|
<Inlined_styles_default
|
|
8880
9295
|
id="builderio-variants"
|
|
8881
9296
|
styles={hideVariantsStyleString()}
|
|
@@ -8886,7 +9301,7 @@ function ContentVariants(props) {
|
|
|
8886
9301
|
scriptStr={updateCookieAndStylesScriptStr()}
|
|
8887
9302
|
nonce={props.nonce || ""}
|
|
8888
9303
|
/>
|
|
8889
|
-
<
|
|
9304
|
+
<For9 each={getVariants(props.content)}>{(variant, _index) => {
|
|
8890
9305
|
const index = _index();
|
|
8891
9306
|
return <Content_default
|
|
8892
9307
|
apiHost={props.apiHost}
|
|
@@ -8913,8 +9328,8 @@ function ContentVariants(props) {
|
|
|
8913
9328
|
trustedHosts={props.trustedHosts}
|
|
8914
9329
|
{...{}}
|
|
8915
9330
|
/>;
|
|
8916
|
-
}}</
|
|
8917
|
-
</
|
|
9331
|
+
}}</For9>
|
|
9332
|
+
</Show16>
|
|
8918
9333
|
<Content_default
|
|
8919
9334
|
apiHost={props.apiHost}
|
|
8920
9335
|
nonce={props.nonce}
|
|
@@ -8969,14 +9384,14 @@ var fetchSymbolContent = async ({
|
|
|
8969
9384
|
|
|
8970
9385
|
// src/blocks/symbol/symbol.tsx
|
|
8971
9386
|
function Symbol2(props) {
|
|
8972
|
-
const [contentToUse, setContentToUse] =
|
|
8973
|
-
const blocksWrapper =
|
|
9387
|
+
const [contentToUse, setContentToUse] = createSignal20(props.symbol?.content);
|
|
9388
|
+
const blocksWrapper = createMemo20(() => {
|
|
8974
9389
|
return "div";
|
|
8975
9390
|
});
|
|
8976
|
-
const contentWrapper =
|
|
9391
|
+
const contentWrapper = createMemo20(() => {
|
|
8977
9392
|
return "div";
|
|
8978
9393
|
});
|
|
8979
|
-
const className =
|
|
9394
|
+
const className = createMemo20(() => {
|
|
8980
9395
|
return [
|
|
8981
9396
|
...[props.attributes[getClassPropName()]],
|
|
8982
9397
|
"builder-symbol",
|
|
@@ -8996,9 +9411,9 @@ function Symbol2(props) {
|
|
|
8996
9411
|
}
|
|
8997
9412
|
});
|
|
8998
9413
|
}
|
|
8999
|
-
|
|
9414
|
+
onMount8(() => {
|
|
9000
9415
|
});
|
|
9001
|
-
const onUpdateFn_0_props_symbol =
|
|
9416
|
+
const onUpdateFn_0_props_symbol = createMemo20(() => props.symbol);
|
|
9002
9417
|
function onUpdateFn_0() {
|
|
9003
9418
|
setContent();
|
|
9004
9419
|
}
|
|
@@ -9083,6 +9498,7 @@ export {
|
|
|
9083
9498
|
isEditing,
|
|
9084
9499
|
isPreviewing,
|
|
9085
9500
|
register,
|
|
9501
|
+
setClientUserAttributes,
|
|
9086
9502
|
setEditorSettings,
|
|
9087
9503
|
subscribeToEditor,
|
|
9088
9504
|
track
|