@builder.io/sdk-solid 4.1.2 → 4.2.0
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/dev.js +25 -9
- package/lib/browser/dev.jsx +57 -35
- package/lib/browser/index.js +24 -8
- package/lib/browser/index.jsx +52 -34
- package/lib/edge/dev.js +25 -9
- package/lib/edge/dev.jsx +57 -35
- package/lib/edge/index.js +24 -8
- package/lib/edge/index.jsx +52 -34
- package/lib/node/dev.js +25 -9
- package/lib/node/dev.jsx +57 -35
- package/lib/node/index.js +24 -8
- package/lib/node/index.jsx +52 -34
- package/package.json +1 -1
package/lib/browser/dev.js
CHANGED
|
@@ -585,15 +585,16 @@ function getProcessedBlock({
|
|
|
585
585
|
rootState,
|
|
586
586
|
rootSetState
|
|
587
587
|
}) {
|
|
588
|
-
let transformedBlock =
|
|
589
|
-
transformedBlock =
|
|
590
|
-
return evaluateBindings({
|
|
588
|
+
let transformedBlock = transformBlock(block);
|
|
589
|
+
transformedBlock = evaluateBindings({
|
|
591
590
|
block: transformedBlock,
|
|
592
591
|
localState,
|
|
593
592
|
rootState,
|
|
594
593
|
rootSetState,
|
|
595
594
|
context
|
|
596
595
|
});
|
|
596
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
597
|
+
return transformedBlock;
|
|
597
598
|
}
|
|
598
599
|
|
|
599
600
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5501,7 +5502,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5501
5502
|
}
|
|
5502
5503
|
|
|
5503
5504
|
// src/constants/sdk-version.ts
|
|
5504
|
-
var SDK_VERSION = "4.
|
|
5505
|
+
var SDK_VERSION = "4.2.0";
|
|
5505
5506
|
|
|
5506
5507
|
// src/helpers/sdk-headers.ts
|
|
5507
5508
|
var getSdkHeaders = () => ({
|
|
@@ -6407,13 +6408,15 @@ function EnableEditor(props) {
|
|
|
6407
6408
|
}
|
|
6408
6409
|
function runHttpRequests() {
|
|
6409
6410
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6410
|
-
Object.entries(requests).forEach(([key,
|
|
6411
|
-
if (!
|
|
6411
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
6412
|
+
if (!httpRequest)
|
|
6412
6413
|
return;
|
|
6414
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6413
6415
|
if (httpReqsPending()[key])
|
|
6414
6416
|
return;
|
|
6415
6417
|
if (httpReqsData()[key] && !isEditing())
|
|
6416
6418
|
return;
|
|
6419
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6417
6420
|
httpReqsPending()[key] = true;
|
|
6418
6421
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
6419
6422
|
code: group,
|
|
@@ -6422,14 +6425,27 @@ function EnableEditor(props) {
|
|
|
6422
6425
|
rootState: props.builderContextSignal.rootState,
|
|
6423
6426
|
rootSetState: props.builderContextSignal.rootSetState
|
|
6424
6427
|
})));
|
|
6425
|
-
|
|
6426
|
-
|
|
6428
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6429
|
+
url: evaluatedUrl,
|
|
6430
|
+
method: httpRequest.request.method,
|
|
6431
|
+
headers: httpRequest.request.headers,
|
|
6432
|
+
body: httpRequest.request.body
|
|
6433
|
+
} : {
|
|
6434
|
+
url: evaluatedUrl,
|
|
6435
|
+
method: "GET"
|
|
6436
|
+
};
|
|
6437
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6438
|
+
fetch(fetchRequestObj.url, {
|
|
6439
|
+
method: fetchRequestObj.method,
|
|
6440
|
+
headers: fetchRequestObj.headers,
|
|
6441
|
+
body: fetchRequestObj.body
|
|
6442
|
+
}).then((response) => response.json()).then((json) => {
|
|
6427
6443
|
mergeNewRootState({
|
|
6428
6444
|
[key]: json
|
|
6429
6445
|
});
|
|
6430
6446
|
httpReqsData()[key] = true;
|
|
6431
6447
|
}).catch((err) => {
|
|
6432
|
-
console.error("error fetching dynamic data",
|
|
6448
|
+
console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
|
|
6433
6449
|
}).finally(() => {
|
|
6434
6450
|
httpReqsPending()[key] = false;
|
|
6435
6451
|
});
|
package/lib/browser/dev.jsx
CHANGED
|
@@ -578,15 +578,16 @@ function getProcessedBlock({
|
|
|
578
578
|
rootState,
|
|
579
579
|
rootSetState
|
|
580
580
|
}) {
|
|
581
|
-
let transformedBlock =
|
|
582
|
-
transformedBlock =
|
|
583
|
-
return evaluateBindings({
|
|
581
|
+
let transformedBlock = transformBlock(block);
|
|
582
|
+
transformedBlock = evaluateBindings({
|
|
584
583
|
block: transformedBlock,
|
|
585
584
|
localState,
|
|
586
585
|
rootState,
|
|
587
586
|
rootSetState,
|
|
588
587
|
context
|
|
589
588
|
});
|
|
589
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
590
|
+
return transformedBlock;
|
|
590
591
|
}
|
|
591
592
|
|
|
592
593
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -4993,7 +4994,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4993
4994
|
}
|
|
4994
4995
|
|
|
4995
4996
|
// src/constants/sdk-version.ts
|
|
4996
|
-
var SDK_VERSION = "4.
|
|
4997
|
+
var SDK_VERSION = "4.2.0";
|
|
4997
4998
|
|
|
4998
4999
|
// src/helpers/sdk-headers.ts
|
|
4999
5000
|
var getSdkHeaders = () => ({
|
|
@@ -5898,38 +5899,59 @@ function EnableEditor(props) {
|
|
|
5898
5899
|
}
|
|
5899
5900
|
function runHttpRequests() {
|
|
5900
5901
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
5901
|
-
Object.entries(requests).forEach(
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
(
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5902
|
+
Object.entries(requests).forEach(
|
|
5903
|
+
([key, httpRequest]) => {
|
|
5904
|
+
if (!httpRequest)
|
|
5905
|
+
return;
|
|
5906
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
5907
|
+
if (httpReqsPending()[key])
|
|
5908
|
+
return;
|
|
5909
|
+
if (httpReqsData()[key] && !isEditing())
|
|
5910
|
+
return;
|
|
5911
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
5912
|
+
httpReqsPending()[key] = true;
|
|
5913
|
+
const evaluatedUrl = url.replace(
|
|
5914
|
+
/{{([^}]+)}}/g,
|
|
5915
|
+
(_match, group) => String(
|
|
5916
|
+
evaluate({
|
|
5917
|
+
code: group,
|
|
5918
|
+
context: props.context || {},
|
|
5919
|
+
localState: void 0,
|
|
5920
|
+
rootState: props.builderContextSignal.rootState,
|
|
5921
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
5922
|
+
})
|
|
5923
|
+
)
|
|
5924
|
+
);
|
|
5925
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
5926
|
+
url: evaluatedUrl,
|
|
5927
|
+
method: httpRequest.request.method,
|
|
5928
|
+
headers: httpRequest.request.headers,
|
|
5929
|
+
body: httpRequest.request.body
|
|
5930
|
+
} : {
|
|
5931
|
+
url: evaluatedUrl,
|
|
5932
|
+
method: "GET"
|
|
5933
|
+
};
|
|
5934
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
5935
|
+
fetch(fetchRequestObj.url, {
|
|
5936
|
+
method: fetchRequestObj.method,
|
|
5937
|
+
headers: fetchRequestObj.headers,
|
|
5938
|
+
body: fetchRequestObj.body
|
|
5939
|
+
}).then((response) => response.json()).then((json) => {
|
|
5940
|
+
mergeNewRootState({
|
|
5941
|
+
[key]: json
|
|
5942
|
+
});
|
|
5943
|
+
httpReqsData()[key] = true;
|
|
5944
|
+
}).catch((err) => {
|
|
5945
|
+
console.error(
|
|
5946
|
+
"error fetching dynamic data",
|
|
5947
|
+
JSON.stringify(httpRequest),
|
|
5948
|
+
err
|
|
5949
|
+
);
|
|
5950
|
+
}).finally(() => {
|
|
5951
|
+
httpReqsPending()[key] = false;
|
|
5925
5952
|
});
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
console.error("error fetching dynamic data", url, err);
|
|
5929
|
-
}).finally(() => {
|
|
5930
|
-
httpReqsPending()[key] = false;
|
|
5931
|
-
});
|
|
5932
|
-
});
|
|
5953
|
+
}
|
|
5954
|
+
);
|
|
5933
5955
|
}
|
|
5934
5956
|
function emitStateUpdate() {
|
|
5935
5957
|
if (isEditing()) {
|
package/lib/browser/index.js
CHANGED
|
@@ -580,15 +580,16 @@ function getProcessedBlock({
|
|
|
580
580
|
rootState,
|
|
581
581
|
rootSetState
|
|
582
582
|
}) {
|
|
583
|
-
let transformedBlock =
|
|
584
|
-
transformedBlock =
|
|
585
|
-
return evaluateBindings({
|
|
583
|
+
let transformedBlock = transformBlock(block);
|
|
584
|
+
transformedBlock = evaluateBindings({
|
|
586
585
|
block: transformedBlock,
|
|
587
586
|
localState,
|
|
588
587
|
rootState,
|
|
589
588
|
rootSetState,
|
|
590
589
|
context
|
|
591
590
|
});
|
|
591
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
592
|
+
return transformedBlock;
|
|
592
593
|
}
|
|
593
594
|
|
|
594
595
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5488,7 +5489,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5488
5489
|
}
|
|
5489
5490
|
|
|
5490
5491
|
// src/constants/sdk-version.ts
|
|
5491
|
-
var SDK_VERSION = "4.
|
|
5492
|
+
var SDK_VERSION = "4.2.0";
|
|
5492
5493
|
|
|
5493
5494
|
// src/helpers/sdk-headers.ts
|
|
5494
5495
|
var getSdkHeaders = () => ({
|
|
@@ -6389,13 +6390,15 @@ function EnableEditor(props) {
|
|
|
6389
6390
|
}
|
|
6390
6391
|
function runHttpRequests() {
|
|
6391
6392
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6392
|
-
Object.entries(requests).forEach(([key,
|
|
6393
|
-
if (!
|
|
6393
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
6394
|
+
if (!httpRequest)
|
|
6394
6395
|
return;
|
|
6396
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6395
6397
|
if (httpReqsPending()[key])
|
|
6396
6398
|
return;
|
|
6397
6399
|
if (httpReqsData()[key] && !isEditing())
|
|
6398
6400
|
return;
|
|
6401
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6399
6402
|
httpReqsPending()[key] = true;
|
|
6400
6403
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
6401
6404
|
code: group,
|
|
@@ -6404,8 +6407,21 @@ function EnableEditor(props) {
|
|
|
6404
6407
|
rootState: props.builderContextSignal.rootState,
|
|
6405
6408
|
rootSetState: props.builderContextSignal.rootSetState
|
|
6406
6409
|
})));
|
|
6407
|
-
|
|
6408
|
-
|
|
6410
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6411
|
+
url: evaluatedUrl,
|
|
6412
|
+
method: httpRequest.request.method,
|
|
6413
|
+
headers: httpRequest.request.headers,
|
|
6414
|
+
body: httpRequest.request.body
|
|
6415
|
+
} : {
|
|
6416
|
+
url: evaluatedUrl,
|
|
6417
|
+
method: "GET"
|
|
6418
|
+
};
|
|
6419
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6420
|
+
fetch(fetchRequestObj.url, {
|
|
6421
|
+
method: fetchRequestObj.method,
|
|
6422
|
+
headers: fetchRequestObj.headers,
|
|
6423
|
+
body: fetchRequestObj.body
|
|
6424
|
+
}).then((response) => response.json()).then((json) => {
|
|
6409
6425
|
mergeNewRootState({
|
|
6410
6426
|
[key]: json
|
|
6411
6427
|
});
|
package/lib/browser/index.jsx
CHANGED
|
@@ -575,15 +575,16 @@ function getProcessedBlock({
|
|
|
575
575
|
rootState,
|
|
576
576
|
rootSetState
|
|
577
577
|
}) {
|
|
578
|
-
let transformedBlock =
|
|
579
|
-
transformedBlock =
|
|
580
|
-
return evaluateBindings({
|
|
578
|
+
let transformedBlock = transformBlock(block);
|
|
579
|
+
transformedBlock = evaluateBindings({
|
|
581
580
|
block: transformedBlock,
|
|
582
581
|
localState,
|
|
583
582
|
rootState,
|
|
584
583
|
rootSetState,
|
|
585
584
|
context
|
|
586
585
|
});
|
|
586
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
587
|
+
return transformedBlock;
|
|
587
588
|
}
|
|
588
589
|
|
|
589
590
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -4982,7 +4983,7 @@ function getPreviewContent(_searchParams) {
|
|
|
4982
4983
|
}
|
|
4983
4984
|
|
|
4984
4985
|
// src/constants/sdk-version.ts
|
|
4985
|
-
var SDK_VERSION = "4.
|
|
4986
|
+
var SDK_VERSION = "4.2.0";
|
|
4986
4987
|
|
|
4987
4988
|
// src/helpers/sdk-headers.ts
|
|
4988
4989
|
var getSdkHeaders = () => ({
|
|
@@ -5882,37 +5883,54 @@ function EnableEditor(props) {
|
|
|
5882
5883
|
}
|
|
5883
5884
|
function runHttpRequests() {
|
|
5884
5885
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
5885
|
-
Object.entries(requests).forEach(
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5894
|
-
|
|
5895
|
-
(
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5908
|
-
|
|
5886
|
+
Object.entries(requests).forEach(
|
|
5887
|
+
([key, httpRequest]) => {
|
|
5888
|
+
if (!httpRequest)
|
|
5889
|
+
return;
|
|
5890
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
5891
|
+
if (httpReqsPending()[key])
|
|
5892
|
+
return;
|
|
5893
|
+
if (httpReqsData()[key] && !isEditing())
|
|
5894
|
+
return;
|
|
5895
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
5896
|
+
httpReqsPending()[key] = true;
|
|
5897
|
+
const evaluatedUrl = url.replace(
|
|
5898
|
+
/{{([^}]+)}}/g,
|
|
5899
|
+
(_match, group) => String(
|
|
5900
|
+
evaluate({
|
|
5901
|
+
code: group,
|
|
5902
|
+
context: props.context || {},
|
|
5903
|
+
localState: void 0,
|
|
5904
|
+
rootState: props.builderContextSignal.rootState,
|
|
5905
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
5906
|
+
})
|
|
5907
|
+
)
|
|
5908
|
+
);
|
|
5909
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
5910
|
+
url: evaluatedUrl,
|
|
5911
|
+
method: httpRequest.request.method,
|
|
5912
|
+
headers: httpRequest.request.headers,
|
|
5913
|
+
body: httpRequest.request.body
|
|
5914
|
+
} : {
|
|
5915
|
+
url: evaluatedUrl,
|
|
5916
|
+
method: "GET"
|
|
5917
|
+
};
|
|
5918
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
5919
|
+
fetch(fetchRequestObj.url, {
|
|
5920
|
+
method: fetchRequestObj.method,
|
|
5921
|
+
headers: fetchRequestObj.headers,
|
|
5922
|
+
body: fetchRequestObj.body
|
|
5923
|
+
}).then((response) => response.json()).then((json) => {
|
|
5924
|
+
mergeNewRootState({
|
|
5925
|
+
[key]: json
|
|
5926
|
+
});
|
|
5927
|
+
httpReqsData()[key] = true;
|
|
5928
|
+
}).catch((err) => {
|
|
5929
|
+
}).finally(() => {
|
|
5930
|
+
httpReqsPending()[key] = false;
|
|
5909
5931
|
});
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
}).finally(() => {
|
|
5913
|
-
httpReqsPending()[key] = false;
|
|
5914
|
-
});
|
|
5915
|
-
});
|
|
5932
|
+
}
|
|
5933
|
+
);
|
|
5916
5934
|
}
|
|
5917
5935
|
function emitStateUpdate() {
|
|
5918
5936
|
if (isEditing()) {
|
package/lib/edge/dev.js
CHANGED
|
@@ -3766,15 +3766,16 @@ function getProcessedBlock({
|
|
|
3766
3766
|
rootState,
|
|
3767
3767
|
rootSetState
|
|
3768
3768
|
}) {
|
|
3769
|
-
let transformedBlock =
|
|
3770
|
-
transformedBlock =
|
|
3771
|
-
return evaluateBindings({
|
|
3769
|
+
let transformedBlock = transformBlock(block);
|
|
3770
|
+
transformedBlock = evaluateBindings({
|
|
3772
3771
|
block: transformedBlock,
|
|
3773
3772
|
localState,
|
|
3774
3773
|
rootState,
|
|
3775
3774
|
rootSetState,
|
|
3776
3775
|
context
|
|
3777
3776
|
});
|
|
3777
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
3778
|
+
return transformedBlock;
|
|
3778
3779
|
}
|
|
3779
3780
|
|
|
3780
3781
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -8682,7 +8683,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8682
8683
|
}
|
|
8683
8684
|
|
|
8684
8685
|
// src/constants/sdk-version.ts
|
|
8685
|
-
var SDK_VERSION = "4.
|
|
8686
|
+
var SDK_VERSION = "4.2.0";
|
|
8686
8687
|
|
|
8687
8688
|
// src/helpers/sdk-headers.ts
|
|
8688
8689
|
var getSdkHeaders = () => ({
|
|
@@ -9588,13 +9589,15 @@ function EnableEditor(props) {
|
|
|
9588
9589
|
}
|
|
9589
9590
|
function runHttpRequests() {
|
|
9590
9591
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9591
|
-
Object.entries(requests).forEach(([key,
|
|
9592
|
-
if (!
|
|
9592
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
9593
|
+
if (!httpRequest)
|
|
9593
9594
|
return;
|
|
9595
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9594
9596
|
if (httpReqsPending()[key])
|
|
9595
9597
|
return;
|
|
9596
9598
|
if (httpReqsData()[key] && !isEditing())
|
|
9597
9599
|
return;
|
|
9600
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9598
9601
|
httpReqsPending()[key] = true;
|
|
9599
9602
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
9600
9603
|
code: group,
|
|
@@ -9603,14 +9606,27 @@ function EnableEditor(props) {
|
|
|
9603
9606
|
rootState: props.builderContextSignal.rootState,
|
|
9604
9607
|
rootSetState: props.builderContextSignal.rootSetState
|
|
9605
9608
|
})));
|
|
9606
|
-
|
|
9607
|
-
|
|
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) => {
|
|
9608
9624
|
mergeNewRootState({
|
|
9609
9625
|
[key]: json
|
|
9610
9626
|
});
|
|
9611
9627
|
httpReqsData()[key] = true;
|
|
9612
9628
|
}).catch((err) => {
|
|
9613
|
-
console.error("error fetching dynamic data",
|
|
9629
|
+
console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
|
|
9614
9630
|
}).finally(() => {
|
|
9615
9631
|
httpReqsPending()[key] = false;
|
|
9616
9632
|
});
|
package/lib/edge/dev.jsx
CHANGED
|
@@ -3761,15 +3761,16 @@ function getProcessedBlock({
|
|
|
3761
3761
|
rootState,
|
|
3762
3762
|
rootSetState
|
|
3763
3763
|
}) {
|
|
3764
|
-
let transformedBlock =
|
|
3765
|
-
transformedBlock =
|
|
3766
|
-
return evaluateBindings({
|
|
3764
|
+
let transformedBlock = transformBlock(block);
|
|
3765
|
+
transformedBlock = evaluateBindings({
|
|
3767
3766
|
block: transformedBlock,
|
|
3768
3767
|
localState,
|
|
3769
3768
|
rootState,
|
|
3770
3769
|
rootSetState,
|
|
3771
3770
|
context
|
|
3772
3771
|
});
|
|
3772
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
3773
|
+
return transformedBlock;
|
|
3773
3774
|
}
|
|
3774
3775
|
|
|
3775
3776
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -8176,7 +8177,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8176
8177
|
}
|
|
8177
8178
|
|
|
8178
8179
|
// src/constants/sdk-version.ts
|
|
8179
|
-
var SDK_VERSION = "4.
|
|
8180
|
+
var SDK_VERSION = "4.2.0";
|
|
8180
8181
|
|
|
8181
8182
|
// src/helpers/sdk-headers.ts
|
|
8182
8183
|
var getSdkHeaders = () => ({
|
|
@@ -9081,38 +9082,59 @@ function EnableEditor(props) {
|
|
|
9081
9082
|
}
|
|
9082
9083
|
function runHttpRequests() {
|
|
9083
9084
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9084
|
-
Object.entries(requests).forEach(
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
(
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
|
|
9102
|
-
|
|
9103
|
-
|
|
9104
|
-
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9085
|
+
Object.entries(requests).forEach(
|
|
9086
|
+
([key, httpRequest]) => {
|
|
9087
|
+
if (!httpRequest)
|
|
9088
|
+
return;
|
|
9089
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9090
|
+
if (httpReqsPending()[key])
|
|
9091
|
+
return;
|
|
9092
|
+
if (httpReqsData()[key] && !isEditing())
|
|
9093
|
+
return;
|
|
9094
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9095
|
+
httpReqsPending()[key] = true;
|
|
9096
|
+
const evaluatedUrl = url.replace(
|
|
9097
|
+
/{{([^}]+)}}/g,
|
|
9098
|
+
(_match, group) => String(
|
|
9099
|
+
evaluate({
|
|
9100
|
+
code: group,
|
|
9101
|
+
context: props.context || {},
|
|
9102
|
+
localState: void 0,
|
|
9103
|
+
rootState: props.builderContextSignal.rootState,
|
|
9104
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
9105
|
+
})
|
|
9106
|
+
)
|
|
9107
|
+
);
|
|
9108
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9109
|
+
url: evaluatedUrl,
|
|
9110
|
+
method: httpRequest.request.method,
|
|
9111
|
+
headers: httpRequest.request.headers,
|
|
9112
|
+
body: httpRequest.request.body
|
|
9113
|
+
} : {
|
|
9114
|
+
url: evaluatedUrl,
|
|
9115
|
+
method: "GET"
|
|
9116
|
+
};
|
|
9117
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9118
|
+
fetch(fetchRequestObj.url, {
|
|
9119
|
+
method: fetchRequestObj.method,
|
|
9120
|
+
headers: fetchRequestObj.headers,
|
|
9121
|
+
body: fetchRequestObj.body
|
|
9122
|
+
}).then((response) => response.json()).then((json) => {
|
|
9123
|
+
mergeNewRootState({
|
|
9124
|
+
[key]: json
|
|
9125
|
+
});
|
|
9126
|
+
httpReqsData()[key] = true;
|
|
9127
|
+
}).catch((err) => {
|
|
9128
|
+
console.error(
|
|
9129
|
+
"error fetching dynamic data",
|
|
9130
|
+
JSON.stringify(httpRequest),
|
|
9131
|
+
err
|
|
9132
|
+
);
|
|
9133
|
+
}).finally(() => {
|
|
9134
|
+
httpReqsPending()[key] = false;
|
|
9108
9135
|
});
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
console.error("error fetching dynamic data", url, err);
|
|
9112
|
-
}).finally(() => {
|
|
9113
|
-
httpReqsPending()[key] = false;
|
|
9114
|
-
});
|
|
9115
|
-
});
|
|
9136
|
+
}
|
|
9137
|
+
);
|
|
9116
9138
|
}
|
|
9117
9139
|
function emitStateUpdate() {
|
|
9118
9140
|
if (isEditing()) {
|
package/lib/edge/index.js
CHANGED
|
@@ -3761,15 +3761,16 @@ function getProcessedBlock({
|
|
|
3761
3761
|
rootState,
|
|
3762
3762
|
rootSetState
|
|
3763
3763
|
}) {
|
|
3764
|
-
let transformedBlock =
|
|
3765
|
-
transformedBlock =
|
|
3766
|
-
return evaluateBindings({
|
|
3764
|
+
let transformedBlock = transformBlock(block);
|
|
3765
|
+
transformedBlock = evaluateBindings({
|
|
3767
3766
|
block: transformedBlock,
|
|
3768
3767
|
localState,
|
|
3769
3768
|
rootState,
|
|
3770
3769
|
rootSetState,
|
|
3771
3770
|
context
|
|
3772
3771
|
});
|
|
3772
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
3773
|
+
return transformedBlock;
|
|
3773
3774
|
}
|
|
3774
3775
|
|
|
3775
3776
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -8669,7 +8670,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8669
8670
|
}
|
|
8670
8671
|
|
|
8671
8672
|
// src/constants/sdk-version.ts
|
|
8672
|
-
var SDK_VERSION = "4.
|
|
8673
|
+
var SDK_VERSION = "4.2.0";
|
|
8673
8674
|
|
|
8674
8675
|
// src/helpers/sdk-headers.ts
|
|
8675
8676
|
var getSdkHeaders = () => ({
|
|
@@ -9570,13 +9571,15 @@ function EnableEditor(props) {
|
|
|
9570
9571
|
}
|
|
9571
9572
|
function runHttpRequests() {
|
|
9572
9573
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9573
|
-
Object.entries(requests).forEach(([key,
|
|
9574
|
-
if (!
|
|
9574
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
9575
|
+
if (!httpRequest)
|
|
9575
9576
|
return;
|
|
9577
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9576
9578
|
if (httpReqsPending()[key])
|
|
9577
9579
|
return;
|
|
9578
9580
|
if (httpReqsData()[key] && !isEditing())
|
|
9579
9581
|
return;
|
|
9582
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9580
9583
|
httpReqsPending()[key] = true;
|
|
9581
9584
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
9582
9585
|
code: group,
|
|
@@ -9585,8 +9588,21 @@ function EnableEditor(props) {
|
|
|
9585
9588
|
rootState: props.builderContextSignal.rootState,
|
|
9586
9589
|
rootSetState: props.builderContextSignal.rootSetState
|
|
9587
9590
|
})));
|
|
9588
|
-
|
|
9589
|
-
|
|
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) => {
|
|
9590
9606
|
mergeNewRootState({
|
|
9591
9607
|
[key]: json
|
|
9592
9608
|
});
|
package/lib/edge/index.jsx
CHANGED
|
@@ -3758,15 +3758,16 @@ function getProcessedBlock({
|
|
|
3758
3758
|
rootState,
|
|
3759
3759
|
rootSetState
|
|
3760
3760
|
}) {
|
|
3761
|
-
let transformedBlock =
|
|
3762
|
-
transformedBlock =
|
|
3763
|
-
return evaluateBindings({
|
|
3761
|
+
let transformedBlock = transformBlock(block);
|
|
3762
|
+
transformedBlock = evaluateBindings({
|
|
3764
3763
|
block: transformedBlock,
|
|
3765
3764
|
localState,
|
|
3766
3765
|
rootState,
|
|
3767
3766
|
rootSetState,
|
|
3768
3767
|
context
|
|
3769
3768
|
});
|
|
3769
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
3770
|
+
return transformedBlock;
|
|
3770
3771
|
}
|
|
3771
3772
|
|
|
3772
3773
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -8165,7 +8166,7 @@ function getPreviewContent(_searchParams) {
|
|
|
8165
8166
|
}
|
|
8166
8167
|
|
|
8167
8168
|
// src/constants/sdk-version.ts
|
|
8168
|
-
var SDK_VERSION = "4.
|
|
8169
|
+
var SDK_VERSION = "4.2.0";
|
|
8169
8170
|
|
|
8170
8171
|
// src/helpers/sdk-headers.ts
|
|
8171
8172
|
var getSdkHeaders = () => ({
|
|
@@ -9065,37 +9066,54 @@ function EnableEditor(props) {
|
|
|
9065
9066
|
}
|
|
9066
9067
|
function runHttpRequests() {
|
|
9067
9068
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
9068
|
-
Object.entries(requests).forEach(
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
(
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9069
|
+
Object.entries(requests).forEach(
|
|
9070
|
+
([key, httpRequest]) => {
|
|
9071
|
+
if (!httpRequest)
|
|
9072
|
+
return;
|
|
9073
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
9074
|
+
if (httpReqsPending()[key])
|
|
9075
|
+
return;
|
|
9076
|
+
if (httpReqsData()[key] && !isEditing())
|
|
9077
|
+
return;
|
|
9078
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
9079
|
+
httpReqsPending()[key] = true;
|
|
9080
|
+
const evaluatedUrl = url.replace(
|
|
9081
|
+
/{{([^}]+)}}/g,
|
|
9082
|
+
(_match, group) => String(
|
|
9083
|
+
evaluate({
|
|
9084
|
+
code: group,
|
|
9085
|
+
context: props.context || {},
|
|
9086
|
+
localState: void 0,
|
|
9087
|
+
rootState: props.builderContextSignal.rootState,
|
|
9088
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
9089
|
+
})
|
|
9090
|
+
)
|
|
9091
|
+
);
|
|
9092
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
9093
|
+
url: evaluatedUrl,
|
|
9094
|
+
method: httpRequest.request.method,
|
|
9095
|
+
headers: httpRequest.request.headers,
|
|
9096
|
+
body: httpRequest.request.body
|
|
9097
|
+
} : {
|
|
9098
|
+
url: evaluatedUrl,
|
|
9099
|
+
method: "GET"
|
|
9100
|
+
};
|
|
9101
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
9102
|
+
fetch(fetchRequestObj.url, {
|
|
9103
|
+
method: fetchRequestObj.method,
|
|
9104
|
+
headers: fetchRequestObj.headers,
|
|
9105
|
+
body: fetchRequestObj.body
|
|
9106
|
+
}).then((response) => response.json()).then((json) => {
|
|
9107
|
+
mergeNewRootState({
|
|
9108
|
+
[key]: json
|
|
9109
|
+
});
|
|
9110
|
+
httpReqsData()[key] = true;
|
|
9111
|
+
}).catch((err) => {
|
|
9112
|
+
}).finally(() => {
|
|
9113
|
+
httpReqsPending()[key] = false;
|
|
9092
9114
|
});
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
}).finally(() => {
|
|
9096
|
-
httpReqsPending()[key] = false;
|
|
9097
|
-
});
|
|
9098
|
-
});
|
|
9115
|
+
}
|
|
9116
|
+
);
|
|
9099
9117
|
}
|
|
9100
9118
|
function emitStateUpdate() {
|
|
9101
9119
|
if (isEditing()) {
|
package/lib/node/dev.js
CHANGED
|
@@ -754,15 +754,16 @@ function getProcessedBlock({
|
|
|
754
754
|
rootState,
|
|
755
755
|
rootSetState
|
|
756
756
|
}) {
|
|
757
|
-
let transformedBlock =
|
|
758
|
-
transformedBlock =
|
|
759
|
-
return evaluateBindings({
|
|
757
|
+
let transformedBlock = transformBlock(block);
|
|
758
|
+
transformedBlock = evaluateBindings({
|
|
760
759
|
block: transformedBlock,
|
|
761
760
|
localState,
|
|
762
761
|
rootState,
|
|
763
762
|
rootSetState,
|
|
764
763
|
context
|
|
765
764
|
});
|
|
765
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
766
|
+
return transformedBlock;
|
|
766
767
|
}
|
|
767
768
|
|
|
768
769
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5670,7 +5671,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5670
5671
|
}
|
|
5671
5672
|
|
|
5672
5673
|
// src/constants/sdk-version.ts
|
|
5673
|
-
var SDK_VERSION = "4.
|
|
5674
|
+
var SDK_VERSION = "4.2.0";
|
|
5674
5675
|
|
|
5675
5676
|
// src/helpers/sdk-headers.ts
|
|
5676
5677
|
var getSdkHeaders = () => ({
|
|
@@ -6576,13 +6577,15 @@ function EnableEditor(props) {
|
|
|
6576
6577
|
}
|
|
6577
6578
|
function runHttpRequests() {
|
|
6578
6579
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6579
|
-
Object.entries(requests).forEach(([key,
|
|
6580
|
-
if (!
|
|
6580
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
6581
|
+
if (!httpRequest)
|
|
6581
6582
|
return;
|
|
6583
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6582
6584
|
if (httpReqsPending()[key])
|
|
6583
6585
|
return;
|
|
6584
6586
|
if (httpReqsData()[key] && !isEditing())
|
|
6585
6587
|
return;
|
|
6588
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6586
6589
|
httpReqsPending()[key] = true;
|
|
6587
6590
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
6588
6591
|
code: group,
|
|
@@ -6591,14 +6594,27 @@ function EnableEditor(props) {
|
|
|
6591
6594
|
rootState: props.builderContextSignal.rootState,
|
|
6592
6595
|
rootSetState: props.builderContextSignal.rootSetState
|
|
6593
6596
|
})));
|
|
6594
|
-
|
|
6595
|
-
|
|
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) => {
|
|
6596
6612
|
mergeNewRootState({
|
|
6597
6613
|
[key]: json
|
|
6598
6614
|
});
|
|
6599
6615
|
httpReqsData()[key] = true;
|
|
6600
6616
|
}).catch((err) => {
|
|
6601
|
-
console.error("error fetching dynamic data",
|
|
6617
|
+
console.error("error fetching dynamic data", JSON.stringify(httpRequest), err);
|
|
6602
6618
|
}).finally(() => {
|
|
6603
6619
|
httpReqsPending()[key] = false;
|
|
6604
6620
|
});
|
package/lib/node/dev.jsx
CHANGED
|
@@ -749,15 +749,16 @@ function getProcessedBlock({
|
|
|
749
749
|
rootState,
|
|
750
750
|
rootSetState
|
|
751
751
|
}) {
|
|
752
|
-
let transformedBlock =
|
|
753
|
-
transformedBlock =
|
|
754
|
-
return evaluateBindings({
|
|
752
|
+
let transformedBlock = transformBlock(block);
|
|
753
|
+
transformedBlock = evaluateBindings({
|
|
755
754
|
block: transformedBlock,
|
|
756
755
|
localState,
|
|
757
756
|
rootState,
|
|
758
757
|
rootSetState,
|
|
759
758
|
context
|
|
760
759
|
});
|
|
760
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
761
|
+
return transformedBlock;
|
|
761
762
|
}
|
|
762
763
|
|
|
763
764
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5164,7 +5165,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5164
5165
|
}
|
|
5165
5166
|
|
|
5166
5167
|
// src/constants/sdk-version.ts
|
|
5167
|
-
var SDK_VERSION = "4.
|
|
5168
|
+
var SDK_VERSION = "4.2.0";
|
|
5168
5169
|
|
|
5169
5170
|
// src/helpers/sdk-headers.ts
|
|
5170
5171
|
var getSdkHeaders = () => ({
|
|
@@ -6069,38 +6070,59 @@ function EnableEditor(props) {
|
|
|
6069
6070
|
}
|
|
6070
6071
|
function runHttpRequests() {
|
|
6071
6072
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6072
|
-
Object.entries(requests).forEach(
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
(
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6073
|
+
Object.entries(requests).forEach(
|
|
6074
|
+
([key, httpRequest]) => {
|
|
6075
|
+
if (!httpRequest)
|
|
6076
|
+
return;
|
|
6077
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6078
|
+
if (httpReqsPending()[key])
|
|
6079
|
+
return;
|
|
6080
|
+
if (httpReqsData()[key] && !isEditing())
|
|
6081
|
+
return;
|
|
6082
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6083
|
+
httpReqsPending()[key] = true;
|
|
6084
|
+
const evaluatedUrl = url.replace(
|
|
6085
|
+
/{{([^}]+)}}/g,
|
|
6086
|
+
(_match, group) => String(
|
|
6087
|
+
evaluate({
|
|
6088
|
+
code: group,
|
|
6089
|
+
context: props.context || {},
|
|
6090
|
+
localState: void 0,
|
|
6091
|
+
rootState: props.builderContextSignal.rootState,
|
|
6092
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
6093
|
+
})
|
|
6094
|
+
)
|
|
6095
|
+
);
|
|
6096
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6097
|
+
url: evaluatedUrl,
|
|
6098
|
+
method: httpRequest.request.method,
|
|
6099
|
+
headers: httpRequest.request.headers,
|
|
6100
|
+
body: httpRequest.request.body
|
|
6101
|
+
} : {
|
|
6102
|
+
url: evaluatedUrl,
|
|
6103
|
+
method: "GET"
|
|
6104
|
+
};
|
|
6105
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6106
|
+
fetch(fetchRequestObj.url, {
|
|
6107
|
+
method: fetchRequestObj.method,
|
|
6108
|
+
headers: fetchRequestObj.headers,
|
|
6109
|
+
body: fetchRequestObj.body
|
|
6110
|
+
}).then((response) => response.json()).then((json) => {
|
|
6111
|
+
mergeNewRootState({
|
|
6112
|
+
[key]: json
|
|
6113
|
+
});
|
|
6114
|
+
httpReqsData()[key] = true;
|
|
6115
|
+
}).catch((err) => {
|
|
6116
|
+
console.error(
|
|
6117
|
+
"error fetching dynamic data",
|
|
6118
|
+
JSON.stringify(httpRequest),
|
|
6119
|
+
err
|
|
6120
|
+
);
|
|
6121
|
+
}).finally(() => {
|
|
6122
|
+
httpReqsPending()[key] = false;
|
|
6096
6123
|
});
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
console.error("error fetching dynamic data", url, err);
|
|
6100
|
-
}).finally(() => {
|
|
6101
|
-
httpReqsPending()[key] = false;
|
|
6102
|
-
});
|
|
6103
|
-
});
|
|
6124
|
+
}
|
|
6125
|
+
);
|
|
6104
6126
|
}
|
|
6105
6127
|
function emitStateUpdate() {
|
|
6106
6128
|
if (isEditing()) {
|
package/lib/node/index.js
CHANGED
|
@@ -749,15 +749,16 @@ function getProcessedBlock({
|
|
|
749
749
|
rootState,
|
|
750
750
|
rootSetState
|
|
751
751
|
}) {
|
|
752
|
-
let transformedBlock =
|
|
753
|
-
transformedBlock =
|
|
754
|
-
return evaluateBindings({
|
|
752
|
+
let transformedBlock = transformBlock(block);
|
|
753
|
+
transformedBlock = evaluateBindings({
|
|
755
754
|
block: transformedBlock,
|
|
756
755
|
localState,
|
|
757
756
|
rootState,
|
|
758
757
|
rootSetState,
|
|
759
758
|
context
|
|
760
759
|
});
|
|
760
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
761
|
+
return transformedBlock;
|
|
761
762
|
}
|
|
762
763
|
|
|
763
764
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5657,7 +5658,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5657
5658
|
}
|
|
5658
5659
|
|
|
5659
5660
|
// src/constants/sdk-version.ts
|
|
5660
|
-
var SDK_VERSION = "4.
|
|
5661
|
+
var SDK_VERSION = "4.2.0";
|
|
5661
5662
|
|
|
5662
5663
|
// src/helpers/sdk-headers.ts
|
|
5663
5664
|
var getSdkHeaders = () => ({
|
|
@@ -6558,13 +6559,15 @@ function EnableEditor(props) {
|
|
|
6558
6559
|
}
|
|
6559
6560
|
function runHttpRequests() {
|
|
6560
6561
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6561
|
-
Object.entries(requests).forEach(([key,
|
|
6562
|
-
if (!
|
|
6562
|
+
Object.entries(requests).forEach(([key, httpRequest]) => {
|
|
6563
|
+
if (!httpRequest)
|
|
6563
6564
|
return;
|
|
6565
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6564
6566
|
if (httpReqsPending()[key])
|
|
6565
6567
|
return;
|
|
6566
6568
|
if (httpReqsData()[key] && !isEditing())
|
|
6567
6569
|
return;
|
|
6570
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6568
6571
|
httpReqsPending()[key] = true;
|
|
6569
6572
|
const evaluatedUrl = url.replace(/{{([^}]+)}}/g, (_match, group) => String(evaluate({
|
|
6570
6573
|
code: group,
|
|
@@ -6573,8 +6576,21 @@ function EnableEditor(props) {
|
|
|
6573
6576
|
rootState: props.builderContextSignal.rootState,
|
|
6574
6577
|
rootSetState: props.builderContextSignal.rootSetState
|
|
6575
6578
|
})));
|
|
6576
|
-
|
|
6577
|
-
|
|
6579
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6580
|
+
url: evaluatedUrl,
|
|
6581
|
+
method: httpRequest.request.method,
|
|
6582
|
+
headers: httpRequest.request.headers,
|
|
6583
|
+
body: httpRequest.request.body
|
|
6584
|
+
} : {
|
|
6585
|
+
url: evaluatedUrl,
|
|
6586
|
+
method: "GET"
|
|
6587
|
+
};
|
|
6588
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6589
|
+
fetch(fetchRequestObj.url, {
|
|
6590
|
+
method: fetchRequestObj.method,
|
|
6591
|
+
headers: fetchRequestObj.headers,
|
|
6592
|
+
body: fetchRequestObj.body
|
|
6593
|
+
}).then((response) => response.json()).then((json) => {
|
|
6578
6594
|
mergeNewRootState({
|
|
6579
6595
|
[key]: json
|
|
6580
6596
|
});
|
package/lib/node/index.jsx
CHANGED
|
@@ -746,15 +746,16 @@ function getProcessedBlock({
|
|
|
746
746
|
rootState,
|
|
747
747
|
rootSetState
|
|
748
748
|
}) {
|
|
749
|
-
let transformedBlock =
|
|
750
|
-
transformedBlock =
|
|
751
|
-
return evaluateBindings({
|
|
749
|
+
let transformedBlock = transformBlock(block);
|
|
750
|
+
transformedBlock = evaluateBindings({
|
|
752
751
|
block: transformedBlock,
|
|
753
752
|
localState,
|
|
754
753
|
rootState,
|
|
755
754
|
rootSetState,
|
|
756
755
|
context
|
|
757
756
|
});
|
|
757
|
+
transformedBlock = resolveLocalizedValues(transformedBlock, rootState.locale);
|
|
758
|
+
return transformedBlock;
|
|
758
759
|
}
|
|
759
760
|
|
|
760
761
|
// src/functions/camel-to-kebab-case.ts
|
|
@@ -5153,7 +5154,7 @@ function getPreviewContent(_searchParams) {
|
|
|
5153
5154
|
}
|
|
5154
5155
|
|
|
5155
5156
|
// src/constants/sdk-version.ts
|
|
5156
|
-
var SDK_VERSION = "4.
|
|
5157
|
+
var SDK_VERSION = "4.2.0";
|
|
5157
5158
|
|
|
5158
5159
|
// src/helpers/sdk-headers.ts
|
|
5159
5160
|
var getSdkHeaders = () => ({
|
|
@@ -6053,37 +6054,54 @@ function EnableEditor(props) {
|
|
|
6053
6054
|
}
|
|
6054
6055
|
function runHttpRequests() {
|
|
6055
6056
|
const requests = props.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
6056
|
-
Object.entries(requests).forEach(
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
(
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6057
|
+
Object.entries(requests).forEach(
|
|
6058
|
+
([key, httpRequest]) => {
|
|
6059
|
+
if (!httpRequest)
|
|
6060
|
+
return;
|
|
6061
|
+
const isCoreRequest = typeof httpRequest === "object" && httpRequest["@type"] === "@builder.io/core:Request";
|
|
6062
|
+
if (httpReqsPending()[key])
|
|
6063
|
+
return;
|
|
6064
|
+
if (httpReqsData()[key] && !isEditing())
|
|
6065
|
+
return;
|
|
6066
|
+
const url = isCoreRequest ? httpRequest.request.url : httpRequest;
|
|
6067
|
+
httpReqsPending()[key] = true;
|
|
6068
|
+
const evaluatedUrl = url.replace(
|
|
6069
|
+
/{{([^}]+)}}/g,
|
|
6070
|
+
(_match, group) => String(
|
|
6071
|
+
evaluate({
|
|
6072
|
+
code: group,
|
|
6073
|
+
context: props.context || {},
|
|
6074
|
+
localState: void 0,
|
|
6075
|
+
rootState: props.builderContextSignal.rootState,
|
|
6076
|
+
rootSetState: props.builderContextSignal.rootSetState
|
|
6077
|
+
})
|
|
6078
|
+
)
|
|
6079
|
+
);
|
|
6080
|
+
const fetchRequestObj = isCoreRequest ? {
|
|
6081
|
+
url: evaluatedUrl,
|
|
6082
|
+
method: httpRequest.request.method,
|
|
6083
|
+
headers: httpRequest.request.headers,
|
|
6084
|
+
body: httpRequest.request.body
|
|
6085
|
+
} : {
|
|
6086
|
+
url: evaluatedUrl,
|
|
6087
|
+
method: "GET"
|
|
6088
|
+
};
|
|
6089
|
+
logFetch(JSON.stringify(fetchRequestObj));
|
|
6090
|
+
fetch(fetchRequestObj.url, {
|
|
6091
|
+
method: fetchRequestObj.method,
|
|
6092
|
+
headers: fetchRequestObj.headers,
|
|
6093
|
+
body: fetchRequestObj.body
|
|
6094
|
+
}).then((response) => response.json()).then((json) => {
|
|
6095
|
+
mergeNewRootState({
|
|
6096
|
+
[key]: json
|
|
6097
|
+
});
|
|
6098
|
+
httpReqsData()[key] = true;
|
|
6099
|
+
}).catch((err) => {
|
|
6100
|
+
}).finally(() => {
|
|
6101
|
+
httpReqsPending()[key] = false;
|
|
6080
6102
|
});
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
}).finally(() => {
|
|
6084
|
-
httpReqsPending()[key] = false;
|
|
6085
|
-
});
|
|
6086
|
-
});
|
|
6103
|
+
}
|
|
6104
|
+
);
|
|
6087
6105
|
}
|
|
6088
6106
|
function emitStateUpdate() {
|
|
6089
6107
|
if (isEditing()) {
|