@builder.io/sdk-react 4.2.2 → 4.2.3
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 +30 -30
- package/lib/browser/blocks-exports.mjs +676 -623
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/server-entry-0817de95.cjs +2 -0
- package/lib/browser/{server-entry-074665de.js → server-entry-331e2fd4.js} +248 -246
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-0768e15a.cjs → accordion-1559ca68.cjs} +1 -1
- package/lib/edge/{accordion-d3831f48.js → accordion-3e9ee224.js} +1 -1
- package/lib/edge/{blocks-2af1d7c9.cjs → blocks-4f20c19a.cjs} +14 -14
- package/lib/edge/{blocks-0269007e.js → blocks-b9be7dc1.js} +735 -721
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-050f4fef.cjs → button-0a632d4f.cjs} +1 -1
- package/lib/edge/{button-a478ff1a.js → button-ba852235.js} +2 -2
- package/lib/edge/{columns-25375990.cjs → columns-66170ac9.cjs} +1 -1
- package/lib/edge/{columns-0b3181f1.js → columns-ee2fba7b.js} +3 -3
- package/lib/edge/{content-variants-4cab7215.cjs → content-variants-4f54d98a.cjs} +3 -3
- package/lib/edge/{content-variants-0dd65b50.js → content-variants-c013569a.js} +142 -108
- package/lib/edge/{custom-code-f7a0f1c1.js → custom-code-38e2c9d5.js} +1 -1
- package/lib/edge/{custom-code-eb5aedd2.cjs → custom-code-48579935.cjs} +1 -1
- package/lib/edge/{embed-e4979560.js → embed-1ce0435c.js} +1 -1
- package/lib/edge/{embed-69114c35.cjs → embed-9a7f29ff.cjs} +1 -1
- package/lib/edge/{form-7b4bd399.cjs → form-d9b6dea6.cjs} +1 -1
- package/lib/edge/{form-30fba682.js → form-f558f5d4.js} +3 -3
- package/lib/edge/{get-class-prop-name-770bdff2.js → get-class-prop-name-35ccd32a.js} +1 -1
- package/lib/edge/{get-class-prop-name-f470d5ce.cjs → get-class-prop-name-d2be9a48.cjs} +1 -1
- package/lib/edge/image-cce92f6c.cjs +17 -0
- package/lib/edge/image-d87761af.js +123 -0
- package/lib/edge/img-a1e0f10e.js +33 -0
- package/lib/edge/img-b21eb075.cjs +1 -0
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-e4a9fe0b.js → input-5c0d3350.js} +1 -1
- package/lib/edge/{input-a6caf021.cjs → input-6854bc85.cjs} +1 -1
- package/lib/edge/{personalization-container-64f3cd71.js → personalization-container-adf9e0bd.js} +4 -4
- package/lib/edge/{personalization-container-f7030f08.cjs → personalization-container-f7fdc090.cjs} +1 -1
- package/lib/edge/{select-c217566c.cjs → select-6c4637ae.cjs} +1 -1
- package/lib/edge/{select-c59c9ac6.js → select-713e73f6.js} +1 -1
- package/lib/edge/server-entry-0bef3cb1.cjs +2 -0
- package/lib/{node/server-entry-83d3751d.js → edge/server-entry-71badd34.js} +307 -307
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-ccd946e2.cjs → slot-59a86f46.cjs} +1 -1
- package/lib/edge/{slot-26ec2911.js → slot-a3c27352.js} +3 -3
- package/lib/edge/{symbol-4548e942.cjs → symbol-3d81a9de.cjs} +1 -1
- package/lib/edge/{symbol-10cb2f77.js → symbol-86e5a3f0.js} +2 -2
- package/lib/edge/{tabs-82a9170c.cjs → tabs-0d914e5c.cjs} +1 -1
- package/lib/edge/{tabs-f9110171.js → tabs-60f8bb61.js} +3 -3
- package/lib/node/blocks-exports.cjs +32 -32
- package/lib/node/blocks-exports.mjs +821 -768
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +3 -3
- package/lib/node/server-entry-05b0f263.cjs +2 -0
- package/lib/{edge/server-entry-fb5f2b80.js → node/server-entry-68823bb0.js} +346 -342
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-596668c3.js → setIvm-bb3d0e32.js} +1 -1
- package/lib/node/{setIvm-0a5b2ba2.cjs → setIvm-bec8f1ed.cjs} +1 -1
- package/lib/node/setIvm.cjs +1 -1
- package/lib/node/setIvm.mjs +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-180c3315.js → should-force-browser-runtime-in-node-a4c71d14.js} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-5b9e373d.cjs → should-force-browser-runtime-in-node-bbbdf124.cjs} +1 -1
- package/package.json +1 -1
- package/types/blocks/img/img.d.ts +2 -0
- package/types/components/block/components/live-edit-block-styles.d.ts +8 -0
- package/types/components/block/components/style-wrapper.d.ts +9 -0
- package/types/components/live-edit.d.ts +9 -0
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/helpers/find-block.d.ts +18 -0
- package/types/helpers/subscribe-to-editor.d.ts +3 -2
- package/lib/browser/server-entry-06504dba.cjs +0 -2
- package/lib/edge/image-209835f4.js +0 -94
- package/lib/edge/image-87a4e006.cjs +0 -17
- package/lib/edge/image.helpers-3e926d47.js +0 -33
- package/lib/edge/image.helpers-dba8a869.cjs +0 -1
- package/lib/edge/img-3bb375bf.js +0 -28
- package/lib/edge/img-ddf74e12.cjs +0 -1
- package/lib/edge/server-entry-67200cf1.cjs +0 -2
- package/lib/node/server-entry-d40e4b66.cjs +0 -2
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsxs as d, Fragment as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as y } from "react";
|
|
3
|
+
function x(e) {
|
|
4
|
+
return e.replace(/http(s)?:/, "");
|
|
5
|
+
}
|
|
6
|
+
function v(e = "", i, t) {
|
|
7
|
+
const n = new RegExp("([?&])" + i + "=.*?(&|$)", "i"), c = e.indexOf("?") !== -1 ? "&" : "?";
|
|
8
|
+
return e.match(n) ? e.replace(n, "$1" + i + "=" + encodeURIComponent(t) + "$2") : e + c + i + "=" + encodeURIComponent(t);
|
|
9
|
+
}
|
|
10
|
+
function $(e, i) {
|
|
11
|
+
if (!e || !(e != null && e.match(/cdn\.shopify\.com/)) || !i)
|
|
12
|
+
return e;
|
|
13
|
+
if (i === "master")
|
|
14
|
+
return x(e);
|
|
15
|
+
const t = e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);
|
|
16
|
+
if (t) {
|
|
17
|
+
const n = e.split(t[0]), c = t[3], r = i.match("x") ? i : `${i}x`;
|
|
18
|
+
return x(`${n[0]}_${r}${c}`);
|
|
19
|
+
}
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
function f(e) {
|
|
23
|
+
if (!e)
|
|
24
|
+
return e;
|
|
25
|
+
const i = [100, 200, 400, 800, 1200, 1600, 2e3];
|
|
26
|
+
if (e.match(/builder\.io/)) {
|
|
27
|
+
let t = e;
|
|
28
|
+
const n = Number(e.split("?width=")[1]);
|
|
29
|
+
return isNaN(n) || (t = `${t} ${n}w`), i.filter((c) => c !== n).map((c) => `${v(e, "width", c)} ${c}w`).concat([t]).join(", ");
|
|
30
|
+
}
|
|
31
|
+
return e.match(/cdn\.shopify\.com/) ? i.map((t) => [$(e, `${t}x${t}`), t]).filter(([t]) => !!t).map(([t, n]) => `${t} ${n}w`).concat([e]).join(", ") : e;
|
|
32
|
+
}
|
|
33
|
+
function R(e) {
|
|
34
|
+
var c, r, u, h, s, g;
|
|
35
|
+
function i() {
|
|
36
|
+
var b;
|
|
37
|
+
const a = e.image || e.src;
|
|
38
|
+
if (!a || // We can auto add srcset for cdn.builder.io and shopify
|
|
39
|
+
// images, otherwise you can supply this prop manually
|
|
40
|
+
!(typeof a == "string" && (a.match(/builder\.io/) || a.match(/cdn\.shopify\.com/))))
|
|
41
|
+
return e.srcset;
|
|
42
|
+
if (!e.noWebp) {
|
|
43
|
+
if (e.srcset && ((b = e.image) != null && b.includes("builder.io/api/v1/image"))) {
|
|
44
|
+
if (!e.srcset.includes(e.image.split("?")[0]))
|
|
45
|
+
return console.debug("Removed given srcset"), f(a);
|
|
46
|
+
} else if (e.image && !e.srcset)
|
|
47
|
+
return f(a);
|
|
48
|
+
return f(a);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function t() {
|
|
52
|
+
var l;
|
|
53
|
+
return (l = i == null ? void 0 : i()) != null && l.match(/builder\.io/) && !e.noWebp ? i().replace(/\?/g, "?format=webp&") : "";
|
|
54
|
+
}
|
|
55
|
+
function n() {
|
|
56
|
+
const l = {
|
|
57
|
+
position: "absolute",
|
|
58
|
+
height: "100%",
|
|
59
|
+
width: "100%",
|
|
60
|
+
left: "0px",
|
|
61
|
+
top: "0px"
|
|
62
|
+
};
|
|
63
|
+
return e.aspectRatio ? l : void 0;
|
|
64
|
+
}
|
|
65
|
+
return y(() => {
|
|
66
|
+
}, []), /* @__PURE__ */ d(m, { children: [
|
|
67
|
+
/* @__PURE__ */ o("style", { children: `.img-3cc22d08 {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
transition: opacity 0.2s ease-in-out;
|
|
70
|
+
}.div-3cc22d08 {
|
|
71
|
+
width: 100%;
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
font-size: 0;
|
|
74
|
+
}.div-3cc22d08-2 {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
align-items: stretch;
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
left: 0;
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}` }),
|
|
84
|
+
/* @__PURE__ */ d(m, { children: [
|
|
85
|
+
/* @__PURE__ */ d("picture", { children: [
|
|
86
|
+
t() ? /* @__PURE__ */ o("source", { type: "image/webp", srcSet: t() }) : null,
|
|
87
|
+
/* @__PURE__ */ o(
|
|
88
|
+
"img",
|
|
89
|
+
{
|
|
90
|
+
loading: e.highPriority ? "eager" : "lazy",
|
|
91
|
+
fetchPriority: e.highPriority ? "high" : "auto",
|
|
92
|
+
alt: e.altText,
|
|
93
|
+
title: e.title,
|
|
94
|
+
role: e.altText ? void 0 : "presentation",
|
|
95
|
+
style: {
|
|
96
|
+
objectPosition: e.backgroundPosition || "center",
|
|
97
|
+
objectFit: e.backgroundSize || "cover",
|
|
98
|
+
...n()
|
|
99
|
+
},
|
|
100
|
+
className: "builder-image" + (e.className ? " " + e.className : "") + " img-3cc22d08",
|
|
101
|
+
src: e.image,
|
|
102
|
+
srcSet: i(),
|
|
103
|
+
sizes: e.sizes
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
] }),
|
|
107
|
+
e.aspectRatio && !((r = (c = e.builderBlock) == null ? void 0 : c.children) != null && r.length && e.fitContent) ? /* @__PURE__ */ o(
|
|
108
|
+
"div",
|
|
109
|
+
{
|
|
110
|
+
className: "builder-image-sizer div-3cc22d08",
|
|
111
|
+
style: {
|
|
112
|
+
paddingTop: e.aspectRatio * 100 + "%"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
) : null,
|
|
116
|
+
(h = (u = e.builderBlock) == null ? void 0 : u.children) != null && h.length && e.fitContent ? /* @__PURE__ */ o(m, { children: e.children }) : null,
|
|
117
|
+
!e.fitContent && ((g = (s = e.builderBlock) == null ? void 0 : s.children) != null && g.length) ? /* @__PURE__ */ o("div", { className: "div-3cc22d08-2", children: e.children }) : null
|
|
118
|
+
] })
|
|
119
|
+
] });
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
R as default
|
|
123
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { isEditing as r } from "./server-entry-71badd34.js";
|
|
3
|
+
import { getClassPropName as a } from "./get-class-prop-name-35ccd32a.js";
|
|
4
|
+
function g(t) {
|
|
5
|
+
var e;
|
|
6
|
+
function n() {
|
|
7
|
+
const i = {
|
|
8
|
+
...t.attributes,
|
|
9
|
+
[a()]: `builder-raw-img ${t.attributes[a()] || ""}`
|
|
10
|
+
};
|
|
11
|
+
return delete i.style, i;
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ o(
|
|
14
|
+
"img",
|
|
15
|
+
{
|
|
16
|
+
loading: "lazy",
|
|
17
|
+
alt: t.altText,
|
|
18
|
+
title: t.title,
|
|
19
|
+
src: t.imgSrc || t.image,
|
|
20
|
+
...n(),
|
|
21
|
+
style: {
|
|
22
|
+
objectFit: t.backgroundSize || "cover",
|
|
23
|
+
objectPosition: t.backgroundPosition || "center",
|
|
24
|
+
aspectRatio: t.aspectRatio || void 0,
|
|
25
|
+
...((e = t.attributes) == null ? void 0 : e.style) || {}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
r() && t.imgSrc || "default-key"
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
g as default
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("./server-entry-0bef3cb1.cjs"),a=require("./get-class-prop-name-d2be9a48.cjs");function l(t){var e;function r(){const i={...t.attributes,[a.getClassPropName()]:`builder-raw-img ${t.attributes[a.getClassPropName()]||""}`};return delete i.style,i}return n.jsx("img",{loading:"lazy",alt:t.altText,title:t.title,src:t.imgSrc||t.image,...r(),style:{objectFit:t.backgroundSize||"cover",objectPosition:t.backgroundPosition||"center",aspectRatio:t.aspectRatio||void 0,...((e=t.attributes)==null?void 0:e.style)||{}}},c.isEditing()&&t.imgSrc||"default-key")}exports.default=l;
|
package/lib/edge/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-0bef3cb1.cjs");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.registerAction=e.registerAction;exports.setClientUserAttributes=e.setClientUserAttributes;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/edge/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Blocks as i, BuilderContext as o, Button as s, Columns as n, Content as c, Fragment as g, Image as m, Section as a, Symbol as l, Text as u, Video as d } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as C, createRegisterComponentMessage as f, fetchBuilderProps as B, fetchEntries as E, fetchOneEntry as b, getBuilderSearchParams as h, isEditing as x, isPreviewing as S, register as P, registerAction as k, setClientUserAttributes as y, setEditorSettings as A, subscribeToEditor as R, track as T } from "./server-entry-
|
|
2
|
+
import { _processContentResult as C, createRegisterComponentMessage as f, fetchBuilderProps as B, fetchEntries as E, fetchOneEntry as b, getBuilderSearchParams as h, isEditing as x, isPreviewing as S, register as P, registerAction as k, setClientUserAttributes as y, setEditorSettings as A, subscribeToEditor as R, track as T } from "./server-entry-71badd34.js";
|
|
3
3
|
import "react";
|
|
4
4
|
export {
|
|
5
5
|
i as Blocks,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),u=require("./server-entry-0bef3cb1.cjs");function a(e){return t.createElement("input",{...e.attributes,key:u.isEditing()&&e.defaultValue?e.defaultValue:"default-key",placeholder:e.placeholder,type:e.type,name:e.name,value:e.value,defaultValue:e.defaultValue,required:e.required})}exports.default=a;
|
package/lib/edge/{personalization-container-64f3cd71.js → personalization-container-adf9e0bd.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as v, jsx as l, Fragment as j } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as Q, useState as c, useEffect as z } from "react";
|
|
3
|
-
import { Blocks as m, InlinedStyles as X } from "./blocks-
|
|
4
|
-
import { getPersonalizationScript as J, getUpdateVisibilityStylesScript as M, checkShouldRenderVariants as Y, DEFAULT_INDEX as C, SDKS_REQUIRING_RESET_APPROACH as f, InlinedScript as h, filterWithCustomTargeting as Z, getBlocksToRender as p } from "./content-variants-
|
|
5
|
-
import { userAttributesService as N, getDefaultCanTrack as tt, TARGET as b, isEditing as et, isPreviewing as it } from "./server-entry-
|
|
6
|
-
import { getClassPropName as O } from "./get-class-prop-name-
|
|
3
|
+
import { Blocks as m, InlinedStyles as X } from "./blocks-b9be7dc1.js";
|
|
4
|
+
import { getPersonalizationScript as J, getUpdateVisibilityStylesScript as M, checkShouldRenderVariants as Y, DEFAULT_INDEX as C, SDKS_REQUIRING_RESET_APPROACH as f, InlinedScript as h, filterWithCustomTargeting as Z, getBlocksToRender as p } from "./content-variants-c013569a.js";
|
|
5
|
+
import { userAttributesService as N, getDefaultCanTrack as tt, TARGET as b, isEditing as et, isPreviewing as it } from "./server-entry-71badd34.js";
|
|
6
|
+
import { getClassPropName as O } from "./get-class-prop-name-35ccd32a.js";
|
|
7
7
|
import "./blocks-exports.mjs";
|
|
8
8
|
import "./dynamic-renderer-8b343325.js";
|
|
9
9
|
function mt(t) {
|
package/lib/edge/{personalization-container-f7030f08.cjs → personalization-container-f7fdc090.cjs}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),k=require("./blocks-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),l=require("react"),k=require("./blocks-4f20c19a.cjs"),r=require("./content-variants-4f54d98a.cjs"),s=require("./server-entry-0bef3cb1.cjs"),U=require("./get-class-prop-name-d2be9a48.cjs");require("./blocks-exports.cjs");require("./dynamic-renderer-b29b45ca.cjs");function O(e){var h,R,B,g,m,T,y,A,P,I,$,j,D;const u=l.useRef(null),[V,q]=l.useState(()=>s.userAttributesService.getUserAttributes()),[C,F]=l.useState(()=>{var t,n,i;return r.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)}),[N,H]=l.useState(()=>{var t,n,i;return r.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)}),[x,L]=l.useState(()=>[]),[E,z]=l.useState(()=>{var t;return r.checkShouldRenderVariants(e.variants,s.getDefaultCanTrack((t=e.builderContext)==null?void 0:t.canTrack))}),[v,w]=l.useState(()=>!1);function G(){return{...e.attributes,[U.getClassPropName()]:`builder-personalization-container ${e.attributes[U.getClassPropName()]||""}`}}function f(){return(e.variants||[]).filter(t=>{var n,i,o,c;return r.filterWithCustomTargeting({...(i=(n=e.builderContext)==null?void 0:n.rootState)!=null&&i.locale?{locale:(c=(o=e.builderContext)==null?void 0:o.rootState)==null?void 0:c.locale}:{},...V},t.query,t.startDate,t.endDate)})}function d(){var t;return r.getBlocksToRender({variants:e.variants,fallbackBlocks:(t=e.builderBlock)==null?void 0:t.children,isHydrated:v,filteredVariants:f(),previewingIndex:e.previewingIndex})}function W(){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 l.useEffect(()=>{var n;w(!0);const t=s.userAttributesService.subscribeOnUserAttributesChange(i=>{q(i)},{fireImmediately:s.TARGET==="qwik"});if(!(s.isEditing()||s.isPreviewing())){const i=f()[0];u.current&&(u.current.dispatchEvent(new CustomEvent("builder.variantLoaded",{detail:{variant:i||r.DEFAULT_INDEX,content:(n=e.builderContext)==null?void 0:n.content},bubbles:!0})),new IntersectionObserver(c=>{c.forEach(S=>{var b;S.isIntersecting&&u.current&&u.current.dispatchEvent(new CustomEvent("builder.variantDisplayed",{detail:{variant:i||r.DEFAULT_INDEX,content:(b=e.builderContext)==null?void 0:b.content},bubbles:!0}))})}).observe(u.current))}x.push(t)},[]),l.useEffect(()=>()=>{x.forEach(t=>t())},[]),a.jsxs("div",{ref:u,...G(),children:[v&&r.SDKS_REQUIRING_RESET_APPROACH.includes(s.TARGET)?a.jsx(k.Blocks,{blocks:d().blocks,parent:(h=e.builderBlock)==null?void 0:h.id,path:d().path,context:e.builderContext,registeredComponents:e.builderComponents,BlocksWrapperProps:{...(R=e.builderContext)==null?void 0:R.BlocksWrapperProps,"data-variant-id":`${(B=e.builderBlock)==null?void 0:B.id}-${d().index}`}}):null,!v&&r.SDKS_REQUIRING_RESET_APPROACH.includes(s.TARGET)||!r.SDKS_REQUIRING_RESET_APPROACH.includes(s.TARGET)?a.jsxs(a.Fragment,{children:[E?a.jsxs(a.Fragment,{children:[a.jsx(k.InlinedStyles,{nonce:((g=e.builderContext)==null?void 0:g.nonce)||"",styles:W(),id:`variants-styles-${(m=e.builderBlock)==null?void 0:m.id}`}),a.jsx(r.InlinedScript,{nonce:((T=e.builderContext)==null?void 0:T.nonce)||"",scriptStr:N,id:`variants-visibility-script-${(y=e.builderBlock)==null?void 0:y.id}`}),(A=e.variants)==null?void 0:A.map((t,n)=>{var i,o,c,S,b,_;return a.jsx(k.Blocks,{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:(c=e.builderBlock)==null?void 0:c.id,path:`component.options.variants.${n}.blocks`,context:e.builderContext,registeredComponents:e.builderComponents,children:a.jsx(r.InlinedScript,{nonce:((S=e.builderContext)==null?void 0:S.nonce)||"",scriptStr:C,id:`variants-script-${(b=e.builderBlock)==null?void 0:b.id}-${n}`})},`${(_=e.builderBlock)==null?void 0:_.id}-${n}`)})]}):null,a.jsx(k.Blocks,{blocks:d().blocks,parent:(P=e.builderBlock)==null?void 0:P.id,path:d().path,context:e.builderContext,registeredComponents:e.builderComponents,BlocksWrapperProps:{...(I=e.builderContext)==null?void 0:I.BlocksWrapperProps,"data-variant-id":`${($=e.builderBlock)==null?void 0:$.id}-${d().index}`},children:E?a.jsx(r.InlinedScript,{nonce:((j=e.builderContext)==null?void 0:j.nonce)||"",scriptStr:C,id:`variants-script-${(D=e.builderBlock)==null?void 0:D.id}-${r.DEFAULT_INDEX}`}):null})]}):null]})}exports.default=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),r=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),n=require("react"),r=require("./server-entry-0bef3cb1.cjs");function i(e){var u;return n.createElement("select",{...e.attributes,value:e.value,key:r.isEditing()&&e.defaultValue?e.defaultValue:"default-key",defaultValue:e.defaultValue,name:e.name,required:e.required},(u=e.options)==null?void 0:u.map((t,a)=>l.jsx("option",{value:t.value,children:t.name||t.value},`${t.name}-${a}`)))}exports.default=i;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { createElement as m } from "react";
|
|
3
|
-
import { isEditing as n } from "./server-entry-
|
|
3
|
+
import { isEditing as n } from "./server-entry-71badd34.js";
|
|
4
4
|
function r(e) {
|
|
5
5
|
var t;
|
|
6
6
|
return /* @__PURE__ */ m(
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const b="react";function a(){return typeof window!="undefined"&&typeof document!="undefined"}const I="[Builder.io]: ",f={log:(...t)=>console.log(I,...t),error:(...t)=>console.error(I,...t),warn:(...t)=>console.warn(I,...t),debug:(...t)=>console.debug(I,...t)},S=t=>t!=null,St=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},v=({name:t,canTrack:e})=>{var r;try{return e?(r=document.cookie.split("; ").find(n=>n.startsWith(`${t}=`)))==null?void 0:r.split("=")[1]:void 0}catch(n){f.warn("[COOKIE] GET error: ",(n==null?void 0:n.message)||n);return}},j=async t=>v(t),bt=t=>t.map(([e,r])=>r?`${e}=${r}`:e).filter(S).join("; "),yt=[["secure",""],["SameSite","None"]],mt=({name:t,value:e,expires:r})=>{const s=(a()?location.protocol==="https:":!0)?yt:[[]],o=r?[["expires",r.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",St(window.location.hostname)],...s];return bt(i)},U=async({name:t,value:e,expires:r,canTrack:n})=>{try{if(!n)return;const s=mt({name:t,value:e,expires:r});document.cookie=s}catch(s){f.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};const N="builder.userAttributes";function V(){let t=!0;const e=new Set;return{setUserAttributes(r){if(!a())return;const n={...this.getUserAttributes(),...r};U({name:N,value:JSON.stringify(n),canTrack:t}),e.forEach(s=>s(n))},getUserAttributes(){return a()?JSON.parse(v({name:N,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(r,{fireImmediately:n}={}){return e.add(r),n&&r(this.getUserAttributes()),function(){e.delete(r)}},setCanTrack(r){t=r}}}let k;a()&&b==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=V()),k=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):k=V();const O=k,wt=t=>{O.setUserAttributes(t)},Et=t=>{const e={};return t.forEach((r,n)=>{e[n]=r}),e},$=t=>t instanceof URLSearchParams?Et(t):t,G=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function At(){return a()&&window.self!==window.top}function J(t){return At()&&G(t||window.location.search).indexOf("builder.frameEditing=")!==-1}function It(t){const e=t||(a()?window.location.search:void 0);return e?G(e).indexOf("builder.preview=")!==-1:!1}const vt=t=>({type:"builder.registerComponent",data:P(t)}),kt=t=>{const e=t.toString().trim(),r=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!r?"function ":""}${e}).apply(this, arguments)`};function P(t){return JSON.parse(JSON.stringify(t,(e,r)=>typeof r=="function"?kt(r):r))}const D={};function Tt(t,e){t==="plugin"&&(e=P(e));let r=D[t];if(r||(r=D[t]=[]),r.push(e),a()){const n={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(n,"*"),parent!==window&&window.postMessage(n,"*")}catch(s){console.debug("Could not postmessage",s)}}}function Ut(t){var e;if(a()){const r=JSON.parse(JSON.stringify(t));t.action&&(r.action=t.action.toString()),(e=window.parent)==null||e.postMessage({type:"builder.registerAction",data:r},"*")}}const F={};function Ot(t){if(a()){Object.assign(F,t);const e={type:"builder.settingsChange",data:F};parent.postMessage(e,"*")}}const M="builder.",Pt="options.",R=t=>{if(!t)return{};const e=$(t),r={};return Object.keys(e).forEach(n=>{if(n.startsWith(M)){const s=n.replace(M,"").replace(Pt,"");r[s]=e[n]}}),r},Rt=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return R(t)},z="4.2.3",X=()=>({"X-Builder-SDK":b,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z});function Ct(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function H(){return Ct().replace(/-/g,"")}const Q="builderSessionId",Bt=async({canTrack:t})=>{if(!t)return;const e=await j({name:Q,canTrack:t});if(S(e))return e;{const r=xt();return _t({id:r,canTrack:t}),r}},xt=()=>H(),_t=({id:t,canTrack:e})=>U({name:Q,value:t,canTrack:e}),Y=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,Lt=({key:t,canTrack:e})=>{var r;try{return e?(r=Y())==null?void 0:r.getItem(t):void 0}catch(n){console.debug("[LocalStorage] GET error: ",n);return}},Nt=({key:t,canTrack:e,value:r})=>{var n;try{e&&((n=Y())==null||n.setItem(t,r))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},Z="builderVisitorId",Vt=({canTrack:t})=>{if(!t)return;const e=Lt({key:Z,canTrack:t});if(S(e))return e;{const r=Dt();return Ft({id:r,canTrack:t}),r}},Dt=()=>H(),Ft=({id:t,canTrack:e})=>Nt({key:Z,value:t,canTrack:e});function q(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&f.log(t)}const Mt=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Kt=()=>typeof navigator=="object"&&navigator.userAgent||"",tt=()=>{const t=Kt(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||b==="reactNative"}},r=t.match(/Tablet|iPad/i),n=Mt();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:r?"tablet":e.any()?"mobile":"desktop"}},Wt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await Bt({canTrack:t}),r=Vt({canTrack:t});return{sessionId:e,visitorId:r}},jt=async({type:t,canTrack:e,apiKey:r,metadata:n,...s})=>({type:t,data:{...s,metadata:{url:location.href,...n},...await Wt({canTrack:e}),userAttributes:tt(),ownerId:r}});async function et({apiHost:t,...e}){if(!e.apiKey){f.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||J()||!(a()||b==="reactNative"))return;const n=`${t||"https://cdn.builder.io"}/api/v1/track`;return q(n),fetch(n,{method:"POST",body:JSON.stringify({events:[await jt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const $t=t=>et({...t,canTrack:!0}),Gt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function rt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const r=new URL(e.origin),n=r.hostname;return(t||Gt).findIndex(s=>s.startsWith("*.")?n.endsWith(s.slice(1)):s===n)>-1}let K=!1;const nt=t=>{var e,r;K||(K=!0,a()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:b,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,modelName:t.modelName,apiKey:t.apiKey,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(r=window.parent)==null||r.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",n=>{var o,i;if(!rt(t.trustedHosts,n))return;const{data:s}=n;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,l=s.data.arguments||[],y=s.data.id,m=new Function(u);let d,h=null;try{d=m.apply(null,l)}catch(p){h=p}h?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:y,error:h.message}},"*"):d&&typeof d.then=="function"?d.then(p=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:y,result:p}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:d,id:y}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:r})=>n=>{if(!rt(e,n))return;const{data:s}=n;if(s)switch(s.type){case"builder.configureSdk":{r.configureSdk(s.data);break}case"builder.triggerAnimation":{r.animation(s.data);break}case"builder.resetState":{const o=s.data,i=o.model,u=o==null?void 0:o.state,l=o.editType;i===t&&u&&r.stateUpdate(u,l);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data,l=o.editType;i===t&&r.contentUpdate(u,l);break}}},Jt=({model:t,apiKey:e,callback:r,trustedHosts:n})=>{if(!a)return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};nt({modelName:t,apiKey:e});const s=st({callbacks:{contentUpdate:r,animation:()=>{},configureSdk:()=>{},stateUpdate:()=>{}},model:t,trustedHosts:n});return window.addEventListener("message",s),()=>{window.removeEventListener("message",s)}},zt="builder.tests",C=t=>`${zt}.${t}`,Xt=({contentId:t})=>j({name:C(t),canTrack:!0}),Ht=({contentId:t})=>v({name:C(t),canTrack:!0}),Qt=({contentId:t,value:e})=>U({name:C(t),value:e,canTrack:!0}),ot=t=>S(t.id)&&S(t.variations)&&Object.keys(t.variations).length>0,Yt=({id:t,variations:e})=>{var s;let r=0;const n=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(r+=i,n<r)return o}return t},it=t=>{const e=Yt(t);return Qt({contentId:t.id,value:e}).catch(r=>{f.error("could not store A/B test variation: ",r)}),e},at=({item:t,testGroupId:e})=>{const r=t.variations[e];return e===t.id||!r?{testVariationId:t.id,testVariationName:"Default"}:{data:r.data,testVariationId:r.id,testVariationName:r.name||(r.id===t.id?"Default":"")}},Zt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const r=Ht({contentId:t.id})||it({variations:t.variations,id:t.id}),n=at({item:t,testGroupId:r});return{...t,...n}},qt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const n=await Xt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:n});return{...t,...s}},ct=t=>{const e=S(t)?t:!0;return O.setCanTrack(e),e};function te(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function ee(){const t=te().fetch;if(typeof t=="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 t}const re=ee();function T(t,e=null,r="."){return Object.keys(t).reduce((n,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(r);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...n,...T(o,i,r)}:{...n,[i]:o}},{})}function ut(t,e,r={}){for(const n in t){const s=t[n],o=e?e+"."+n:n;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?ut(s,o,r):r[o]=s}return r}function ne(t){const e={};for(const r in t){const n=r.split(".");let s=e;for(let o=0;o<n.length;o++){const i=n[o];o===n.length-1?s[i]=t[r]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",W=t=>typeof t=="number"&&!isNaN(t)&&t>=0,B=t=>{const{limit:e=30,userAttributes:r,query:n,model:s,apiKey:o,enrich:i,locale:u,apiVersion:l=se,fields:y,omit:m,offset:d,cacheSeconds:h,staleCacheSeconds:p,sort:w,includeUnpublished:x,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const ht=e!==1,pt=gt||"https://cdn.builder.io",c=new URL(`${pt}/api/${l}/content/${s}`);c.searchParams.set("apiKey",o),c.searchParams.set("limit",String(e)),c.searchParams.set("noTraverse",String(ht)),c.searchParams.set("includeRefs",String(!0)),u&&c.searchParams.set("locale",u);let A=r||{};if(i&&c.searchParams.set("enrich",String(i)),c.searchParams.set("omit",m!=null?m:"meta.componentsUsed"),y&&c.searchParams.set("fields",y),Number.isFinite(d)&&d>-1&&c.searchParams.set("offset",String(Math.floor(d))),typeof x=="boolean"&&c.searchParams.set("includeUnpublished",String(x)),h&&W(h)&&c.searchParams.set("cacheSeconds",String(h)),p&&W(p)&&c.searchParams.set("staleCacheSeconds",String(p)),w){const g=T({sort:w});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}const _={...Rt(),...$(t.options||{})};A={...A,...ie(_)};const L=T(_);for(const g in L)c.searchParams.set(g,String(L[g]));if(Object.keys(A).length>0&&c.searchParams.set("userAttributes",JSON.stringify(A)),n){const g=ut({query:n});for(const E in g)c.searchParams.set(E,JSON.stringify(g[E]))}return c},oe=t=>{const e={};for(const r in t)r.startsWith("userAttributes.")&&(e[r]=t[r],delete t[r]);return e},ie=t=>{if(a()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:r}=ne(e);return r}return{}},ae=t=>"results"in t;async function lt(t){var n;const e=t.locale||((n=t.userAttributes)==null?void 0:n.locale);e&&(t.locale=e,t.userAttributes={locale:e,...t.userAttributes});const r=await ft({...t,limit:1});return r&&r[0]||null}const ce=async t=>{var i,u;const e=B(t),r=(i=t.fetch)!=null?i:re,n={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...X()}};return await(await r(e.href,n)).json()},dt=async(t,e,r=B(t))=>{const n=ct(t.canTrack);if(r.search.includes("preview="),!n||!(a()||b==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await qt({item:o,canTrack:n}));e.results=s}catch(s){f.error("Could not process A/B tests. ",s)}return e.results};async function ft(t){const e=B(t),r=await ce(t);if(!ae(r))throw f.error("Error fetching data. ",{url:e,content:r,options:t}),r;return dt(t,r)}const ue=async t=>{var n,s,o;const e=t.path||((n=t.url)==null?void 0:n.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),r={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:R(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:r.apiKey,model:r.model,content:await lt(r)}};exports.TARGET=b;exports._processContentResult=dt;exports._track=et;exports.checkIsDefined=S;exports.createEditorListener=st;exports.createRegisterComponentMessage=vt;exports.fetchBuilderProps=ue;exports.fetchEntries=ft;exports.fetchOneEntry=lt;exports.getBuilderSearchParams=R;exports.getCookieSync=v;exports.getDefaultCanTrack=ct;exports.getUserAttributes=tt;exports.handleABTestingSync=Zt;exports.isBrowser=a;exports.isEditing=J;exports.isPreviewing=It;exports.logFetch=q;exports.logger=f;exports.register=Tt;exports.registerAction=Ut;exports.serializeIncludingFunctions=P;exports.setClientUserAttributes=wt;exports.setEditorSettings=Ot;exports.setupBrowserForEditing=nt;exports.subscribeToEditor=Jt;exports.track=$t;exports.userAttributesService=O;
|