@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
|
@@ -1,77 +1,126 @@
|
|
|
1
|
-
const b = "react"
|
|
2
|
-
log: (...t) => console.log(v, ...t),
|
|
3
|
-
error: (...t) => console.error(v, ...t),
|
|
4
|
-
warn: (...t) => console.warn(v, ...t),
|
|
5
|
-
debug: (...t) => console.debug(v, ...t)
|
|
6
|
-
};
|
|
1
|
+
const b = "react";
|
|
7
2
|
function c() {
|
|
8
3
|
return typeof window != "undefined" && typeof document != "undefined";
|
|
9
4
|
}
|
|
10
|
-
const
|
|
5
|
+
const I = "[Builder.io]: ", h = {
|
|
6
|
+
log: (...t) => console.log(I, ...t),
|
|
7
|
+
error: (...t) => console.error(I, ...t),
|
|
8
|
+
warn: (...t) => console.warn(I, ...t),
|
|
9
|
+
debug: (...t) => console.debug(I, ...t)
|
|
10
|
+
}, y = (t) => t != null, it = (t) => {
|
|
11
|
+
if (t === "localhost" || t === "127.0.0.1")
|
|
12
|
+
return t;
|
|
13
|
+
const e = t.split(".");
|
|
14
|
+
return e.length > 2 ? e.slice(1).join(".") : t;
|
|
15
|
+
}, U = ({
|
|
16
|
+
name: t,
|
|
17
|
+
canTrack: e
|
|
18
|
+
}) => {
|
|
19
|
+
var n;
|
|
20
|
+
try {
|
|
21
|
+
return e ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${t}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
22
|
+
} catch (r) {
|
|
23
|
+
h.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}, K = async (t) => U(t), at = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), ct = [["secure", ""], ["SameSite", "None"]], ut = ({
|
|
27
|
+
name: t,
|
|
28
|
+
value: e,
|
|
29
|
+
expires: n
|
|
30
|
+
}) => {
|
|
31
|
+
const s = (c() ? location.protocol === "https:" : !0) ? ct : [[]], o = n ? [["expires", n.toUTCString()]] : [[]], i = [[t, e], ...o, ["path", "/"], ["domain", it(window.location.hostname)], ...s];
|
|
32
|
+
return at(i);
|
|
33
|
+
}, T = async ({
|
|
34
|
+
name: t,
|
|
35
|
+
value: e,
|
|
36
|
+
expires: n,
|
|
37
|
+
canTrack: r
|
|
38
|
+
}) => {
|
|
39
|
+
try {
|
|
40
|
+
if (!r)
|
|
41
|
+
return;
|
|
42
|
+
const s = ut({
|
|
43
|
+
name: t,
|
|
44
|
+
value: e,
|
|
45
|
+
expires: n
|
|
46
|
+
});
|
|
47
|
+
document.cookie = s;
|
|
48
|
+
} catch (s) {
|
|
49
|
+
h.warn("[COOKIE] SET error: ", (s == null ? void 0 : s.message) || s);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const x = "builder.userAttributes";
|
|
53
|
+
function _() {
|
|
54
|
+
let t = !0;
|
|
55
|
+
const e = /* @__PURE__ */ new Set();
|
|
56
|
+
return {
|
|
57
|
+
setUserAttributes(n) {
|
|
58
|
+
if (!c())
|
|
59
|
+
return;
|
|
60
|
+
const r = {
|
|
61
|
+
...this.getUserAttributes(),
|
|
62
|
+
...n
|
|
63
|
+
};
|
|
64
|
+
T({
|
|
65
|
+
name: x,
|
|
66
|
+
value: JSON.stringify(r),
|
|
67
|
+
canTrack: t
|
|
68
|
+
}), e.forEach((s) => s(r));
|
|
69
|
+
},
|
|
70
|
+
getUserAttributes() {
|
|
71
|
+
return c() ? JSON.parse(U({
|
|
72
|
+
name: x,
|
|
73
|
+
canTrack: t
|
|
74
|
+
}) || "{}") : {};
|
|
75
|
+
},
|
|
76
|
+
subscribeOnUserAttributesChange(n, {
|
|
77
|
+
fireImmediately: r
|
|
78
|
+
} = {}) {
|
|
79
|
+
return e.add(n), r && n(this.getUserAttributes()), function() {
|
|
80
|
+
e.delete(n);
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
setCanTrack(n) {
|
|
84
|
+
t = n;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
let v;
|
|
89
|
+
c() && b === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = _()), v = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : v = _();
|
|
90
|
+
const M = v, te = (t) => {
|
|
91
|
+
M.setUserAttributes(t);
|
|
92
|
+
}, lt = (t) => {
|
|
11
93
|
const e = {};
|
|
12
94
|
return t.forEach((n, r) => {
|
|
13
95
|
e[r] = n;
|
|
14
96
|
}), e;
|
|
15
|
-
},
|
|
16
|
-
function
|
|
97
|
+
}, W = (t) => t instanceof URLSearchParams ? lt(t) : t, j = (t) => typeof t == "string" ? t : t instanceof URLSearchParams ? t.toString() : new URLSearchParams(t).toString();
|
|
98
|
+
function dt() {
|
|
17
99
|
return c() && window.self !== window.top;
|
|
18
100
|
}
|
|
19
|
-
function
|
|
20
|
-
return
|
|
21
|
-
|
|
101
|
+
function ft(t) {
|
|
102
|
+
return dt() && // accessing window.location.search is safe here because `isIframe()` is only `true` if we're in a browser.
|
|
103
|
+
j(t || window.location.search).indexOf("builder.frameEditing=") !== -1;
|
|
22
104
|
}
|
|
23
|
-
const lt = () => {
|
|
24
|
-
if (c()) {
|
|
25
|
-
const t = new URL(location.href);
|
|
26
|
-
return t.pathname === "" && (t.pathname = "/"), t;
|
|
27
|
-
} else
|
|
28
|
-
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
29
|
-
}, dt = () => typeof navigator == "object" && navigator.userAgent || "", ft = () => {
|
|
30
|
-
const t = dt(), e = {
|
|
31
|
-
Android() {
|
|
32
|
-
return t.match(/Android/i);
|
|
33
|
-
},
|
|
34
|
-
BlackBerry() {
|
|
35
|
-
return t.match(/BlackBerry/i);
|
|
36
|
-
},
|
|
37
|
-
iOS() {
|
|
38
|
-
return t.match(/iPhone|iPod/i);
|
|
39
|
-
},
|
|
40
|
-
Opera() {
|
|
41
|
-
return t.match(/Opera Mini/i);
|
|
42
|
-
},
|
|
43
|
-
Windows() {
|
|
44
|
-
return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
|
|
45
|
-
},
|
|
46
|
-
any() {
|
|
47
|
-
return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || b === "reactNative";
|
|
48
|
-
}
|
|
49
|
-
}, n = t.match(/Tablet|iPad/i), r = lt();
|
|
50
|
-
return {
|
|
51
|
-
urlPath: r == null ? void 0 : r.pathname,
|
|
52
|
-
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
53
|
-
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
54
|
-
};
|
|
55
|
-
}, y = (t) => t != null;
|
|
56
105
|
function ee(t) {
|
|
57
106
|
const e = t || (c() ? window.location.search : void 0);
|
|
58
|
-
return e ?
|
|
107
|
+
return e ? j(e).indexOf("builder.preview=") !== -1 : !1;
|
|
59
108
|
}
|
|
60
109
|
const ne = (t) => ({
|
|
61
110
|
type: "builder.registerComponent",
|
|
62
|
-
data:
|
|
111
|
+
data: $(t)
|
|
63
112
|
}), ht = (t) => {
|
|
64
113
|
const e = t.toString().trim(), n = /^[a-zA-Z0-9_]+\s*=>/i.test(e);
|
|
65
114
|
return `return (${!e.startsWith("function") && !e.startsWith("async") && !e.startsWith("(") && !n ? "function " : ""}${e}).apply(this, arguments)`;
|
|
66
115
|
};
|
|
67
|
-
function
|
|
116
|
+
function $(t) {
|
|
68
117
|
return JSON.parse(JSON.stringify(t, (e, n) => typeof n == "function" ? ht(n) : n));
|
|
69
118
|
}
|
|
70
|
-
const
|
|
119
|
+
const L = {};
|
|
71
120
|
function re(t, e) {
|
|
72
|
-
t === "plugin" && (e =
|
|
73
|
-
let n =
|
|
74
|
-
if (n || (n =
|
|
121
|
+
t === "plugin" && (e = $(e));
|
|
122
|
+
let n = L[t];
|
|
123
|
+
if (n || (n = L[t] = []), n.push(e), c()) {
|
|
75
124
|
const r = {
|
|
76
125
|
type: "builder.register",
|
|
77
126
|
data: {
|
|
@@ -96,24 +145,24 @@ function se(t) {
|
|
|
96
145
|
}, "*");
|
|
97
146
|
}
|
|
98
147
|
}
|
|
99
|
-
const
|
|
148
|
+
const N = {};
|
|
100
149
|
function oe(t) {
|
|
101
150
|
if (c()) {
|
|
102
|
-
Object.assign(
|
|
151
|
+
Object.assign(N, t);
|
|
103
152
|
const e = {
|
|
104
153
|
type: "builder.settingsChange",
|
|
105
|
-
data:
|
|
154
|
+
data: N
|
|
106
155
|
};
|
|
107
156
|
parent.postMessage(e, "*");
|
|
108
157
|
}
|
|
109
158
|
}
|
|
110
|
-
const
|
|
159
|
+
const V = "builder.", gt = "options.", G = (t) => {
|
|
111
160
|
if (!t)
|
|
112
161
|
return {};
|
|
113
|
-
const e =
|
|
162
|
+
const e = W(t), n = {};
|
|
114
163
|
return Object.keys(e).forEach((r) => {
|
|
115
|
-
if (r.startsWith(
|
|
116
|
-
const s = r.replace(
|
|
164
|
+
if (r.startsWith(V)) {
|
|
165
|
+
const s = r.replace(V, "").replace(gt, "");
|
|
117
166
|
n[s] = e[r];
|
|
118
167
|
}
|
|
119
168
|
}), n;
|
|
@@ -121,88 +170,47 @@ const N = "builder.", gt = "options.", $ = (t) => {
|
|
|
121
170
|
if (!c())
|
|
122
171
|
return {};
|
|
123
172
|
const t = new URLSearchParams(window.location.search);
|
|
124
|
-
return
|
|
125
|
-
},
|
|
173
|
+
return G(t);
|
|
174
|
+
}, J = "4.2.3", z = () => ({
|
|
126
175
|
"X-Builder-SDK": b,
|
|
127
176
|
"X-Builder-SDK-GEN": "2",
|
|
128
|
-
"X-Builder-SDK-Version":
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
return t;
|
|
132
|
-
const e = t.split(".");
|
|
133
|
-
return e.length > 2 ? e.slice(1).join(".") : t;
|
|
134
|
-
}, O = ({
|
|
135
|
-
name: t,
|
|
136
|
-
canTrack: e
|
|
137
|
-
}) => {
|
|
138
|
-
var n;
|
|
139
|
-
try {
|
|
140
|
-
return e ? (n = document.cookie.split("; ").find((r) => r.startsWith(`${t}=`))) == null ? void 0 : n.split("=")[1] : void 0;
|
|
141
|
-
} catch (r) {
|
|
142
|
-
f.warn("[COOKIE] GET error: ", (r == null ? void 0 : r.message) || r);
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
}, z = async (t) => O(t), yt = (t) => t.map(([e, n]) => n ? `${e}=${n}` : e).filter(y).join("; "), bt = [["secure", ""], ["SameSite", "None"]], mt = ({
|
|
146
|
-
name: t,
|
|
147
|
-
value: e,
|
|
148
|
-
expires: n
|
|
149
|
-
}) => {
|
|
150
|
-
const s = (c() ? location.protocol === "https:" : !0) ? bt : [[]], o = n ? [["expires", n.toUTCString()]] : [[]], i = [[t, e], ...o, ["path", "/"], ["domain", St(window.location.hostname)], ...s];
|
|
151
|
-
return yt(i);
|
|
152
|
-
}, T = async ({
|
|
153
|
-
name: t,
|
|
154
|
-
value: e,
|
|
155
|
-
expires: n,
|
|
156
|
-
canTrack: r
|
|
157
|
-
}) => {
|
|
158
|
-
try {
|
|
159
|
-
if (!r)
|
|
160
|
-
return;
|
|
161
|
-
const s = mt({
|
|
162
|
-
name: t,
|
|
163
|
-
value: e,
|
|
164
|
-
expires: n
|
|
165
|
-
});
|
|
166
|
-
document.cookie = s;
|
|
167
|
-
} catch (s) {
|
|
168
|
-
f.warn("[COOKIE] SET error: ", (s == null ? void 0 : s.message) || s);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
function wt() {
|
|
177
|
+
"X-Builder-SDK-Version": J
|
|
178
|
+
});
|
|
179
|
+
function St() {
|
|
172
180
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
173
181
|
const e = Math.random() * 16 | 0;
|
|
174
182
|
return (t == "x" ? e : e & 3 | 8).toString(16);
|
|
175
183
|
});
|
|
176
184
|
}
|
|
177
185
|
function X() {
|
|
178
|
-
return
|
|
186
|
+
return St().replace(/-/g, "");
|
|
179
187
|
}
|
|
180
|
-
const H = "builderSessionId",
|
|
188
|
+
const H = "builderSessionId", yt = async ({
|
|
181
189
|
canTrack: t
|
|
182
190
|
}) => {
|
|
183
191
|
if (!t)
|
|
184
192
|
return;
|
|
185
|
-
const e = await
|
|
193
|
+
const e = await K({
|
|
186
194
|
name: H,
|
|
187
195
|
canTrack: t
|
|
188
196
|
});
|
|
189
197
|
if (y(e))
|
|
190
198
|
return e;
|
|
191
199
|
{
|
|
192
|
-
const n =
|
|
193
|
-
return
|
|
200
|
+
const n = bt();
|
|
201
|
+
return mt({
|
|
194
202
|
id: n,
|
|
195
203
|
canTrack: t
|
|
196
204
|
}), n;
|
|
197
205
|
}
|
|
198
|
-
},
|
|
206
|
+
}, bt = () => X(), mt = ({
|
|
199
207
|
id: t,
|
|
200
208
|
canTrack: e
|
|
201
209
|
}) => T({
|
|
202
210
|
name: H,
|
|
203
211
|
value: t,
|
|
204
212
|
canTrack: e
|
|
205
|
-
}), Q = () => c() && typeof localStorage != "undefined" ? localStorage : void 0,
|
|
213
|
+
}), Q = () => c() && typeof localStorage != "undefined" ? localStorage : void 0, wt = ({
|
|
206
214
|
key: t,
|
|
207
215
|
canTrack: e
|
|
208
216
|
}) => {
|
|
@@ -213,7 +221,7 @@ const H = "builderSessionId", Et = async ({
|
|
|
213
221
|
console.debug("[LocalStorage] GET error: ", r);
|
|
214
222
|
return;
|
|
215
223
|
}
|
|
216
|
-
},
|
|
224
|
+
}, Et = ({
|
|
217
225
|
key: t,
|
|
218
226
|
canTrack: e,
|
|
219
227
|
value: n
|
|
@@ -224,37 +232,69 @@ const H = "builderSessionId", Et = async ({
|
|
|
224
232
|
} catch (s) {
|
|
225
233
|
console.debug("[LocalStorage] SET error: ", s);
|
|
226
234
|
}
|
|
227
|
-
}, Y = "builderVisitorId",
|
|
235
|
+
}, Y = "builderVisitorId", At = ({
|
|
228
236
|
canTrack: t
|
|
229
237
|
}) => {
|
|
230
238
|
if (!t)
|
|
231
239
|
return;
|
|
232
|
-
const e =
|
|
240
|
+
const e = wt({
|
|
233
241
|
key: Y,
|
|
234
242
|
canTrack: t
|
|
235
243
|
});
|
|
236
244
|
if (y(e))
|
|
237
245
|
return e;
|
|
238
246
|
{
|
|
239
|
-
const n =
|
|
240
|
-
return
|
|
247
|
+
const n = It();
|
|
248
|
+
return vt({
|
|
241
249
|
id: n,
|
|
242
250
|
canTrack: t
|
|
243
251
|
}), n;
|
|
244
252
|
}
|
|
245
|
-
},
|
|
253
|
+
}, It = () => X(), vt = ({
|
|
246
254
|
id: t,
|
|
247
255
|
canTrack: e
|
|
248
|
-
}) =>
|
|
256
|
+
}) => Et({
|
|
249
257
|
key: Y,
|
|
250
258
|
value: t,
|
|
251
259
|
canTrack: e
|
|
252
260
|
});
|
|
253
|
-
function
|
|
261
|
+
function kt(t) {
|
|
254
262
|
var e;
|
|
255
|
-
typeof process != "undefined" && ((e = process.env) != null && e.DEBUG) && String(process.env.DEBUG) == "true" &&
|
|
263
|
+
typeof process != "undefined" && ((e = process.env) != null && e.DEBUG) && String(process.env.DEBUG) == "true" && h.log(t);
|
|
256
264
|
}
|
|
257
|
-
const
|
|
265
|
+
const Ut = () => {
|
|
266
|
+
if (c()) {
|
|
267
|
+
const t = new URL(location.href);
|
|
268
|
+
return t.pathname === "" && (t.pathname = "/"), t;
|
|
269
|
+
} else
|
|
270
|
+
return console.warn("Cannot get location for tracking in non-browser environment"), null;
|
|
271
|
+
}, Tt = () => typeof navigator == "object" && navigator.userAgent || "", Ot = () => {
|
|
272
|
+
const t = Tt(), e = {
|
|
273
|
+
Android() {
|
|
274
|
+
return t.match(/Android/i);
|
|
275
|
+
},
|
|
276
|
+
BlackBerry() {
|
|
277
|
+
return t.match(/BlackBerry/i);
|
|
278
|
+
},
|
|
279
|
+
iOS() {
|
|
280
|
+
return t.match(/iPhone|iPod/i);
|
|
281
|
+
},
|
|
282
|
+
Opera() {
|
|
283
|
+
return t.match(/Opera Mini/i);
|
|
284
|
+
},
|
|
285
|
+
Windows() {
|
|
286
|
+
return t.match(/IEMobile/i) || t.match(/WPDesktop/i);
|
|
287
|
+
},
|
|
288
|
+
any() {
|
|
289
|
+
return e.Android() || e.BlackBerry() || e.iOS() || e.Opera() || e.Windows() || b === "reactNative";
|
|
290
|
+
}
|
|
291
|
+
}, n = t.match(/Tablet|iPad/i), r = Ut();
|
|
292
|
+
return {
|
|
293
|
+
urlPath: r == null ? void 0 : r.pathname,
|
|
294
|
+
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
295
|
+
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
296
|
+
};
|
|
297
|
+
}, Pt = async ({
|
|
258
298
|
canTrack: t
|
|
259
299
|
}) => {
|
|
260
300
|
if (!t)
|
|
@@ -262,16 +302,16 @@ const Rt = async ({
|
|
|
262
302
|
visitorId: void 0,
|
|
263
303
|
sessionId: void 0
|
|
264
304
|
};
|
|
265
|
-
const e = await
|
|
305
|
+
const e = await yt({
|
|
266
306
|
canTrack: t
|
|
267
|
-
}), n =
|
|
307
|
+
}), n = At({
|
|
268
308
|
canTrack: t
|
|
269
309
|
});
|
|
270
310
|
return {
|
|
271
311
|
sessionId: e,
|
|
272
312
|
visitorId: n
|
|
273
313
|
};
|
|
274
|
-
},
|
|
314
|
+
}, Rt = async ({
|
|
275
315
|
type: t,
|
|
276
316
|
canTrack: e,
|
|
277
317
|
apiKey: n,
|
|
@@ -285,56 +325,56 @@ const Rt = async ({
|
|
|
285
325
|
url: location.href,
|
|
286
326
|
...r
|
|
287
327
|
},
|
|
288
|
-
...await
|
|
328
|
+
...await Pt({
|
|
289
329
|
canTrack: e
|
|
290
330
|
}),
|
|
291
|
-
userAttributes:
|
|
331
|
+
userAttributes: Ot(),
|
|
292
332
|
ownerId: n
|
|
293
333
|
}
|
|
294
334
|
});
|
|
295
|
-
async function
|
|
335
|
+
async function Ct({
|
|
296
336
|
apiHost: t,
|
|
297
337
|
...e
|
|
298
338
|
}) {
|
|
299
339
|
if (!e.apiKey) {
|
|
300
|
-
|
|
340
|
+
h.error("Missing API key for track call. Please provide your API key.");
|
|
301
341
|
return;
|
|
302
342
|
}
|
|
303
|
-
if (!e.canTrack ||
|
|
343
|
+
if (!e.canTrack || ft() || !(c() || b === "reactNative"))
|
|
304
344
|
return;
|
|
305
345
|
const r = `${t || "https://cdn.builder.io"}/api/v1/track`;
|
|
306
|
-
return
|
|
346
|
+
return kt(r), fetch(r, {
|
|
307
347
|
method: "POST",
|
|
308
348
|
body: JSON.stringify({
|
|
309
|
-
events: [await
|
|
349
|
+
events: [await Rt(e)]
|
|
310
350
|
}),
|
|
311
351
|
headers: {
|
|
312
352
|
"content-type": "application/json",
|
|
313
|
-
...
|
|
353
|
+
...z()
|
|
314
354
|
},
|
|
315
355
|
mode: "cors"
|
|
316
356
|
}).catch((s) => {
|
|
317
357
|
console.error("Failed to track: ", s);
|
|
318
358
|
});
|
|
319
359
|
}
|
|
320
|
-
const ie = (t) =>
|
|
360
|
+
const ie = (t) => Ct({
|
|
321
361
|
...t,
|
|
322
362
|
canTrack: !0
|
|
323
|
-
}),
|
|
363
|
+
}), Bt = ["*.beta.builder.io", "beta.builder.io", "builder.io", "localhost", "qa.builder.io"];
|
|
324
364
|
function Z(t, e) {
|
|
325
365
|
if (!e.origin.startsWith("http") && !e.origin.startsWith("https"))
|
|
326
366
|
return !1;
|
|
327
367
|
const n = new URL(e.origin), r = n.hostname;
|
|
328
|
-
return (t ||
|
|
368
|
+
return (t || Bt).findIndex((s) => s.startsWith("*.") ? r.endsWith(s.slice(1)) : s === r) > -1;
|
|
329
369
|
}
|
|
330
|
-
let
|
|
331
|
-
const
|
|
370
|
+
let D = !1;
|
|
371
|
+
const xt = (t) => {
|
|
332
372
|
var e, n;
|
|
333
|
-
|
|
373
|
+
D || (D = !0, c() && ((e = window.parent) == null || e.postMessage({
|
|
334
374
|
type: "builder.sdkInfo",
|
|
335
375
|
data: {
|
|
336
376
|
target: b,
|
|
337
|
-
version:
|
|
377
|
+
version: J,
|
|
338
378
|
supportsPatchUpdates: !1,
|
|
339
379
|
// Supports builder-model="..." attribute which is needed to
|
|
340
380
|
// scope our '+ add block' button styling
|
|
@@ -360,40 +400,40 @@ const _t = (t) => {
|
|
|
360
400
|
if (s != null && s.type)
|
|
361
401
|
switch (s.type) {
|
|
362
402
|
case "builder.evaluate": {
|
|
363
|
-
const u = s.data.text,
|
|
364
|
-
let
|
|
403
|
+
const u = s.data.text, l = s.data.arguments || [], S = s.data.id, m = new Function(u);
|
|
404
|
+
let d, g = null;
|
|
365
405
|
try {
|
|
366
|
-
|
|
367
|
-
} catch (
|
|
368
|
-
|
|
406
|
+
d = m.apply(null, l);
|
|
407
|
+
} catch (p) {
|
|
408
|
+
g = p;
|
|
369
409
|
}
|
|
370
|
-
|
|
410
|
+
g ? (o = window.parent) == null || o.postMessage({
|
|
371
411
|
type: "builder.evaluateError",
|
|
372
412
|
data: {
|
|
373
|
-
id:
|
|
374
|
-
error:
|
|
413
|
+
id: S,
|
|
414
|
+
error: g.message
|
|
375
415
|
}
|
|
376
|
-
}, "*") :
|
|
377
|
-
var
|
|
378
|
-
(
|
|
416
|
+
}, "*") : d && typeof d.then == "function" ? d.then((p) => {
|
|
417
|
+
var w;
|
|
418
|
+
(w = window.parent) == null || w.postMessage({
|
|
379
419
|
type: "builder.evaluateResult",
|
|
380
420
|
data: {
|
|
381
|
-
id:
|
|
382
|
-
result:
|
|
421
|
+
id: S,
|
|
422
|
+
result: p
|
|
383
423
|
}
|
|
384
424
|
}, "*");
|
|
385
425
|
}).catch(console.error) : (i = window.parent) == null || i.postMessage({
|
|
386
426
|
type: "builder.evaluateResult",
|
|
387
427
|
data: {
|
|
388
|
-
result:
|
|
389
|
-
id:
|
|
428
|
+
result: d,
|
|
429
|
+
id: S
|
|
390
430
|
}
|
|
391
431
|
}, "*");
|
|
392
432
|
break;
|
|
393
433
|
}
|
|
394
434
|
}
|
|
395
435
|
})));
|
|
396
|
-
},
|
|
436
|
+
}, _t = ({
|
|
397
437
|
model: t,
|
|
398
438
|
trustedHosts: e,
|
|
399
439
|
callbacks: n
|
|
@@ -414,13 +454,13 @@ const _t = (t) => {
|
|
|
414
454
|
break;
|
|
415
455
|
}
|
|
416
456
|
case "builder.resetState": {
|
|
417
|
-
const o = s.data, i = o.model, u = o == null ? void 0 : o.state;
|
|
418
|
-
i === t && u && n.stateUpdate(u);
|
|
457
|
+
const o = s.data, i = o.model, u = o == null ? void 0 : o.state, l = o.editType;
|
|
458
|
+
i === t && u && n.stateUpdate(u, l);
|
|
419
459
|
break;
|
|
420
460
|
}
|
|
421
461
|
case "builder.contentUpdate": {
|
|
422
|
-
const o = s.data, i = o.key || o.alias || o.entry || o.modelName, u = o.data;
|
|
423
|
-
i === t && n.contentUpdate(u);
|
|
462
|
+
const o = s.data, i = o.key || o.alias || o.entry || o.modelName, u = o.data, l = o.editType;
|
|
463
|
+
i === t && n.contentUpdate(u, l);
|
|
424
464
|
break;
|
|
425
465
|
}
|
|
426
466
|
}
|
|
@@ -431,13 +471,13 @@ const _t = (t) => {
|
|
|
431
471
|
trustedHosts: r
|
|
432
472
|
}) => {
|
|
433
473
|
if (!c)
|
|
434
|
-
return
|
|
474
|
+
return h.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."), () => {
|
|
435
475
|
};
|
|
436
|
-
|
|
476
|
+
xt({
|
|
437
477
|
modelName: t,
|
|
438
478
|
apiKey: e
|
|
439
479
|
});
|
|
440
|
-
const s =
|
|
480
|
+
const s = _t({
|
|
441
481
|
callbacks: {
|
|
442
482
|
contentUpdate: n,
|
|
443
483
|
animation: () => {
|
|
@@ -453,24 +493,24 @@ const _t = (t) => {
|
|
|
453
493
|
return window.addEventListener("message", s), () => {
|
|
454
494
|
window.removeEventListener("message", s);
|
|
455
495
|
};
|
|
456
|
-
},
|
|
496
|
+
}, Lt = "builder.tests", O = (t) => `${Lt}.${t}`, Nt = ({
|
|
457
497
|
contentId: t
|
|
458
|
-
}) =>
|
|
459
|
-
name:
|
|
498
|
+
}) => K({
|
|
499
|
+
name: O(t),
|
|
460
500
|
canTrack: !0
|
|
461
|
-
}),
|
|
501
|
+
}), Vt = ({
|
|
462
502
|
contentId: t
|
|
463
|
-
}) =>
|
|
464
|
-
name:
|
|
503
|
+
}) => U({
|
|
504
|
+
name: O(t),
|
|
465
505
|
canTrack: !0
|
|
466
|
-
}),
|
|
506
|
+
}), Dt = ({
|
|
467
507
|
contentId: t,
|
|
468
508
|
value: e
|
|
469
509
|
}) => T({
|
|
470
|
-
name:
|
|
510
|
+
name: O(t),
|
|
471
511
|
value: e,
|
|
472
512
|
canTrack: !0
|
|
473
|
-
}), q = (t) => y(t.id) && y(t.variations) && Object.keys(t.variations).length > 0,
|
|
513
|
+
}), q = (t) => y(t.id) && y(t.variations) && Object.keys(t.variations).length > 0, Ft = ({
|
|
474
514
|
id: t,
|
|
475
515
|
variations: e
|
|
476
516
|
}) => {
|
|
@@ -484,12 +524,12 @@ const _t = (t) => {
|
|
|
484
524
|
}
|
|
485
525
|
return t;
|
|
486
526
|
}, tt = (t) => {
|
|
487
|
-
const e =
|
|
488
|
-
return
|
|
527
|
+
const e = Ft(t);
|
|
528
|
+
return Dt({
|
|
489
529
|
contentId: t.id,
|
|
490
530
|
value: e
|
|
491
531
|
}).catch((n) => {
|
|
492
|
-
|
|
532
|
+
h.error("could not store A/B test variation: ", n);
|
|
493
533
|
}), e;
|
|
494
534
|
}, et = ({
|
|
495
535
|
item: t,
|
|
@@ -515,7 +555,7 @@ const _t = (t) => {
|
|
|
515
555
|
return;
|
|
516
556
|
if (!q(t))
|
|
517
557
|
return t;
|
|
518
|
-
const n =
|
|
558
|
+
const n = Vt({
|
|
519
559
|
contentId: t.id
|
|
520
560
|
}) || tt({
|
|
521
561
|
variations: t.variations,
|
|
@@ -528,13 +568,13 @@ const _t = (t) => {
|
|
|
528
568
|
...t,
|
|
529
569
|
...r
|
|
530
570
|
};
|
|
531
|
-
},
|
|
571
|
+
}, Kt = async ({
|
|
532
572
|
item: t,
|
|
533
573
|
canTrack: e
|
|
534
574
|
}) => {
|
|
535
575
|
if (!e || !q(t))
|
|
536
576
|
return t;
|
|
537
|
-
const r = await
|
|
577
|
+
const r = await Nt({
|
|
538
578
|
contentId: t.id
|
|
539
579
|
}) || tt({
|
|
540
580
|
variations: t.variations,
|
|
@@ -547,82 +587,41 @@ const _t = (t) => {
|
|
|
547
587
|
...t,
|
|
548
588
|
...s
|
|
549
589
|
};
|
|
550
|
-
}
|
|
551
|
-
const D = "builder.userAttributes";
|
|
552
|
-
function F() {
|
|
553
|
-
let t = !0;
|
|
554
|
-
const e = /* @__PURE__ */ new Set();
|
|
555
|
-
return {
|
|
556
|
-
setUserAttributes(n) {
|
|
557
|
-
if (!c())
|
|
558
|
-
return;
|
|
559
|
-
const r = {
|
|
560
|
-
...this.getUserAttributes(),
|
|
561
|
-
...n
|
|
562
|
-
};
|
|
563
|
-
T({
|
|
564
|
-
name: D,
|
|
565
|
-
value: JSON.stringify(r),
|
|
566
|
-
canTrack: t
|
|
567
|
-
}), e.forEach((s) => s(r));
|
|
568
|
-
},
|
|
569
|
-
getUserAttributes() {
|
|
570
|
-
return c() ? JSON.parse(O({
|
|
571
|
-
name: D,
|
|
572
|
-
canTrack: t
|
|
573
|
-
}) || "{}") : {};
|
|
574
|
-
},
|
|
575
|
-
subscribeOnUserAttributesChange(n, {
|
|
576
|
-
fireImmediately: r
|
|
577
|
-
} = {}) {
|
|
578
|
-
return e.add(n), r && n(this.getUserAttributes()), function() {
|
|
579
|
-
e.delete(n);
|
|
580
|
-
};
|
|
581
|
-
},
|
|
582
|
-
setCanTrack(n) {
|
|
583
|
-
t = n;
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
}
|
|
587
|
-
let k;
|
|
588
|
-
c() && b === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = F()), k = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : k = F();
|
|
589
|
-
const nt = k, ue = (t) => {
|
|
590
|
-
nt.setUserAttributes(t);
|
|
591
|
-
}, Wt = (t) => {
|
|
590
|
+
}, Mt = (t) => {
|
|
592
591
|
const e = y(t) ? t : !0;
|
|
593
|
-
return
|
|
592
|
+
return M.setCanTrack(e), e;
|
|
594
593
|
};
|
|
595
|
-
function
|
|
594
|
+
function Wt() {
|
|
596
595
|
return typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : globalThis;
|
|
597
596
|
}
|
|
598
|
-
function
|
|
599
|
-
const t =
|
|
597
|
+
function jt() {
|
|
598
|
+
const t = Wt().fetch;
|
|
600
599
|
if (typeof t == "undefined")
|
|
601
600
|
throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
602
601
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`), new Error("Builder SDK could not find a global `fetch` function");
|
|
603
602
|
return t;
|
|
604
603
|
}
|
|
605
|
-
const
|
|
606
|
-
function
|
|
604
|
+
const $t = jt();
|
|
605
|
+
function k(t, e = null, n = ".") {
|
|
607
606
|
return Object.keys(t).reduce((r, s) => {
|
|
608
607
|
const o = t[s], i = [e, s].filter(Boolean).join(n);
|
|
609
608
|
return [typeof o == "object", o !== null, !(Array.isArray(o) && o.length === 0)].every(Boolean) ? {
|
|
610
609
|
...r,
|
|
611
|
-
...
|
|
610
|
+
...k(o, i, n)
|
|
612
611
|
} : {
|
|
613
612
|
...r,
|
|
614
613
|
[i]: o
|
|
615
614
|
};
|
|
616
615
|
}, {});
|
|
617
616
|
}
|
|
618
|
-
function
|
|
617
|
+
function nt(t, e, n = {}) {
|
|
619
618
|
for (const r in t) {
|
|
620
619
|
const s = t[r], o = e ? e + "." + r : r;
|
|
621
|
-
s && typeof s == "object" && !Array.isArray(s) && !Object.keys(s).find((i) => i.startsWith("$")) ?
|
|
620
|
+
s && typeof s == "object" && !Array.isArray(s) && !Object.keys(s).find((i) => i.startsWith("$")) ? nt(s, o, n) : n[o] = s;
|
|
622
621
|
}
|
|
623
622
|
return n;
|
|
624
623
|
}
|
|
625
|
-
function
|
|
624
|
+
function Gt(t) {
|
|
626
625
|
const e = {};
|
|
627
626
|
for (const n in t) {
|
|
628
627
|
const r = n.split(".");
|
|
@@ -634,7 +633,7 @@ function Jt(t) {
|
|
|
634
633
|
}
|
|
635
634
|
return e;
|
|
636
635
|
}
|
|
637
|
-
const
|
|
636
|
+
const Jt = "v3", F = (t) => typeof t == "number" && !isNaN(t) && t >= 0, P = (t) => {
|
|
638
637
|
const {
|
|
639
638
|
limit: e = 30,
|
|
640
639
|
userAttributes: n,
|
|
@@ -643,113 +642,115 @@ const zt = "v3", K = (t) => typeof t == "number" && !isNaN(t) && t >= 0, R = (t)
|
|
|
643
642
|
apiKey: o,
|
|
644
643
|
enrich: i,
|
|
645
644
|
locale: u,
|
|
646
|
-
apiVersion:
|
|
647
|
-
fields:
|
|
648
|
-
omit:
|
|
649
|
-
offset:
|
|
650
|
-
cacheSeconds:
|
|
651
|
-
staleCacheSeconds:
|
|
652
|
-
sort:
|
|
653
|
-
includeUnpublished:
|
|
654
|
-
apiHost:
|
|
645
|
+
apiVersion: l = Jt,
|
|
646
|
+
fields: S,
|
|
647
|
+
omit: m,
|
|
648
|
+
offset: d,
|
|
649
|
+
cacheSeconds: g,
|
|
650
|
+
staleCacheSeconds: p,
|
|
651
|
+
sort: w,
|
|
652
|
+
includeUnpublished: R,
|
|
653
|
+
apiHost: rt
|
|
655
654
|
} = t;
|
|
656
655
|
if (!o)
|
|
657
656
|
throw new Error("Missing API key");
|
|
658
|
-
if (!["v3"].includes(
|
|
659
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${
|
|
660
|
-
const
|
|
661
|
-
a.searchParams.set("apiKey", o), a.searchParams.set("limit", String(e)), a.searchParams.set("noTraverse", String(
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
...S
|
|
667
|
-
}), i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", w != null ? w : "meta.componentsUsed"), p && a.searchParams.set("fields", p), Number.isFinite(l) && l > -1 && a.searchParams.set("offset", String(Math.floor(l))), typeof C == "boolean" && a.searchParams.set("includeUnpublished", String(C)), h && K(h) && a.searchParams.set("cacheSeconds", String(h)), g && K(g) && a.searchParams.set("staleCacheSeconds", String(g)), E) {
|
|
668
|
-
const d = U({
|
|
669
|
-
sort: E
|
|
657
|
+
if (!["v3"].includes(l))
|
|
658
|
+
throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);
|
|
659
|
+
const st = e !== 1, ot = rt || "https://cdn.builder.io", a = new URL(`${ot}/api/${l}/content/${s}`);
|
|
660
|
+
a.searchParams.set("apiKey", o), a.searchParams.set("limit", String(e)), a.searchParams.set("noTraverse", String(st)), a.searchParams.set("includeRefs", String(!0)), u && a.searchParams.set("locale", u);
|
|
661
|
+
let A = n || {};
|
|
662
|
+
if (i && a.searchParams.set("enrich", String(i)), a.searchParams.set("omit", m != null ? m : "meta.componentsUsed"), S && a.searchParams.set("fields", S), Number.isFinite(d) && d > -1 && a.searchParams.set("offset", String(Math.floor(d))), typeof R == "boolean" && a.searchParams.set("includeUnpublished", String(R)), g && F(g) && a.searchParams.set("cacheSeconds", String(g)), p && F(p) && a.searchParams.set("staleCacheSeconds", String(p)), w) {
|
|
663
|
+
const f = k({
|
|
664
|
+
sort: w
|
|
670
665
|
});
|
|
671
|
-
for (const
|
|
672
|
-
a.searchParams.set(
|
|
666
|
+
for (const E in f)
|
|
667
|
+
a.searchParams.set(E, JSON.stringify(f[E]));
|
|
673
668
|
}
|
|
674
|
-
const
|
|
669
|
+
const C = {
|
|
675
670
|
...pt(),
|
|
676
|
-
...
|
|
671
|
+
...W(t.options || {})
|
|
677
672
|
};
|
|
678
|
-
|
|
679
|
-
...
|
|
680
|
-
...
|
|
673
|
+
A = {
|
|
674
|
+
...A,
|
|
675
|
+
...Xt(C)
|
|
681
676
|
};
|
|
682
|
-
const
|
|
683
|
-
for (const
|
|
684
|
-
a.searchParams.set(
|
|
685
|
-
if (Object.keys(
|
|
686
|
-
const
|
|
677
|
+
const B = k(C);
|
|
678
|
+
for (const f in B)
|
|
679
|
+
a.searchParams.set(f, String(B[f]));
|
|
680
|
+
if (Object.keys(A).length > 0 && a.searchParams.set("userAttributes", JSON.stringify(A)), r) {
|
|
681
|
+
const f = nt({
|
|
687
682
|
query: r
|
|
688
683
|
});
|
|
689
|
-
for (const
|
|
690
|
-
a.searchParams.set(
|
|
684
|
+
for (const E in f)
|
|
685
|
+
a.searchParams.set(E, JSON.stringify(f[E]));
|
|
691
686
|
}
|
|
692
687
|
return a;
|
|
693
|
-
},
|
|
688
|
+
}, zt = (t) => {
|
|
694
689
|
const e = {};
|
|
695
690
|
for (const n in t)
|
|
696
691
|
n.startsWith("userAttributes.") && (e[n] = t[n], delete t[n]);
|
|
697
692
|
return e;
|
|
698
|
-
},
|
|
693
|
+
}, Xt = (t) => {
|
|
699
694
|
if (c() && t.preview === "BUILDER_STUDIO") {
|
|
700
695
|
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
701
|
-
const e =
|
|
696
|
+
const e = zt(t), {
|
|
702
697
|
userAttributes: n
|
|
703
|
-
} =
|
|
698
|
+
} = Gt(e);
|
|
704
699
|
return n;
|
|
705
700
|
}
|
|
706
701
|
return {};
|
|
707
|
-
},
|
|
708
|
-
async function
|
|
709
|
-
|
|
702
|
+
}, Ht = (t) => "results" in t;
|
|
703
|
+
async function Qt(t) {
|
|
704
|
+
var r;
|
|
705
|
+
const e = t.locale || ((r = t.userAttributes) == null ? void 0 : r.locale);
|
|
706
|
+
e && (t.locale = e, t.userAttributes = {
|
|
707
|
+
locale: e,
|
|
708
|
+
...t.userAttributes
|
|
709
|
+
});
|
|
710
|
+
const n = await qt({
|
|
710
711
|
...t,
|
|
711
712
|
limit: 1
|
|
712
713
|
});
|
|
713
|
-
return
|
|
714
|
+
return n && n[0] || null;
|
|
714
715
|
}
|
|
715
|
-
const
|
|
716
|
+
const Yt = async (t) => {
|
|
716
717
|
var i, u;
|
|
717
|
-
const e =
|
|
718
|
+
const e = P(t), n = (i = t.fetch) != null ? i : $t, r = {
|
|
718
719
|
...t.fetchOptions,
|
|
719
720
|
headers: {
|
|
720
721
|
...(u = t.fetchOptions) == null ? void 0 : u.headers,
|
|
721
|
-
...
|
|
722
|
+
...z()
|
|
722
723
|
}
|
|
723
724
|
};
|
|
724
725
|
return await (await n(e.href, r)).json();
|
|
725
|
-
},
|
|
726
|
-
const r =
|
|
726
|
+
}, Zt = async (t, e, n = P(t)) => {
|
|
727
|
+
const r = Mt(t.canTrack);
|
|
727
728
|
if (n.search.includes("preview="), !r || !(c() || b === "reactNative"))
|
|
728
729
|
return e.results;
|
|
729
730
|
try {
|
|
730
731
|
const s = [];
|
|
731
732
|
for (const o of e.results)
|
|
732
|
-
s.push(await
|
|
733
|
+
s.push(await Kt({
|
|
733
734
|
item: o,
|
|
734
735
|
canTrack: r
|
|
735
736
|
}));
|
|
736
737
|
e.results = s;
|
|
737
738
|
} catch (s) {
|
|
738
|
-
|
|
739
|
+
h.error("Could not process A/B tests. ", s);
|
|
739
740
|
}
|
|
740
741
|
return e.results;
|
|
741
742
|
};
|
|
742
|
-
async function
|
|
743
|
-
const e =
|
|
744
|
-
if (!
|
|
745
|
-
throw
|
|
743
|
+
async function qt(t) {
|
|
744
|
+
const e = P(t), n = await Yt(t);
|
|
745
|
+
if (!Ht(n))
|
|
746
|
+
throw h.error("Error fetching data. ", {
|
|
746
747
|
url: e,
|
|
747
748
|
content: n,
|
|
748
749
|
options: t
|
|
749
750
|
}), n;
|
|
750
|
-
return
|
|
751
|
+
return Zt(t, n);
|
|
751
752
|
}
|
|
752
|
-
const
|
|
753
|
+
const ue = async (t) => {
|
|
753
754
|
var r, s, o;
|
|
754
755
|
const e = t.path || ((r = t.url) == null ? void 0 : r.pathname) || ((s = t.userAttributes) == null ? void 0 : s.urlPath), n = {
|
|
755
756
|
...t,
|
|
@@ -761,42 +762,41 @@ const le = async (t) => {
|
|
|
761
762
|
urlPath: e
|
|
762
763
|
} : {}
|
|
763
764
|
},
|
|
764
|
-
options:
|
|
765
|
+
options: G(t.searchParams || ((o = t.url) == null ? void 0 : o.searchParams) || t.options)
|
|
765
766
|
};
|
|
766
767
|
return {
|
|
767
768
|
apiKey: n.apiKey,
|
|
768
769
|
model: n.model,
|
|
769
|
-
content: await
|
|
770
|
+
content: await Qt(n)
|
|
770
771
|
};
|
|
771
772
|
};
|
|
772
773
|
export {
|
|
773
|
-
v as MSG_PREFIX,
|
|
774
774
|
b as TARGET,
|
|
775
|
-
|
|
776
|
-
|
|
775
|
+
Zt as _processContentResult,
|
|
776
|
+
Ct as _track,
|
|
777
777
|
y as checkIsDefined,
|
|
778
|
-
|
|
778
|
+
_t as createEditorListener,
|
|
779
779
|
ne as createRegisterComponentMessage,
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
780
|
+
ue as fetchBuilderProps,
|
|
781
|
+
qt as fetchEntries,
|
|
782
|
+
Qt as fetchOneEntry,
|
|
783
|
+
G as getBuilderSearchParams,
|
|
784
|
+
U as getCookieSync,
|
|
785
|
+
Mt as getDefaultCanTrack,
|
|
786
|
+
Ot as getUserAttributes,
|
|
787
787
|
ce as handleABTestingSync,
|
|
788
788
|
c as isBrowser,
|
|
789
|
-
|
|
789
|
+
ft as isEditing,
|
|
790
790
|
ee as isPreviewing,
|
|
791
|
-
|
|
792
|
-
|
|
791
|
+
kt as logFetch,
|
|
792
|
+
h as logger,
|
|
793
793
|
re as register,
|
|
794
794
|
se as registerAction,
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
$ as serializeIncludingFunctions,
|
|
796
|
+
te as setClientUserAttributes,
|
|
797
797
|
oe as setEditorSettings,
|
|
798
|
-
|
|
798
|
+
xt as setupBrowserForEditing,
|
|
799
799
|
ae as subscribeToEditor,
|
|
800
800
|
ie as track,
|
|
801
|
-
|
|
801
|
+
M as userAttributesService
|
|
802
802
|
};
|