@builder.io/sdk-react 1.0.24 → 1.0.26
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-exports.cjs +9 -9
- package/lib/browser/blocks-exports.mjs +75 -75
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/init.cjs +8 -1
- package/lib/browser/init.mjs +38 -2
- package/lib/browser/{server-entry-a540d463.cjs → server-entry-298501b1.cjs} +2 -2
- package/lib/browser/{server-entry-85d7f359.js → server-entry-c522a38f.js} +2 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{blocks-e6873db2.js → blocks-612eb41b.js} +140 -140
- package/lib/edge/{blocks-59950370.cjs → blocks-77e27834.cjs} +11 -11
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-8a6ae666.js → button-70b2e3a9.js} +2 -2
- package/lib/edge/{button-aff4f652.cjs → button-956ab5bc.cjs} +1 -1
- package/lib/edge/{columns-0768e506.js → columns-623de7ba.js} +3 -3
- package/lib/edge/{columns-8dca796d.cjs → columns-9ed7dfeb.cjs} +1 -1
- package/lib/edge/{content-variants-c8061bc0.js → content-variants-059e455f.js} +9 -9
- package/lib/edge/{content-variants-e79859ac.cjs → content-variants-eca40007.cjs} +1 -1
- package/lib/edge/{form-e6847833.cjs → form-5c01a94c.cjs} +1 -1
- package/lib/edge/{form-c3d12c27.js → form-a1e588d6.js} +3 -3
- package/lib/edge/{get-class-prop-name-a966a097.cjs → get-class-prop-name-65450a8e.cjs} +1 -1
- package/lib/edge/{get-class-prop-name-a023381f.js → get-class-prop-name-bee742f6.js} +1 -1
- package/lib/edge/{img-03949fec.js → img-79534c61.js} +1 -1
- package/lib/edge/{img-1431a6ab.cjs → img-d8259a3f.cjs} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/init.cjs +8 -1
- package/lib/edge/init.mjs +38 -2
- package/lib/edge/{input-f611f26d.js → input-5b9458cd.js} +1 -1
- package/lib/edge/{input-f420d17a.cjs → input-d9a6232c.cjs} +1 -1
- package/lib/edge/{select-e056d1d3.js → select-1b1b666f.js} +1 -1
- package/lib/edge/{select-aadf10db.cjs → select-fd3daca2.cjs} +1 -1
- package/lib/edge/{server-entry-95f97e05.cjs → server-entry-2f25c4ff.cjs} +2 -2
- package/lib/edge/{server-entry-bbf65248.js → server-entry-5a6eeaf9.js} +2 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-3ed45869.cjs → slot-0f591294.cjs} +1 -1
- package/lib/edge/{slot-2f6f1817.js → slot-7cd830aa.js} +3 -3
- package/lib/edge/{symbol-c9d45cc8.cjs → symbol-0eff91f7.cjs} +1 -1
- package/lib/edge/{symbol-853c210f.js → symbol-1bd5d636.js} +2 -2
- package/lib/edge/{tabs-34a12e52.cjs → tabs-784ddfd3.cjs} +1 -1
- package/lib/edge/{tabs-28d0f021.js → tabs-fd103011.js} +3 -3
- package/lib/node/blocks-exports.cjs +9 -9
- package/lib/node/blocks-exports.mjs +167 -167
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +2 -2
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +9 -6
- package/lib/node/node-runtime-72de67f1.cjs +48 -0
- package/lib/node/{node-runtime-071b85f9.js → node-runtime-8a7cc42d.js} +49 -47
- package/lib/node/{server-entry-fd29e8b4.js → server-entry-262852ac.js} +1 -1
- package/lib/node/{server-entry-b5031981.cjs → server-entry-e9d5a539.cjs} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/components/block/block.helpers.d.ts +4 -4
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/node-runtime/init.d.ts +4 -1
- package/types/functions/evaluate/node-runtime/node-runtime.d.ts +4 -1
- package/lib/node/node-runtime-41e3da8e.cjs +0 -48
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
var Ue = Object.defineProperty;
|
|
3
3
|
var je = (e, t, n) => t in e ? Ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
4
|
var ne = (e, t, n) => (je(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
5
|
-
import { jsx as s, Fragment as
|
|
6
|
-
import { TARGET as z, isEditing as F, isBrowser as j, getUserAttributes as He, checkIsDefined as G, logger as Z, fastClone as le, registerInsertMenu as Ke, setupBrowserForEditing as qe, createRegisterComponentMessage as ze, getDefaultCanTrack as Q, _track as me, isPreviewing as _e, fetchOneEntry as Ce, createEditorListener as Je, fetch as Ye, serializeComponentInfo as fe, handleABTestingSync as Ge } from "./server-entry-
|
|
5
|
+
import { jsx as s, Fragment as w, jsxs as V } from "react/jsx-runtime";
|
|
6
|
+
import { TARGET as z, isEditing as F, isBrowser as j, getUserAttributes as He, checkIsDefined as G, logger as Z, fastClone as le, registerInsertMenu as Ke, setupBrowserForEditing as qe, createRegisterComponentMessage as ze, getDefaultCanTrack as Q, _track as me, isPreviewing as _e, fetchOneEntry as Ce, createEditorListener as Je, fetch as Ye, serializeComponentInfo as fe, handleABTestingSync as Ge } from "./server-entry-c522a38f.js";
|
|
7
7
|
import { createContext as Te, useState as C, useEffect as P, useContext as he, useRef as ee, createElement as we } from "react";
|
|
8
8
|
const Qe = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]), Xe = (e) => typeof e == "string" && Qe.has(e.toLowerCase());
|
|
9
9
|
function se(e) {
|
|
10
|
-
return /* @__PURE__ */ s(
|
|
10
|
+
return /* @__PURE__ */ s(w, { children: Xe(e.TagName) ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ s(w, { children: typeof e.TagName == "string" ? /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ s(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
11
11
|
}
|
|
12
12
|
const K = () => {
|
|
13
13
|
switch (z) {
|
|
@@ -461,7 +461,7 @@ const bt = ({
|
|
|
461
461
|
},
|
|
462
462
|
block: i
|
|
463
463
|
}));
|
|
464
|
-
}, pt = (e) => e && ["Core:Button", "Symbol", "Columns", "Form:Form", "Builder: Tabs"].includes(e), xt = (e) => e && ["Symbol", "Columns", "Form:Form", "Builder: Tabs"].includes(e), Ne = {
|
|
464
|
+
}, pt = (e) => e && (e.isRSC || ["Core:Button", "Symbol", "Columns", "Form:Form", "Builder: Tabs"].includes(e.name)), xt = (e) => e && (e.isRSC || ["Symbol", "Columns", "Form:Form", "Builder: Tabs"].includes(e.name)), Ne = {
|
|
465
465
|
small: {
|
|
466
466
|
min: 320,
|
|
467
467
|
default: 321,
|
|
@@ -526,7 +526,7 @@ function St(e) {
|
|
|
526
526
|
return G(i.hide) ? !i.hide : G(i.show) ? i.show : !0;
|
|
527
527
|
}
|
|
528
528
|
function n() {
|
|
529
|
-
var
|
|
529
|
+
var E, R, A;
|
|
530
530
|
const i = X({
|
|
531
531
|
block: e.block,
|
|
532
532
|
localState: e.context.localState,
|
|
@@ -535,7 +535,7 @@ function St(e) {
|
|
|
535
535
|
context: e.context.context,
|
|
536
536
|
shouldEvaluateBindings: !0
|
|
537
537
|
}), o = i.responsiveStyles, a = e.context.content, r = $e(
|
|
538
|
-
((
|
|
538
|
+
((E = a == null ? void 0 : a.meta) == null ? void 0 : E.breakpoints) || {}
|
|
539
539
|
), l = o == null ? void 0 : o.large, c = o == null ? void 0 : o.medium, d = o == null ? void 0 : o.small, m = i.id;
|
|
540
540
|
if (!m)
|
|
541
541
|
return "";
|
|
@@ -557,10 +557,10 @@ function St(e) {
|
|
|
557
557
|
r
|
|
558
558
|
)
|
|
559
559
|
}) : "", S = i.animations && i.animations.find((W) => W.trigger === "hover");
|
|
560
|
-
let
|
|
560
|
+
let I = "";
|
|
561
561
|
if (S) {
|
|
562
562
|
const W = ((A = (R = S.steps) == null ? void 0 : R[1]) == null ? void 0 : A.styles) || {};
|
|
563
|
-
|
|
563
|
+
I = J({
|
|
564
564
|
className: `${m}:hover`,
|
|
565
565
|
styles: {
|
|
566
566
|
...W,
|
|
@@ -575,10 +575,10 @@ function St(e) {
|
|
|
575
575
|
u,
|
|
576
576
|
g,
|
|
577
577
|
y,
|
|
578
|
-
|
|
578
|
+
I
|
|
579
579
|
].join(" ");
|
|
580
580
|
}
|
|
581
|
-
return /* @__PURE__ */ s(
|
|
581
|
+
return /* @__PURE__ */ s(w, { children: n() && t() ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(te, { id: "builderio-block", styles: n() }) }) : null });
|
|
582
582
|
}
|
|
583
583
|
function vt(e) {
|
|
584
584
|
return e.charAt(0).toUpperCase() + e.slice(1);
|
|
@@ -717,7 +717,7 @@ function ye(e) {
|
|
|
717
717
|
const [t, n] = C(
|
|
718
718
|
() => e.isInteractive ? Et : e.componentRef
|
|
719
719
|
);
|
|
720
|
-
return /* @__PURE__ */ s(
|
|
720
|
+
return /* @__PURE__ */ s(w, { children: e.componentRef ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(
|
|
721
721
|
t,
|
|
722
722
|
{
|
|
723
723
|
...Rt({
|
|
@@ -797,17 +797,17 @@ function _(e) {
|
|
|
797
797
|
return !((g = t == null ? void 0 : t()) != null && g.component) && !n() ? (y = i().children) != null ? y : [] : [];
|
|
798
798
|
}
|
|
799
799
|
function l() {
|
|
800
|
-
var u, g, y, S
|
|
800
|
+
var u, g, y, S;
|
|
801
801
|
return {
|
|
802
802
|
blockChildren: (u = i().children) != null ? u : [],
|
|
803
803
|
componentRef: (g = t == null ? void 0 : t()) == null ? void 0 : g.component,
|
|
804
804
|
componentOptions: {
|
|
805
805
|
...et(i()),
|
|
806
806
|
builderContext: e.context,
|
|
807
|
-
...pt(
|
|
807
|
+
...pt(t()) ? {
|
|
808
808
|
builderLinkComponent: e.linkComponent
|
|
809
809
|
} : {},
|
|
810
|
-
...xt(
|
|
810
|
+
...xt(t()) ? {
|
|
811
811
|
builderComponents: e.registeredComponents
|
|
812
812
|
} : {}
|
|
813
813
|
},
|
|
@@ -815,8 +815,8 @@ function _(e) {
|
|
|
815
815
|
linkComponent: e.linkComponent,
|
|
816
816
|
registeredComponents: e.registeredComponents,
|
|
817
817
|
builderBlock: i(),
|
|
818
|
-
includeBlockProps: ((
|
|
819
|
-
isInteractive: !((
|
|
818
|
+
includeBlockProps: ((y = t == null ? void 0 : t()) == null ? void 0 : y.noWrap) === !0,
|
|
819
|
+
isInteractive: !((S = t == null ? void 0 : t()) != null && S.isRSC)
|
|
820
820
|
};
|
|
821
821
|
}
|
|
822
822
|
return P(() => {
|
|
@@ -827,9 +827,9 @@ function _(e) {
|
|
|
827
827
|
elementId: u
|
|
828
828
|
}))
|
|
829
829
|
);
|
|
830
|
-
}, []), /* @__PURE__ */ s(
|
|
830
|
+
}, []), /* @__PURE__ */ s(w, { children: a() ? /* @__PURE__ */ V(w, { children: [
|
|
831
831
|
/* @__PURE__ */ s(St, { block: e.block, context: e.context }),
|
|
832
|
-
(c = t == null ? void 0 : t()) != null && c.noWrap ? /* @__PURE__ */ s(
|
|
832
|
+
(c = t == null ? void 0 : t()) != null && c.noWrap ? /* @__PURE__ */ s(w, { children: /* @__PURE__ */ s(
|
|
833
833
|
ye,
|
|
834
834
|
{
|
|
835
835
|
componentRef: l().componentRef,
|
|
@@ -842,7 +842,7 @@ function _(e) {
|
|
|
842
842
|
includeBlockProps: l().includeBlockProps,
|
|
843
843
|
isInteractive: l().isInteractive
|
|
844
844
|
}
|
|
845
|
-
) }) : /* @__PURE__ */ s(
|
|
845
|
+
) }) : /* @__PURE__ */ s(w, { children: n() ? /* @__PURE__ */ s(w, { children: (m = n()) == null ? void 0 : m.map((u, g) => /* @__PURE__ */ s(
|
|
846
846
|
Pt,
|
|
847
847
|
{
|
|
848
848
|
repeatContext: u.context,
|
|
@@ -919,7 +919,7 @@ function Vt(e) {
|
|
|
919
919
|
"*"
|
|
920
920
|
));
|
|
921
921
|
}
|
|
922
|
-
return /* @__PURE__ */ V(
|
|
922
|
+
return /* @__PURE__ */ V(w, { children: [
|
|
923
923
|
/* @__PURE__ */ s(
|
|
924
924
|
e.BlocksWrapper,
|
|
925
925
|
{
|
|
@@ -953,7 +953,7 @@ function M(e) {
|
|
|
953
953
|
styleProp: e.styleProp,
|
|
954
954
|
BlocksWrapper: ((i = e.context) == null ? void 0 : i.BlocksWrapper) || t.BlocksWrapper,
|
|
955
955
|
BlocksWrapperProps: ((o = e.context) == null ? void 0 : o.BlocksWrapperProps) || t.BlocksWrapperProps,
|
|
956
|
-
children: e.blocks ? /* @__PURE__ */ s(
|
|
956
|
+
children: e.blocks ? /* @__PURE__ */ s(w, { children: (a = e.blocks) == null ? void 0 : a.map((r) => /* @__PURE__ */ s(
|
|
957
957
|
_,
|
|
958
958
|
{
|
|
959
959
|
block: r,
|
|
@@ -978,24 +978,24 @@ function At(e) {
|
|
|
978
978
|
return x.link ? e.builderLinkComponent || "a" : "div";
|
|
979
979
|
}
|
|
980
980
|
function c(x) {
|
|
981
|
-
var
|
|
982
|
-
return ((
|
|
981
|
+
var T;
|
|
982
|
+
return ((T = i[x]) == null ? void 0 : T.width) || 100 / i.length;
|
|
983
983
|
}
|
|
984
984
|
function d(x) {
|
|
985
|
-
const
|
|
986
|
-
return `calc(${c(x)}% - ${
|
|
985
|
+
const T = t * (i.length - 1) / i.length;
|
|
986
|
+
return `calc(${c(x)}% - ${T}px)`;
|
|
987
987
|
}
|
|
988
988
|
function m({
|
|
989
989
|
stackedStyle: x,
|
|
990
|
-
desktopStyle:
|
|
990
|
+
desktopStyle: T
|
|
991
991
|
}) {
|
|
992
|
-
return a === "tablet" ? x :
|
|
992
|
+
return a === "tablet" ? x : T;
|
|
993
993
|
}
|
|
994
994
|
function u({
|
|
995
995
|
stackedStyle: x,
|
|
996
|
-
desktopStyle:
|
|
996
|
+
desktopStyle: T
|
|
997
997
|
}) {
|
|
998
|
-
return a === "never" ?
|
|
998
|
+
return a === "never" ? T : x;
|
|
999
999
|
}
|
|
1000
1000
|
const [g, y] = C(
|
|
1001
1001
|
() => e.stackColumnsAt === "never" ? "row" : e.reverseColumnsWhenStacked ? "column-reverse" : "column"
|
|
@@ -1009,8 +1009,8 @@ function At(e) {
|
|
|
1009
1009
|
})
|
|
1010
1010
|
};
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
const
|
|
1012
|
+
function I(x) {
|
|
1013
|
+
const T = x === 0 ? 0 : t, N = d(x), h = `${T}px`, f = "100%", b = 0;
|
|
1014
1014
|
return {
|
|
1015
1015
|
...{
|
|
1016
1016
|
display: "flex",
|
|
@@ -1037,7 +1037,7 @@ function At(e) {
|
|
|
1037
1037
|
})
|
|
1038
1038
|
};
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function E(x) {
|
|
1041
1041
|
var N, h;
|
|
1042
1042
|
return $e(
|
|
1043
1043
|
((h = (N = e.builderContext.content) == null ? void 0 : N.meta) == null ? void 0 : h.breakpoints) || {}
|
|
@@ -1045,7 +1045,7 @@ function At(e) {
|
|
|
1045
1045
|
}
|
|
1046
1046
|
function R() {
|
|
1047
1047
|
return `
|
|
1048
|
-
@media (max-width: ${
|
|
1048
|
+
@media (max-width: ${E("medium")}px) {
|
|
1049
1049
|
.${e.builderBlock.id}-breakpoints {
|
|
1050
1050
|
flex-direction: var(--flex-dir-tablet);
|
|
1051
1051
|
align-items: stretch;
|
|
@@ -1057,7 +1057,7 @@ function At(e) {
|
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
|
|
1060
|
-
@media (max-width: ${
|
|
1060
|
+
@media (max-width: ${E("small")}px) {
|
|
1061
1061
|
.${e.builderBlock.id}-breakpoints {
|
|
1062
1062
|
flex-direction: var(--flex-dir);
|
|
1063
1063
|
align-items: stretch;
|
|
@@ -1070,16 +1070,16 @@ function At(e) {
|
|
|
1070
1070
|
},
|
|
1071
1071
|
`;
|
|
1072
1072
|
}
|
|
1073
|
-
function A(x,
|
|
1073
|
+
function A(x, T) {
|
|
1074
1074
|
return {
|
|
1075
1075
|
...x.link ? {
|
|
1076
1076
|
href: x.link
|
|
1077
1077
|
} : {},
|
|
1078
1078
|
[K()]: "builder-column",
|
|
1079
|
-
style: We(T
|
|
1079
|
+
style: We(I(T))
|
|
1080
1080
|
};
|
|
1081
1081
|
}
|
|
1082
|
-
return /* @__PURE__ */ V(
|
|
1082
|
+
return /* @__PURE__ */ V(w, { children: [
|
|
1083
1083
|
/* @__PURE__ */ V(
|
|
1084
1084
|
"div",
|
|
1085
1085
|
{
|
|
@@ -1087,16 +1087,16 @@ function At(e) {
|
|
|
1087
1087
|
style: S(),
|
|
1088
1088
|
children: [
|
|
1089
1089
|
/* @__PURE__ */ s(te, { id: "builderio-columns", styles: R() }),
|
|
1090
|
-
(D = e.columns) == null ? void 0 : D.map((x,
|
|
1090
|
+
(D = e.columns) == null ? void 0 : D.map((x, T) => /* @__PURE__ */ s(
|
|
1091
1091
|
se,
|
|
1092
1092
|
{
|
|
1093
1093
|
TagName: l(x),
|
|
1094
1094
|
actionAttributes: {},
|
|
1095
|
-
attributes: A(x,
|
|
1095
|
+
attributes: A(x, T),
|
|
1096
1096
|
children: /* @__PURE__ */ s(
|
|
1097
1097
|
M,
|
|
1098
1098
|
{
|
|
1099
|
-
path: `component.options.columns.${
|
|
1099
|
+
path: `component.options.columns.${T}.blocks`,
|
|
1100
1100
|
parent: e.builderBlock.id,
|
|
1101
1101
|
styleProp: {
|
|
1102
1102
|
flexGrow: "1"
|
|
@@ -1108,7 +1108,7 @@ function At(e) {
|
|
|
1108
1108
|
}
|
|
1109
1109
|
)
|
|
1110
1110
|
},
|
|
1111
|
-
|
|
1111
|
+
T
|
|
1112
1112
|
))
|
|
1113
1113
|
]
|
|
1114
1114
|
}
|
|
@@ -1182,8 +1182,8 @@ function Ft(e) {
|
|
|
1182
1182
|
};
|
|
1183
1183
|
return e.aspectRatio ? m : void 0;
|
|
1184
1184
|
}
|
|
1185
|
-
return /* @__PURE__ */ V(
|
|
1186
|
-
/* @__PURE__ */ V(
|
|
1185
|
+
return /* @__PURE__ */ V(w, { children: [
|
|
1186
|
+
/* @__PURE__ */ V(w, { children: [
|
|
1187
1187
|
/* @__PURE__ */ V("picture", { children: [
|
|
1188
1188
|
n() ? /* @__PURE__ */ s("source", { type: "image/webp", srcSet: n() }) : null,
|
|
1189
1189
|
/* @__PURE__ */ s(
|
|
@@ -1213,7 +1213,7 @@ function Ft(e) {
|
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
1215
|
) : null,
|
|
1216
|
-
(l = (r = e.builderBlock) == null ? void 0 : r.children) != null && l.length && e.fitContent ? /* @__PURE__ */ s(
|
|
1216
|
+
(l = (r = e.builderBlock) == null ? void 0 : r.children) != null && l.length && e.fitContent ? /* @__PURE__ */ s(w, { children: e.children }) : null,
|
|
1217
1217
|
!e.fitContent && ((d = (c = e.builderBlock) == null ? void 0 : c.children) != null && d.length) ? /* @__PURE__ */ s("div", { className: "div-3ac67dd4-2", children: e.children }) : null
|
|
1218
1218
|
] }),
|
|
1219
1219
|
/* @__PURE__ */ s("style", { children: `.img-3ac67dd4 {
|
|
@@ -2292,18 +2292,18 @@ function ln(e) {
|
|
|
2292
2292
|
var u, g;
|
|
2293
2293
|
const t = ee(null), [n, i] = C(() => "unsubmitted"), [o, a] = C(() => null), [r, l] = C(() => "");
|
|
2294
2294
|
function c(y) {
|
|
2295
|
-
var
|
|
2295
|
+
var I, E;
|
|
2296
2296
|
const S = {
|
|
2297
2297
|
...e.builderContext.rootState,
|
|
2298
2298
|
...y
|
|
2299
2299
|
};
|
|
2300
|
-
e.builderContext.rootSetState ? (
|
|
2300
|
+
e.builderContext.rootSetState ? (E = (I = e.builderContext).rootSetState) == null || E.call(I, S) : e.builderContext.rootState = S;
|
|
2301
2301
|
}
|
|
2302
2302
|
function d() {
|
|
2303
2303
|
return F() && e.previewState || n;
|
|
2304
2304
|
}
|
|
2305
2305
|
function m(y) {
|
|
2306
|
-
var
|
|
2306
|
+
var I;
|
|
2307
2307
|
const S = e.sendWithJs || e.sendSubmissionsTo === "email";
|
|
2308
2308
|
if (e.sendSubmissionsTo === "zapier")
|
|
2309
2309
|
y.preventDefault();
|
|
@@ -2313,9 +2313,9 @@ function ln(e) {
|
|
|
2313
2313
|
return;
|
|
2314
2314
|
}
|
|
2315
2315
|
y.preventDefault();
|
|
2316
|
-
const
|
|
2316
|
+
const E = y.currentTarget, R = e.customHeaders || {};
|
|
2317
2317
|
let A;
|
|
2318
|
-
const W = new FormData(
|
|
2318
|
+
const W = new FormData(E), D = Array.from(
|
|
2319
2319
|
y.currentTarget.querySelectorAll("input,select,textarea")
|
|
2320
2320
|
).filter((h) => !!h.name).map((h) => {
|
|
2321
2321
|
let f;
|
|
@@ -2352,9 +2352,9 @@ function ln(e) {
|
|
|
2352
2352
|
Re(h, b, f);
|
|
2353
2353
|
}), A = JSON.stringify(h);
|
|
2354
2354
|
}
|
|
2355
|
-
x && x !== "multipart/form-data" && (S && ((
|
|
2356
|
-
const
|
|
2357
|
-
if (t.current && (t.current.dispatchEvent(
|
|
2355
|
+
x && x !== "multipart/form-data" && (S && ((I = e.action) != null && I.includes("zapier.com")) || (R["content-type"] = x));
|
|
2356
|
+
const T = new CustomEvent("presubmit", { detail: { body: A } });
|
|
2357
|
+
if (t.current && (t.current.dispatchEvent(T), T.defaultPrevented))
|
|
2358
2358
|
return;
|
|
2359
2359
|
i("sending");
|
|
2360
2360
|
const N = `${an() === "dev" ? "http://localhost:5000" : "https://builder.io"}/api/v1/form-submit?apiKey=${e.builderContext.apiKey}&to=${btoa(
|
|
@@ -2399,7 +2399,7 @@ function ln(e) {
|
|
|
2399
2399
|
);
|
|
2400
2400
|
}
|
|
2401
2401
|
}
|
|
2402
|
-
return /* @__PURE__ */ V(
|
|
2402
|
+
return /* @__PURE__ */ V(w, { children: [
|
|
2403
2403
|
" ",
|
|
2404
2404
|
/* @__PURE__ */ V(
|
|
2405
2405
|
"form",
|
|
@@ -2412,7 +2412,7 @@ function ln(e) {
|
|
|
2412
2412
|
onSubmit: (y) => m(y),
|
|
2413
2413
|
...e.attributes,
|
|
2414
2414
|
children: [
|
|
2415
|
-
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ s(
|
|
2415
|
+
e.builderBlock && e.builderBlock.children ? /* @__PURE__ */ s(w, { children: (g = (u = e.builderBlock) == null ? void 0 : u.children) == null ? void 0 : g.map((y, S) => /* @__PURE__ */ s(
|
|
2416
2416
|
_,
|
|
2417
2417
|
{
|
|
2418
2418
|
block: y,
|
|
@@ -3085,7 +3085,7 @@ font-weight: ${l};
|
|
|
3085
3085
|
}
|
|
3086
3086
|
`, Wn = (e) => e ? "" : An, Nn = (e) => `variant-${e}`;
|
|
3087
3087
|
function $n(e) {
|
|
3088
|
-
var A, W, D, x,
|
|
3088
|
+
var A, W, D, x, T, N, h;
|
|
3089
3089
|
const t = ee(null);
|
|
3090
3090
|
function n(f) {
|
|
3091
3091
|
var p, v;
|
|
@@ -3166,7 +3166,7 @@ function $n(e) {
|
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
3168
3168
|
const [d, m] = C(() => ({})), [u, g] = C(() => ({})), [y, S] = C(() => !1);
|
|
3169
|
-
function
|
|
3169
|
+
function I(f) {
|
|
3170
3170
|
var b, p;
|
|
3171
3171
|
if (e.builderContextSignal.content) {
|
|
3172
3172
|
const v = (b = e.builderContextSignal.content) == null ? void 0 : b.testVariationId, k = (p = e.builderContextSignal.content) == null ? void 0 : p.id;
|
|
@@ -3182,7 +3182,7 @@ function $n(e) {
|
|
|
3182
3182
|
}
|
|
3183
3183
|
y || S(!0);
|
|
3184
3184
|
}
|
|
3185
|
-
function
|
|
3185
|
+
function E() {
|
|
3186
3186
|
var b, p, v;
|
|
3187
3187
|
const f = (v = (p = (b = e.builderContextSignal.content) == null ? void 0 : b.data) == null ? void 0 : p.httpRequests) != null ? v : {};
|
|
3188
3188
|
Object.entries(f).forEach(([k, B]) => {
|
|
@@ -3276,13 +3276,13 @@ function $n(e) {
|
|
|
3276
3276
|
}, []), P(() => {
|
|
3277
3277
|
e.apiKey || Z.error(
|
|
3278
3278
|
"No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
3279
|
-
), c(),
|
|
3279
|
+
), c(), E(), R();
|
|
3280
3280
|
}, []), P(() => {
|
|
3281
3281
|
e.content && i(e.content);
|
|
3282
3282
|
}, [e.content]), P(() => {
|
|
3283
3283
|
c();
|
|
3284
3284
|
}, [(W = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : W.jsCode]), P(() => {
|
|
3285
|
-
|
|
3285
|
+
E();
|
|
3286
3286
|
}, [(x = (D = e.builderContextSignal.content) == null ? void 0 : D.data) == null ? void 0 : x.httpRequests]), P(() => {
|
|
3287
3287
|
R();
|
|
3288
3288
|
}, [e.builderContextSignal.rootState]), P(() => {
|
|
@@ -3300,8 +3300,8 @@ function $n(e) {
|
|
|
3300
3300
|
a,
|
|
3301
3301
|
{
|
|
3302
3302
|
ref: t,
|
|
3303
|
-
onClick: (f) =>
|
|
3304
|
-
"builder-content-id": (
|
|
3303
|
+
onClick: (f) => I(f),
|
|
3304
|
+
"builder-content-id": (T = e.builderContextSignal.content) == null ? void 0 : T.id,
|
|
3305
3305
|
"builder-model": e.model,
|
|
3306
3306
|
...o(),
|
|
3307
3307
|
...e.contentWrapperProps,
|
|
@@ -3359,19 +3359,19 @@ function ke(e) {
|
|
|
3359
3359
|
var c, d, m, u, g, y, S;
|
|
3360
3360
|
const [t, n] = C(
|
|
3361
3361
|
() => {
|
|
3362
|
-
var
|
|
3362
|
+
var I, E;
|
|
3363
3363
|
return wn({
|
|
3364
3364
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3365
|
-
variationId: (
|
|
3365
|
+
variationId: (I = e.content) == null ? void 0 : I.testVariationId,
|
|
3366
3366
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
3367
|
-
contentId: (
|
|
3367
|
+
contentId: (E = e.content) == null ? void 0 : E.id
|
|
3368
3368
|
});
|
|
3369
3369
|
}
|
|
3370
3370
|
);
|
|
3371
|
-
function i(
|
|
3372
|
-
l((
|
|
3373
|
-
...
|
|
3374
|
-
rootState:
|
|
3371
|
+
function i(I) {
|
|
3372
|
+
l((E) => ({
|
|
3373
|
+
...E,
|
|
3374
|
+
rootState: I
|
|
3375
3375
|
}));
|
|
3376
3376
|
}
|
|
3377
3377
|
const [o, a] = C(
|
|
@@ -3379,10 +3379,10 @@ function ke(e) {
|
|
|
3379
3379
|
...xe(),
|
|
3380
3380
|
...e.customComponents || []
|
|
3381
3381
|
].reduce(
|
|
3382
|
-
(
|
|
3383
|
-
...
|
|
3382
|
+
(I, { component: E, ...R }) => ({
|
|
3383
|
+
...I,
|
|
3384
3384
|
[R.name]: {
|
|
3385
|
-
component:
|
|
3385
|
+
component: E,
|
|
3386
3386
|
...fe(R)
|
|
3387
3387
|
}
|
|
3388
3388
|
}),
|
|
@@ -3407,8 +3407,8 @@ function ke(e) {
|
|
|
3407
3407
|
...xe(),
|
|
3408
3408
|
...e.customComponents || []
|
|
3409
3409
|
].reduce(
|
|
3410
|
-
(
|
|
3411
|
-
...
|
|
3410
|
+
(I, { component: E, ...R }) => ({
|
|
3411
|
+
...I,
|
|
3412
3412
|
[R.name]: fe(R)
|
|
3413
3413
|
}),
|
|
3414
3414
|
{}
|
|
@@ -3505,7 +3505,7 @@ function Mn(e) {
|
|
|
3505
3505
|
});
|
|
3506
3506
|
}
|
|
3507
3507
|
return P(() => {
|
|
3508
|
-
}, []), /* @__PURE__ */ V(
|
|
3508
|
+
}, []), /* @__PURE__ */ V(w, { children: [
|
|
3509
3509
|
!e.isNestedRender && z !== "reactNative" ? /* @__PURE__ */ s(
|
|
3510
3510
|
re,
|
|
3511
3511
|
{
|
|
@@ -3513,7 +3513,7 @@ function Mn(e) {
|
|
|
3513
3513
|
scriptStr: Cn()
|
|
3514
3514
|
}
|
|
3515
3515
|
) : null,
|
|
3516
|
-
t ? /* @__PURE__ */ V(
|
|
3516
|
+
t ? /* @__PURE__ */ V(w, { children: [
|
|
3517
3517
|
/* @__PURE__ */ s(
|
|
3518
3518
|
te,
|
|
3519
3519
|
{
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./blocks-exports.cjs"),e=require("./server-entry-298501b1.cjs");require("react/jsx-runtime");require("react");exports.Blocks=t.Blocks;exports.BuilderContext=t.BuilderContext;exports.Button=t.Button;exports.Columns=t.Columns;exports.Content=t.Content;exports.Fragment=t.Fragment;exports.Image=t.Image;exports.Section=t.Section;exports.Symbol=t.Symbol;exports.Text=t.Text;exports.Video=t.Video;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as i, BuilderContext as s, Button as n, Columns as c, Content as m, Fragment as g, Image as a, Section as d, Symbol as l, Text as p, Video as u } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as B, createRegisterComponentMessage as C, fetchBuilderProps as E, fetchEntries as h, fetchOneEntry as x, getBuilderSearchParams as S, isEditing as b, isPreviewing as P, register as k, setEditorSettings as y, subscribeToEditor as R, track as T } from "./server-entry-
|
|
2
|
+
import { _processContentResult as B, createRegisterComponentMessage as C, fetchBuilderProps as E, fetchEntries as h, fetchOneEntry as x, getBuilderSearchParams as S, isEditing as b, isPreviewing as P, register as k, setEditorSettings as y, subscribeToEditor as R, track as T } from "./server-entry-c522a38f.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
package/lib/browser/init.cjs
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("isolated-vm")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ivm=require("isolated-vm"),serverEntry=require("./server-entry-298501b1.cjs"),noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=eval("require")}catch(e){}const INJECTED_IVM_GLOBAL="BUILDER_IVM";let IVM_INSTANCE=null;const setIvm=(e,t={})=>{IVM_INSTANCE=e,setIsolateContext(t)},getIvm=()=>{try{if(IVM_INSTANCE)return IVM_INSTANCE;const e=safeDynamicRequire("isolated-vm");if(e)return e}catch(e){serverEntry.logger.error("isolated-vm import error.",e)}throw new Error(`${serverEntry.MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
|
|
2
|
+
|
|
3
|
+
In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
|
|
4
|
+
importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
|
|
5
|
+
a server-only execution path within your application.
|
|
6
|
+
|
|
7
|
+
Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
|
|
8
|
+
`)};function setIsolateContext(e={memoryLimit:128}){const t=getIvm(),n=new t.Isolate(e).createContextSync(),i=n.global;return i.setSync("global",i.derefInto()),i.setSync("log",function(...o){console.log(...o)}),i.setSync(INJECTED_IVM_GLOBAL,t),n}const initializeNodeRuntime=e=>{const{ivmIsolateOptions:t}=e||{};setIvm(ivm,t)};exports.initializeNodeRuntime=initializeNodeRuntime;
|
package/lib/browser/init.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "isolated-vm";
|
|
1
|
+
import ivm from "isolated-vm";
|
|
2
|
+
import { logger, MSG_PREFIX } from "./server-entry-c522a38f.js";
|
|
2
3
|
const noop = () => {
|
|
3
4
|
};
|
|
4
5
|
let safeDynamicRequire = noop;
|
|
@@ -6,7 +7,42 @@ try {
|
|
|
6
7
|
safeDynamicRequire = eval("require");
|
|
7
8
|
} catch (e) {
|
|
8
9
|
}
|
|
9
|
-
const
|
|
10
|
+
const INJECTED_IVM_GLOBAL = "BUILDER_IVM";
|
|
11
|
+
let IVM_INSTANCE = null;
|
|
12
|
+
const setIvm = (e, t = {}) => {
|
|
13
|
+
IVM_INSTANCE = e, setIsolateContext(t);
|
|
14
|
+
}, getIvm = () => {
|
|
15
|
+
try {
|
|
16
|
+
if (IVM_INSTANCE)
|
|
17
|
+
return IVM_INSTANCE;
|
|
18
|
+
const e = safeDynamicRequire("isolated-vm");
|
|
19
|
+
if (e)
|
|
20
|
+
return e;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
logger.error("isolated-vm import error.", e);
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on Node server.
|
|
25
|
+
|
|
26
|
+
In certain Node environments, the SDK requires additional initialization steps. This can be achieved by
|
|
27
|
+
importing and calling \`initializeNodeRuntime()\` from "@builder.io/sdk-react/node/init". This must be done in
|
|
28
|
+
a server-only execution path within your application.
|
|
29
|
+
|
|
30
|
+
Please see the documentation for more information: https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments
|
|
31
|
+
`);
|
|
32
|
+
};
|
|
33
|
+
function setIsolateContext(e = {
|
|
34
|
+
memoryLimit: 128
|
|
35
|
+
}) {
|
|
36
|
+
const t = getIvm(), i = new t.Isolate(e).createContextSync(), o = i.global;
|
|
37
|
+
return o.setSync("global", o.derefInto()), o.setSync("log", function(...n) {
|
|
38
|
+
console.log(...n);
|
|
39
|
+
}), o.setSync(INJECTED_IVM_GLOBAL, t), i;
|
|
40
|
+
}
|
|
41
|
+
const initializeNodeRuntime = (e) => {
|
|
42
|
+
const {
|
|
43
|
+
ivmIsolateOptions: t
|
|
44
|
+
} = e || {};
|
|
45
|
+
setIvm(ivm, t);
|
|
10
46
|
};
|
|
11
47
|
export {
|
|
12
48
|
initializeNodeRuntime
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
2
|
-
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const J=Oe();function v(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],a=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...v(s,a,n)}:{...r,[a]:s}},{})}const Te="v3",A="builder.",xe="options.",P=e=>{if(!e)return{};const t=U(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(A)){const o=r.replace(A,"").replace(xe,"");n[o]=t[r]}}),n},Ae=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},R=e=>typeof e=="number"&&!isNaN(e)&&e>=0,O=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:a,locale:l,apiVersion:y=Te,fields:m,omit:E,offset:u,cacheSeconds:g,staleCacheSeconds:h,sort:S,includeUnpublished:T}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(y))throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);const ie=t!==1,i=new URL(`https://cdn.builder.io/api/${y}/content/${o}`);if(i.searchParams.set("apiKey",s),i.searchParams.set("limit",String(t)),i.searchParams.set("noTraverse",String(ie)),i.searchParams.set("includeRefs",String(!0)),l&&i.searchParams.set("locale",l),a&&i.searchParams.set("enrich",String(a)),i.searchParams.set("omit",E||"meta.componentsUsed"),m&&i.searchParams.set("fields",m),Number.isFinite(u)&&u>-1&&i.searchParams.set("offset",String(Math.floor(u))),typeof T=="boolean"&&i.searchParams.set("includeUnpublished",String(T)),g&&R(g)&&i.searchParams.set("cacheSeconds",String(g)),h&&R(h)&&i.searchParams.set("staleCacheSeconds",String(h)),S){const f=v({sort:S});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}const ae={...Ae(),...U(e.options||{})},x=v(ae);for(const f in x)i.searchParams.set(f,String(x[f]));if(n&&i.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=v({query:r});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}return i},Re=e=>"results"in e;async function H(e){const t=await q({...e,limit:1});return t&&t[0]||null}const Be=async e=>{var s;const t=O(e);return await(await((s=e.fetch)!=null?s:J)(t.href,e.fetchOptions)).json()},X=async(e,t,n=O(e))=>{const r
|
|
1
|
+
"use strict";const I="react",b="[Builder.io]: ",d={log:(...e)=>console.log(b,...e),error:(...e)=>console.error(b,...e),warn:(...e)=>console.warn(b,...e),debug:(...e)=>console.debug(b,...e)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const ce=e=>{const t={};return e.forEach((n,r)=>{t[r]=n}),t},U=e=>e instanceof URLSearchParams?ce(e):e,M=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function ue(){return c()&&window.self!==window.top}function F(e){return ue()&&M(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const de=()=>{if(c()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},le=()=>typeof navigator=="object"&&navigator.userAgent||"",N=()=>{const e=le(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),r=de();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},p=e=>e!=null,k=e=>JSON.parse(JSON.stringify(e)),fe=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},D=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(r=>r.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},_=async e=>D(e),ge=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(p).join("; "),he=[["secure",""],["SameSite","None"]],pe=({name:e,value:t,expires:n})=>{const o=(c()?location.protocol==="https:":!0)?he:[[]],s=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...s,["path","/"],["domain",fe(window.location.hostname)],...o];return ge(a)},j=async({name:e,value:t,expires:n,canTrack:r})=>{try{if(!r)return;const o=pe({name:e,value:t,expires:n});document.cookie=o}catch(o){d.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}},me="builder.tests",C=e=>`${me}.${e}`,ye=({contentId:e})=>_({name:C(e),canTrack:!0}),Se=({contentId:e})=>D({name:C(e),canTrack:!0}),we=({contentId:e,value:t})=>j({name:C(e),value:t,canTrack:!0}),K=e=>p(e.id)&&p(e.variations)&&Object.keys(e.variations).length>0,be=({id:e,variations:t})=>{var o;let n=0;const r=Math.random();for(const s in t){const a=(o=t[s])==null?void 0:o.testRatio;if(n+=a,r<n)return s}return e},G=e=>{const t=be(e);return we({contentId:e.id,value:t}).catch(n=>{d.error("could not store A/B test variation: ",n)}),t},W=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},Ie=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!K(e))return e;const n=Se({contentId:e.id})||G({variations:e.variations,id:e.id}),r=W({item:e,testGroupId:n});return{...e,...r}},ve=async({item:e,canTrack:t})=>{if(!t||!K(e))return e;const r=await ye({contentId:e.id})||G({variations:e.variations,id:e.id}),o=W({item:e,testGroupId:r});return{...e,...o}},$=e=>p(e)?e:!0,Ee=e=>({type:"builder.registerComponent",data:z(e)}),ke=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},Ce=e=>typeof e=="function"?ke(e):k(e),z=({inputs:e,...t})=>({...k(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((r,[o,s])=>({...r,[o]:Ce(s)}),{}))});function Pe(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function Oe(){const e=Pe().fetch;if(typeof e=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const J=Oe();function v(e,t=null,n="."){return Object.keys(e).reduce((r,o)=>{const s=e[o],a=[t,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...v(s,a,n)}:{...r,[a]:s}},{})}const Te="v3",A="builder.",xe="options.",P=e=>{if(!e)return{};const t=U(e),n={};return Object.keys(t).forEach(r=>{if(r.startsWith(A)){const o=r.replace(A,"").replace(xe,"");n[o]=t[r]}}),n},Ae=()=>{if(!c())return{};const e=new URLSearchParams(window.location.search);return P(e)},R=e=>typeof e=="number"&&!isNaN(e)&&e>=0,O=e=>{const{limit:t=30,userAttributes:n,query:r,model:o,apiKey:s,enrich:a,locale:l,apiVersion:y=Te,fields:m,omit:E,offset:u,cacheSeconds:g,staleCacheSeconds:h,sort:S,includeUnpublished:T}=e;if(!s)throw new Error("Missing API key");if(!["v3"].includes(y))throw new Error(`Invalid apiVersion: expected 'v3', received '${y}'`);const ie=t!==1,i=new URL(`https://cdn.builder.io/api/${y}/content/${o}`);if(i.searchParams.set("apiKey",s),i.searchParams.set("limit",String(t)),i.searchParams.set("noTraverse",String(ie)),i.searchParams.set("includeRefs",String(!0)),l&&i.searchParams.set("locale",l),a&&i.searchParams.set("enrich",String(a)),i.searchParams.set("omit",E||"meta.componentsUsed"),m&&i.searchParams.set("fields",m),Number.isFinite(u)&&u>-1&&i.searchParams.set("offset",String(Math.floor(u))),typeof T=="boolean"&&i.searchParams.set("includeUnpublished",String(T)),g&&R(g)&&i.searchParams.set("cacheSeconds",String(g)),h&&R(h)&&i.searchParams.set("staleCacheSeconds",String(h)),S){const f=v({sort:S});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}const ae={...Ae(),...U(e.options||{})},x=v(ae);for(const f in x)i.searchParams.set(f,String(x[f]));if(n&&i.searchParams.set("userAttributes",JSON.stringify(n)),r){const f=v({query:r});for(const w in f)i.searchParams.set(w,JSON.stringify(f[w]))}return i},Re=e=>"results"in e;async function H(e){const t=await q({...e,limit:1});return t&&t[0]||null}const Be=async e=>{var s;const t=O(e);return await(await((s=e.fetch)!=null?s:J)(t.href,e.fetchOptions)).json()},X=async(e,t,n=O(e))=>{const r=$(e.canTrack);if(n.search.includes("preview="),!r||!(c()||I==="reactNative"))return t.results;try{const o=[];for(const s of t.results)o.push(await ve({item:s,canTrack:r}));t.results=o}catch(o){d.error("Could not process A/B tests. ",o)}return t.results};async function q(e){try{const t=O(e),n=await Be(e);return Re(n)?X(e,n):(d.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return d.error("Error fetching data. ",t),null}}function Le(e){const t=e||(c()?window.location.search:void 0);return t?M(t).indexOf("builder.preview=")!==-1:!1}function Ve(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function Y(){return Ve().replace(/-/g,"")}const Q="builderSessionId",Ue=async({canTrack:e})=>{if(!e)return;const t=await _({name:Q,canTrack:e});if(p(t))return t;{const n=Me();return Fe({id:n,canTrack:e}),n}},Me=()=>Y(),Fe=({id:e,canTrack:t})=>j({name:Q,value:e,canTrack:t}),Z=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Ne=({key:e,canTrack:t})=>{var n;try{return t?(n=Z())==null?void 0:n.getItem(e):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},De=({key:e,canTrack:t,value:n})=>{var r;try{t&&((r=Z())==null||r.setItem(e,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},ee="builderVisitorId",_e=({canTrack:e})=>{if(!e)return;const t=Ne({key:ee,canTrack:e});if(p(t))return t;{const n=je();return Ke({id:n,canTrack:e}),n}},je=()=>Y(),Ke=({id:e,canTrack:t})=>De({key:ee,value:e,canTrack:t}),Ge=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Ue({canTrack:e}),n=_e({canTrack:e});return{sessionId:t,visitorId:n}},We=async({type:e,canTrack:t,apiKey:n,metadata:r,...o})=>({type:e,data:{...o,metadata:{url:location.href,...r},...await Ge({canTrack:t}),userAttributes:N(),ownerId:n}});async function te(e){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!F()&&(c()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await We(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const $e=e=>te({...e,canTrack:!0}),ze=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function ne(e,t){const n=new URL(t.origin),r=n.hostname;return(e||ze).findIndex(o=>o.startsWith("*.")?r.endsWith(o.slice(1)):o===r)>-1}const Je="1.0.26",B={};function re(e,t){let n=B[e];if(n||(n=B[e]=[]),n.push(t),c()){const r={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const He=()=>{re("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let L=!1;const oe=(e={})=>{var t,n;L||(L=!0,c()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:Je,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",r=>{var s,a;if(!ne(e.trustedHosts,r))return;const{data:o}=r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const l=o.data.text,y=o.data.arguments||[],m=o.data.id,E=new Function(l);let u,g=null;try{u=E.apply(null,y)}catch(h){g=h}g?(s=window.parent)==null||s.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):u&&typeof u.then=="function"?u.then(h=>{var S;(S=window.parent)==null||S.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:u,id:m}},"*");break}}})))},se=({model:e,trustedHosts:t,callbacks:n})=>r=>{if(!ne(t,r))return;const{data:o}=r;if(o)switch(o.type){case"builder.configureSdk":{n.configureSdk(o.data);break}case"builder.triggerAnimation":{n.animation(o.data);break}case"builder.contentUpdate":{const s=o.data,a=s.key||s.alias||s.entry||s.modelName,l=s.data;a===e&&n.contentUpdate(l);break}}},Xe=(e,t,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};oe();const r=se({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},V={};function qe(e){if(c()){Object.assign(V,e);const t={type:"builder.settingsChange",data:V};parent.postMessage(t,"*")}}const Ye=async e=>{var r,o,s;const t=e.path||((r=e.url)==null?void 0:r.pathname)||((o=e.userAttributes)==null?void 0:o.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:P(e.searchParams||((s=e.url)==null?void 0:s.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await H(n)}};exports.MSG_PREFIX=b;exports.TARGET=I;exports._processContentResult=X;exports._track=te;exports.checkIsDefined=p;exports.createEditorListener=se;exports.createRegisterComponentMessage=Ee;exports.fastClone=k;exports.fetch=J;exports.fetchBuilderProps=Ye;exports.fetchEntries=q;exports.fetchOneEntry=H;exports.getBuilderSearchParams=P;exports.getDefaultCanTrack=$;exports.getUserAttributes=N;exports.handleABTestingSync=Ie;exports.isBrowser=c;exports.isEditing=F;exports.isPreviewing=Le;exports.logger=d;exports.register=re;exports.registerInsertMenu=He;exports.serializeComponentInfo=z;exports.setEditorSettings=qe;exports.setupBrowserForEditing=oe;exports.subscribeToEditor=Xe;exports.track=$e;
|
|
@@ -476,7 +476,7 @@ function J(e, t) {
|
|
|
476
476
|
const n = new URL(t.origin), r = n.hostname;
|
|
477
477
|
return (e || je).findIndex((o) => o.startsWith("*.") ? r.endsWith(o.slice(1)) : o === r) > -1;
|
|
478
478
|
}
|
|
479
|
-
const De = "1.0.
|
|
479
|
+
const De = "1.0.26", T = {};
|
|
480
480
|
function Ke(e, t) {
|
|
481
481
|
let n = T[e];
|
|
482
482
|
if (n || (n = T[e] = []), n.push(t), c()) {
|
|
@@ -656,6 +656,7 @@ const Ye = async (e) => {
|
|
|
656
656
|
};
|
|
657
657
|
};
|
|
658
658
|
export {
|
|
659
|
+
b as MSG_PREFIX,
|
|
659
660
|
I as TARGET,
|
|
660
661
|
Pe as _processContentResult,
|
|
661
662
|
Fe as _track,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-298501b1.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-
|
|
1
|
+
import { _processContentResult as r, createRegisterComponentMessage as s, fetchBuilderProps as i, fetchEntries as n, fetchOneEntry as o, getBuilderSearchParams as c, isEditing as g, isPreviewing as a, register as d, setEditorSettings as E, subscribeToEditor as f, track as h } from "./server-entry-c522a38f.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
s as createRegisterComponentMessage,
|