@builder.io/sdk-react 3.0.6 → 3.0.7
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 +16 -16
- package/lib/browser/blocks-exports.mjs +540 -515
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{server-entry-df5e89e5.js → server-entry-20c79b90.js} +28 -27
- package/lib/browser/{server-entry-a1c64831.cjs → server-entry-762e29e0.cjs} +2 -2
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/{accordion-fbfb71f4.cjs → accordion-071aa4f9.cjs} +1 -1
- package/lib/edge/{accordion-289f3464.js → accordion-22c2c037.js} +1 -1
- package/lib/edge/{blocks-582a7fd7.js → blocks-2989e629.js} +1305 -1280
- package/lib/edge/blocks-d3f37507.cjs +30 -0
- package/lib/edge/blocks-exports.cjs +1 -1
- package/lib/edge/blocks-exports.mjs +2 -2
- package/lib/edge/{button-9b112da6.js → button-2b5270c4.js} +2 -2
- package/lib/edge/{button-da357144.cjs → button-a2cc6565.cjs} +1 -1
- package/lib/edge/{columns-aba58dda.js → columns-21b9be25.js} +3 -3
- package/lib/edge/{columns-a211113f.cjs → columns-b7240242.cjs} +1 -1
- package/lib/edge/{content-variants-08f4371c.js → content-variants-88f4dc64.js} +10 -10
- package/lib/edge/{content-variants-4b5899b5.cjs → content-variants-fdd5ee50.cjs} +1 -1
- package/lib/edge/{form-e3a3afd4.cjs → form-77687883.cjs} +1 -1
- package/lib/edge/{form-4d4553c2.js → form-d29f3cc0.js} +3 -3
- package/lib/edge/{get-class-prop-name-38c2baca.js → get-class-prop-name-dbc5d99c.js} +1 -1
- package/lib/edge/{get-class-prop-name-fbe244e3.cjs → get-class-prop-name-f597545d.cjs} +1 -1
- package/lib/edge/{img-8d549af8.cjs → img-03f9002b.cjs} +1 -1
- package/lib/edge/{img-c49066fa.js → img-fed70928.js} +1 -1
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/edge/{input-e7301f4e.js → input-083c3c35.js} +1 -1
- package/lib/edge/{input-1ae3842f.cjs → input-1e548fd0.cjs} +1 -1
- package/lib/edge/{personalization-container-035be6ba.js → personalization-container-bcff3433.js} +4 -4
- package/lib/edge/{personalization-container-25cd8b5e.cjs → personalization-container-dde10a09.cjs} +1 -1
- package/lib/edge/{select-64fdaa79.cjs → select-21e33225.cjs} +1 -1
- package/lib/edge/{select-4187b229.js → select-9f22c2ba.js} +1 -1
- package/lib/edge/{server-entry-61fca4f7.js → server-entry-43a6f5be.js} +28 -27
- package/lib/edge/{server-entry-2ef4e66a.cjs → server-entry-ac35a5c8.cjs} +2 -2
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/edge/{slot-995f63c2.cjs → slot-a9f5d6c0.cjs} +1 -1
- package/lib/edge/{slot-d6c46a42.js → slot-ca171e8c.js} +3 -3
- package/lib/edge/{symbol-623dc717.js → symbol-8f6ff028.js} +2 -2
- package/lib/edge/{symbol-498daa97.cjs → symbol-a2015c7e.cjs} +1 -1
- package/lib/edge/{tabs-12ba41b1.js → tabs-6b67fca2.js} +3 -3
- package/lib/edge/{tabs-d39499cd.cjs → tabs-880c9088.cjs} +1 -1
- package/lib/node/blocks-exports.cjs +14 -14
- package/lib/node/blocks-exports.mjs +357 -332
- 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-98ebff74.cjs → server-entry-0b433783.cjs} +2 -2
- package/lib/node/{server-entry-27d9d31e.js → server-entry-6626257d.js} +28 -27
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/lib/node/{setIvm-784fe19f.cjs → setIvm-49abbae6.cjs} +1 -1
- package/lib/node/{setIvm-2dde9074.js → setIvm-5cb298bf.js} +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-cd6baa94.cjs → should-force-browser-runtime-in-node-11e8399e.cjs} +1 -1
- package/lib/node/{should-force-browser-runtime-in-node-80f081c8.js → should-force-browser-runtime-in-node-94f1a5b3.js} +1 -1
- package/package.json +1 -1
- package/types/constants/device-sizes.d.ts +3 -2
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/types/builder-block.d.ts +0 -1
- package/types/types/builder-content.d.ts +1 -0
- package/lib/edge/blocks-459a090b.cjs +0 -30
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-762e29e0.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.setClientUserAttributes=e.setClientUserAttributes;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 o, BuilderContext as s, Button as n, Columns as c, Content as m, Fragment as g, Image as a, Section as l, Symbol as u, Text as d, Video as p } from "./blocks-exports.mjs";
|
|
2
|
-
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, setClientUserAttributes as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-
|
|
2
|
+
import { _processContentResult as f, createRegisterComponentMessage as B, fetchBuilderProps as E, fetchEntries as b, fetchOneEntry as h, getBuilderSearchParams as x, isEditing as S, isPreviewing as P, register as k, setClientUserAttributes as y, setEditorSettings as R, subscribeToEditor as T, track as v } from "./server-entry-20c79b90.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
export {
|
|
@@ -67,11 +67,11 @@ const ne = (t) => ({
|
|
|
67
67
|
function j(t) {
|
|
68
68
|
return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? dt(n) : n));
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const R = {};
|
|
71
71
|
function ft(t, e) {
|
|
72
72
|
t === "plugin" && (e = j(e));
|
|
73
|
-
let n =
|
|
74
|
-
if (n || (n =
|
|
73
|
+
let n = R[t];
|
|
74
|
+
if (n || (n = R[t] = []), n.push(e), c()) {
|
|
75
75
|
const r = {
|
|
76
76
|
type: "builder.register",
|
|
77
77
|
data: {
|
|
@@ -112,7 +112,7 @@ const V = "builder.", ht = "options.", W = (t) => {
|
|
|
112
112
|
return {};
|
|
113
113
|
const t = new URLSearchParams(window.location.search);
|
|
114
114
|
return W(t);
|
|
115
|
-
}, _ = "3.0.
|
|
115
|
+
}, _ = "3.0.7", $ = () => ({
|
|
116
116
|
"X-Builder-SDK": v,
|
|
117
117
|
"X-Builder-SDK-GEN": "2",
|
|
118
118
|
"X-Builder-SDK-Version": _
|
|
@@ -167,13 +167,13 @@ function St() {
|
|
|
167
167
|
function J() {
|
|
168
168
|
return St().replace(/-/g, "");
|
|
169
169
|
}
|
|
170
|
-
const
|
|
170
|
+
const X = "builderSessionId", wt = async ({
|
|
171
171
|
canTrack: t
|
|
172
172
|
}) => {
|
|
173
173
|
if (!t)
|
|
174
174
|
return;
|
|
175
175
|
const e = await G({
|
|
176
|
-
name:
|
|
176
|
+
name: X,
|
|
177
177
|
canTrack: t
|
|
178
178
|
});
|
|
179
179
|
if (y(e))
|
|
@@ -189,16 +189,16 @@ const z = "builderSessionId", wt = async ({
|
|
|
189
189
|
id: t,
|
|
190
190
|
canTrack: e
|
|
191
191
|
}) => P({
|
|
192
|
-
name:
|
|
192
|
+
name: X,
|
|
193
193
|
value: t,
|
|
194
194
|
canTrack: e
|
|
195
|
-
}),
|
|
195
|
+
}), z = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, kt = ({
|
|
196
196
|
key: t,
|
|
197
197
|
canTrack: e
|
|
198
198
|
}) => {
|
|
199
199
|
var n;
|
|
200
200
|
try {
|
|
201
|
-
return e ? (n =
|
|
201
|
+
return e ? (n = z()) == null ? void 0 : n.getItem(t) : void 0;
|
|
202
202
|
} catch (r) {
|
|
203
203
|
console.debug("[LocalStorage] GET error: ", r);
|
|
204
204
|
return;
|
|
@@ -210,17 +210,17 @@ const z = "builderSessionId", wt = async ({
|
|
|
210
210
|
}) => {
|
|
211
211
|
var r;
|
|
212
212
|
try {
|
|
213
|
-
e && ((r =
|
|
213
|
+
e && ((r = z()) == null || r.setItem(t, n));
|
|
214
214
|
} catch (s) {
|
|
215
215
|
console.debug("[LocalStorage] SET error: ", s);
|
|
216
216
|
}
|
|
217
|
-
},
|
|
217
|
+
}, H = "builderVisitorId", Et = ({
|
|
218
218
|
canTrack: t
|
|
219
219
|
}) => {
|
|
220
220
|
if (!t)
|
|
221
221
|
return;
|
|
222
222
|
const e = kt({
|
|
223
|
-
key:
|
|
223
|
+
key: H,
|
|
224
224
|
canTrack: t
|
|
225
225
|
});
|
|
226
226
|
if (y(e))
|
|
@@ -236,7 +236,7 @@ const z = "builderSessionId", wt = async ({
|
|
|
236
236
|
id: t,
|
|
237
237
|
canTrack: e
|
|
238
238
|
}) => At({
|
|
239
|
-
key:
|
|
239
|
+
key: H,
|
|
240
240
|
value: t,
|
|
241
241
|
canTrack: e
|
|
242
242
|
});
|
|
@@ -310,12 +310,12 @@ async function xt({
|
|
|
310
310
|
const se = (t) => xt({
|
|
311
311
|
...t,
|
|
312
312
|
canTrack: !0
|
|
313
|
-
}),
|
|
313
|
+
}), Bt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
314
314
|
function Q(t, e) {
|
|
315
315
|
if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
|
|
316
316
|
return !1;
|
|
317
317
|
const n = new URL(e.origin), r = n.hostname;
|
|
318
|
-
return (t ||
|
|
318
|
+
return (t || Bt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
|
|
319
319
|
}
|
|
320
320
|
const oe = () => {
|
|
321
321
|
ft("insertMenu", {
|
|
@@ -341,7 +341,7 @@ const oe = () => {
|
|
|
341
341
|
});
|
|
342
342
|
};
|
|
343
343
|
let N = !1;
|
|
344
|
-
const
|
|
344
|
+
const Rt = (t = {}) => {
|
|
345
345
|
var e, n;
|
|
346
346
|
N || (N = !0, c() && ((e = window.parent) == null || e.postMessage({
|
|
347
347
|
type: "builder.sdkInfo",
|
|
@@ -353,6 +353,7 @@ const Bt = (t = {}) => {
|
|
|
353
353
|
// scope our '+ add block' button styling
|
|
354
354
|
supportsAddBlockScoping: !0,
|
|
355
355
|
supportsCustomBreakpoints: !0,
|
|
356
|
+
supportsXSmallBreakpoint: !0,
|
|
356
357
|
blockLevelPersonalization: !0
|
|
357
358
|
}
|
|
358
359
|
}, "*"), (n = window.parent) == null || n.postMessage({
|
|
@@ -433,7 +434,7 @@ const Bt = (t = {}) => {
|
|
|
433
434
|
if (!c)
|
|
434
435
|
return f.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
435
436
|
};
|
|
436
|
-
|
|
437
|
+
Rt();
|
|
437
438
|
const r = Lt({
|
|
438
439
|
callbacks: {
|
|
439
440
|
contentUpdate: e,
|
|
@@ -624,7 +625,7 @@ function Jt(t) {
|
|
|
624
625
|
}
|
|
625
626
|
return e;
|
|
626
627
|
}
|
|
627
|
-
const
|
|
628
|
+
const Xt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t) => {
|
|
628
629
|
const {
|
|
629
630
|
limit: e = 30,
|
|
630
631
|
userAttributes: n,
|
|
@@ -633,7 +634,7 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
|
|
|
633
634
|
apiKey: o,
|
|
634
635
|
enrich: i,
|
|
635
636
|
locale: u,
|
|
636
|
-
apiVersion: b =
|
|
637
|
+
apiVersion: b = Xt,
|
|
637
638
|
fields: p,
|
|
638
639
|
omit: k,
|
|
639
640
|
offset: l,
|
|
@@ -667,11 +668,11 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
|
|
|
667
668
|
};
|
|
668
669
|
m = {
|
|
669
670
|
...m,
|
|
670
|
-
...
|
|
671
|
+
...Ht(x)
|
|
671
672
|
};
|
|
672
|
-
const
|
|
673
|
-
for (const d in
|
|
674
|
-
a.searchParams.set(d, String(
|
|
673
|
+
const B = E(x);
|
|
674
|
+
for (const d in B)
|
|
675
|
+
a.searchParams.set(d, String(B[d]));
|
|
675
676
|
if (Object.keys(m).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(m)), r) {
|
|
676
677
|
const d = et({
|
|
677
678
|
query: r
|
|
@@ -680,15 +681,15 @@ const zt = "v3", D = (t) => typeof t == "number" && !isNaN(t) && t >= 0, U = (t)
|
|
|
680
681
|
a.searchParams.set(w, JSON.stringify(d[w]));
|
|
681
682
|
}
|
|
682
683
|
return a;
|
|
683
|
-
},
|
|
684
|
+
}, zt = (t) => {
|
|
684
685
|
const e = {};
|
|
685
686
|
for (const n in t)
|
|
686
687
|
n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
|
|
687
688
|
return e;
|
|
688
|
-
},
|
|
689
|
+
}, Ht = (t) => {
|
|
689
690
|
if (c() && t.preview === "BUILDER_STUDIO") {
|
|
690
691
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
691
|
-
const e =
|
|
692
|
+
const e = zt(t), {
|
|
692
693
|
userAttributes: n
|
|
693
694
|
} = Jt(e);
|
|
694
695
|
return n;
|
|
@@ -783,7 +784,7 @@ export {
|
|
|
783
784
|
j as serializeIncludingFunctions,
|
|
784
785
|
ce as setClientUserAttributes,
|
|
785
786
|
re as setEditorSettings,
|
|
786
|
-
|
|
787
|
+
Rt as setupBrowserForEditing,
|
|
787
788
|
ie as subscribeToEditor,
|
|
788
789
|
se as track,
|
|
789
790
|
tt as userAttributesService
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const y="react",E="[Builder.io]: ",d={log:(...t)=>console.log(E,...t),error:(...t)=>console.error(E,...t),warn:(...t)=>console.warn(E,...t),debug:(...t)=>console.debug(E,...t)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const mt=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},j=t=>t instanceof URLSearchParams?mt(t):t,W=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return c()&&window.self!==window.top}function $(t){return bt()&&W(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(c()){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},St=()=>typeof navigator=="object"&&navigator.userAgent||"",G=()=>{const t=St(),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()||y==="reactNative"}},n=t.match(/Tablet|iPad/i),r=yt();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},p=t=>t!=null;function wt(t){const e=t||(c()?window.location.search:void 0);return e?W(e).indexOf("builder.preview=")!==-1:!1}const vt=t=>({type:"builder.registerComponent",data:O(t)}),Et=t=>{const e=t.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!n?"function ":""}${e}).apply(this, arguments)`};function O(t){return JSON.parse(JSON.stringify(t,(e,n)=>typeof n=="function"?Et(n):n))}const V={};function J(t,e){t==="plugin"&&(e=O(e));let n=V[t];if(n||(n=V[t]=[]),n.push(e),c()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(s){console.debug("Could not postmessage",s)}}}const N={};function It(t){if(c()){Object.assign(N,t);const e={type:"builder.settingsChange",data:N};parent.postMessage(e,"*")}}const D="builder.",kt="options.",C=t=>{if(!t)return{};const e=j(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(D)){const s=r.replace(D,"").replace(kt,"");n[s]=e[r]}}),n},At=()=>{if(!c())return{};const t=new URLSearchParams(window.location.search);return C(t)},z="3.0.
|
|
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 ne=ee();function A(t,e=null,n="."){return Object.keys(t).reduce((r,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(n);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...r,...A(o,i,n)}:{...r,[i]:o}},{})}function ut(t,e,n={}){for(const r in t){const s=t[r],o=e?e+"."+r:r;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?ut(s,o,n):n[o]=s}return n}function re(t){const e={};for(const n in t){const r=n.split(".");let s=e;for(let o=0;o<r.length;o++){const i=r[o];o===r.length-1?s[i]=t[n]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",_=t=>typeof t=="number"&&!isNaN(t)&&t>=0,x=t=>{const{limit:e=30,userAttributes:n,query:r,model:s,apiKey:o,enrich:i,locale:u,apiVersion:S=se,fields:m,omit:I,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:R,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ht=e!==1,pt=gt||"https://cdn.builder.io",a=new URL(`${pt}/api/${S}/content/${s}`);a.searchParams.set("apiKey",o),a.searchParams.set("limit",String(e)),a.searchParams.set("noTraverse",String(ht)),a.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let b=n||{};if(k&&(a.searchParams.set("locale",k),b={locale:k,...b}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",I||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof R=="boolean"&&a.searchParams.set("includeUnpublished",String(R)),g&&_(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&_(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=A({sort:w});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}const L={...At(),...j(t.options||{})};b={...b,...ie(L)};const F=A(L);for(const f in F)a.searchParams.set(f,String(F[f]));if(Object.keys(b).length>0&&a.searchParams.set("userAttributes",JSON.stringify(b)),r){const f=ut({query:r});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}return a},oe=t=>{const e={};for(const n in t)n.startsWith("userAttributes.")&&(e[n]=t[n],delete t[n]);return e},ie=t=>{if(c()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:n}=re(e);return n}return{}},ae=t=>"results"in t;async function lt(t){const e=await ft({...t,limit:1});return e&&e[0]||null}const ce=async t=>{var i,u;const e=x(t),n=(i=t.fetch)!=null?i:ne,r={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...
|
|
1
|
+
"use strict";const y="react",E="[Builder.io]: ",d={log:(...t)=>console.log(E,...t),error:(...t)=>console.error(E,...t),warn:(...t)=>console.warn(E,...t),debug:(...t)=>console.debug(E,...t)};function c(){return typeof window!="undefined"&&typeof document!="undefined"}const mt=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},j=t=>t instanceof URLSearchParams?mt(t):t,W=t=>typeof t=="string"?t:t instanceof URLSearchParams?t.toString():new URLSearchParams(t).toString();function bt(){return c()&&window.self!==window.top}function $(t){return bt()&&W(t||window.location.search).indexOf("builder.frameEditing=")!==-1}const yt=()=>{if(c()){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},St=()=>typeof navigator=="object"&&navigator.userAgent||"",G=()=>{const t=St(),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()||y==="reactNative"}},n=t.match(/Tablet|iPad/i),r=yt();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},p=t=>t!=null;function wt(t){const e=t||(c()?window.location.search:void 0);return e?W(e).indexOf("builder.preview=")!==-1:!1}const vt=t=>({type:"builder.registerComponent",data:O(t)}),Et=t=>{const e=t.toString().trim(),n=/^[a-zA-Z0-9_]+\s*=>/i.test(e);return`return (${!e.startsWith("function")&&!e.startsWith("async")&&!e.startsWith("(")&&!n?"function ":""}${e}).apply(this, arguments)`};function O(t){return JSON.parse(JSON.stringify(t,(e,n)=>typeof n=="function"?Et(n):n))}const V={};function J(t,e){t==="plugin"&&(e=O(e));let n=V[t];if(n||(n=V[t]=[]),n.push(e),c()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(s){console.debug("Could not postmessage",s)}}}const N={};function It(t){if(c()){Object.assign(N,t);const e={type:"builder.settingsChange",data:N};parent.postMessage(e,"*")}}const D="builder.",kt="options.",C=t=>{if(!t)return{};const e=j(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(D)){const s=r.replace(D,"").replace(kt,"");n[s]=e[r]}}),n},At=()=>{if(!c())return{};const t=new URLSearchParams(window.location.search);return C(t)},z="3.0.7",X=()=>({"X-Builder-SDK":y,"X-Builder-SDK-GEN":"2","X-Builder-SDK-Version":z}),Ot=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},P=({name:t,canTrack:e})=>{var n;try{return e?(n=document.cookie.split("; ").find(r=>r.startsWith(`${t}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){d.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},H=async t=>P(t),Ct=t=>t.map(([e,n])=>n?`${e}=${n}`:e).filter(p).join("; "),Pt=[["secure",""],["SameSite","None"]],Tt=({name:t,value:e,expires:n})=>{const s=(c()?location.protocol==="https:":!0)?Pt:[[]],o=n?[["expires",n.toUTCString()]]:[[]],i=[[t,e],...o,["path","/"],["domain",Ot(window.location.hostname)],...s];return Ct(i)},T=async({name:t,value:e,expires:n,canTrack:r})=>{try{if(!r)return;const s=Tt({name:t,value:e,expires:n});document.cookie=s}catch(s){d.warn("[COOKIE] SET error: ",(s==null?void 0:s.message)||s)}};function Ut(){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 Q(){return Ut().replace(/-/g,"")}const Y="builderSessionId",Bt=async({canTrack:t})=>{if(!t)return;const e=await H({name:Y,canTrack:t});if(p(e))return e;{const n=xt();return Rt({id:n,canTrack:t}),n}},xt=()=>Q(),Rt=({id:t,canTrack:e})=>T({name:Y,value:t,canTrack:e}),Z=()=>c()&&typeof localStorage!="undefined"?localStorage:void 0,Lt=({key:t,canTrack:e})=>{var n;try{return e?(n=Z())==null?void 0:n.getItem(t):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},Ft=({key:t,canTrack:e,value:n})=>{var r;try{e&&((r=Z())==null||r.setItem(t,n))}catch(s){console.debug("[LocalStorage] SET error: ",s)}},q="builderVisitorId",Vt=({canTrack:t})=>{if(!t)return;const e=Lt({key:q,canTrack:t});if(p(e))return e;{const n=Nt();return Dt({id:n,canTrack:t}),n}},Nt=()=>Q(),Dt=({id:t,canTrack:e})=>Ft({key:q,value:t,canTrack:e});function tt(t){var e;typeof process!="undefined"&&((e=process.env)!=null&&e.DEBUG)&&String(process.env.DEBUG)=="true"&&d.log(t)}const Mt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await Bt({canTrack:t}),n=Vt({canTrack:t});return{sessionId:e,visitorId:n}},Kt=async({type:t,canTrack:e,apiKey:n,metadata:r,...s})=>({type:t,data:{...s,metadata:{url:location.href,...r},...await Mt({canTrack:e}),userAttributes:G(),ownerId:n}});async function et({apiHost:t,...e}){if(!e.apiKey){d.error("Missing API key for track call. Please provide your API key.");return}if(!e.canTrack||$()||!(c()||y==="reactNative"))return;const r=`${t||"https://cdn.builder.io"}/api/v1/track`;return tt(r),fetch(r,{method:"POST",body:JSON.stringify({events:[await Kt(e)]}),headers:{"content-type":"application/json",...X()},mode:"cors"}).catch(s=>{console.error("Failed to track: ",s)})}const _t=t=>et({...t,canTrack:!0}),jt=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function nt(t,e){if(!e.origin.startsWith("http")&&!e.origin.startsWith("https"))return!1;const n=new URL(e.origin),r=n.hostname;return(t||jt).findIndex(s=>s.startsWith("*.")?r.endsWith(s.slice(1)):s===r)>-1}const Wt=()=>{J("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 M=!1;const rt=(t={})=>{var e,n;M||(M=!0,c()&&((e=window.parent)==null||e.postMessage({type:"builder.sdkInfo",data:{target:y,version:z,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0,supportsXSmallBreakpoint:!0,blockLevelPersonalization:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:t}},"*"),window.addEventListener("message",r=>{var o,i;if(!nt(t.trustedHosts,r))return;const{data:s}=r;if(s!=null&&s.type)switch(s.type){case"builder.evaluate":{const u=s.data.text,S=s.data.arguments||[],m=s.data.id,I=new Function(u);let l,g=null;try{l=I.apply(null,S)}catch(h){g=h}g?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:m,error:g.message}},"*"):l&&typeof l.then=="function"?l.then(h=>{var w;(w=window.parent)==null||w.postMessage({type:"builder.evaluateResult",data:{id:m,result:h}},"*")}).catch(console.error):(i=window.parent)==null||i.postMessage({type:"builder.evaluateResult",data:{result:l,id:m}},"*");break}}})))},st=({model:t,trustedHosts:e,callbacks:n})=>r=>{if(!nt(e,r))return;const{data:s}=r;if(s)switch(s.type){case"builder.configureSdk":{n.configureSdk(s.data);break}case"builder.triggerAnimation":{n.animation(s.data);break}case"builder.contentUpdate":{const o=s.data,i=o.key||o.alias||o.entry||o.modelName,u=o.data;i===t&&n.contentUpdate(u);break}}},$t=(t,e,n)=>{if(!c)return d.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};rt();const r=st({callbacks:{contentUpdate:e,animation:()=>{},configureSdk:()=>{}},model:t,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}},Gt="builder.tests",U=t=>`${Gt}.${t}`,Jt=({contentId:t})=>H({name:U(t),canTrack:!0}),zt=({contentId:t})=>P({name:U(t),canTrack:!0}),Xt=({contentId:t,value:e})=>T({name:U(t),value:e,canTrack:!0}),ot=t=>p(t.id)&&p(t.variations)&&Object.keys(t.variations).length>0,Ht=({id:t,variations:e})=>{var s;let n=0;const r=Math.random();for(const o in e){const i=(s=e[o])==null?void 0:s.testRatio;if(n+=i,r<n)return o}return t},it=t=>{const e=Ht(t);return Xt({contentId:t.id,value:e}).catch(n=>{d.error("could not store A/B test variation: ",n)}),e},at=({item:t,testGroupId:e})=>{const n=t.variations[e];return e===t.id||!n?{testVariationId:t.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===t.id?"Default":"")}},Qt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!ot(t))return t;const n=zt({contentId:t.id})||it({variations:t.variations,id:t.id}),r=at({item:t,testGroupId:n});return{...t,...r}},Yt=async({item:t,canTrack:e})=>{if(!e||!ot(t))return t;const r=await Jt({contentId:t.id})||it({variations:t.variations,id:t.id}),s=at({item:t,testGroupId:r});return{...t,...s}},K="builder.userAttributes";function Zt(){let t=!0;const e=new Set;return{setUserAttributes(n){if(!c())return;const r={...this.getUserAttributes(),...n};T({name:K,value:JSON.stringify(r),canTrack:t}),e.forEach(s=>s(r))},getUserAttributes(){return c()?JSON.parse(P({name:K,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(n){return e.add(n),()=>{e.delete(n)}},setCanTrack(n){t=n}}}const B=Zt(),qt=t=>{B.setUserAttributes(t)},ct=t=>{const e=p(t)?t:!0;return B.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 ne=ee();function A(t,e=null,n="."){return Object.keys(t).reduce((r,s)=>{const o=t[s],i=[e,s].filter(Boolean).join(n);return[typeof o=="object",o!==null,!(Array.isArray(o)&&o.length===0)].every(Boolean)?{...r,...A(o,i,n)}:{...r,[i]:o}},{})}function ut(t,e,n={}){for(const r in t){const s=t[r],o=e?e+"."+r:r;s&&typeof s=="object"&&!Array.isArray(s)&&!Object.keys(s).find(i=>i.startsWith("$"))?ut(s,o,n):n[o]=s}return n}function re(t){const e={};for(const n in t){const r=n.split(".");let s=e;for(let o=0;o<r.length;o++){const i=r[o];o===r.length-1?s[i]=t[n]:(s[i]=s[i]||{},s=s[i])}}return e}const se="v3",_=t=>typeof t=="number"&&!isNaN(t)&&t>=0,x=t=>{const{limit:e=30,userAttributes:n,query:r,model:s,apiKey:o,enrich:i,locale:u,apiVersion:S=se,fields:m,omit:I,offset:l,cacheSeconds:g,staleCacheSeconds:h,sort:w,includeUnpublished:R,apiHost:gt}=t;if(!o)throw new Error("Missing API key");if(!["v3"].includes(S))throw new Error(`Invalid apiVersion: expected 'v3', received '${S}'`);const ht=e!==1,pt=gt||"https://cdn.builder.io",a=new URL(`${pt}/api/${S}/content/${s}`);a.searchParams.set("apiKey",o),a.searchParams.set("limit",String(e)),a.searchParams.set("noTraverse",String(ht)),a.searchParams.set("includeRefs",String(!0));const k=u||(n==null?void 0:n.locale);let b=n||{};if(k&&(a.searchParams.set("locale",k),b={locale:k,...b}),i&&a.searchParams.set("enrich",String(i)),a.searchParams.set("omit",I||"meta.componentsUsed"),m&&a.searchParams.set("fields",m),Number.isFinite(l)&&l>-1&&a.searchParams.set("offset",String(Math.floor(l))),typeof R=="boolean"&&a.searchParams.set("includeUnpublished",String(R)),g&&_(g)&&a.searchParams.set("cacheSeconds",String(g)),h&&_(h)&&a.searchParams.set("staleCacheSeconds",String(h)),w){const f=A({sort:w});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}const L={...At(),...j(t.options||{})};b={...b,...ie(L)};const F=A(L);for(const f in F)a.searchParams.set(f,String(F[f]));if(Object.keys(b).length>0&&a.searchParams.set("userAttributes",JSON.stringify(b)),r){const f=ut({query:r});for(const v in f)a.searchParams.set(v,JSON.stringify(f[v]))}return a},oe=t=>{const e={};for(const n in t)n.startsWith("userAttributes.")&&(e[n]=t[n],delete t[n]);return e},ie=t=>{if(c()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const e=oe(t),{userAttributes:n}=re(e);return n}return{}},ae=t=>"results"in t;async function lt(t){const e=await ft({...t,limit:1});return e&&e[0]||null}const ce=async t=>{var i,u;const e=x(t),n=(i=t.fetch)!=null?i:ne,r={...t.fetchOptions,headers:{...(u=t.fetchOptions)==null?void 0:u.headers,...X()}};return await(await n(e.href,r)).json()},dt=async(t,e,n=x(t))=>{const r=ct(t.canTrack);if(n.search.includes("preview="),!r||!(c()||y==="reactNative"))return e.results;try{const s=[];for(const o of e.results)s.push(await Yt({item:o,canTrack:r}));e.results=s}catch(s){d.error("Could not process A/B tests. ",s)}return e.results};async function ft(t){const e=x(t),n=await ce(t);if(!ae(n))throw d.error("Error fetching data. ",{url:e,content:n,options:t}),n;return dt(t,n)}const ue=async t=>{var r,s,o;const e=t.path||((r=t.url)==null?void 0:r.pathname)||((s=t.userAttributes)==null?void 0:s.urlPath),n={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:C(t.searchParams||((o=t.url)==null?void 0:o.searchParams)||t.options)};return{apiKey:n.apiKey,model:n.model,content:await lt(n)}};exports.TARGET=y;exports._processContentResult=dt;exports._track=et;exports.checkIsDefined=p;exports.createEditorListener=st;exports.createRegisterComponentMessage=vt;exports.fetchBuilderProps=ue;exports.fetchEntries=ft;exports.fetchOneEntry=lt;exports.getBuilderSearchParams=C;exports.getDefaultCanTrack=ct;exports.getUserAttributes=G;exports.handleABTestingSync=Qt;exports.isBrowser=c;exports.isEditing=$;exports.isPreviewing=wt;exports.logFetch=tt;exports.logger=d;exports.register=J;exports.registerInsertMenu=Wt;exports.serializeIncludingFunctions=O;exports.setClientUserAttributes=qt;exports.setEditorSettings=It;exports.setupBrowserForEditing=rt;exports.subscribeToEditor=$t;exports.track=_t;exports.userAttributesService=B;
|
|
@@ -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-762e29e0.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-20c79b90.js";
|
|
2
2
|
export {
|
|
3
3
|
r as _processContentResult,
|
|
4
4
|
s as createRegisterComponentMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),j=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react/jsx-runtime"),j=require("react"),g=require("./blocks-exports.cjs");require("./server-entry-ac35a5c8.cjs");function S(e){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(i,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return i.default=e,Object.freeze(i)}const v=S(j),y=e=>e.toString();function p(e){var u;const[i,r]=j.useState(()=>[]);function s(){return!!(e.grid||e.oneAtATime)}function O(){return{display:"flex",alignItems:"stretch",flexDirection:"column",...e.grid&&{flexDirection:"row",alignItems:"flex-start",flexWrap:"wrap"}}}function C(){const n={...{display:"flex",flexDirection:"column"},alignItems:"stretch",cursor:"pointer"};return Object.fromEntries(Object.entries(n).filter(([l,a])=>a!==void 0))}function h(t){return`builder-accordion-title builder-accordion-title-${i.includes(t)?"open":"closed"}`}function k(t){return`builder-accordion-detail builder-accordion-detail-${i.includes(t)?"open":"closed"}`}function d(){let t=null;if(e.grid&&i.length&&document){const l=i[0];let o=document.querySelector(`.builder-accordion-title[data-index="${l}"]`);if(t=l,o){let m=o.getBoundingClientRect();for(;o=o&&o.nextElementSibling;)if(o){if(o.classList.contains("builder-accordion-detail"))continue;const f=o.getBoundingClientRect();if(f.left>m.left){const b=parseInt(o.getAttribute("data-index")||"",10);isNaN(b)||(m=f,t=b)}else break}}}return typeof t=="number"&&(t=t+1),t}function I(){const t={order:typeof d()=="number"?d():void 0,...e.grid&&{width:"100%"}};return Object.fromEntries(Object.entries(t).filter(([n,l])=>l!==void 0))}function x(t){i.includes(t)?r(s()?[]:i.filter(n=>n!==t)):r(s()?[t]:i.concat(t))}return c.jsx("div",{className:"builder-accordion",style:O(),children:(u=e.items)==null?void 0:u.map((t,n)=>c.jsxs(v.Fragment,{children:[c.jsx("div",{className:h(n),style:{...C(),...e.grid&&{width:e.gridRowWidth,order:d()!==null?y(n):y(n+1)}},"data-index":n,onClick:l=>x(n),children:c.jsx(g.Blocks,{blocks:t.title,path:`items.${n}.title`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}),i.includes(n)?c.jsx("div",{className:k(n),style:I(),children:c.jsx(g.Blocks,{blocks:t.detail,path:`items.${n}.detail`,parent:e.builderBlock.id,context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent})}):null]},n))})}exports.default=p;
|
|
@@ -2,7 +2,7 @@ import { jsx as l, jsxs as j } from "react/jsx-runtime";
|
|
|
2
2
|
import * as p from "react";
|
|
3
3
|
import { useState as x } from "react";
|
|
4
4
|
import { Blocks as g } from "./blocks-exports.mjs";
|
|
5
|
-
import "./server-entry-
|
|
5
|
+
import "./server-entry-43a6f5be.js";
|
|
6
6
|
const y = (t) => t.toString();
|
|
7
7
|
function B(t) {
|
|
8
8
|
var a;
|