@builder.io/sdk-react-nextjs 0.17.0 → 0.17.2
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/image/component-info.cjs +1 -1
- package/lib/browser/blocks/image/component-info.mjs +4 -3
- package/lib/browser/blocks/image/image.cjs +4 -4
- package/lib/browser/blocks/image/image.mjs +20 -20
- package/lib/browser/blocks/img/component-info.cjs +1 -1
- package/lib/browser/blocks/img/component-info.mjs +4 -3
- package/lib/browser/blocks/text/text.cjs +1 -1
- package/lib/browser/blocks/text/text.mjs +6 -24
- package/lib/browser/blocks/video/component-info.cjs +1 -1
- package/lib/browser/blocks/video/component-info.mjs +5 -4
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.helpers.cjs +3 -3
- package/lib/browser/components/block/block.helpers.mjs +57 -54
- package/lib/browser/components/block/block.mjs +49 -48
- package/lib/browser/components/content/components/enable-editor.cjs +1 -1
- package/lib/browser/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/browser/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/browser/components/content/components/enable-editor.mjs +159 -147
- package/lib/browser/components/content/content.cjs +1 -1
- package/lib/browser/components/content/content.mjs +57 -56
- package/lib/browser/constants/file-types.cjs +1 -0
- package/lib/browser/constants/file-types.mjs +5 -0
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/context/builder.context.cjs +1 -1
- package/lib/browser/context/builder.context.mjs +2 -1
- package/lib/browser/functions/extract-localized-values.cjs +1 -0
- package/lib/browser/functions/extract-localized-values.mjs +28 -0
- package/lib/browser/functions/get-block-component-options.cjs +1 -1
- package/lib/browser/functions/get-block-component-options.mjs +21 -5
- package/lib/browser/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/browser/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/browser/functions/get-processed-block.cjs +1 -1
- package/lib/browser/functions/get-processed-block.mjs +49 -49
- package/lib/browser/functions/register-component.cjs +1 -1
- package/lib/browser/functions/register-component.mjs +7 -7
- package/lib/browser/functions/traverse.cjs +1 -0
- package/lib/browser/functions/traverse.mjs +20 -0
- package/lib/browser/helpers/flatten.cjs +1 -1
- package/lib/browser/helpers/flatten.mjs +28 -15
- package/lib/edge/blocks/image/component-info.cjs +1 -1
- package/lib/edge/blocks/image/component-info.mjs +4 -3
- package/lib/edge/blocks/image/image.cjs +4 -4
- package/lib/edge/blocks/image/image.mjs +20 -20
- package/lib/edge/blocks/img/component-info.cjs +1 -1
- package/lib/edge/blocks/img/component-info.mjs +4 -3
- package/lib/edge/blocks/text/text.cjs +1 -1
- package/lib/edge/blocks/text/text.mjs +6 -24
- package/lib/edge/blocks/video/component-info.cjs +1 -1
- package/lib/edge/blocks/video/component-info.mjs +5 -4
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.helpers.cjs +3 -3
- package/lib/edge/components/block/block.helpers.mjs +57 -54
- package/lib/edge/components/block/block.mjs +49 -48
- package/lib/edge/components/content/components/enable-editor.cjs +1 -1
- package/lib/edge/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/edge/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/edge/components/content/components/enable-editor.mjs +159 -147
- package/lib/edge/components/content/content.cjs +1 -1
- package/lib/edge/components/content/content.mjs +57 -56
- package/lib/edge/constants/file-types.cjs +1 -0
- package/lib/edge/constants/file-types.mjs +5 -0
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/context/builder.context.cjs +1 -1
- package/lib/edge/context/builder.context.mjs +2 -1
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.cjs +5 -5
- package/lib/edge/functions/evaluate/edge-runtime/edge-runtime.mjs +25 -28
- package/lib/edge/functions/extract-localized-values.cjs +1 -0
- package/lib/edge/functions/extract-localized-values.mjs +28 -0
- package/lib/edge/functions/get-block-component-options.cjs +1 -1
- package/lib/edge/functions/get-block-component-options.mjs +21 -5
- package/lib/edge/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/edge/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/edge/functions/get-processed-block.cjs +1 -1
- package/lib/edge/functions/get-processed-block.mjs +49 -49
- package/lib/edge/functions/register-component.cjs +1 -1
- package/lib/edge/functions/register-component.mjs +7 -7
- package/lib/edge/functions/traverse.cjs +1 -0
- package/lib/edge/functions/traverse.mjs +20 -0
- package/lib/edge/helpers/flatten.cjs +1 -1
- package/lib/edge/helpers/flatten.mjs +28 -15
- package/lib/node/blocks/image/component-info.cjs +1 -1
- package/lib/node/blocks/image/component-info.mjs +4 -3
- package/lib/node/blocks/image/image.cjs +4 -4
- package/lib/node/blocks/image/image.mjs +20 -20
- package/lib/node/blocks/img/component-info.cjs +1 -1
- package/lib/node/blocks/img/component-info.mjs +4 -3
- package/lib/node/blocks/text/text.cjs +1 -1
- package/lib/node/blocks/text/text.mjs +6 -24
- package/lib/node/blocks/video/component-info.cjs +1 -1
- package/lib/node/blocks/video/component-info.mjs +5 -4
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.helpers.cjs +3 -3
- package/lib/node/components/block/block.helpers.mjs +57 -54
- package/lib/node/components/block/block.mjs +49 -48
- package/lib/node/components/content/components/enable-editor.cjs +1 -1
- package/lib/node/components/content/components/enable-editor.helpers.cjs +1 -0
- package/lib/node/components/content/components/enable-editor.helpers.mjs +8 -0
- package/lib/node/components/content/components/enable-editor.mjs +159 -147
- package/lib/node/components/content/content.cjs +1 -1
- package/lib/node/components/content/content.mjs +57 -56
- package/lib/node/constants/file-types.cjs +1 -0
- package/lib/node/constants/file-types.mjs +5 -0
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/context/builder.context.cjs +1 -1
- package/lib/node/context/builder.context.mjs +2 -1
- package/lib/node/functions/extract-localized-values.cjs +1 -0
- package/lib/node/functions/extract-localized-values.mjs +28 -0
- package/lib/node/functions/get-block-component-options.cjs +1 -1
- package/lib/node/functions/get-block-component-options.mjs +21 -5
- package/lib/node/functions/get-content/generate-content-url.cjs +1 -1
- package/lib/node/functions/get-content/generate-content-url.mjs +60 -40
- package/lib/node/functions/get-processed-block.cjs +1 -1
- package/lib/node/functions/get-processed-block.mjs +49 -49
- package/lib/node/functions/register-component.cjs +1 -1
- package/lib/node/functions/register-component.mjs +7 -7
- package/lib/node/functions/traverse.cjs +1 -0
- package/lib/node/functions/traverse.mjs +20 -0
- package/lib/node/helpers/flatten.cjs +1 -1
- package/lib/node/helpers/flatten.mjs +28 -15
- package/package.json +1 -1
- package/types/cjs/components/block/block.helpers.d.ts +6 -3
- package/types/cjs/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/cjs/constants/file-types.d.ts +2 -0
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/context/types.d.ts +1 -0
- package/types/cjs/functions/extract-localized-values.d.ts +2 -0
- package/types/cjs/functions/get-block-component-options.d.ts +2 -1
- package/types/cjs/functions/get-processed-block.d.ts +1 -6
- package/types/cjs/functions/traverse.d.ts +34 -0
- package/types/cjs/helpers/flatten.d.ts +6 -0
- package/types/cjs/server-index.d.ts +1 -1
- package/types/cjs/types/components.d.ts +3 -0
- package/types/esm/components/block/block.helpers.d.ts +6 -3
- package/types/esm/components/content/components/enable-editor.helpers.d.ts +11 -0
- package/types/esm/constants/file-types.d.ts +2 -0
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/context/types.d.ts +1 -0
- package/types/esm/functions/extract-localized-values.d.ts +2 -0
- package/types/esm/functions/get-block-component-options.d.ts +2 -1
- package/types/esm/functions/get-processed-block.d.ts +1 -6
- package/types/esm/functions/traverse.d.ts +34 -0
- package/types/esm/helpers/flatten.d.ts +6 -0
- package/types/esm/server-index.d.ts +1 -1
- package/types/esm/types/components.d.ts +3 -0
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { getDefaultRegisteredComponents as
|
|
3
|
-
import { evaluate as
|
|
4
|
-
import { serializeIncludingFunctions as
|
|
5
|
-
import { logger as
|
|
6
|
-
import
|
|
7
|
-
import { getUpdateVariantVisibilityScript as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { getContentInitialValue as
|
|
12
|
-
function
|
|
13
|
-
var
|
|
14
|
-
const
|
|
1
|
+
import { jsxs as v, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { getDefaultRegisteredComponents as y } from "../../constants/builder-registered-components.mjs";
|
|
3
|
+
import { evaluate as h } from "../../functions/evaluate/evaluate.mjs";
|
|
4
|
+
import { serializeIncludingFunctions as g } from "../../functions/register-component.mjs";
|
|
5
|
+
import { logger as W } from "../../helpers/logger.mjs";
|
|
6
|
+
import P from "../blocks/blocks.mjs";
|
|
7
|
+
import { getUpdateVariantVisibilityScript as V } from "../content-variants/helpers.mjs";
|
|
8
|
+
import K from "../inlined-script.mjs";
|
|
9
|
+
import R from "./components/enable-editor.mjs";
|
|
10
|
+
import T from "./components/styles.mjs";
|
|
11
|
+
import { getContentInitialValue as N, getRootStateInitialValue as j } from "./content.helpers.mjs";
|
|
12
|
+
function G(t) {
|
|
13
|
+
var i, d, r, l, m, s, u, C, S, f, k;
|
|
14
|
+
const I = V({
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
16
|
-
variationId: (
|
|
16
|
+
variationId: (i = t.content) == null ? void 0 : i.testVariationId,
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
|
|
18
|
-
contentId: (
|
|
19
|
-
}),
|
|
20
|
-
...
|
|
21
|
-
...
|
|
18
|
+
contentId: (d = t.content) == null ? void 0 : d.id
|
|
19
|
+
}), b = [
|
|
20
|
+
...y(),
|
|
21
|
+
...t.customComponents || []
|
|
22
22
|
].reduce(
|
|
23
|
-
(
|
|
24
|
-
...
|
|
23
|
+
(n, { component: x, ...o }) => ({
|
|
24
|
+
...n,
|
|
25
25
|
[o.name]: {
|
|
26
|
-
component:
|
|
27
|
-
...
|
|
26
|
+
component: x,
|
|
27
|
+
...g(o)
|
|
28
28
|
}
|
|
29
29
|
}),
|
|
30
30
|
{}
|
|
31
|
-
),
|
|
32
|
-
content:
|
|
31
|
+
), e = {
|
|
32
|
+
content: N({
|
|
33
33
|
content: t.content,
|
|
34
34
|
data: t.data
|
|
35
35
|
}),
|
|
36
36
|
localState: void 0,
|
|
37
|
-
rootState:
|
|
37
|
+
rootState: j({
|
|
38
38
|
content: t.content,
|
|
39
39
|
data: t.data,
|
|
40
40
|
locale: t.locale
|
|
@@ -45,35 +45,36 @@ function L(t) {
|
|
|
45
45
|
apiKey: t.apiKey,
|
|
46
46
|
apiVersion: t.apiVersion,
|
|
47
47
|
componentInfos: [
|
|
48
|
-
...
|
|
49
|
-
...
|
|
48
|
+
...y(),
|
|
49
|
+
...t.customComponents || []
|
|
50
50
|
].reduce(
|
|
51
|
-
(
|
|
52
|
-
...
|
|
53
|
-
[o.name]:
|
|
51
|
+
(n, { component: x, ...o }) => ({
|
|
52
|
+
...n,
|
|
53
|
+
[o.name]: g(o)
|
|
54
54
|
}),
|
|
55
55
|
{}
|
|
56
56
|
),
|
|
57
57
|
inheritedStyles: {},
|
|
58
58
|
BlocksWrapper: t.blocksWrapper || "div",
|
|
59
59
|
BlocksWrapperProps: t.blocksWrapperProps || {},
|
|
60
|
-
nonce: t.nonce || ""
|
|
60
|
+
nonce: t.nonce || "",
|
|
61
|
+
model: t.model || ""
|
|
61
62
|
};
|
|
62
|
-
t.apiKey ||
|
|
63
|
+
t.apiKey || W.error(
|
|
63
64
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
64
65
|
);
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
code:
|
|
66
|
+
const c = (l = (r = e.content) == null ? void 0 : r.data) == null ? void 0 : l.jsCode;
|
|
67
|
+
return c && h({
|
|
68
|
+
code: c,
|
|
68
69
|
context: t.context || {},
|
|
69
70
|
localState: void 0,
|
|
70
|
-
rootState:
|
|
71
|
-
rootSetState: (
|
|
72
|
-
|
|
71
|
+
rootState: e.rootState,
|
|
72
|
+
rootSetState: (n) => {
|
|
73
|
+
e.rootState = n;
|
|
73
74
|
},
|
|
74
75
|
isExpression: !1
|
|
75
|
-
}), /* @__PURE__ */
|
|
76
|
-
|
|
76
|
+
}), /* @__PURE__ */ v(
|
|
77
|
+
R,
|
|
77
78
|
{
|
|
78
79
|
apiHost: t.apiHost,
|
|
79
80
|
nonce: t.nonce,
|
|
@@ -86,36 +87,36 @@ function L(t) {
|
|
|
86
87
|
locale: t.locale,
|
|
87
88
|
enrich: t.enrich,
|
|
88
89
|
showContent: t.showContent,
|
|
89
|
-
builderContextSignal:
|
|
90
|
+
builderContextSignal: e,
|
|
90
91
|
contentWrapper: t.contentWrapper,
|
|
91
92
|
contentWrapperProps: t.contentWrapperProps,
|
|
92
93
|
trustedHosts: t.trustedHosts,
|
|
93
94
|
isNestedRender: t.isNestedRender,
|
|
94
95
|
children: [
|
|
95
|
-
t.isSsrAbTest ? /* @__PURE__ */
|
|
96
|
-
|
|
96
|
+
t.isSsrAbTest ? /* @__PURE__ */ a(
|
|
97
|
+
K,
|
|
97
98
|
{
|
|
98
99
|
id: "builderio-variant-visibility",
|
|
99
|
-
scriptStr:
|
|
100
|
+
scriptStr: I,
|
|
100
101
|
nonce: t.nonce || ""
|
|
101
102
|
}
|
|
102
103
|
) : null,
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
|
|
104
|
+
/* @__PURE__ */ a(
|
|
105
|
+
T,
|
|
105
106
|
{
|
|
106
107
|
nonce: t.nonce || "",
|
|
107
108
|
isNestedRender: t.isNestedRender,
|
|
108
|
-
contentId: (
|
|
109
|
-
cssCode: (
|
|
110
|
-
customFonts: (
|
|
109
|
+
contentId: (m = e.content) == null ? void 0 : m.id,
|
|
110
|
+
cssCode: (u = (s = e.content) == null ? void 0 : s.data) == null ? void 0 : u.cssCode,
|
|
111
|
+
customFonts: (S = (C = e.content) == null ? void 0 : C.data) == null ? void 0 : S.customFonts
|
|
111
112
|
}
|
|
112
113
|
),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
|
|
114
|
+
/* @__PURE__ */ a(
|
|
115
|
+
P,
|
|
115
116
|
{
|
|
116
|
-
blocks: (
|
|
117
|
-
context:
|
|
118
|
-
registeredComponents:
|
|
117
|
+
blocks: (k = (f = e.content) == null ? void 0 : f.data) == null ? void 0 : k.blocks,
|
|
118
|
+
context: e,
|
|
119
|
+
registeredComponents: b,
|
|
119
120
|
linkComponent: t.linkComponent
|
|
120
121
|
}
|
|
121
122
|
)
|
|
@@ -124,5 +125,5 @@ function L(t) {
|
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
127
|
export {
|
|
127
|
-
|
|
128
|
+
G as default
|
|
128
129
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=["jpeg","jpg","png","svg","webp","gif","jfif","pjpeg","pjp","apng","avif","tif","tiff","heif","bmp","eps","raw","cr2","nef","orf","sr2","psd","heic","dib","ai"],f=["mp4","webm","mkv","flv","vob","ogv","ogg","drc","gif","gifv","mng","avi","mov","qt","mts","m2ts","ts","wmv","yuv","rm","rmvb","viv","asf","amv","m4p","mpeg","mpe","m2v","m4v","svi","3gp","3g2","mxf","roq","nsv","f4v","f4p","f4a","f4b"];exports.IMAGE_FILE_TYPES=v;exports.VIDEO_FILE_TYPES=f;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const v = ["jpeg", "jpg", "png", "svg", "webp", "gif", "jfif", "pjpeg", "pjp", "apng", "avif", "tif", "tiff", "heif", "bmp", "eps", "raw", "cr2", "nef", "orf", "sr2", "psd", "heic", "dib", "ai"], f = ["mp4", "webm", "mkv", "flv", "vob", "ogv", "ogg", "drc", "gif", "gifv", "mng", "avi", "mov", "qt", "mts", "m2ts", "ts", "wmv", "yuv", "rm", "rmvb", "viv", "asf", "amv", "m4p", "mpeg", "mpe", "m2v", "m4v", "svi", "3gp", "3g2", "mxf", "roq", "nsv", "f4v", "f4p", "f4a", "f4b"];
|
|
2
|
+
export {
|
|
3
|
+
v as IMAGE_FILE_TYPES,
|
|
4
|
+
f as VIDEO_FILE_TYPES
|
|
5
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.17.2";exports.SDK_VERSION=e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";const
|
|
1
|
+
"use client";"use strict";const e=require("react"),t=e.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{},nonce:"",model:""});module.exports=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./traverse.cjs");function s(e){return e&&typeof e=="object"&&e["@type"]==="@builder.io/core:LocalizedValue"}function l(e){if(!e||!Object.getOwnPropertyNames(e).length)return!1;let o=!1;return r.traverse(e,t=>{if(s(t)){o=!0;return}}),o}function u(e,o){return!e||!Object.getOwnPropertyNames(e).length?{}:(r.traverse(e,(t,n)=>{var i;s(t)&&n((i=t[o])!=null?i:void 0)}),e)}function c(e,o){var t,n;return(t=e.component)!=null&&t.options&&l((n=e.component)==null?void 0:n.options)&&(o||console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization"),e.component.options=u(e.component.options,o!=null?o:"Default")),e}exports.resolveLocalizedValues=c;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { traverse as r } from "./traverse.mjs";
|
|
2
|
+
function s(e) {
|
|
3
|
+
return e && typeof e == "object" && e["@type"] === "@builder.io/core:LocalizedValue";
|
|
4
|
+
}
|
|
5
|
+
function l(e) {
|
|
6
|
+
if (!e || !Object.getOwnPropertyNames(e).length)
|
|
7
|
+
return !1;
|
|
8
|
+
let o = !1;
|
|
9
|
+
return r(e, (t) => {
|
|
10
|
+
if (s(t)) {
|
|
11
|
+
o = !0;
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}), o;
|
|
15
|
+
}
|
|
16
|
+
function u(e, o) {
|
|
17
|
+
return !e || !Object.getOwnPropertyNames(e).length ? {} : (r(e, (t, n) => {
|
|
18
|
+
var i;
|
|
19
|
+
s(t) && n((i = t[o]) != null ? i : void 0);
|
|
20
|
+
}), e);
|
|
21
|
+
}
|
|
22
|
+
function p(e, o) {
|
|
23
|
+
var t, n;
|
|
24
|
+
return (t = e.component) != null && t.options && l((n = e.component) == null ? void 0 : n.options) && (o || console.warn("[Builder.io] In order to use localized fields in Builder, you must pass a locale prop to the BuilderComponent or to options object while fetching the content to resolve localized fields. Learn more: https://www.builder.io/c/docs/localization-inline#targeting-and-inline-localization"), e.component.options = u(e.component.options, o != null ? o : "Default")), e;
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
p as resolveLocalizedValues
|
|
28
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./evaluate/evaluate.cjs");function i(t,e){var o;return{...(o=t.component)==null?void 0:o.options,...t.options,...r(t,e)}}const r=(t,e)=>{var o,n;if(((o=t.component)==null?void 0:o.name)==="Text"&&((n=t.component.options)!=null&&n.text)&&typeof t.component.options.text=="string")return{...t.component.options,text:t.component.options.text.replace(/{{([^}]+)}}/g,(s,p)=>a.evaluate({code:p,context:e,localState:e.localState,rootState:e.rootState,rootSetState:e.rootSetState}))}};exports.getBlockComponentOptions=i;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { evaluate as a } from "./evaluate/evaluate.mjs";
|
|
2
|
+
function s(t, o) {
|
|
3
|
+
var e;
|
|
3
4
|
return {
|
|
4
|
-
...(
|
|
5
|
-
...
|
|
5
|
+
...(e = t.component) == null ? void 0 : e.options,
|
|
6
|
+
...t.options,
|
|
7
|
+
...r(t, o)
|
|
6
8
|
};
|
|
7
9
|
}
|
|
10
|
+
const r = (t, o) => {
|
|
11
|
+
var e, n;
|
|
12
|
+
if (((e = t.component) == null ? void 0 : e.name) === "Text" && ((n = t.component.options) != null && n.text) && typeof t.component.options.text == "string")
|
|
13
|
+
return {
|
|
14
|
+
...t.component.options,
|
|
15
|
+
text: t.component.options.text.replace(/{{([^}]+)}}/g, (i, p) => a({
|
|
16
|
+
code: p,
|
|
17
|
+
context: o,
|
|
18
|
+
localState: o.localState,
|
|
19
|
+
rootState: o.rootState,
|
|
20
|
+
rootSetState: o.rootSetState
|
|
21
|
+
}))
|
|
22
|
+
};
|
|
23
|
+
};
|
|
8
24
|
export {
|
|
9
|
-
|
|
25
|
+
s as getBlockComponentOptions
|
|
10
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../helpers/flatten.cjs"),O=require("../../helpers/search/search.cjs"),E=require("../../types/api-version.cjs"),F=require("../get-builder-search-params/index.cjs"),T=require("../is-browser.cjs"),U=t=>typeof t=="number"&&!isNaN(t)&&t>=0,V=t=>{const{limit:a=30,userAttributes:s,query:m,model:w,apiKey:d,enrich:P,locale:A,apiVersion:c=E.DEFAULT_API_VERSION,fields:S,omit:v,offset:l,cacheSeconds:f,staleCacheSeconds:u,sort:b,includeUnpublished:g,apiHost:N}=t;if(!d)throw new Error("Missing API key");if(!["v3"].includes(c))throw new Error(`Invalid apiVersion: expected 'v3', received '${c}'`);const k=a!==1,I=N||"https://cdn.builder.io",e=new URL(`${I}/api/${c}/content/${w}`);e.searchParams.set("apiKey",d),e.searchParams.set("limit",String(a)),e.searchParams.set("noTraverse",String(k)),e.searchParams.set("includeRefs",String(!0));const h=A||(s==null?void 0:s.locale);let n=s||{};if(h&&(e.searchParams.set("locale",h),n={locale:h,...n}),P&&e.searchParams.set("enrich",String(P)),e.searchParams.set("omit",v||"meta.componentsUsed"),S&&e.searchParams.set("fields",S),Number.isFinite(l)&&l>-1&&e.searchParams.set("offset",String(Math.floor(l))),typeof g=="boolean"&&e.searchParams.set("includeUnpublished",String(g)),f&&U(f)&&e.searchParams.set("cacheSeconds",String(f)),u&&U(u)&&e.searchParams.set("staleCacheSeconds",String(u)),b){const r=o.flatten({sort:b});for(const i in r)e.searchParams.set(i,JSON.stringify(r[i]))}const p={...F.getBuilderSearchParamsFromWindow(),...O.normalizeSearchParams(t.options||{})};n={...n,...B(p)};const y=o.flatten(p);for(const r in y)e.searchParams.set(r,String(y[r]));if(Object.keys(n).length>0&&e.searchParams.set("userAttributes",JSON.stringify(n)),m){const r=o.flattenMongoQuery({query:m});for(const i in r)e.searchParams.set(i,JSON.stringify(r[i]))}return e},$=t=>{const a={};for(const s in t)s.startsWith("userAttributes.")&&(a[s]=t[s],delete t[s]);return a},B=t=>{if(T.isBrowser()&&t.preview==="BUILDER_STUDIO"){t["userAttributes.urlPath"]=window.location.pathname,t["userAttributes.host"]=window.location.host;const a=$(t),{userAttributes:s}=o.unflatten(a);return s}return{}};exports.generateContentUrl=V;
|
|
@@ -1,59 +1,79 @@
|
|
|
1
|
-
import { flatten as
|
|
2
|
-
import { normalizeSearchParams as
|
|
3
|
-
import { DEFAULT_API_VERSION as
|
|
4
|
-
import { getBuilderSearchParamsFromWindow as
|
|
5
|
-
|
|
1
|
+
import { flatten as U, flattenMongoQuery as E, unflatten as F } from "../../helpers/flatten.mjs";
|
|
2
|
+
import { normalizeSearchParams as O } from "../../helpers/search/search.mjs";
|
|
3
|
+
import { DEFAULT_API_VERSION as J } from "../../types/api-version.mjs";
|
|
4
|
+
import { getBuilderSearchParamsFromWindow as L } from "../get-builder-search-params/index.mjs";
|
|
5
|
+
import { isBrowser as R } from "../is-browser.mjs";
|
|
6
|
+
const w = (t) => typeof t == "number" && !isNaN(t) && t >= 0, _ = (t) => {
|
|
6
7
|
const {
|
|
7
|
-
limit:
|
|
8
|
-
userAttributes:
|
|
8
|
+
limit: a = 30,
|
|
9
|
+
userAttributes: r,
|
|
9
10
|
query: h,
|
|
10
|
-
model:
|
|
11
|
-
apiKey:
|
|
12
|
-
enrich:
|
|
13
|
-
locale:
|
|
14
|
-
apiVersion:
|
|
15
|
-
fields:
|
|
16
|
-
omit:
|
|
17
|
-
offset:
|
|
18
|
-
cacheSeconds:
|
|
11
|
+
model: y,
|
|
12
|
+
apiKey: u,
|
|
13
|
+
enrich: d,
|
|
14
|
+
locale: A,
|
|
15
|
+
apiVersion: o = J,
|
|
16
|
+
fields: P,
|
|
17
|
+
omit: N,
|
|
18
|
+
offset: c,
|
|
19
|
+
cacheSeconds: l,
|
|
19
20
|
staleCacheSeconds: f,
|
|
20
21
|
sort: S,
|
|
21
|
-
includeUnpublished:
|
|
22
|
-
apiHost:
|
|
23
|
-
} =
|
|
24
|
-
if (!
|
|
22
|
+
includeUnpublished: p,
|
|
23
|
+
apiHost: v
|
|
24
|
+
} = t;
|
|
25
|
+
if (!u)
|
|
25
26
|
throw new Error("Missing API key");
|
|
26
|
-
if (!["v3"].includes(
|
|
27
|
-
throw new Error(`Invalid apiVersion: expected 'v3', received '${
|
|
28
|
-
const
|
|
29
|
-
e.searchParams.set("apiKey",
|
|
30
|
-
const
|
|
31
|
-
let i =
|
|
32
|
-
if (
|
|
33
|
-
locale:
|
|
27
|
+
if (!["v3"].includes(o))
|
|
28
|
+
throw new Error(`Invalid apiVersion: expected 'v3', received '${o}'`);
|
|
29
|
+
const k = a !== 1, I = v || "https://cdn.builder.io", e = new URL(`${I}/api/${o}/content/${y}`);
|
|
30
|
+
e.searchParams.set("apiKey", u), e.searchParams.set("limit", String(a)), e.searchParams.set("noTraverse", String(k)), e.searchParams.set("includeRefs", String(!0));
|
|
31
|
+
const m = A || (r == null ? void 0 : r.locale);
|
|
32
|
+
let i = r || {};
|
|
33
|
+
if (m && (e.searchParams.set("locale", m), i = {
|
|
34
|
+
locale: m,
|
|
34
35
|
...i
|
|
35
|
-
}),
|
|
36
|
-
const s =
|
|
36
|
+
}), d && e.searchParams.set("enrich", String(d)), e.searchParams.set("omit", N || "meta.componentsUsed"), P && e.searchParams.set("fields", P), Number.isFinite(c) && c > -1 && e.searchParams.set("offset", String(Math.floor(c))), typeof p == "boolean" && e.searchParams.set("includeUnpublished", String(p)), l && w(l) && e.searchParams.set("cacheSeconds", String(l)), f && w(f) && e.searchParams.set("staleCacheSeconds", String(f)), S) {
|
|
37
|
+
const s = U({
|
|
37
38
|
sort: S
|
|
38
39
|
});
|
|
39
|
-
for (const
|
|
40
|
-
e.searchParams.set(
|
|
40
|
+
for (const n in s)
|
|
41
|
+
e.searchParams.set(n, JSON.stringify(s[n]));
|
|
41
42
|
}
|
|
42
|
-
const
|
|
43
|
-
...
|
|
44
|
-
...
|
|
45
|
-
}
|
|
43
|
+
const b = {
|
|
44
|
+
...L(),
|
|
45
|
+
...O(t.options || {})
|
|
46
|
+
};
|
|
47
|
+
i = {
|
|
48
|
+
...i,
|
|
49
|
+
...$(b)
|
|
50
|
+
};
|
|
51
|
+
const g = U(b);
|
|
46
52
|
for (const s in g)
|
|
47
53
|
e.searchParams.set(s, String(g[s]));
|
|
48
|
-
if (i && e.searchParams.set("userAttributes", JSON.stringify(i)), h) {
|
|
54
|
+
if (Object.keys(i).length > 0 && e.searchParams.set("userAttributes", JSON.stringify(i)), h) {
|
|
49
55
|
const s = E({
|
|
50
56
|
query: h
|
|
51
57
|
});
|
|
52
|
-
for (const
|
|
53
|
-
e.searchParams.set(
|
|
58
|
+
for (const n in s)
|
|
59
|
+
e.searchParams.set(n, JSON.stringify(s[n]));
|
|
54
60
|
}
|
|
55
61
|
return e;
|
|
62
|
+
}, T = (t) => {
|
|
63
|
+
const a = {};
|
|
64
|
+
for (const r in t)
|
|
65
|
+
r.startsWith("userAttributes.") && (a[r] = t[r], delete t[r]);
|
|
66
|
+
return a;
|
|
67
|
+
}, $ = (t) => {
|
|
68
|
+
if (R() && t.preview === "BUILDER_STUDIO") {
|
|
69
|
+
t["userAttributes.urlPath"] = window.location.pathname, t["userAttributes.host"] = window.location.host;
|
|
70
|
+
const a = T(t), {
|
|
71
|
+
userAttributes: r
|
|
72
|
+
} = F(a);
|
|
73
|
+
return r;
|
|
74
|
+
}
|
|
75
|
+
return {};
|
|
56
76
|
};
|
|
57
77
|
export {
|
|
58
|
-
|
|
78
|
+
_ as generateContentUrl
|
|
59
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../constants/target.cjs"),d=require("../helpers/omit.cjs"),p=require("./evaluate/evaluate.cjs"),f=require("./extract-localized-values.cjs"),g=require("./fast-clone.cjs"),m=require("./set.cjs"),y=require("./transform-block.cjs");function o(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>o(n));if(e["@type"]==="@builder.io/sdk:Element")return e;const t={};for(const n in e)n!=="meta"&&Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=o(e[n]));return t}const C=["svelte","vue","angular","qwik","solid"].includes(u.TARGET),q=e=>{if(C){const t=g.fastClone(e);return{...t,properties:{...t.properties},actions:{...t.actions}}}else{const t=o(d.omit(e,"children","meta"));return{...t,properties:{...t.properties},actions:{...t.actions},children:e.children,meta:e.meta}}},v=({block:e,context:t,localState:n,rootState:i,rootSetState:s})=>{if(!e.bindings)return e;const r=q(e);for(const c in e.bindings){const a=e.bindings[c],l=p.evaluate({code:a,localState:n,rootState:i,rootSetState:s,context:t});m.set(r,c,l)}return r};function B({block:e,context:t,localState:n,rootState:i,rootSetState:s}){let r=f.resolveLocalizedValues(e,i.locale);return r=y.transformBlock(r),v({block:r,localState:n,rootState:i,rootSetState:s,context:t})}exports.deepCloneWithConditions=o;exports.getProcessedBlock=B;
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
import { TARGET as
|
|
2
|
-
import { omit as
|
|
3
|
-
import { evaluate as
|
|
1
|
+
import { TARGET as l } from "../constants/target.mjs";
|
|
2
|
+
import { omit as m } from "../helpers/omit.mjs";
|
|
3
|
+
import { evaluate as d } from "./evaluate/evaluate.mjs";
|
|
4
|
+
import { resolveLocalizedValues as f } from "./extract-localized-values.mjs";
|
|
4
5
|
import { fastClone as u } from "./fast-clone.mjs";
|
|
5
|
-
import { set as
|
|
6
|
-
import { transformBlock as
|
|
7
|
-
function
|
|
6
|
+
import { set as y } from "./set.mjs";
|
|
7
|
+
import { transformBlock as g } from "./transform-block.mjs";
|
|
8
|
+
function s(e) {
|
|
8
9
|
if (e === null || typeof e != "object")
|
|
9
10
|
return e;
|
|
10
11
|
if (Array.isArray(e))
|
|
11
|
-
return e.map((
|
|
12
|
+
return e.map((t) => s(t));
|
|
12
13
|
if (e["@type"] === "@builder.io/sdk:Element")
|
|
13
14
|
return e;
|
|
14
|
-
const
|
|
15
|
-
for (const
|
|
16
|
-
|
|
17
|
-
return
|
|
15
|
+
const r = {};
|
|
16
|
+
for (const t in e)
|
|
17
|
+
t !== "meta" && Object.prototype.hasOwnProperty.call(e, t) && (r[t] = s(e[t]));
|
|
18
|
+
return r;
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
20
|
+
const C = ["svelte", "vue", "angular", "qwik", "solid"].includes(l), v = (e) => {
|
|
21
|
+
if (C) {
|
|
22
|
+
const r = u(e);
|
|
22
23
|
return {
|
|
23
|
-
...
|
|
24
|
+
...r,
|
|
24
25
|
properties: {
|
|
25
|
-
...
|
|
26
|
+
...r.properties
|
|
26
27
|
},
|
|
27
28
|
actions: {
|
|
28
|
-
...
|
|
29
|
+
...r.actions
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
} else {
|
|
32
|
-
const
|
|
33
|
+
const r = s(m(e, "children", "meta"));
|
|
33
34
|
return {
|
|
34
|
-
...
|
|
35
|
+
...r,
|
|
35
36
|
properties: {
|
|
36
|
-
...
|
|
37
|
+
...r.properties
|
|
37
38
|
},
|
|
38
39
|
actions: {
|
|
39
|
-
...
|
|
40
|
+
...r.actions
|
|
40
41
|
},
|
|
41
42
|
children: e.children,
|
|
42
43
|
meta: e.meta
|
|
@@ -44,44 +45,43 @@ const g = ["svelte", "vue", "angular", "qwik", "solid"].includes(d), C = (e) =>
|
|
|
44
45
|
}
|
|
45
46
|
}, O = ({
|
|
46
47
|
block: e,
|
|
47
|
-
context:
|
|
48
|
-
localState:
|
|
49
|
-
rootState:
|
|
50
|
-
rootSetState:
|
|
48
|
+
context: r,
|
|
49
|
+
localState: t,
|
|
50
|
+
rootState: i,
|
|
51
|
+
rootSetState: o
|
|
51
52
|
}) => {
|
|
52
53
|
if (!e.bindings)
|
|
53
54
|
return e;
|
|
54
|
-
const
|
|
55
|
-
for (const
|
|
56
|
-
const p = e.bindings[
|
|
55
|
+
const n = v(e);
|
|
56
|
+
for (const c in e.bindings) {
|
|
57
|
+
const p = e.bindings[c], a = d({
|
|
57
58
|
code: p,
|
|
58
|
-
localState:
|
|
59
|
-
rootState:
|
|
60
|
-
rootSetState:
|
|
61
|
-
context:
|
|
59
|
+
localState: t,
|
|
60
|
+
rootState: i,
|
|
61
|
+
rootSetState: o,
|
|
62
|
+
context: r
|
|
62
63
|
});
|
|
63
|
-
|
|
64
|
+
y(n, c, a);
|
|
64
65
|
}
|
|
65
|
-
return
|
|
66
|
+
return n;
|
|
66
67
|
};
|
|
67
|
-
function
|
|
68
|
+
function P({
|
|
68
69
|
block: e,
|
|
69
|
-
context:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
rootSetState: i
|
|
70
|
+
context: r,
|
|
71
|
+
localState: t,
|
|
72
|
+
rootState: i,
|
|
73
|
+
rootSetState: o
|
|
74
74
|
}) {
|
|
75
|
-
|
|
76
|
-
return
|
|
75
|
+
let n = f(e, i.locale);
|
|
76
|
+
return n = g(n), O({
|
|
77
77
|
block: n,
|
|
78
|
-
localState:
|
|
79
|
-
rootState:
|
|
80
|
-
rootSetState:
|
|
81
|
-
context:
|
|
82
|
-
})
|
|
78
|
+
localState: t,
|
|
79
|
+
rootState: i,
|
|
80
|
+
rootSetState: o,
|
|
81
|
+
context: r
|
|
82
|
+
});
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
s as deepCloneWithConditions,
|
|
86
|
+
P as getProcessedBlock
|
|
87
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=n=>({type:"builder.registerComponent",data:r(n)}),s=n=>{const t=n.toString().trim(),e=/^[a-zA-Z0-9_]+\s*=>/i.test(t);return`return (${!t.startsWith("function")&&!t.startsWith("async")&&!t.startsWith("(")&&!e?"function ":""}${t}).apply(this, arguments)`};function r(n){return JSON.parse(JSON.stringify(n,(t,e)=>typeof e=="function"?s(e):e))}exports.createRegisterComponentMessage=i;exports.serializeIncludingFunctions=r;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const o = (
|
|
1
|
+
const o = (n) => ({
|
|
2
2
|
type: "builder.registerComponent",
|
|
3
|
-
data: i(
|
|
4
|
-
}), e = (
|
|
5
|
-
const
|
|
6
|
-
return `return (${!
|
|
3
|
+
data: i(n)
|
|
4
|
+
}), e = (n) => {
|
|
5
|
+
const t = n.toString().trim(), r = /^[a-zA-Z0-9_]+\s*=>/i.test(t);
|
|
6
|
+
return `return (${!t.startsWith("function") && !t.startsWith("async") && !t.startsWith("(") && !r ? "function " : ""}${t}).apply(this, arguments)`;
|
|
7
7
|
};
|
|
8
|
-
function i(
|
|
9
|
-
return JSON.parse(JSON.stringify(
|
|
8
|
+
function i(n) {
|
|
9
|
+
return JSON.parse(JSON.stringify(n, (t, r) => typeof r == "function" ? e(r) : r));
|
|
10
10
|
}
|
|
11
11
|
export {
|
|
12
12
|
o as createRegisterComponentMessage,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function s(e,t,a=null,l=null,n=new WeakSet){if(e==null||typeof e!="object"){t(e,r=>{a!==null&&l!==null&&(a[l]=r)});return}n.has(e)||(n.add(e),Array.isArray(e)?e.forEach((r,u)=>{t(r,f=>{e[u]=f}),s(r,t,e,u,n)}):Object.entries(e).forEach(([r,u])=>{t(u,f=>{e[r]=f}),s(u,t,e,r,n)}))}exports.traverse=s;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function h(r, t, p = null, s = null, e = /* @__PURE__ */ new WeakSet()) {
|
|
2
|
+
if (r == null || typeof r != "object") {
|
|
3
|
+
t(r, (n) => {
|
|
4
|
+
p !== null && s !== null && (p[s] = n);
|
|
5
|
+
});
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
e.has(r) || (e.add(r), Array.isArray(r) ? r.forEach((n, u) => {
|
|
9
|
+
t(n, (f) => {
|
|
10
|
+
r[u] = f;
|
|
11
|
+
}), h(n, t, r, u, e);
|
|
12
|
+
}) : Object.entries(r).forEach(([n, u]) => {
|
|
13
|
+
t(u, (f) => {
|
|
14
|
+
r[n] = f;
|
|
15
|
+
}), h(u, t, r, n, e);
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
h as traverse
|
|
20
|
+
};
|