@builder.io/sdk-solid 4.1.3 → 4.2.1
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/dist/index.d.ts +18 -1
- package/lib/browser/dev.js +38 -11
- package/lib/browser/dev.jsx +72 -36
- package/lib/browser/index.js +37 -10
- package/lib/browser/index.jsx +67 -35
- package/lib/edge/dev.js +38 -11
- package/lib/edge/dev.jsx +72 -36
- package/lib/edge/index.js +37 -10
- package/lib/edge/index.jsx +67 -35
- package/lib/node/dev.js +38 -11
- package/lib/node/dev.jsx +72 -36
- package/lib/node/index.js +37 -10
- package/lib/node/index.jsx +67 -35
- package/package.json +1 -1
package/lib/edge/dev.js
CHANGED
|
@@ -7693,9 +7693,9 @@ function logFetch(url) {
|
|
|
7693
7693
|
}
|
|
7694
7694
|
|
|
7695
7695
|
// src/blocks/form/form/form.tsx
|
|
7696
|
-
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-
|
|
7696
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
|
|
7697
7697
|
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
7698
|
-
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-
|
|
7698
|
+
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
|
|
7699
7699
|
padding: 10px;
|
|
7700
7700
|
color: red;
|
|
7701
7701
|
text-align: center;
|
|
@@ -7732,13 +7732,13 @@ function FormComponent(props) {
|
|
|
7732
7732
|
const headers = props.customHeaders || {};
|
|
7733
7733
|
let body;
|
|
7734
7734
|
const formData = new FormData(el);
|
|
7735
|
-
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
|
|
7735
|
+
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
|
|
7736
7736
|
let value;
|
|
7737
7737
|
const key = el2.name;
|
|
7738
7738
|
if (el2 instanceof HTMLInputElement) {
|
|
7739
7739
|
if (el2.type === "radio") {
|
|
7740
7740
|
if (el2.checked) {
|
|
7741
|
-
value = el2.
|
|
7741
|
+
value = el2.value;
|
|
7742
7742
|
return {
|
|
7743
7743
|
key,
|
|
7744
7744
|
value
|
|
@@ -8683,7 +8683,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8683
8683
|
}
|
|
8684
8684
|
|
|
8685
8685
|
// src/constants/sdk-version.ts
|
|
8686
|
-
var SDK_VERSION = "4.1
|
|
8686
|
+
var SDK_VERSION = "4.2.1";
|
|
8687
8687
|
|
|
8688
8688
|
// src/helpers/sdk-headers.ts
|
|
8689
8689
|
var getSdkHeaders = () => ({
|
|
@@ -9589,13 +9589,15 @@ function EnableEditor(props) {
|
|
|
9589
9589
|
}
|
|
9590
9590
|
function runHttpRequests() {
|
|
9591
9591
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9592
|
-
Object.entries(requests).forEach(([key,
|
|
9593
|
-
if (!
|
|
9592
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
9593
|
+
if (!httpRequest)
|
|
9594
9594
|
return;
|
|
9595
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9595
9596
|
if (httpReqsPending()[key])
|
|
9596
9597
|
return;
|
|
9597
9598
|
if (httpReqsData()[key] && !isEditing())
|
|
9598
9599
|
return;
|
|
9600
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9599
9601
|
httpReqsPending()[key] = true;
|
|
9600
9602
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
9601
9603
|
code: group,
|
|
@@ -9604,14 +9606,27 @@ function EnableEditor(props) {
|
|
|
9604
9606
|
rootState: props.builderContextSignal.rootState,
|
|
9605
9607
|
rootSetState: props.builderContextSignal.rootSetState
|
|
9606
9608
|
})));
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9610
|
+
url: evaluatedUrl,
|
|
9611
|
+
method: httpRequest.request.method,
|
|
9612
|
+
headers: httpRequest.request.headers,
|
|
9613
|
+
body: httpRequest.request.body
|
|
9614
|
+
} : {
|
|
9615
|
+
url: evaluatedUrl,
|
|
9616
|
+
method: "GET"
|
|
9617
|
+
};
|
|
9618
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9619
|
+
fetch(fetchRequestObj.url, {
|
|
9620
|
+
method: fetchRequestObj.method,
|
|
9621
|
+
headers: fetchRequestObj.headers,
|
|
9622
|
+
body: fetchRequestObj.body
|
|
9623
|
+
}).then((response) => response.json()).then((json) => {
|
|
9609
9624
|
mergeNewRootState({
|
|
9610
9625
|
[key]: json
|
|
9611
9626
|
});
|
|
9612
9627
|
httpReqsData()[key] = true;
|
|
9613
9628
|
}).catch((err) => {
|
|
9614
|
-
console.error("error fetching dynamic data",
|
|
9629
|
+
console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
|
|
9615
9630
|
}).finally(() => {
|
|
9616
9631
|
httpReqsPending()[key] = false;
|
|
9617
9632
|
});
|
|
@@ -10383,6 +10398,18 @@ function register(type, info) {
|
|
|
10383
10398
|
}
|
|
10384
10399
|
}
|
|
10385
10400
|
}
|
|
10401
|
+
function registerAction(action) {
|
|
10402
|
+
if (isBrowser()) {
|
|
10403
|
+
const actionClone = JSON.parse(JSON.stringify(action));
|
|
10404
|
+
if (action.action) {
|
|
10405
|
+
actionClone.action = action.action.toString();
|
|
10406
|
+
}
|
|
10407
|
+
window.parent?.postMessage({
|
|
10408
|
+
type: "builder.registerAction",
|
|
10409
|
+
data: actionClone
|
|
10410
|
+
}, "*");
|
|
10411
|
+
}
|
|
10412
|
+
}
|
|
10386
10413
|
|
|
10387
10414
|
// src/functions/set-editor-settings.ts
|
|
10388
10415
|
var settings = {};
|
|
@@ -10419,4 +10446,4 @@ var fetchBuilderProps = async (_args) => {
|
|
|
10419
10446
|
};
|
|
10420
10447
|
};
|
|
10421
10448
|
|
|
10422
|
-
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|
|
10449
|
+
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, registerAction, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -7335,13 +7335,15 @@ function FormComponent(props) {
|
|
|
7335
7335
|
const headers = props.customHeaders || {};
|
|
7336
7336
|
let body;
|
|
7337
7337
|
const formData = new FormData(el);
|
|
7338
|
-
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).
|
|
7338
|
+
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
|
|
7339
|
+
(el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
|
|
7340
|
+
).map((el2) => {
|
|
7339
7341
|
let value;
|
|
7340
7342
|
const key = el2.name;
|
|
7341
7343
|
if (el2 instanceof HTMLInputElement) {
|
|
7342
7344
|
if (el2.type === "radio") {
|
|
7343
7345
|
if (el2.checked) {
|
|
7344
|
-
value = el2.
|
|
7346
|
+
value = el2.value;
|
|
7345
7347
|
return {
|
|
7346
7348
|
key,
|
|
7347
7349
|
value
|
|
@@ -7534,14 +7536,14 @@ function FormComponent(props) {
|
|
|
7534
7536
|
blocks={props.sendingMessage}
|
|
7535
7537
|
context={props.builderContext}
|
|
7536
7538
|
/></Show12>
|
|
7537
|
-
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
7539
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
7538
7540
|
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
7539
7541
|
path="successMessage"
|
|
7540
7542
|
blocks={props.successMessage}
|
|
7541
7543
|
context={props.builderContext}
|
|
7542
7544
|
/></Show12>
|
|
7543
7545
|
</form>
|
|
7544
|
-
<style>{`.pre-
|
|
7546
|
+
<style>{`.pre-fdf23968 {
|
|
7545
7547
|
padding: 10px;
|
|
7546
7548
|
color: red;
|
|
7547
7549
|
text-align: center;
|
|
@@ -8177,7 +8179,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8177
8179
|
}
|
|
8178
8180
|
|
|
8179
8181
|
// src/constants/sdk-version.ts
|
|
8180
|
-
var SDK_VERSION = "4.1
|
|
8182
|
+
var SDK_VERSION = "4.2.1";
|
|
8181
8183
|
|
|
8182
8184
|
// src/helpers/sdk-headers.ts
|
|
8183
8185
|
var getSdkHeaders = () => ({
|
|
@@ -9082,38 +9084,59 @@ function EnableEditor(props) {
|
|
|
9082
9084
|
}
|
|
9083
9085
|
function runHttpRequests() {
|
|
9084
9086
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9085
|
-
Object.entries(requests).forEach(
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
(
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9087
|
+
Object.entries(requests).forEach(
|
|
9088
|
+
([key, httpRequest]) => {
|
|
9089
|
+
if (!httpRequest)
|
|
9090
|
+
return;
|
|
9091
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9092
|
+
if (httpReqsPending()[key])
|
|
9093
|
+
return;
|
|
9094
|
+
if (httpReqsData()[key] && !isEditing())
|
|
9095
|
+
return;
|
|
9096
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9097
|
+
httpReqsPending()[key] = true;
|
|
9098
|
+
const evaluatedUrl = url.replace(
|
|
9099
|
+
/{{([^}]+)}}/g,
|
|
9100
|
+
(_match, group) => String(
|
|
9101
|
+
evaluate({
|
|
9102
|
+
code: group,
|
|
9103
|
+
context: props.context || {},
|
|
9104
|
+
localState: void 0,
|
|
9105
|
+
rootState: props.builderContextSignal.rootState,
|
|
9106
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
9107
|
+
})
|
|
9108
|
+
)
|
|
9109
|
+
);
|
|
9110
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9111
|
+
url: evaluatedUrl,
|
|
9112
|
+
method: httpRequest.request.method,
|
|
9113
|
+
headers: httpRequest.request.headers,
|
|
9114
|
+
body: httpRequest.request.body
|
|
9115
|
+
} : {
|
|
9116
|
+
url: evaluatedUrl,
|
|
9117
|
+
method: "GET"
|
|
9118
|
+
};
|
|
9119
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9120
|
+
fetch(fetchRequestObj.url, {
|
|
9121
|
+
method: fetchRequestObj.method,
|
|
9122
|
+
headers: fetchRequestObj.headers,
|
|
9123
|
+
body: fetchRequestObj.body
|
|
9124
|
+
}).then((response) => response.json()).then((json) => {
|
|
9125
|
+
mergeNewRootState({
|
|
9126
|
+
[key]: json
|
|
9127
|
+
});
|
|
9128
|
+
httpReqsData()[key] = true;
|
|
9129
|
+
}).catch((err) => {
|
|
9130
|
+
console.error(
|
|
9131
|
+
"error fetching dynamic data",
|
|
9132
|
+
JSON.stringify(httpRequest),
|
|
9133
|
+
err
|
|
9134
|
+
);
|
|
9135
|
+
}).finally(() => {
|
|
9136
|
+
httpReqsPending()[key] = false;
|
|
9109
9137
|
});
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
console.error("error fetching dynamic data", url, err);
|
|
9113
|
-
}).finally(() => {
|
|
9114
|
-
httpReqsPending()[key] = false;
|
|
9115
|
-
});
|
|
9116
|
-
});
|
|
9138
|
+
}
|
|
9139
|
+
);
|
|
9117
9140
|
}
|
|
9118
9141
|
function emitStateUpdate() {
|
|
9119
9142
|
if (isEditing()) {
|
|
@@ -9685,6 +9708,18 @@ function register(type, info) {
|
|
|
9685
9708
|
}
|
|
9686
9709
|
}
|
|
9687
9710
|
}
|
|
9711
|
+
function registerAction(action) {
|
|
9712
|
+
if (isBrowser()) {
|
|
9713
|
+
const actionClone = JSON.parse(JSON.stringify(action));
|
|
9714
|
+
if (action.action) {
|
|
9715
|
+
actionClone.action = action.action.toString();
|
|
9716
|
+
}
|
|
9717
|
+
window.parent?.postMessage({
|
|
9718
|
+
type: "builder.registerAction",
|
|
9719
|
+
data: actionClone
|
|
9720
|
+
}, "*");
|
|
9721
|
+
}
|
|
9722
|
+
}
|
|
9688
9723
|
|
|
9689
9724
|
// src/functions/set-editor-settings.ts
|
|
9690
9725
|
var settings = {};
|
|
@@ -9741,6 +9776,7 @@ export {
|
|
|
9741
9776
|
isEditing,
|
|
9742
9777
|
isPreviewing,
|
|
9743
9778
|
register,
|
|
9779
|
+
registerAction,
|
|
9744
9780
|
setClientUserAttributes,
|
|
9745
9781
|
setEditorSettings,
|
|
9746
9782
|
subscribeToEditor,
|
package/lib/edge/index.js
CHANGED
|
@@ -7682,9 +7682,9 @@ function logFetch(url) {
|
|
|
7682
7682
|
}
|
|
7683
7683
|
|
|
7684
7684
|
// src/blocks/form/form/form.tsx
|
|
7685
|
-
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-
|
|
7685
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
|
|
7686
7686
|
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
7687
|
-
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-
|
|
7687
|
+
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
|
|
7688
7688
|
padding: 10px;
|
|
7689
7689
|
color: red;
|
|
7690
7690
|
text-align: center;
|
|
@@ -7721,13 +7721,13 @@ function FormComponent(props) {
|
|
|
7721
7721
|
const headers = props.customHeaders || {};
|
|
7722
7722
|
let body;
|
|
7723
7723
|
const formData = new FormData(el);
|
|
7724
|
-
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
|
|
7724
|
+
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
|
|
7725
7725
|
let value;
|
|
7726
7726
|
const key = el2.name;
|
|
7727
7727
|
if (el2 instanceof HTMLInputElement) {
|
|
7728
7728
|
if (el2.type === "radio") {
|
|
7729
7729
|
if (el2.checked) {
|
|
7730
|
-
value = el2.
|
|
7730
|
+
value = el2.value;
|
|
7731
7731
|
return {
|
|
7732
7732
|
key,
|
|
7733
7733
|
value
|
|
@@ -8670,7 +8670,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8670
8670
|
}
|
|
8671
8671
|
|
|
8672
8672
|
// src/constants/sdk-version.ts
|
|
8673
|
-
var SDK_VERSION = "4.1
|
|
8673
|
+
var SDK_VERSION = "4.2.1";
|
|
8674
8674
|
|
|
8675
8675
|
// src/helpers/sdk-headers.ts
|
|
8676
8676
|
var getSdkHeaders = () => ({
|
|
@@ -9571,13 +9571,15 @@ function EnableEditor(props) {
|
|
|
9571
9571
|
}
|
|
9572
9572
|
function runHttpRequests() {
|
|
9573
9573
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9574
|
-
Object.entries(requests).forEach(([key,
|
|
9575
|
-
if (!
|
|
9574
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
9575
|
+
if (!httpRequest)
|
|
9576
9576
|
return;
|
|
9577
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9577
9578
|
if (httpReqsPending()[key])
|
|
9578
9579
|
return;
|
|
9579
9580
|
if (httpReqsData()[key] && !isEditing())
|
|
9580
9581
|
return;
|
|
9582
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9581
9583
|
httpReqsPending()[key] = true;
|
|
9582
9584
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
9583
9585
|
code: group,
|
|
@@ -9586,8 +9588,21 @@ function EnableEditor(props) {
|
|
|
9586
9588
|
rootState: props.builderContextSignal.rootState,
|
|
9587
9589
|
rootSetState: props.builderContextSignal.rootSetState
|
|
9588
9590
|
})));
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9592
|
+
url: evaluatedUrl,
|
|
9593
|
+
method: httpRequest.request.method,
|
|
9594
|
+
headers: httpRequest.request.headers,
|
|
9595
|
+
body: httpRequest.request.body
|
|
9596
|
+
} : {
|
|
9597
|
+
url: evaluatedUrl,
|
|
9598
|
+
method: "GET"
|
|
9599
|
+
};
|
|
9600
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9601
|
+
fetch(fetchRequestObj.url, {
|
|
9602
|
+
method: fetchRequestObj.method,
|
|
9603
|
+
headers: fetchRequestObj.headers,
|
|
9604
|
+
body: fetchRequestObj.body
|
|
9605
|
+
}).then((response) => response.json()).then((json) => {
|
|
9591
9606
|
mergeNewRootState({
|
|
9592
9607
|
[key]: json
|
|
9593
9608
|
});
|
|
@@ -10363,6 +10378,18 @@ function register(type, info) {
|
|
|
10363
10378
|
}
|
|
10364
10379
|
}
|
|
10365
10380
|
}
|
|
10381
|
+
function registerAction(action) {
|
|
10382
|
+
if (isBrowser()) {
|
|
10383
|
+
const actionClone = JSON.parse(JSON.stringify(action));
|
|
10384
|
+
if (action.action) {
|
|
10385
|
+
actionClone.action = action.action.toString();
|
|
10386
|
+
}
|
|
10387
|
+
window.parent?.postMessage({
|
|
10388
|
+
type: "builder.registerAction",
|
|
10389
|
+
data: actionClone
|
|
10390
|
+
}, "*");
|
|
10391
|
+
}
|
|
10392
|
+
}
|
|
10366
10393
|
|
|
10367
10394
|
// src/functions/set-editor-settings.ts
|
|
10368
10395
|
var settings = {};
|
|
@@ -10399,4 +10426,4 @@ var fetchBuilderProps = async (_args) => {
|
|
|
10399
10426
|
};
|
|
10400
10427
|
};
|
|
10401
10428
|
|
|
10402
|
-
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|
|
10429
|
+
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, registerAction, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|
package/lib/edge/index.jsx
CHANGED
|
@@ -7326,13 +7326,15 @@ function FormComponent(props) {
|
|
|
7326
7326
|
const headers = props.customHeaders || {};
|
|
7327
7327
|
let body;
|
|
7328
7328
|
const formData = new FormData(el);
|
|
7329
|
-
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).
|
|
7329
|
+
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter(
|
|
7330
|
+
(el2) => !!el2.name && (el2.type !== "radio" || el2.checked)
|
|
7331
|
+
).map((el2) => {
|
|
7330
7332
|
let value;
|
|
7331
7333
|
const key = el2.name;
|
|
7332
7334
|
if (el2 instanceof HTMLInputElement) {
|
|
7333
7335
|
if (el2.type === "radio") {
|
|
7334
7336
|
if (el2.checked) {
|
|
7335
|
-
value = el2.
|
|
7337
|
+
value = el2.value;
|
|
7336
7338
|
return {
|
|
7337
7339
|
key,
|
|
7338
7340
|
value
|
|
@@ -7524,14 +7526,14 @@ function FormComponent(props) {
|
|
|
7524
7526
|
blocks={props.sendingMessage}
|
|
7525
7527
|
context={props.builderContext}
|
|
7526
7528
|
/></Show12>
|
|
7527
|
-
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-
|
|
7529
|
+
<Show12 when={submissionState() === "error" && responseData()}><pre class="builder-form-error-text pre-fdf23968">{JSON.stringify(responseData(), null, 2)}</pre></Show12>
|
|
7528
7530
|
<Show12 when={submissionState() === "success"}><Blocks_default
|
|
7529
7531
|
path="successMessage"
|
|
7530
7532
|
blocks={props.successMessage}
|
|
7531
7533
|
context={props.builderContext}
|
|
7532
7534
|
/></Show12>
|
|
7533
7535
|
</form>
|
|
7534
|
-
<style>{`.pre-
|
|
7536
|
+
<style>{`.pre-fdf23968 {
|
|
7535
7537
|
padding: 10px;
|
|
7536
7538
|
color: red;
|
|
7537
7539
|
text-align: center;
|
|
@@ -8166,7 +8168,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8166
8168
|
}
|
|
8167
8169
|
|
|
8168
8170
|
// src/constants/sdk-version.ts
|
|
8169
|
-
var SDK_VERSION = "4.1
|
|
8171
|
+
var SDK_VERSION = "4.2.1";
|
|
8170
8172
|
|
|
8171
8173
|
// src/helpers/sdk-headers.ts
|
|
8172
8174
|
var getSdkHeaders = () => ({
|
|
@@ -9066,37 +9068,54 @@ function EnableEditor(props) {
|
|
|
9066
9068
|
}
|
|
9067
9069
|
function runHttpRequests() {
|
|
9068
9070
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9069
|
-
Object.entries(requests).forEach(
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
(
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9071
|
+
Object.entries(requests).forEach(
|
|
9072
|
+
([key, httpRequest]) => {
|
|
9073
|
+
if (!httpRequest)
|
|
9074
|
+
return;
|
|
9075
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9076
|
+
if (httpReqsPending()[key])
|
|
9077
|
+
return;
|
|
9078
|
+
if (httpReqsData()[key] && !isEditing())
|
|
9079
|
+
return;
|
|
9080
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9081
|
+
httpReqsPending()[key] = true;
|
|
9082
|
+
const evaluatedUrl = url.replace(
|
|
9083
|
+
/{{([^}]+)}}/g,
|
|
9084
|
+
(_match, group) => String(
|
|
9085
|
+
evaluate({
|
|
9086
|
+
code: group,
|
|
9087
|
+
context: props.context || {},
|
|
9088
|
+
localState: void 0,
|
|
9089
|
+
rootState: props.builderContextSignal.rootState,
|
|
9090
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
9091
|
+
})
|
|
9092
|
+
)
|
|
9093
|
+
);
|
|
9094
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9095
|
+
url: evaluatedUrl,
|
|
9096
|
+
method: httpRequest.request.method,
|
|
9097
|
+
headers: httpRequest.request.headers,
|
|
9098
|
+
body: httpRequest.request.body
|
|
9099
|
+
} : {
|
|
9100
|
+
url: evaluatedUrl,
|
|
9101
|
+
method: "GET"
|
|
9102
|
+
};
|
|
9103
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9104
|
+
fetch(fetchRequestObj.url, {
|
|
9105
|
+
method: fetchRequestObj.method,
|
|
9106
|
+
headers: fetchRequestObj.headers,
|
|
9107
|
+
body: fetchRequestObj.body
|
|
9108
|
+
}).then((response) => response.json()).then((json) => {
|
|
9109
|
+
mergeNewRootState({
|
|
9110
|
+
[key]: json
|
|
9111
|
+
});
|
|
9112
|
+
httpReqsData()[key] = true;
|
|
9113
|
+
}).catch((err) => {
|
|
9114
|
+
}).finally(() => {
|
|
9115
|
+
httpReqsPending()[key] = false;
|
|
9093
9116
|
});
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
}).finally(() => {
|
|
9097
|
-
httpReqsPending()[key] = false;
|
|
9098
|
-
});
|
|
9099
|
-
});
|
|
9117
|
+
}
|
|
9118
|
+
);
|
|
9100
9119
|
}
|
|
9101
9120
|
function emitStateUpdate() {
|
|
9102
9121
|
if (isEditing()) {
|
|
@@ -9667,6 +9686,18 @@ function register(type, info) {
|
|
|
9667
9686
|
}
|
|
9668
9687
|
}
|
|
9669
9688
|
}
|
|
9689
|
+
function registerAction(action) {
|
|
9690
|
+
if (isBrowser()) {
|
|
9691
|
+
const actionClone = JSON.parse(JSON.stringify(action));
|
|
9692
|
+
if (action.action) {
|
|
9693
|
+
actionClone.action = action.action.toString();
|
|
9694
|
+
}
|
|
9695
|
+
window.parent?.postMessage({
|
|
9696
|
+
type: "builder.registerAction",
|
|
9697
|
+
data: actionClone
|
|
9698
|
+
}, "*");
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9670
9701
|
|
|
9671
9702
|
// src/functions/set-editor-settings.ts
|
|
9672
9703
|
var settings = {};
|
|
@@ -9723,6 +9754,7 @@ export {
|
|
|
9723
9754
|
isEditing,
|
|
9724
9755
|
isPreviewing,
|
|
9725
9756
|
register,
|
|
9757
|
+
registerAction,
|
|
9726
9758
|
setClientUserAttributes,
|
|
9727
9759
|
setEditorSettings,
|
|
9728
9760
|
subscribeToEditor,
|
package/lib/node/dev.js
CHANGED
|
@@ -4681,9 +4681,9 @@ function logFetch(url) {
|
|
|
4681
4681
|
}
|
|
4682
4682
|
|
|
4683
4683
|
// src/blocks/form/form/form.tsx
|
|
4684
|
-
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-
|
|
4684
|
+
var _tmpl$15 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-fdf23968">`);
|
|
4685
4685
|
var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
|
|
4686
|
-
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-
|
|
4686
|
+
var _tmpl$34 = /* @__PURE__ */ template(`<style>.pre-fdf23968 {
|
|
4687
4687
|
padding: 10px;
|
|
4688
4688
|
color: red;
|
|
4689
4689
|
text-align: center;
|
|
@@ -4720,13 +4720,13 @@ function FormComponent(props) {
|
|
|
4720
4720
|
const headers = props.customHeaders || {};
|
|
4721
4721
|
let body;
|
|
4722
4722
|
const formData = new FormData(el);
|
|
4723
|
-
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).map((el2) => {
|
|
4723
|
+
const formPairs = Array.from(el.querySelectorAll("input,select,textarea")).filter((el2) => !!el2.name).filter((el2) => !!el2.name && (el2.type !== "radio" || el2.checked)).map((el2) => {
|
|
4724
4724
|
let value;
|
|
4725
4725
|
const key = el2.name;
|
|
4726
4726
|
if (el2 instanceof HTMLInputElement) {
|
|
4727
4727
|
if (el2.type === "radio") {
|
|
4728
4728
|
if (el2.checked) {
|
|
4729
|
-
value = el2.
|
|
4729
|
+
value = el2.value;
|
|
4730
4730
|
return {
|
|
4731
4731
|
key,
|
|
4732
4732
|
value
|
|
@@ -5671,7 +5671,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5671
5671
|
}
|
|
5672
5672
|
|
|
5673
5673
|
// src/constants/sdk-version.ts
|
|
5674
|
-
var SDK_VERSION = "4.1
|
|
5674
|
+
var SDK_VERSION = "4.2.1";
|
|
5675
5675
|
|
|
5676
5676
|
// src/helpers/sdk-headers.ts
|
|
5677
5677
|
var getSdkHeaders = () => ({
|
|
@@ -6577,13 +6577,15 @@ function EnableEditor(props) {
|
|
|
6577
6577
|
}
|
|
6578
6578
|
function runHttpRequests() {
|
|
6579
6579
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6580
|
-
Object.entries(requests).forEach(([key,
|
|
6581
|
-
if (!
|
|
6580
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
6581
|
+
if (!httpRequest)
|
|
6582
6582
|
return;
|
|
6583
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6583
6584
|
if (httpReqsPending()[key])
|
|
6584
6585
|
return;
|
|
6585
6586
|
if (httpReqsData()[key] && !isEditing())
|
|
6586
6587
|
return;
|
|
6588
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6587
6589
|
httpReqsPending()[key] = true;
|
|
6588
6590
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
6589
6591
|
code: group,
|
|
@@ -6592,14 +6594,27 @@ function EnableEditor(props) {
|
|
|
6592
6594
|
rootState: props.builderContextSignal.rootState,
|
|
6593
6595
|
rootSetState: props.builderContextSignal.rootSetState
|
|
6594
6596
|
})));
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6598
|
+
url: evaluatedUrl,
|
|
6599
|
+
method: httpRequest.request.method,
|
|
6600
|
+
headers: httpRequest.request.headers,
|
|
6601
|
+
body: httpRequest.request.body
|
|
6602
|
+
} : {
|
|
6603
|
+
url: evaluatedUrl,
|
|
6604
|
+
method: "GET"
|
|
6605
|
+
};
|
|
6606
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6607
|
+
fetch(fetchRequestObj.url, {
|
|
6608
|
+
method: fetchRequestObj.method,
|
|
6609
|
+
headers: fetchRequestObj.headers,
|
|
6610
|
+
body: fetchRequestObj.body
|
|
6611
|
+
}).then((response) => response.json()).then((json) => {
|
|
6597
6612
|
mergeNewRootState({
|
|
6598
6613
|
[key]: json
|
|
6599
6614
|
});
|
|
6600
6615
|
httpReqsData()[key] = true;
|
|
6601
6616
|
}).catch((err) => {
|
|
6602
|
-
console.error("error fetching dynamic data",
|
|
6617
|
+
console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
|
|
6603
6618
|
}).finally(() => {
|
|
6604
6619
|
httpReqsPending()[key] = false;
|
|
6605
6620
|
});
|
|
@@ -7371,6 +7386,18 @@ function register(type, info) {
|
|
|
7371
7386
|
}
|
|
7372
7387
|
}
|
|
7373
7388
|
}
|
|
7389
|
+
function registerAction(action) {
|
|
7390
|
+
if (isBrowser()) {
|
|
7391
|
+
const actionClone = JSON.parse(JSON.stringify(action));
|
|
7392
|
+
if (action.action) {
|
|
7393
|
+
actionClone.action = action.action.toString();
|
|
7394
|
+
}
|
|
7395
|
+
window.parent?.postMessage({
|
|
7396
|
+
type: "builder.registerAction",
|
|
7397
|
+
data: actionClone
|
|
7398
|
+
}, "*");
|
|
7399
|
+
}
|
|
7400
|
+
}
|
|
7374
7401
|
|
|
7375
7402
|
// src/functions/set-editor-settings.ts
|
|
7376
7403
|
var settings = {};
|
|
@@ -7407,4 +7434,4 @@ var fetchBuilderProps = async (_args) => {
|
|
|
7407
7434
|
};
|
|
7408
7435
|
};
|
|
7409
7436
|
|
|
7410
|
-
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|
|
7437
|
+
export { blocks_default as Blocks, builder_context_default as BuilderContext, button_default as Button, columns_default as Columns, content_variants_default as Content, fragment_default as Fragment, image_default as Image, section_default as Section, symbol_default as Symbol, text_default as Text, video_default as Video, _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getBuilderSearchParams, isEditing, isPreviewing, register, registerAction, setClientUserAttributes, setEditorSettings, subscribeToEditor, track };
|