@builder.io/sdk-react-nextjs 0.18.11 → 0.18.15
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/lib/browser/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/browser/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/browser/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/browser/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/browser/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/browser/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/browser/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/browser/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/browser/blocks/symbol/symbol.cjs +1 -1
- package/lib/browser/blocks/symbol/symbol.mjs +23 -23
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +1 -0
- package/lib/browser/components/block/components/interactive-element.cjs +1 -1
- package/lib/browser/components/block/components/interactive-element.mjs +16 -12
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/browser/components/blocks/blocks.cjs +1 -1
- package/lib/browser/components/blocks/blocks.mjs +21 -18
- package/lib/browser/components/content-variants/content-variants.cjs +1 -1
- package/lib/browser/components/content-variants/content-variants.mjs +51 -40
- package/lib/browser/constants/builder-registered-components.cjs +1 -1
- package/lib/browser/constants/builder-registered-components.mjs +44 -36
- package/lib/browser/constants/extra-components.cjs +1 -1
- package/lib/browser/constants/extra-components.mjs +3 -2
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/browser/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/browser/helpers/user-attributes.cjs +1 -1
- package/lib/browser/helpers/user-attributes.mjs +30 -24
- package/lib/edge/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/edge/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/edge/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/edge/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/edge/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/edge/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/edge/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/edge/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/edge/blocks/symbol/symbol.cjs +1 -1
- package/lib/edge/blocks/symbol/symbol.mjs +23 -23
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +1 -0
- package/lib/edge/components/block/components/interactive-element.cjs +1 -1
- package/lib/edge/components/block/components/interactive-element.mjs +16 -12
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/edge/components/blocks/blocks.cjs +1 -1
- package/lib/edge/components/blocks/blocks.mjs +21 -18
- package/lib/edge/components/content-variants/content-variants.cjs +1 -1
- package/lib/edge/components/content-variants/content-variants.mjs +51 -40
- package/lib/edge/constants/builder-registered-components.cjs +1 -1
- package/lib/edge/constants/builder-registered-components.mjs +44 -36
- package/lib/edge/constants/extra-components.cjs +1 -1
- package/lib/edge/constants/extra-components.mjs +3 -2
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/edge/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/edge/helpers/user-attributes.cjs +1 -1
- package/lib/edge/helpers/user-attributes.mjs +30 -24
- package/lib/node/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/node/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/node/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/node/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/node/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/node/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/node/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/node/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/node/blocks/symbol/symbol.cjs +1 -1
- package/lib/node/blocks/symbol/symbol.mjs +23 -23
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +1 -0
- package/lib/node/components/block/components/interactive-element.cjs +1 -1
- package/lib/node/components/block/components/interactive-element.mjs +16 -12
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/node/components/blocks/blocks.cjs +1 -1
- package/lib/node/components/blocks/blocks.mjs +21 -18
- package/lib/node/components/content-variants/content-variants.cjs +1 -1
- package/lib/node/components/content-variants/content-variants.mjs +51 -40
- package/lib/node/constants/builder-registered-components.cjs +1 -1
- package/lib/node/constants/builder-registered-components.mjs +44 -36
- package/lib/node/constants/extra-components.cjs +1 -1
- package/lib/node/constants/extra-components.mjs +3 -2
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/node/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/node/helpers/user-attributes.cjs +1 -1
- package/lib/node/helpers/user-attributes.mjs +30 -24
- package/package.json +2 -2
- package/types/cjs/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
- package/types/cjs/blocks/personalization-container/helpers.d.ts +24 -4
- package/types/cjs/blocks/personalization-container/personalization-container.types.d.ts +2 -2
- package/types/cjs/components/blocks/blocks-wrapper.d.ts +13 -1
- package/types/cjs/components/blocks/blocks.types.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/no-serialize-wrapper.d.ts +1 -0
- package/types/cjs/helpers/user-attributes.d.ts +6 -2
- package/types/esm/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
- package/types/esm/blocks/personalization-container/helpers.d.ts +24 -4
- package/types/esm/blocks/personalization-container/personalization-container.types.d.ts +2 -2
- package/types/esm/components/blocks/blocks-wrapper.d.ts +13 -1
- package/types/esm/components/blocks/blocks.types.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/no-serialize-wrapper.d.ts +1 -0
- package/types/esm/helpers/user-attributes.d.ts +6 -2
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
function m(l, f, y, p) {
|
|
2
|
+
function o(r) {
|
|
3
|
+
return typeof r == "string";
|
|
4
|
+
}
|
|
5
|
+
function a(r) {
|
|
6
|
+
return typeof r == "number";
|
|
7
|
+
}
|
|
8
|
+
function c(r, n) {
|
|
9
|
+
return (() => {
|
|
10
|
+
const u = n.property, s = n.operator;
|
|
11
|
+
let e = n.value;
|
|
12
|
+
if (n && n.property === "urlPath" && n.value && typeof n.value == "string" && n.value !== "/" && n.value.endsWith("/") && (e = n.value.slice(0, -1)), !(u && s))
|
|
13
|
+
return !0;
|
|
14
|
+
if (Array.isArray(e))
|
|
15
|
+
return s === "isNot" ? e.every((v) => c(r, {
|
|
16
|
+
property: u,
|
|
17
|
+
operator: s,
|
|
18
|
+
value: v
|
|
19
|
+
})) : !!e.find((v) => c(r, {
|
|
20
|
+
property: u,
|
|
21
|
+
operator: s,
|
|
22
|
+
value: v
|
|
23
|
+
}));
|
|
24
|
+
const t = r[u];
|
|
25
|
+
if (Array.isArray(t))
|
|
26
|
+
return t.includes(e);
|
|
27
|
+
switch (s) {
|
|
28
|
+
case "is":
|
|
29
|
+
return t === e;
|
|
30
|
+
case "isNot":
|
|
31
|
+
return t !== e;
|
|
32
|
+
case "contains":
|
|
33
|
+
return (o(t) || Array.isArray(t)) && t.includes(String(e));
|
|
34
|
+
case "startsWith":
|
|
35
|
+
return o(t) && t.startsWith(String(e));
|
|
36
|
+
case "endsWith":
|
|
37
|
+
return o(t) && t.endsWith(String(e));
|
|
38
|
+
case "greaterThan":
|
|
39
|
+
return a(t) && a(e) && t > e;
|
|
40
|
+
case "lessThan":
|
|
41
|
+
return a(t) && a(e) && t < e;
|
|
42
|
+
case "greaterThanOrEqualTo":
|
|
43
|
+
return a(t) && a(e) && t >= e;
|
|
44
|
+
case "lessThanOrEqualTo":
|
|
45
|
+
return a(t) && a(e) && t <= e;
|
|
46
|
+
default:
|
|
47
|
+
return !1;
|
|
48
|
+
}
|
|
49
|
+
})();
|
|
50
|
+
}
|
|
51
|
+
const i = {
|
|
52
|
+
query: f,
|
|
53
|
+
startDate: y,
|
|
54
|
+
endDate: p
|
|
55
|
+
}, d = l.date && new Date(l.date) || /* @__PURE__ */ new Date();
|
|
56
|
+
return i.startDate && new Date(i.startDate) > d || i.endDate && new Date(i.endDate) < d ? !1 : !i.query || !i.query.length ? !0 : i.query.every((r) => c(l, r));
|
|
57
|
+
}
|
|
58
|
+
const b = `function getPersonalizedVariant(variants, blockId, isHydrationTarget, locale) {
|
|
59
|
+
if (!navigator.cookieEnabled) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
function getCookie(name) {
|
|
63
|
+
const nameEQ = name + '=';
|
|
64
|
+
const ca = document.cookie.split(';');
|
|
65
|
+
for (let i = 0; i < ca.length; i++) {
|
|
66
|
+
let c = ca[i];
|
|
67
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
68
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
73
|
+
if (locale) {
|
|
74
|
+
attributes.locale = locale;
|
|
75
|
+
}
|
|
76
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
77
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
78
|
+
});
|
|
79
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
80
|
+
const variantId = parentDiv?.getAttribute('data-variant-id');
|
|
81
|
+
const isDefaultVariant = variantId === \`\${blockId}-default\`;
|
|
82
|
+
const isWinningVariant = winningVariantIndex !== -1 && variantId === \`\${blockId}-\${winningVariantIndex}\` || winningVariantIndex === -1 && isDefaultVariant;
|
|
83
|
+
if (isWinningVariant && !isDefaultVariant) {
|
|
84
|
+
parentDiv?.removeAttribute('hidden');
|
|
85
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
86
|
+
} else if (!isWinningVariant && isDefaultVariant) {
|
|
87
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
88
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
89
|
+
}
|
|
90
|
+
if (isHydrationTarget) {
|
|
91
|
+
if (!isWinningVariant) {
|
|
92
|
+
const itsStyleEl = parentDiv?.previousElementSibling;
|
|
93
|
+
if (itsStyleEl) {
|
|
94
|
+
itsStyleEl.remove();
|
|
95
|
+
}
|
|
96
|
+
parentDiv?.remove();
|
|
97
|
+
}
|
|
98
|
+
const thisScript = document.currentScript;
|
|
99
|
+
if (thisScript) {
|
|
100
|
+
thisScript.remove();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}`, h = `function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
104
|
+
function isString(val) {
|
|
105
|
+
return typeof val === 'string';
|
|
106
|
+
}
|
|
107
|
+
function isNumber(val) {
|
|
108
|
+
return typeof val === 'number';
|
|
109
|
+
}
|
|
110
|
+
function objectMatchesQuery(userattr, query) {
|
|
111
|
+
const result = (() => {
|
|
112
|
+
const property = query.property;
|
|
113
|
+
const operator = query.operator;
|
|
114
|
+
let testValue = query.value;
|
|
115
|
+
if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {
|
|
116
|
+
testValue = query.value.slice(0, -1);
|
|
117
|
+
}
|
|
118
|
+
if (!(property && operator)) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
if (Array.isArray(testValue)) {
|
|
122
|
+
if (operator === 'isNot') {
|
|
123
|
+
return testValue.every(val => objectMatchesQuery(userattr, {
|
|
124
|
+
property,
|
|
125
|
+
operator,
|
|
126
|
+
value: val
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
return !!testValue.find(val => objectMatchesQuery(userattr, {
|
|
130
|
+
property,
|
|
131
|
+
operator,
|
|
132
|
+
value: val
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
const value = userattr[property];
|
|
136
|
+
if (Array.isArray(value)) {
|
|
137
|
+
return value.includes(testValue);
|
|
138
|
+
}
|
|
139
|
+
switch (operator) {
|
|
140
|
+
case 'is':
|
|
141
|
+
return value === testValue;
|
|
142
|
+
case 'isNot':
|
|
143
|
+
return value !== testValue;
|
|
144
|
+
case 'contains':
|
|
145
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
146
|
+
case 'startsWith':
|
|
147
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
148
|
+
case 'endsWith':
|
|
149
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
150
|
+
case 'greaterThan':
|
|
151
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
152
|
+
case 'lessThan':
|
|
153
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
154
|
+
case 'greaterThanOrEqualTo':
|
|
155
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
156
|
+
case 'lessThanOrEqualTo':
|
|
157
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
158
|
+
default:
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
})();
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
const item = {
|
|
165
|
+
query,
|
|
166
|
+
startDate,
|
|
167
|
+
endDate
|
|
168
|
+
};
|
|
169
|
+
const now = userAttributes.date && new Date(userAttributes.date) || new Date();
|
|
170
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
171
|
+
return false;
|
|
172
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
if (!item.query || !item.query.length) {
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
return item.query.every(filter => {
|
|
179
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
180
|
+
});
|
|
181
|
+
}`, S = `function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {
|
|
182
|
+
function getCookie(name) {
|
|
183
|
+
const nameEQ = name + '=';
|
|
184
|
+
const ca = document.cookie.split(';');
|
|
185
|
+
for (let i = 0; i < ca.length; i++) {
|
|
186
|
+
let c = ca[i];
|
|
187
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
188
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
189
|
+
}
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
const visibilityStylesEl = document.currentScript?.previousElementSibling;
|
|
193
|
+
if (!visibilityStylesEl) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
if (isHydrationTarget) {
|
|
197
|
+
visibilityStylesEl.remove();
|
|
198
|
+
const currentScript = document.currentScript;
|
|
199
|
+
if (currentScript) {
|
|
200
|
+
currentScript.remove();
|
|
201
|
+
}
|
|
202
|
+
} else {
|
|
203
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
204
|
+
if (locale) {
|
|
205
|
+
attributes.locale = locale;
|
|
206
|
+
}
|
|
207
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
208
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
209
|
+
});
|
|
210
|
+
if (winningVariantIndex !== -1) {
|
|
211
|
+
let newStyleStr = variants?.map((_, index) => {
|
|
212
|
+
if (index === winningVariantIndex) return '';
|
|
213
|
+
return \`div[data-variant-id="\${blockId}-\${index}"] { display: none !important; } \`;
|
|
214
|
+
}).join('') || '';
|
|
215
|
+
newStyleStr += \`div[data-variant-id="\${blockId}-default"] { display: none !important; } \`;
|
|
216
|
+
visibilityStylesEl.innerHTML = newStyleStr;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}`;
|
|
220
|
+
export {
|
|
221
|
+
h as FILTER_WITH_CUSTOM_TARGETING_SCRIPT,
|
|
222
|
+
b as PERSONALIZATION_SCRIPT,
|
|
223
|
+
S as UPDATE_VISIBILITY_STYLES_SCRIPT,
|
|
224
|
+
m as filterWithCustomTargeting
|
|
225
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../constants/target.cjs"),_=require("../../functions/is-browser.cjs"),N=require("../../functions/is-editing.cjs"),r=require("./helpers/inlined-fns.cjs"),u="default",g="filterWithCustomTargeting",R="builderIoPersonalization",E="updateVisibilityStylesScript",l=["react","vue","svelte","qwik"],P=["vue","svelte","qwik"];function d(t,i){return!(t&&t.length>0)||!i?!1:P.includes(c.TARGET)?!0:!_.isBrowser()}function $({variants:t,previewingIndex:i,isHydrated:n,filteredVariants:o,fallbackBlocks:s}){var I;const T={blocks:s!=null?s:[],path:"this.children",index:u};if(n&&N.isEditing()){if(typeof i=="number"&&i<((I=t==null?void 0:t.length)!=null?I:0)){const e=t==null?void 0:t[i];if(e)return{blocks:e.blocks,path:`variants.${i}.blocks`,index:i}}return T}if(_.isBrowser()){const e=o==null?void 0:o[0];if(e&&t){const S=t.indexOf(e);if(S!==-1)return{blocks:e.blocks,path:`variants.${S}.blocks`,index:S}}}return T}const O=()=>`
|
|
2
|
+
window.${g} = ${r.FILTER_WITH_CUSTOM_TARGETING_SCRIPT}
|
|
3
|
+
window.${R} = ${r.PERSONALIZATION_SCRIPT}
|
|
4
|
+
window.${E} = ${r.UPDATE_VISIBILITY_STYLES_SCRIPT}
|
|
5
|
+
`,A=c.TARGET==="react",f=(t,i,n)=>`window.${R}(${JSON.stringify(t)}, "${i}", ${A}${n?`, "${n}"`:""})`,h=(t,i,n)=>`window.${E}(${JSON.stringify(t)}, "${i}", ${A}${n?`, "${n}"`:""})`;exports.filterWithCustomTargeting=r.filterWithCustomTargeting;exports.DEFAULT_INDEX=u;exports.SDKS_REQUIRING_RESET_APPROACH=P;exports.SDKS_SUPPORTING_PERSONALIZATION=l;exports.checkShouldRenderVariants=d;exports.getBlocksToRender=$;exports.getInitPersonalizationVariantsFnsScriptString=O;exports.getPersonalizationScript=f;exports.getUpdateVisibilityStylesScript=h;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { TARGET as S } from "../../constants/target.mjs";
|
|
2
|
+
import { isBrowser as _ } from "../../functions/is-browser.mjs";
|
|
3
|
+
import { isEditing as E } from "../../functions/is-editing.mjs";
|
|
4
|
+
import { FILTER_WITH_CUSTOM_TARGETING_SCRIPT as f, PERSONALIZATION_SCRIPT as N, UPDATE_VISIBILITY_STYLES_SCRIPT as $ } from "./helpers/inlined-fns.mjs";
|
|
5
|
+
import { filterWithCustomTargeting as D } from "./helpers/inlined-fns.mjs";
|
|
6
|
+
const A = "default", P = "filterWithCustomTargeting", c = "builderIoPersonalization", u = "updateVisibilityStylesScript", p = ["react", "vue", "svelte", "qwik"], O = ["vue", "svelte", "qwik"];
|
|
7
|
+
function l(t, n) {
|
|
8
|
+
return !(t && t.length > 0) || !n ? !1 : O.includes(S) ? !0 : !_();
|
|
9
|
+
}
|
|
10
|
+
function C({
|
|
11
|
+
variants: t,
|
|
12
|
+
previewingIndex: n,
|
|
13
|
+
isHydrated: i,
|
|
14
|
+
filteredVariants: r,
|
|
15
|
+
fallbackBlocks: e
|
|
16
|
+
}) {
|
|
17
|
+
var I;
|
|
18
|
+
const T = {
|
|
19
|
+
blocks: e != null ? e : [],
|
|
20
|
+
path: "this.children",
|
|
21
|
+
index: A
|
|
22
|
+
};
|
|
23
|
+
if (i && E()) {
|
|
24
|
+
if (typeof n == "number" && n < ((I = t == null ? void 0 : t.length) != null ? I : 0)) {
|
|
25
|
+
const o = t == null ? void 0 : t[n];
|
|
26
|
+
if (o)
|
|
27
|
+
return {
|
|
28
|
+
blocks: o.blocks,
|
|
29
|
+
path: `variants.${n}.blocks`,
|
|
30
|
+
index: n
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return T;
|
|
34
|
+
}
|
|
35
|
+
if (_()) {
|
|
36
|
+
const o = r == null ? void 0 : r[0];
|
|
37
|
+
if (o && t) {
|
|
38
|
+
const s = t.indexOf(o);
|
|
39
|
+
if (s !== -1)
|
|
40
|
+
return {
|
|
41
|
+
blocks: o.blocks,
|
|
42
|
+
path: `variants.${s}.blocks`,
|
|
43
|
+
index: s
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return T;
|
|
48
|
+
}
|
|
49
|
+
const w = () => `
|
|
50
|
+
window.${P} = ${f}
|
|
51
|
+
window.${c} = ${N}
|
|
52
|
+
window.${u} = ${$}
|
|
53
|
+
`, R = S === "react", L = (t, n, i) => `window.${c}(${JSON.stringify(t)}, "${n}", ${R}${i ? `, "${i}"` : ""})`, U = (t, n, i) => `window.${u}(${JSON.stringify(t)}, "${n}", ${R}${i ? `, "${i}"` : ""})`;
|
|
54
|
+
export {
|
|
55
|
+
A as DEFAULT_INDEX,
|
|
56
|
+
O as SDKS_REQUIRING_RESET_APPROACH,
|
|
57
|
+
p as SDKS_SUPPORTING_PERSONALIZATION,
|
|
58
|
+
l as checkShouldRenderVariants,
|
|
59
|
+
D as filterWithCustomTargeting,
|
|
60
|
+
C as getBlocksToRender,
|
|
61
|
+
w as getInitPersonalizationVariantsFnsScriptString,
|
|
62
|
+
L as getPersonalizationScript,
|
|
63
|
+
U as getUpdateVisibilityStylesScript
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";const r=require("react/jsx-runtime"),a=require("react"),v=require("../../components/blocks/blocks.cjs"),C=require("../../components/inlined-script.cjs"),H=require("../../components/inlined-styles.cjs"),S=require("../../constants/target.cjs"),U=require("../../functions/get-class-prop-name.cjs"),L=require("../../functions/is-editing.cjs"),z=require("../../functions/is-previewing.cjs"),K=require("../../helpers/canTrack.cjs"),V=require("../../helpers/user-attributes.cjs"),s=require("./helpers.cjs"),Q=require("./helpers/inlined-fns.cjs");function X(e){var f,g,B,m,A,T,P,$,y,q,I,D,_;const c=a.useRef(null),[N,w]=a.useState(()=>V.userAttributesService.getUserAttributes()),[x,J]=a.useState(()=>{var t,n,i;return s.getPersonalizationScript(e.variants,((t=e.builderBlock)==null?void 0:t.id)||"none",(i=(n=e.builderContext)==null?void 0:n.rootState)==null?void 0:i.locale)}),[G,M]=a.useState(()=>{var t,n,i;return s.getUpdateVisibilityStylesScript(e.variants,((t=e.builderBlock)==null?void 0:t.id)||"none",(i=(n=e.builderContext)==null?void 0:n.rootState)==null?void 0:i.locale)}),[E,Y]=a.useState(()=>[]),[h,Z]=a.useState(()=>{var t;return s.checkShouldRenderVariants(e.variants,K.getDefaultCanTrack((t=e.builderContext)==null?void 0:t.canTrack))}),[k,W]=a.useState(()=>!1);function F(){return{...e.attributes,[U.getClassPropName()]:`builder-personalization-container ${e.attributes[U.getClassPropName()]||""}`}}function R(){return(e.variants||[]).filter(t=>{var n,i,o,l;return Q.filterWithCustomTargeting({...(i=(n=e.builderContext)==null?void 0:n.rootState)!=null&&i.locale?{locale:(l=(o=e.builderContext)==null?void 0:o.rootState)==null?void 0:l.locale}:{},...N},t.query,t.startDate,t.endDate)})}function u(){var t;return s.getBlocksToRender({variants:e.variants,fallbackBlocks:(t=e.builderBlock)==null?void 0:t.children,isHydrated:k,filteredVariants:R(),previewingIndex:e.previewingIndex})}function O(){return(e.variants||[]).map((t,n)=>{var i;return`div[data-variant-id="${(i=e.builderBlock)==null?void 0:i.id}-${n}"] { display: none !important; } `}).join("")}return a.useEffect(()=>{var n;W(!0);const t=V.userAttributesService.subscribeOnUserAttributesChange(i=>{w(i)},{fireImmediately:S.TARGET==="qwik"});if(!(L.isEditing()||z.isPreviewing())){const i=R()[0];c.current&&(c.current.dispatchEvent(new CustomEvent("builder.variantLoaded",{detail:{variant:i||s.DEFAULT_INDEX,content:(n=e.builderContext)==null?void 0:n.content},bubbles:!0})),new IntersectionObserver(l=>{l.forEach(b=>{var d;b.isIntersecting&&c.current&&c.current.dispatchEvent(new CustomEvent("builder.variantDisplayed",{detail:{variant:i||s.DEFAULT_INDEX,content:(d=e.builderContext)==null?void 0:d.content},bubbles:!0}))})}).observe(c.current))}E.push(t)},[]),a.useEffect(()=>()=>{E.forEach(t=>t())},[]),r.jsxs("div",{ref:c,...F(),children:[k&&s.SDKS_REQUIRING_RESET_APPROACH.includes(S.TARGET)?r.jsx(v,{blocks:u().blocks,parent:(f=e.builderBlock)==null?void 0:f.id,path:u().path,context:e.builderContext,registeredComponents:e.builderComponents,BlocksWrapperProps:{...(g=e.builderContext)==null?void 0:g.BlocksWrapperProps,"data-variant-id":`${(B=e.builderBlock)==null?void 0:B.id}-${u().index}`}}):null,!k&&s.SDKS_REQUIRING_RESET_APPROACH.includes(S.TARGET)||!s.SDKS_REQUIRING_RESET_APPROACH.includes(S.TARGET)?r.jsxs(r.Fragment,{children:[h?r.jsxs(r.Fragment,{children:[r.jsx(H,{nonce:((m=e.builderContext)==null?void 0:m.nonce)||"",styles:O(),id:`variants-styles-${(A=e.builderBlock)==null?void 0:A.id}`}),r.jsx(C,{nonce:((T=e.builderContext)==null?void 0:T.nonce)||"",scriptStr:G,id:`variants-visibility-script-${(P=e.builderBlock)==null?void 0:P.id}`}),($=e.variants)==null?void 0:$.map((t,n)=>{var i,o,l,b,d,j;return r.jsx(v,{BlocksWrapperProps:{...(i=e.builderContext)==null?void 0:i.BlocksWrapperProps,"aria-hidden":!0,hidden:!0,"data-variant-id":`${(o=e.builderBlock)==null?void 0:o.id}-${n}`},blocks:t.blocks,parent:(l=e.builderBlock)==null?void 0:l.id,path:`component.options.variants.${n}.blocks`,context:e.builderContext,registeredComponents:e.builderComponents,children:r.jsx(C,{nonce:((b=e.builderContext)==null?void 0:b.nonce)||"",scriptStr:x,id:`variants-script-${(d=e.builderBlock)==null?void 0:d.id}-${n}`})},`${(j=e.builderBlock)==null?void 0:j.id}-${n}`)})]}):null,r.jsx(v,{blocks:u().blocks,parent:(y=e.builderBlock)==null?void 0:y.id,path:u().path,context:e.builderContext,registeredComponents:e.builderComponents,BlocksWrapperProps:{...(q=e.builderContext)==null?void 0:q.BlocksWrapperProps,"data-variant-id":`${(I=e.builderBlock)==null?void 0:I.id}-${u().index}`},children:h?r.jsx(C,{nonce:((D=e.builderContext)==null?void 0:D.nonce)||"",scriptStr:x,id:`variants-script-${(_=e.builderBlock)==null?void 0:_.id}-${s.DEFAULT_INDEX}`}):null})]}):null]})}module.exports=X;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as f, jsx as l, Fragment as j } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as Q, useState as c, useEffect as z } from "react";
|
|
4
|
+
import k from "../../components/blocks/blocks.mjs";
|
|
5
|
+
import v from "../../components/inlined-script.mjs";
|
|
6
|
+
import X from "../../components/inlined-styles.mjs";
|
|
7
|
+
import { TARGET as b } from "../../constants/target.mjs";
|
|
8
|
+
import { getClassPropName as N } from "../../functions/get-class-prop-name.mjs";
|
|
9
|
+
import { isEditing as J } from "../../functions/is-editing.mjs";
|
|
10
|
+
import { isPreviewing as M } from "../../functions/is-previewing.mjs";
|
|
11
|
+
import { getDefaultCanTrack as Y } from "../../helpers/canTrack.mjs";
|
|
12
|
+
import { userAttributesService as O } from "../../helpers/user-attributes.mjs";
|
|
13
|
+
import { getPersonalizationScript as Z, getUpdateVisibilityStylesScript as p, checkShouldRenderVariants as tt, DEFAULT_INDEX as C, SDKS_REQUIRING_RESET_APPROACH as h, getBlocksToRender as et } from "./helpers.mjs";
|
|
14
|
+
import { filterWithCustomTargeting as it } from "./helpers/inlined-fns.mjs";
|
|
15
|
+
function xt(t) {
|
|
16
|
+
var $, y, E, R, P, V, I, A, T, U, w, D, W;
|
|
17
|
+
const a = Q(null), [q, F] = c(
|
|
18
|
+
() => O.getUserAttributes()
|
|
19
|
+
), [S, nt] = c(
|
|
20
|
+
() => {
|
|
21
|
+
var e, n, i;
|
|
22
|
+
return Z(
|
|
23
|
+
t.variants,
|
|
24
|
+
((e = t.builderBlock) == null ? void 0 : e.id) || "none",
|
|
25
|
+
(i = (n = t.builderContext) == null ? void 0 : n.rootState) == null ? void 0 : i.locale
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
), [G, rt] = c(
|
|
29
|
+
() => {
|
|
30
|
+
var e, n, i;
|
|
31
|
+
return p(
|
|
32
|
+
t.variants,
|
|
33
|
+
((e = t.builderBlock) == null ? void 0 : e.id) || "none",
|
|
34
|
+
(i = (n = t.builderContext) == null ? void 0 : n.rootState) == null ? void 0 : i.locale
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
), [x, lt] = c(() => []), [B, at] = c(
|
|
38
|
+
() => {
|
|
39
|
+
var e;
|
|
40
|
+
return tt(
|
|
41
|
+
t.variants,
|
|
42
|
+
Y((e = t.builderContext) == null ? void 0 : e.canTrack)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
), [m, H] = c(() => !1);
|
|
46
|
+
function L() {
|
|
47
|
+
return {
|
|
48
|
+
...t.attributes,
|
|
49
|
+
[N()]: `builder-personalization-container ${t.attributes[N()] || ""}`
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function g() {
|
|
53
|
+
return (t.variants || []).filter((e) => {
|
|
54
|
+
var n, i, d, r;
|
|
55
|
+
return it(
|
|
56
|
+
{
|
|
57
|
+
...(i = (n = t.builderContext) == null ? void 0 : n.rootState) != null && i.locale ? {
|
|
58
|
+
locale: (r = (d = t.builderContext) == null ? void 0 : d.rootState) == null ? void 0 : r.locale
|
|
59
|
+
} : {},
|
|
60
|
+
...q
|
|
61
|
+
},
|
|
62
|
+
e.query,
|
|
63
|
+
e.startDate,
|
|
64
|
+
e.endDate
|
|
65
|
+
);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function o() {
|
|
69
|
+
var e;
|
|
70
|
+
return et({
|
|
71
|
+
variants: t.variants,
|
|
72
|
+
fallbackBlocks: (e = t.builderBlock) == null ? void 0 : e.children,
|
|
73
|
+
isHydrated: m,
|
|
74
|
+
filteredVariants: g(),
|
|
75
|
+
previewingIndex: t.previewingIndex
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function K() {
|
|
79
|
+
return (t.variants || []).map(
|
|
80
|
+
(e, n) => {
|
|
81
|
+
var i;
|
|
82
|
+
return `div[data-variant-id="${(i = t.builderBlock) == null ? void 0 : i.id}-${n}"] { display: none !important; } `;
|
|
83
|
+
}
|
|
84
|
+
).join("");
|
|
85
|
+
}
|
|
86
|
+
return z(() => {
|
|
87
|
+
var n;
|
|
88
|
+
H(!0);
|
|
89
|
+
const e = O.subscribeOnUserAttributesChange(
|
|
90
|
+
(i) => {
|
|
91
|
+
F(i);
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
fireImmediately: b === "qwik"
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
if (!(J() || M())) {
|
|
98
|
+
const i = g()[0];
|
|
99
|
+
a.current && (a.current.dispatchEvent(
|
|
100
|
+
new CustomEvent("builder.variantLoaded", {
|
|
101
|
+
detail: {
|
|
102
|
+
variant: i || C,
|
|
103
|
+
content: (n = t.builderContext) == null ? void 0 : n.content
|
|
104
|
+
},
|
|
105
|
+
bubbles: !0
|
|
106
|
+
})
|
|
107
|
+
), new IntersectionObserver((r) => {
|
|
108
|
+
r.forEach((u) => {
|
|
109
|
+
var s;
|
|
110
|
+
u.isIntersecting && a.current && a.current.dispatchEvent(
|
|
111
|
+
new CustomEvent("builder.variantDisplayed", {
|
|
112
|
+
detail: {
|
|
113
|
+
variant: i || C,
|
|
114
|
+
content: (s = t.builderContext) == null ? void 0 : s.content
|
|
115
|
+
},
|
|
116
|
+
bubbles: !0
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
});
|
|
120
|
+
}).observe(a.current));
|
|
121
|
+
}
|
|
122
|
+
x.push(e);
|
|
123
|
+
}, []), z(() => () => {
|
|
124
|
+
x.forEach((e) => e());
|
|
125
|
+
}, []), /* @__PURE__ */ f("div", { ref: a, ...L(), children: [
|
|
126
|
+
m && h.includes(b) ? /* @__PURE__ */ l(
|
|
127
|
+
k,
|
|
128
|
+
{
|
|
129
|
+
blocks: o().blocks,
|
|
130
|
+
parent: ($ = t.builderBlock) == null ? void 0 : $.id,
|
|
131
|
+
path: o().path,
|
|
132
|
+
context: t.builderContext,
|
|
133
|
+
registeredComponents: t.builderComponents,
|
|
134
|
+
BlocksWrapperProps: {
|
|
135
|
+
...(y = t.builderContext) == null ? void 0 : y.BlocksWrapperProps,
|
|
136
|
+
"data-variant-id": `${(E = t.builderBlock) == null ? void 0 : E.id}-${o().index}`
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
) : null,
|
|
140
|
+
!m && h.includes(b) || !h.includes(b) ? /* @__PURE__ */ f(j, { children: [
|
|
141
|
+
B ? /* @__PURE__ */ f(j, { children: [
|
|
142
|
+
/* @__PURE__ */ l(
|
|
143
|
+
X,
|
|
144
|
+
{
|
|
145
|
+
nonce: ((R = t.builderContext) == null ? void 0 : R.nonce) || "",
|
|
146
|
+
styles: K(),
|
|
147
|
+
id: `variants-styles-${(P = t.builderBlock) == null ? void 0 : P.id}`
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ l(
|
|
151
|
+
v,
|
|
152
|
+
{
|
|
153
|
+
nonce: ((V = t.builderContext) == null ? void 0 : V.nonce) || "",
|
|
154
|
+
scriptStr: G,
|
|
155
|
+
id: `variants-visibility-script-${(I = t.builderBlock) == null ? void 0 : I.id}`
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
(A = t.variants) == null ? void 0 : A.map((e, n) => {
|
|
159
|
+
var i, d, r, u, s, _;
|
|
160
|
+
return /* @__PURE__ */ l(
|
|
161
|
+
k,
|
|
162
|
+
{
|
|
163
|
+
BlocksWrapperProps: {
|
|
164
|
+
...(i = t.builderContext) == null ? void 0 : i.BlocksWrapperProps,
|
|
165
|
+
"aria-hidden": !0,
|
|
166
|
+
hidden: !0,
|
|
167
|
+
"data-variant-id": `${(d = t.builderBlock) == null ? void 0 : d.id}-${n}`
|
|
168
|
+
},
|
|
169
|
+
blocks: e.blocks,
|
|
170
|
+
parent: (r = t.builderBlock) == null ? void 0 : r.id,
|
|
171
|
+
path: `component.options.variants.${n}.blocks`,
|
|
172
|
+
context: t.builderContext,
|
|
173
|
+
registeredComponents: t.builderComponents,
|
|
174
|
+
children: /* @__PURE__ */ l(
|
|
175
|
+
v,
|
|
176
|
+
{
|
|
177
|
+
nonce: ((u = t.builderContext) == null ? void 0 : u.nonce) || "",
|
|
178
|
+
scriptStr: S,
|
|
179
|
+
id: `variants-script-${(s = t.builderBlock) == null ? void 0 : s.id}-${n}`
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
},
|
|
183
|
+
`${(_ = t.builderBlock) == null ? void 0 : _.id}-${n}`
|
|
184
|
+
);
|
|
185
|
+
})
|
|
186
|
+
] }) : null,
|
|
187
|
+
/* @__PURE__ */ l(
|
|
188
|
+
k,
|
|
189
|
+
{
|
|
190
|
+
blocks: o().blocks,
|
|
191
|
+
parent: (T = t.builderBlock) == null ? void 0 : T.id,
|
|
192
|
+
path: o().path,
|
|
193
|
+
context: t.builderContext,
|
|
194
|
+
registeredComponents: t.builderComponents,
|
|
195
|
+
BlocksWrapperProps: {
|
|
196
|
+
...(U = t.builderContext) == null ? void 0 : U.BlocksWrapperProps,
|
|
197
|
+
"data-variant-id": `${(w = t.builderBlock) == null ? void 0 : w.id}-${o().index}`
|
|
198
|
+
},
|
|
199
|
+
children: B ? /* @__PURE__ */ l(
|
|
200
|
+
v,
|
|
201
|
+
{
|
|
202
|
+
nonce: ((D = t.builderContext) == null ? void 0 : D.nonce) || "",
|
|
203
|
+
scriptStr: S,
|
|
204
|
+
id: `variants-script-${(W = t.builderBlock) == null ? void 0 : W.id}-${C}`
|
|
205
|
+
}
|
|
206
|
+
) : null
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] }) : null
|
|
210
|
+
] });
|
|
211
|
+
}
|
|
212
|
+
export {
|
|
213
|
+
xt as default
|
|
214
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),x=require("../../components/content-variants/content-variants.cjs"),k=require("../../functions/get-class-prop-name.cjs"),f=require("./symbol.helpers.cjs");async function v(e){var n,i,l,o,a,c,r;const m=function(){return"div"},y=function(){return"div"},C=function(){var s,u;return[e.attributes[k.getClassPropName()],"builder-symbol",(s=e.symbol)!=null&&s.inline?"builder-inline-symbol":void 0,(u=e.symbol)!=null&&u.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},t=((n=e.symbol)==null?void 0:n.content)||await f.fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext});return(i=e.symbol)==null||i.entry,d.jsx("div",{...e.attributes,className:C(),children:d.jsx(x,{nonce:e.builderContext.nonce,isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(l=e.builderBlock)==null?void 0:l.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.data,...e.builderContext.localState,...(a=t==null?void 0:t.data)==null?void 0:a.state},canTrack:e.builderContext.canTrack,model:(r=(c=e.symbol)==null?void 0:c.model)!=null?r:"",content:t,linkComponent:e.builderLinkComponent,blocksWrapper:m(),contentWrapper:y()})})}module.exports=v;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getClassPropName as
|
|
4
|
-
import { fetchSymbolContent as
|
|
5
|
-
async function
|
|
6
|
-
var n, o, i, l, a, r;
|
|
7
|
-
const
|
|
8
|
-
return "div";
|
|
9
|
-
}, s = function() {
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import x from "../../components/content-variants/content-variants.mjs";
|
|
3
|
+
import { getClassPropName as f } from "../../functions/get-class-prop-name.mjs";
|
|
4
|
+
import { fetchSymbolContent as k } from "./symbol.helpers.mjs";
|
|
5
|
+
async function j(e) {
|
|
6
|
+
var n, o, i, l, a, r, c;
|
|
7
|
+
const s = function() {
|
|
10
8
|
return "div";
|
|
11
9
|
}, y = function() {
|
|
12
|
-
|
|
10
|
+
return "div";
|
|
11
|
+
}, C = function() {
|
|
12
|
+
var b, d;
|
|
13
13
|
return [
|
|
14
|
-
e.attributes[
|
|
14
|
+
e.attributes[f()],
|
|
15
15
|
"builder-symbol",
|
|
16
|
-
(
|
|
17
|
-
(
|
|
16
|
+
(b = e.symbol) != null && b.inline ? "builder-inline-symbol" : void 0,
|
|
17
|
+
(d = e.symbol) != null && d.dynamic || e.dynamic ? "builder-dynamic-symbol" : void 0
|
|
18
18
|
].filter(Boolean).join(" ");
|
|
19
|
-
}, t = ((n = e.symbol) == null ? void 0 : n.content) || await
|
|
19
|
+
}, t = ((n = e.symbol) == null ? void 0 : n.content) || await k({
|
|
20
20
|
symbol: e.symbol,
|
|
21
21
|
builderContextValue: e.builderContext
|
|
22
22
|
});
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
23
|
+
return (o = e.symbol) == null || o.entry, /* @__PURE__ */ u("div", { ...e.attributes, className: C(), children: /* @__PURE__ */ u(
|
|
24
|
+
x,
|
|
25
25
|
{
|
|
26
26
|
nonce: e.builderContext.nonce,
|
|
27
27
|
isNestedRender: !0,
|
|
@@ -29,23 +29,23 @@ async function V(e) {
|
|
|
29
29
|
apiKey: e.builderContext.apiKey,
|
|
30
30
|
context: {
|
|
31
31
|
...e.builderContext.context,
|
|
32
|
-
symbolId: (
|
|
32
|
+
symbolId: (i = e.builderBlock) == null ? void 0 : i.id
|
|
33
33
|
},
|
|
34
34
|
customComponents: Object.values(e.builderComponents),
|
|
35
35
|
data: {
|
|
36
|
-
...(
|
|
36
|
+
...(l = e.symbol) == null ? void 0 : l.data,
|
|
37
37
|
...e.builderContext.localState,
|
|
38
|
-
...(
|
|
38
|
+
...(a = t == null ? void 0 : t.data) == null ? void 0 : a.state
|
|
39
39
|
},
|
|
40
40
|
canTrack: e.builderContext.canTrack,
|
|
41
|
-
model: (
|
|
41
|
+
model: (c = (r = e.symbol) == null ? void 0 : r.model) != null ? c : "",
|
|
42
42
|
content: t,
|
|
43
43
|
linkComponent: e.builderLinkComponent,
|
|
44
|
-
blocksWrapper:
|
|
45
|
-
contentWrapper:
|
|
44
|
+
blocksWrapper: s(),
|
|
45
|
+
contentWrapper: y()
|
|
46
46
|
}
|
|
47
47
|
) });
|
|
48
48
|
}
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
j as default
|
|
51
51
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),v=require("../../constants/target.cjs"),S=require("../../functions/get-block-component-options.cjs"),j=require("../../functions/get-processed-block.cjs"),P=require("../../functions/is-previewing.cjs");require("../../functions/get-fetch.cjs");const d=require("./block.helpers.cjs"),q=require("./components/block-styles.cjs"),O=require("./components/block-wrapper.cjs"),h=require("./components/component-ref/component-ref.cjs"),p=require("./components/repeated-block.cjs");function b(e){var a,C,x,g;const m=function(){return d.getRepeatItemData({block:e.block,context:e.context})},u={value:null,update:!1},c=function(){var i;if(u.value&&!u.update&&!P.isPreviewing())return u.value;const r=(i=e.block.repeat)!=null&&i.collection?e.block:j.getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context});return u.value=r,u.update=!1,r},l=function(){return d.getComponent({block:c(),registeredComponents:e.registeredComponents,model:e.context.model})},f=function(){var i;return e.block.tagName==="a"||((i=c().properties)==null?void 0:i.href)||c().href?e.linkComponent||"a":e.block.tagName||"div"},B=function(){var s,k;if((s=e.block.repeat)!=null&&s.collection)return!!((k=m())!=null&&k.length);const r="hide"in c()?c().hide:!1;return("show"in c()?c().show:!0)&&!r},R=function(){var i,s;return!((i=l())!=null&&i.component)&&!m()?(s=c().children)!=null?s:[]:[]},n=function(){var r,i,s,k;return{blockChildren:(r=c().children)!=null?r:[],componentRef:(i=l())==null?void 0:i.component,componentOptions:{...S.getBlockComponentOptions(c(),e.context),...d.provideBuilderBlock(l(),c()),...d.provideBuilderContext(l(),e.context),...d.provideLinkComponent(l(),e.linkComponent),...d.provideRegisteredComponents(l(),e.registeredComponents,e.context.model)},context:e.context,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:c(),includeBlockProps:((s=l())==null?void 0:s.noWrap)===!0,isInteractive:!((k=l())!=null&&k.isRSC&&v.TARGET==="rsc")}};return t.jsx(t.Fragment,{children:B()?t.jsxs(t.Fragment,{children:[t.jsx(q,{block:c(),context:e.context}),(a=l())!=null&&a.noWrap?m()?t.jsx(t.Fragment,{children:(g=m())==null?void 0:g.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsx(h,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}):t.jsx(t.Fragment,{children:m()?t.jsx(t.Fragment,{children:(x=m())==null?void 0:x.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsxs(O,{Wrapper:f(),block:c(),context:e.context,children:[t.jsx(h,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}),(C=R())==null?void 0:C.map(o=>t.jsx(b,{block:o,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent,context:e.context},o.id))]})})]}):null})}module.exports=b;
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),v=require("../../constants/target.cjs"),S=require("../../functions/get-block-component-options.cjs"),j=require("../../functions/get-processed-block.cjs"),P=require("../../functions/is-previewing.cjs");require("../../helpers/user-attributes.cjs");require("../../functions/get-fetch.cjs");const d=require("./block.helpers.cjs"),q=require("./components/block-styles.cjs"),O=require("./components/block-wrapper.cjs"),h=require("./components/component-ref/component-ref.cjs"),p=require("./components/repeated-block.cjs");function b(e){var a,C,x,g;const m=function(){return d.getRepeatItemData({block:e.block,context:e.context})},u={value:null,update:!1},c=function(){var i;if(u.value&&!u.update&&!P.isPreviewing())return u.value;const r=(i=e.block.repeat)!=null&&i.collection?e.block:j.getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context});return u.value=r,u.update=!1,r},l=function(){return d.getComponent({block:c(),registeredComponents:e.registeredComponents,model:e.context.model})},f=function(){var i;return e.block.tagName==="a"||((i=c().properties)==null?void 0:i.href)||c().href?e.linkComponent||"a":e.block.tagName||"div"},B=function(){var s,k;if((s=e.block.repeat)!=null&&s.collection)return!!((k=m())!=null&&k.length);const r="hide"in c()?c().hide:!1;return("show"in c()?c().show:!0)&&!r},R=function(){var i,s;return!((i=l())!=null&&i.component)&&!m()?(s=c().children)!=null?s:[]:[]},n=function(){var r,i,s,k;return{blockChildren:(r=c().children)!=null?r:[],componentRef:(i=l())==null?void 0:i.component,componentOptions:{...S.getBlockComponentOptions(c(),e.context),...d.provideBuilderBlock(l(),c()),...d.provideBuilderContext(l(),e.context),...d.provideLinkComponent(l(),e.linkComponent),...d.provideRegisteredComponents(l(),e.registeredComponents,e.context.model)},context:e.context,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:c(),includeBlockProps:((s=l())==null?void 0:s.noWrap)===!0,isInteractive:!((k=l())!=null&&k.isRSC&&v.TARGET==="rsc")}};return t.jsx(t.Fragment,{children:B()?t.jsxs(t.Fragment,{children:[t.jsx(q,{block:c(),context:e.context}),(a=l())!=null&&a.noWrap?m()?t.jsx(t.Fragment,{children:(g=m())==null?void 0:g.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsx(h,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}):t.jsx(t.Fragment,{children:m()?t.jsx(t.Fragment,{children:(x=m())==null?void 0:x.map((o,r)=>t.jsx(p,{repeatContext:o.context,block:o.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},d.generateKey(r)))}):t.jsxs(O,{Wrapper:f(),block:c(),context:e.context,children:[t.jsx(h,{componentRef:n().componentRef,componentOptions:n().componentOptions,blockChildren:n().blockChildren,context:n().context,registeredComponents:n().registeredComponents,linkComponent:n().linkComponent,builderBlock:n().builderBlock,includeBlockProps:n().includeBlockProps,isInteractive:n().isInteractive}),(C=R())==null?void 0:C.map(o=>t.jsx(b,{block:o,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent,context:e.context},o.id))]})})]}):null})}module.exports=b;
|
|
@@ -3,6 +3,7 @@ import { TARGET as S } from "../../constants/target.mjs";
|
|
|
3
3
|
import { getBlockComponentOptions as P } from "../../functions/get-block-component-options.mjs";
|
|
4
4
|
import { getProcessedBlock as I } from "../../functions/get-processed-block.mjs";
|
|
5
5
|
import { isPreviewing as O } from "../../functions/is-previewing.mjs";
|
|
6
|
+
import "../../helpers/user-attributes.mjs";
|
|
6
7
|
import "../../functions/get-fetch.mjs";
|
|
7
8
|
import { generateKey as x, getRepeatItemData as w, getComponent as W, provideBuilderBlock as T, provideBuilderContext as L, provideLinkComponent as U, provideRegisteredComponents as j } from "./block.helpers.mjs";
|
|
8
9
|
import y from "./components/block-styles.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";const e=require("react/jsx-runtime"),o=require("react"),l=require("../../../functions/get-block-actions.cjs"),i=require("../../../functions/get-block-properties.cjs"),u=require("../../awaiter.cjs");function x(t){var r,n;o.useState(()=>0);function c(){return t.includeBlockProps?{...i.getBlockProperties({block:t.block,context:t.context}),...l.getBlockActions({block:t.block,rootState:t.context.rootState,rootSetState:t.context.rootSetState,localState:t.context.localState,context:t.context.context})}:{}}function a(){return t.wrapperProps}return o.useEffect(()=>{},[t.wrapperProps,(n=(r=t.block)==null?void 0:r.component)==null?void 0:n.options]),e.jsx(e.Fragment,{children:t.Wrapper.load?e.jsx(e.Fragment,{children:e.jsx(u,{load:t.Wrapper.load,fallback:t.Wrapper.fallback,props:t.wrapperProps,attributes:c(),children:t.children})}):e.jsx(t.Wrapper,{...a(),attributes:c(),children:t.children})})}module.exports=x;
|