@builder.io/sdk-react-native 0.5.5 → 0.5.6-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/blocks/symbol/symbol.helpers.js +5 -5
- package/dist/blocks/symbol/symbol.js +1 -1
- package/dist/components/block/block.helpers.js +2 -2
- package/dist/components/block/block.js +1 -1
- package/dist/components/block/components/component-ref/component-ref.js +2 -2
- package/dist/components/block/components/repeated-block.js +2 -2
- package/dist/components/blocks/blocks.js +4 -4
- package/dist/components/content/components/enable-editor.js +11 -11
- package/dist/components/content/content.js +2 -2
- package/dist/functions/fetch-builder-props.js +69 -0
- package/dist/functions/get-content/index.js +13 -9
- package/dist/functions/get-processed-block.js +2 -2
- package/dist/functions/is-non-node-server.js +2 -2
- package/dist/functions/transform-block.js +1 -0
- package/dist/index.js +6 -2
- package/package.json +10 -2
- package/src/blocks/symbol/symbol.helpers.js +4 -4
- package/src/blocks/symbol/symbol.jsx +2 -2
- package/src/components/block/block.helpers.js +1 -1
- package/src/components/block/block.jsx +1 -1
- package/src/components/block/components/component-ref/component-ref.jsx +1 -1
- package/src/components/block/components/repeated-block.jsx +1 -1
- package/src/components/blocks/blocks.jsx +2 -2
- package/src/components/content/components/enable-editor.jsx +6 -6
- package/src/components/content/content.jsx +1 -1
- package/src/functions/fetch-builder-props.js +60 -0
- package/src/functions/get-content/index.js +10 -8
- package/src/functions/get-processed-block.js +1 -1
- package/src/functions/is-non-node-server.js +1 -1
- package/src/functions/transform-block.js +1 -0
- package/src/index.js +3 -2
- package/dist/functions/if-target.js +0 -13
- package/src/functions/if-target.js +0 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fetchSymbolContent = void 0;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -44,11 +44,11 @@ var __async = (__this, __arguments, generator) => {
|
|
|
44
44
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
-
const index_js_1 = require("../../functions/get-content/index.js");
|
|
48
47
|
const logger_js_1 = require("../../helpers/logger.js");
|
|
49
|
-
const
|
|
48
|
+
const index_js_1 = require("../../index.js");
|
|
49
|
+
const fetchSymbolContent = _0 => __async(void 0, [_0], function* ({ builderContextValue, symbol }) {
|
|
50
50
|
if ((symbol == null ? void 0 : symbol.model) && (builderContextValue == null ? void 0 : builderContextValue.apiKey)) {
|
|
51
|
-
return (0, index_js_1.
|
|
51
|
+
return (0, index_js_1.fetchOneEntry)(__spreadValues({
|
|
52
52
|
model: symbol.model,
|
|
53
53
|
apiKey: builderContextValue.apiKey,
|
|
54
54
|
apiVersion: builderContextValue.apiVersion
|
|
@@ -63,4 +63,4 @@ const fetchContent = _0 => __async(void 0, [_0], function* ({ builderContextValu
|
|
|
63
63
|
}
|
|
64
64
|
return void 0;
|
|
65
65
|
});
|
|
66
|
-
exports.
|
|
66
|
+
exports.fetchSymbolContent = fetchSymbolContent;
|
|
@@ -52,7 +52,7 @@ function Symbol(props) {
|
|
|
52
52
|
function setContent() {
|
|
53
53
|
if (contentToUse)
|
|
54
54
|
return;
|
|
55
|
-
(0, symbol_helpers_js_1.
|
|
55
|
+
(0, symbol_helpers_js_1.fetchSymbolContent)({
|
|
56
56
|
symbol: props.symbol,
|
|
57
57
|
builderContextValue: props.builderContext,
|
|
58
58
|
}).then((newContent) => {
|
|
@@ -37,7 +37,7 @@ var __objRest = (source, exclude) => {
|
|
|
37
37
|
}
|
|
38
38
|
return target;
|
|
39
39
|
};
|
|
40
|
-
const
|
|
40
|
+
const index_js_1 = require("../../functions/evaluate/index.js");
|
|
41
41
|
const get_processed_block_js_1 = require("../../functions/get-processed-block.js");
|
|
42
42
|
const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
43
43
|
const isEmptyHtmlElement = tagName => {
|
|
@@ -74,7 +74,7 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
74
74
|
if (!(repeat == null ? void 0 : repeat.collection)) {
|
|
75
75
|
return void 0;
|
|
76
76
|
}
|
|
77
|
-
const itemsArray = (0,
|
|
77
|
+
const itemsArray = (0, index_js_1.evaluate)({
|
|
78
78
|
code: repeat.collection,
|
|
79
79
|
localState: context.localState,
|
|
80
80
|
rootState: context.rootState,
|
|
@@ -34,11 +34,11 @@ const block_styles_1 = __importDefault(require("../block-styles"));
|
|
|
34
34
|
const block_1 = __importDefault(require("../../block"));
|
|
35
35
|
const interactive_element_1 = __importDefault(require("../interactive-element"));
|
|
36
36
|
const component_ref_helpers_js_1 = require("./component-ref.helpers.js");
|
|
37
|
-
const
|
|
37
|
+
const builder_context_js_1 = __importDefault(require("../../../../context/builder.context.js"));
|
|
38
38
|
function ComponentRef(props) {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
const [Wrapper, setWrapper] = (0, react_1.useState)(() => props.isInteractive ? interactive_element_1.default : props.componentRef);
|
|
41
|
-
return (React.createElement(
|
|
41
|
+
return (React.createElement(builder_context_js_1.default.Provider, { value: {
|
|
42
42
|
content: props.context.content,
|
|
43
43
|
rootState: props.context.rootState,
|
|
44
44
|
localState: props.context.localState,
|
|
@@ -30,11 +30,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
32
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
33
|
+
const builder_context_js_1 = __importDefault(require("../../../context/builder.context.js"));
|
|
34
34
|
const block_1 = __importDefault(require("../block"));
|
|
35
35
|
function RepeatedBlock(props) {
|
|
36
36
|
const [store, setStore] = (0, react_1.useState)(() => props.repeatContext);
|
|
37
|
-
return (React.createElement(
|
|
37
|
+
return (React.createElement(builder_context_js_1.default.Provider, { value: store },
|
|
38
38
|
React.createElement(block_1.default, { block: props.block, context: store, registeredComponents: props.registeredComponents })));
|
|
39
39
|
}
|
|
40
40
|
exports.default = RepeatedBlock;
|
|
@@ -33,12 +33,12 @@ const react_1 = require("react");
|
|
|
33
33
|
const block_styles_1 = __importDefault(require("../block/components/block-styles"));
|
|
34
34
|
const block_1 = __importDefault(require("../block/block"));
|
|
35
35
|
const blocks_wrapper_1 = __importDefault(require("./blocks-wrapper"));
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const builder_context_js_1 = __importDefault(require("../../context/builder.context.js"));
|
|
37
|
+
const components_context_js_1 = __importDefault(require("../../context/components.context.js"));
|
|
38
38
|
function Blocks(props) {
|
|
39
39
|
var _a, _b;
|
|
40
|
-
const builderContext = (0, react_1.useContext)(
|
|
41
|
-
const componentsContext = (0, react_1.useContext)(
|
|
40
|
+
const builderContext = (0, react_1.useContext)(builder_context_js_1.default);
|
|
41
|
+
const componentsContext = (0, react_1.useContext)(components_context_js_1.default);
|
|
42
42
|
return (React.createElement(blocks_wrapper_1.default, { blocks: props.blocks, parent: props.parent, path: props.path, styleProp: props.styleProp },
|
|
43
43
|
props.blocks ? (React.createElement(React.Fragment, null, (_a = props.blocks) === null || _a === void 0 ? void 0 : _a.map((block) => (React.createElement(block_1.default, { key: "render-block-" + block.id, block: block, context: props.context || builderContext, registeredComponents: props.registeredComponents ||
|
|
44
44
|
componentsContext.registeredComponents }))))) : null,
|
|
@@ -30,18 +30,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
30
30
|
const React = __importStar(require("react"));
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
32
|
const react_1 = require("react");
|
|
33
|
-
const
|
|
33
|
+
const index_js_1 = require("../../../functions/evaluate/index.js");
|
|
34
34
|
const get_fetch_js_1 = require("../../../functions/get-fetch.js");
|
|
35
35
|
const is_browser_js_1 = require("../../../functions/is-browser.js");
|
|
36
36
|
const is_editing_js_1 = require("../../../functions/is-editing.js");
|
|
37
37
|
const register_component_js_1 = require("../../../functions/register-component.js");
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const index_js_2 = require("../../../functions/track/index.js");
|
|
39
|
+
const builder_context_js_1 = __importDefault(require("../../../context/builder.context.js"));
|
|
40
40
|
const init_editing_js_1 = require("../../../scripts/init-editing.js");
|
|
41
41
|
const nullable_js_1 = require("../../../helpers/nullable.js");
|
|
42
42
|
const interaction_js_1 = require("../../../functions/track/interaction.js");
|
|
43
43
|
const logger_js_1 = require("../../../helpers/logger.js");
|
|
44
|
-
const
|
|
44
|
+
const index_js_3 = require("../../../functions/get-content/index.js");
|
|
45
45
|
const is_previewing_js_1 = require("../../../functions/is-previewing.js");
|
|
46
46
|
const set_js_1 = require("../../../helpers/preview-lru-cache/set.js");
|
|
47
47
|
function EnableEditor(props) {
|
|
@@ -112,7 +112,7 @@ function EnableEditor(props) {
|
|
|
112
112
|
// run any dynamic JS code attached to content
|
|
113
113
|
const jsCode = (_b = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.jsCode;
|
|
114
114
|
if (jsCode) {
|
|
115
|
-
(0,
|
|
115
|
+
(0, index_js_1.evaluate)({
|
|
116
116
|
code: jsCode,
|
|
117
117
|
context: props.context || {},
|
|
118
118
|
localState: undefined,
|
|
@@ -128,7 +128,7 @@ function EnableEditor(props) {
|
|
|
128
128
|
if (props.builderContextSignal.content) {
|
|
129
129
|
const variationId = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.testVariationId;
|
|
130
130
|
const contentId = (_b = props.builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.id;
|
|
131
|
-
(0,
|
|
131
|
+
(0, index_js_2._track)({
|
|
132
132
|
type: "click",
|
|
133
133
|
canTrack: canTrackToUse,
|
|
134
134
|
contentId,
|
|
@@ -143,7 +143,7 @@ function EnableEditor(props) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
function evalExpression(expression) {
|
|
146
|
-
return expression.replace(/{{([^}]+)}}/g, (_match, group) => (0,
|
|
146
|
+
return expression.replace(/{{([^}]+)}}/g, (_match, group) => (0, index_js_1.evaluate)({
|
|
147
147
|
code: group,
|
|
148
148
|
context: props.context || {},
|
|
149
149
|
localState: undefined,
|
|
@@ -229,7 +229,7 @@ function EnableEditor(props) {
|
|
|
229
229
|
if (props.builderContextSignal.content) {
|
|
230
230
|
const variationId = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.testVariationId;
|
|
231
231
|
const contentId = (_b = props.builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.id;
|
|
232
|
-
(0,
|
|
232
|
+
(0, index_js_2._track)({
|
|
233
233
|
type: "impression",
|
|
234
234
|
canTrack: canTrackToUse,
|
|
235
235
|
contentId,
|
|
@@ -253,7 +253,7 @@ function EnableEditor(props) {
|
|
|
253
253
|
if (searchParamPreviewModel === props.model &&
|
|
254
254
|
previewApiKey === props.apiKey &&
|
|
255
255
|
(!props.content || searchParamPreviewId === props.content.id)) {
|
|
256
|
-
(0,
|
|
256
|
+
(0, index_js_3.fetchOneEntry)({
|
|
257
257
|
model: props.model,
|
|
258
258
|
apiKey: props.apiKey,
|
|
259
259
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
@@ -295,8 +295,8 @@ function EnableEditor(props) {
|
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
}, []);
|
|
298
|
-
return (React.createElement(
|
|
299
|
-
React.createElement(react_native_1.
|
|
298
|
+
return (React.createElement(builder_context_js_1.default.Provider, { value: props.builderContextSignal }, props.builderContextSignal.content ? (React.createElement(React.Fragment, null,
|
|
299
|
+
React.createElement(react_native_1.ScrollView, { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": (_e = props.builderContextSignal.content) === null || _e === void 0 ? void 0 : _e.id, "builder-model": props.model, ...{
|
|
300
300
|
// currently, we can't set the actual ID here. // we don't need it right now, we just need to identify content divs for testing.
|
|
301
301
|
dataSet: {
|
|
302
302
|
"builder-content-id": "",
|
|
@@ -40,7 +40,7 @@ const helpers_js_1 = require("../content-variants/helpers.js");
|
|
|
40
40
|
const enable_editor_1 = __importDefault(require("./components/enable-editor"));
|
|
41
41
|
const inlined_script_1 = __importDefault(require("../inlined-script"));
|
|
42
42
|
const wrap_component_ref_js_1 = require("./wrap-component-ref.js");
|
|
43
|
-
const
|
|
43
|
+
const components_context_js_1 = __importDefault(require("../../context/components.context.js"));
|
|
44
44
|
function ContentComponent(props) {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
46
46
|
const [scriptStr, setScriptStr] = (0, react_1.useState)(() => {
|
|
@@ -101,7 +101,7 @@ function ContentComponent(props) {
|
|
|
101
101
|
}), {}),
|
|
102
102
|
inheritedStyles: {},
|
|
103
103
|
}));
|
|
104
|
-
return (React.createElement(
|
|
104
|
+
return (React.createElement(components_context_js_1.default.Provider, { value: {
|
|
105
105
|
registeredComponents: registeredComponents,
|
|
106
106
|
} },
|
|
107
107
|
React.createElement(enable_editor_1.default, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal, ...{
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchBuilderProps = void 0;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value
|
|
15
|
+
}) : obj[key] = value;
|
|
16
|
+
var __spreadValues = (a, b) => {
|
|
17
|
+
for (var prop in b || (b = {}))
|
|
18
|
+
if (__hasOwnProp.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
if (__getOwnPropSymbols)
|
|
21
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
22
|
+
if (__propIsEnum.call(b, prop))
|
|
23
|
+
__defNormalProp(a, prop, b[prop]);
|
|
24
|
+
}
|
|
25
|
+
return a;
|
|
26
|
+
};
|
|
27
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
|
+
var __async = (__this, __arguments, generator) => {
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
var fulfilled = value => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.next(value));
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var rejected = value => {
|
|
39
|
+
try {
|
|
40
|
+
step(generator.throw(value));
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
reject(e);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
47
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const index_js_1 = require("./get-builder-search-params/index.js");
|
|
51
|
+
const index_js_2 = require("./get-content/index.js");
|
|
52
|
+
const fetchBuilderProps = _args => __async(void 0, null, function* () {
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
|
|
55
|
+
const getContentArgs = __spreadProps(__spreadValues({}, _args), {
|
|
56
|
+
apiKey: _args.apiKey,
|
|
57
|
+
model: _args.model || "page",
|
|
58
|
+
userAttributes: __spreadValues(__spreadValues({}, _args.userAttributes), urlPath ? {
|
|
59
|
+
urlPath
|
|
60
|
+
} : {}),
|
|
61
|
+
options: (0, index_js_1.getBuilderSearchParams)(_args.searchParams || ((_c = _args.url) == null ? void 0 : _c.searchParams) || _args.options)
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
apiKey: getContentArgs.apiKey,
|
|
65
|
+
model: getContentArgs.model,
|
|
66
|
+
content: yield (0, index_js_2.fetchOneEntry)(getContentArgs)
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
exports.fetchBuilderProps = fetchBuilderProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getContent = exports.getAllContent = exports.fetchOneEntry = exports.fetchEntries = exports._processContentResult = void 0;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __defProps = Object.defineProperties;
|
|
6
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -56,9 +56,9 @@ const get_fetch_js_1 = require("../get-fetch.js");
|
|
|
56
56
|
const is_browser_js_1 = require("../is-browser.js");
|
|
57
57
|
const generate_content_url_js_1 = require("./generate-content-url.js");
|
|
58
58
|
const checkContentHasResults = content => "results" in content;
|
|
59
|
-
function
|
|
59
|
+
function fetchOneEntry(options) {
|
|
60
60
|
return __async(this, null, function* () {
|
|
61
|
-
const allContent = yield
|
|
61
|
+
const allContent = yield fetchEntries(__spreadProps(__spreadValues({}, options), {
|
|
62
62
|
limit: 1
|
|
63
63
|
}));
|
|
64
64
|
if (allContent) {
|
|
@@ -67,14 +67,16 @@ function getContent(options) {
|
|
|
67
67
|
return null;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
+
exports.fetchOneEntry = fetchOneEntry;
|
|
71
|
+
const getContent = fetchOneEntry;
|
|
70
72
|
exports.getContent = getContent;
|
|
71
|
-
const
|
|
73
|
+
const _fetchContent = options => __async(void 0, null, function* () {
|
|
72
74
|
const url = (0, generate_content_url_js_1.generateContentUrl)(options);
|
|
73
75
|
const res = yield (0, get_fetch_js_1.fetch)(url.href);
|
|
74
76
|
const content = yield res.json();
|
|
75
77
|
return content;
|
|
76
78
|
});
|
|
77
|
-
const
|
|
79
|
+
const _processContentResult = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (options, content, url = (0, generate_content_url_js_1.generateContentUrl)(options)) {
|
|
78
80
|
const canTrack = (0, canTrack_js_1.getDefaultCanTrack)(options.canTrack);
|
|
79
81
|
const isPreviewing = url.search.includes(`preview=`);
|
|
80
82
|
if (target_js_1.TARGET === "rsc" && isPreviewing) {
|
|
@@ -104,12 +106,12 @@ const processContentResult = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2],
|
|
|
104
106
|
}
|
|
105
107
|
return content;
|
|
106
108
|
});
|
|
107
|
-
exports.
|
|
108
|
-
function
|
|
109
|
+
exports._processContentResult = _processContentResult;
|
|
110
|
+
function fetchEntries(options) {
|
|
109
111
|
return __async(this, null, function* () {
|
|
110
112
|
try {
|
|
111
113
|
const url = (0, generate_content_url_js_1.generateContentUrl)(options);
|
|
112
|
-
const content = yield
|
|
114
|
+
const content = yield _fetchContent(options);
|
|
113
115
|
if (!checkContentHasResults(content)) {
|
|
114
116
|
logger_js_1.logger.error("Error fetching data. ", {
|
|
115
117
|
url,
|
|
@@ -118,7 +120,7 @@ function getAllContent(options) {
|
|
|
118
120
|
});
|
|
119
121
|
return null;
|
|
120
122
|
}
|
|
121
|
-
return
|
|
123
|
+
return _processContentResult(options, content);
|
|
122
124
|
}
|
|
123
125
|
catch (error) {
|
|
124
126
|
logger_js_1.logger.error("Error fetching data. ", error);
|
|
@@ -126,4 +128,6 @@ function getAllContent(options) {
|
|
|
126
128
|
}
|
|
127
129
|
});
|
|
128
130
|
}
|
|
131
|
+
exports.fetchEntries = fetchEntries;
|
|
132
|
+
const getAllContent = fetchEntries;
|
|
129
133
|
exports.getAllContent = getAllContent;
|
|
@@ -25,7 +25,7 @@ var __spreadValues = (a, b) => {
|
|
|
25
25
|
return a;
|
|
26
26
|
};
|
|
27
27
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
28
|
-
const
|
|
28
|
+
const index_js_1 = require("./evaluate/index.js");
|
|
29
29
|
const fast_clone_js_1 = require("./fast-clone.js");
|
|
30
30
|
const set_js_1 = require("./set.js");
|
|
31
31
|
const transform_block_js_1 = require("./transform-block.js");
|
|
@@ -40,7 +40,7 @@ const evaluateBindings = ({ block, context, localState, rootState, rootSetState
|
|
|
40
40
|
});
|
|
41
41
|
for (const binding in block.bindings) {
|
|
42
42
|
const expression = block.bindings[binding];
|
|
43
|
-
const value = (0,
|
|
43
|
+
const value = (0, index_js_1.evaluate)({
|
|
44
44
|
code: expression,
|
|
45
45
|
localState,
|
|
46
46
|
rootState,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNonNodeServer = void 0;
|
|
4
|
-
const
|
|
4
|
+
const is_browser_js_1 = require("./is-browser.js");
|
|
5
5
|
function isNonNodeServer() {
|
|
6
6
|
const hasNode = () => {
|
|
7
7
|
var _a;
|
|
8
8
|
return typeof process !== "undefined" && ((_a = process == null ? void 0 : process.versions) == null ? void 0 : _a.node);
|
|
9
9
|
};
|
|
10
|
-
return !(0,
|
|
10
|
+
return !(0, is_browser_js_1.isBrowser)() && !hasNode();
|
|
11
11
|
}
|
|
12
12
|
exports.isNonNodeServer = isNonNodeServer;
|
|
@@ -23,6 +23,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
23
23
|
function transformBlock(block) {
|
|
24
24
|
if (block.id.startsWith("builder-pixel-") && !block.component) {
|
|
25
25
|
return __spreadProps(__spreadValues({}, block), {
|
|
26
|
+
tagName: void 0,
|
|
26
27
|
component: {
|
|
27
28
|
name: "Image",
|
|
28
29
|
options: {
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.track = exports.setEditorSettings = exports.register = exports.
|
|
17
|
+
exports.track = exports.setEditorSettings = exports.register = exports.isPreviewing = exports.isEditing = exports.getContent = exports.getBuilderSearchParams = exports.getAllContent = exports.fetchOneEntry = exports.fetchEntries = exports.fetchBuilderProps = exports.createRegisterComponentMessage = exports._processContentResult = void 0;
|
|
18
18
|
__exportStar(require("./index-helpers/top-of-file.js"), exports);
|
|
19
19
|
__exportStar(require("./index-helpers/blocks-exports.js"), exports);
|
|
20
20
|
const is_editing_js_1 = require("./functions/is-editing.js");
|
|
@@ -28,10 +28,14 @@ Object.defineProperty(exports, "register", { enumerable: true, get: function ()
|
|
|
28
28
|
const set_editor_settings_js_1 = require("./functions/set-editor-settings.js");
|
|
29
29
|
Object.defineProperty(exports, "setEditorSettings", { enumerable: true, get: function () { return set_editor_settings_js_1.setEditorSettings; } });
|
|
30
30
|
const index_js_1 = require("./functions/get-content/index.js");
|
|
31
|
+
Object.defineProperty(exports, "fetchEntries", { enumerable: true, get: function () { return index_js_1.fetchEntries; } });
|
|
32
|
+
Object.defineProperty(exports, "fetchOneEntry", { enumerable: true, get: function () { return index_js_1.fetchOneEntry; } });
|
|
31
33
|
Object.defineProperty(exports, "getAllContent", { enumerable: true, get: function () { return index_js_1.getAllContent; } });
|
|
32
34
|
Object.defineProperty(exports, "getContent", { enumerable: true, get: function () { return index_js_1.getContent; } });
|
|
33
|
-
Object.defineProperty(exports, "
|
|
35
|
+
Object.defineProperty(exports, "_processContentResult", { enumerable: true, get: function () { return index_js_1._processContentResult; } });
|
|
34
36
|
const index_js_2 = require("./functions/get-builder-search-params/index.js");
|
|
35
37
|
Object.defineProperty(exports, "getBuilderSearchParams", { enumerable: true, get: function () { return index_js_2.getBuilderSearchParams; } });
|
|
36
38
|
const index_js_3 = require("./functions/track/index.js");
|
|
37
39
|
Object.defineProperty(exports, "track", { enumerable: true, get: function () { return index_js_3.track; } });
|
|
40
|
+
const fetch_builder_props_js_1 = require("./functions/fetch-builder-props.js");
|
|
41
|
+
Object.defineProperty(exports, "fetchBuilderProps", { enumerable: true, get: function () { return fetch_builder_props_js_1.fetchBuilderProps; } });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-react-native",
|
|
3
3
|
"description": "Builder.io SDK for React Native",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.6-1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -40,6 +40,14 @@
|
|
|
40
40
|
"nx": {
|
|
41
41
|
"implicitDependencies": [
|
|
42
42
|
"@builder.io/sdks"
|
|
43
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"targets": {
|
|
45
|
+
"build": {
|
|
46
|
+
"dependsOn": [
|
|
47
|
+
"^build:react-native",
|
|
48
|
+
"^build"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
44
52
|
}
|
|
45
53
|
}
|
|
@@ -35,14 +35,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
35
35
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
import { getContent } from "../../functions/get-content/index.js";
|
|
39
38
|
import { logger } from "../../helpers/logger.js";
|
|
40
|
-
|
|
39
|
+
import { fetchOneEntry } from "../../index.js";
|
|
40
|
+
const fetchSymbolContent = _0 => __async(void 0, [_0], function* ({
|
|
41
41
|
builderContextValue,
|
|
42
42
|
symbol
|
|
43
43
|
}) {
|
|
44
44
|
if ((symbol == null ? void 0 : symbol.model) && (builderContextValue == null ? void 0 : builderContextValue.apiKey)) {
|
|
45
|
-
return
|
|
45
|
+
return fetchOneEntry(__spreadValues({
|
|
46
46
|
model: symbol.model,
|
|
47
47
|
apiKey: builderContextValue.apiKey,
|
|
48
48
|
apiVersion: builderContextValue.apiVersion
|
|
@@ -57,4 +57,4 @@ const fetchContent = _0 => __async(void 0, [_0], function* ({
|
|
|
57
57
|
}
|
|
58
58
|
return void 0;
|
|
59
59
|
});
|
|
60
|
-
export {
|
|
60
|
+
export { fetchSymbolContent }
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { useState, useEffect } from "react";
|
|
12
12
|
import ContentVariants from "../../components/content-variants/content-variants";
|
|
13
13
|
import { filterAttrs } from "../helpers.js";
|
|
14
|
-
import {
|
|
14
|
+
import { fetchSymbolContent } from "./symbol.helpers.js";
|
|
15
15
|
|
|
16
16
|
function Symbol(props) {
|
|
17
17
|
function className() {
|
|
@@ -31,7 +31,7 @@ function Symbol(props) {
|
|
|
31
31
|
|
|
32
32
|
function setContent() {
|
|
33
33
|
if (contentToUse) return;
|
|
34
|
-
|
|
34
|
+
fetchSymbolContent({
|
|
35
35
|
symbol: props.symbol,
|
|
36
36
|
builderContextValue: props.builderContext,
|
|
37
37
|
}).then((newContent) => {
|
|
@@ -26,7 +26,7 @@ var __objRest = (source, exclude) => {
|
|
|
26
26
|
}
|
|
27
27
|
return target;
|
|
28
28
|
};
|
|
29
|
-
import { evaluate } from "../../functions/evaluate";
|
|
29
|
+
import { evaluate } from "../../functions/evaluate/index.js";
|
|
30
30
|
import { getProcessedBlock } from "../../functions/get-processed-block.js";
|
|
31
31
|
const EMPTY_HTML_ELEMENTS = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"];
|
|
32
32
|
const isEmptyHtmlElement = tagName => {
|
|
@@ -13,7 +13,7 @@ import BlockStyles from "../block-styles";
|
|
|
13
13
|
import Block from "../../block";
|
|
14
14
|
import InteractiveElement from "../interactive-element";
|
|
15
15
|
import { getWrapperProps } from "./component-ref.helpers.js";
|
|
16
|
-
import BuilderContext from "../../../../context/builder.context";
|
|
16
|
+
import BuilderContext from "../../../../context/builder.context.js";
|
|
17
17
|
|
|
18
18
|
function ComponentRef(props) {
|
|
19
19
|
const [Wrapper, setWrapper] = useState(() =>
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
Text,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
import { useState, useContext } from "react";
|
|
12
|
-
import BuilderContext from "../../../context/builder.context";
|
|
12
|
+
import BuilderContext from "../../../context/builder.context.js";
|
|
13
13
|
import Block from "../block";
|
|
14
14
|
|
|
15
15
|
function RepeatedBlock(props) {
|
|
@@ -12,8 +12,8 @@ import { useContext } from "react";
|
|
|
12
12
|
import BlockStyles from "../block/components/block-styles";
|
|
13
13
|
import Block from "../block/block";
|
|
14
14
|
import BlocksWrapper from "./blocks-wrapper";
|
|
15
|
-
import BuilderContext from "../../context/builder.context";
|
|
16
|
-
import ComponentsContext from "../../context/components.context";
|
|
15
|
+
import BuilderContext from "../../context/builder.context.js";
|
|
16
|
+
import ComponentsContext from "../../context/components.context.js";
|
|
17
17
|
|
|
18
18
|
function Blocks(props) {
|
|
19
19
|
const builderContext = useContext(BuilderContext);
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
Text,
|
|
10
10
|
} from "react-native";
|
|
11
11
|
import { useState, useContext, useRef, useEffect } from "react";
|
|
12
|
-
import { evaluate } from "../../../functions/evaluate";
|
|
12
|
+
import { evaluate } from "../../../functions/evaluate/index.js";
|
|
13
13
|
import { fetch } from "../../../functions/get-fetch.js";
|
|
14
14
|
import { isBrowser } from "../../../functions/is-browser.js";
|
|
15
15
|
import { isEditing } from "../../../functions/is-editing.js";
|
|
16
16
|
import { createRegisterComponentMessage } from "../../../functions/register-component.js";
|
|
17
17
|
import { _track } from "../../../functions/track/index.js";
|
|
18
|
-
import builderContext from "../../../context/builder.context";
|
|
18
|
+
import builderContext from "../../../context/builder.context.js";
|
|
19
19
|
import {
|
|
20
20
|
registerInsertMenu,
|
|
21
21
|
setupBrowserForEditing,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
import { checkIsDefined } from "../../../helpers/nullable.js";
|
|
24
24
|
import { getInteractionPropertiesForEvent } from "../../../functions/track/interaction.js";
|
|
25
25
|
import { logger } from "../../../helpers/logger.js";
|
|
26
|
-
import {
|
|
26
|
+
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
27
27
|
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
28
28
|
import { postPreviewContent } from "../../../helpers/preview-lru-cache/set.js";
|
|
29
29
|
|
|
@@ -268,7 +268,7 @@ function EnableEditor(props) {
|
|
|
268
268
|
previewApiKey === props.apiKey &&
|
|
269
269
|
(!props.content || searchParamPreviewId === props.content.id)
|
|
270
270
|
) {
|
|
271
|
-
|
|
271
|
+
fetchOneEntry({
|
|
272
272
|
model: props.model,
|
|
273
273
|
apiKey: props.apiKey,
|
|
274
274
|
apiVersion: props.builderContextSignal.apiVersion,
|
|
@@ -320,7 +320,7 @@ function EnableEditor(props) {
|
|
|
320
320
|
<builderContext.Provider value={props.builderContextSignal}>
|
|
321
321
|
{props.builderContextSignal.content ? (
|
|
322
322
|
<>
|
|
323
|
-
<
|
|
323
|
+
<ScrollView
|
|
324
324
|
key={forceReRenderCount}
|
|
325
325
|
ref={elementRef}
|
|
326
326
|
onClick={(event) => onClick(event)}
|
|
@@ -340,7 +340,7 @@ function EnableEditor(props) {
|
|
|
340
340
|
})}
|
|
341
341
|
>
|
|
342
342
|
{props.children}
|
|
343
|
-
</
|
|
343
|
+
</ScrollView>
|
|
344
344
|
</>
|
|
345
345
|
) : null}
|
|
346
346
|
</builderContext.Provider>
|
|
@@ -25,7 +25,7 @@ import { getRenderContentScriptString } from "../content-variants/helpers.js";
|
|
|
25
25
|
import EnableEditor from "./components/enable-editor";
|
|
26
26
|
import InlinedScript from "../inlined-script";
|
|
27
27
|
import { wrapComponentRef } from "./wrap-component-ref.js";
|
|
28
|
-
import ComponentsContext from "../../context/components.context";
|
|
28
|
+
import ComponentsContext from "../../context/components.context.js";
|
|
29
29
|
|
|
30
30
|
function ContentComponent(props) {
|
|
31
31
|
const [scriptStr, setScriptStr] = useState(() =>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
configurable: true,
|
|
10
|
+
writable: true,
|
|
11
|
+
value
|
|
12
|
+
}) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
var __async = (__this, __arguments, generator) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
var fulfilled = value => {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var rejected = value => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.throw(value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var step = x => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
import { getBuilderSearchParams } from "./get-builder-search-params/index.js";
|
|
42
|
+
import { fetchOneEntry } from "./get-content/index.js";
|
|
43
|
+
const fetchBuilderProps = _args => __async(void 0, null, function* () {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
const urlPath = _args.path || ((_a = _args.url) == null ? void 0 : _a.pathname) || ((_b = _args.userAttributes) == null ? void 0 : _b.urlPath);
|
|
46
|
+
const getContentArgs = __spreadProps(__spreadValues({}, _args), {
|
|
47
|
+
apiKey: _args.apiKey,
|
|
48
|
+
model: _args.model || "page",
|
|
49
|
+
userAttributes: __spreadValues(__spreadValues({}, _args.userAttributes), urlPath ? {
|
|
50
|
+
urlPath
|
|
51
|
+
} : {}),
|
|
52
|
+
options: getBuilderSearchParams(_args.searchParams || ((_c = _args.url) == null ? void 0 : _c.searchParams) || _args.options)
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
apiKey: getContentArgs.apiKey,
|
|
56
|
+
model: getContentArgs.model,
|
|
57
|
+
content: yield fetchOneEntry(getContentArgs)
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
export { fetchBuilderProps }
|
|
@@ -47,9 +47,9 @@ import { fetch } from "../get-fetch.js";
|
|
|
47
47
|
import { isBrowser } from "../is-browser.js";
|
|
48
48
|
import { generateContentUrl } from "./generate-content-url.js";
|
|
49
49
|
const checkContentHasResults = content => "results" in content;
|
|
50
|
-
function
|
|
50
|
+
function fetchOneEntry(options) {
|
|
51
51
|
return __async(this, null, function* () {
|
|
52
|
-
const allContent = yield
|
|
52
|
+
const allContent = yield fetchEntries(__spreadProps(__spreadValues({}, options), {
|
|
53
53
|
limit: 1
|
|
54
54
|
}));
|
|
55
55
|
if (allContent) {
|
|
@@ -58,13 +58,14 @@ function getContent(options) {
|
|
|
58
58
|
return null;
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const getContent = fetchOneEntry;
|
|
62
|
+
const _fetchContent = options => __async(void 0, null, function* () {
|
|
62
63
|
const url = generateContentUrl(options);
|
|
63
64
|
const res = yield fetch(url.href);
|
|
64
65
|
const content = yield res.json();
|
|
65
66
|
return content;
|
|
66
67
|
});
|
|
67
|
-
const
|
|
68
|
+
const _processContentResult = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (options, content, url = generateContentUrl(options)) {
|
|
68
69
|
const canTrack = getDefaultCanTrack(options.canTrack);
|
|
69
70
|
const isPreviewing = url.search.includes(`preview=`);
|
|
70
71
|
if (TARGET === "rsc" && isPreviewing) {
|
|
@@ -91,11 +92,11 @@ const processContentResult = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2],
|
|
|
91
92
|
}
|
|
92
93
|
return content;
|
|
93
94
|
});
|
|
94
|
-
function
|
|
95
|
+
function fetchEntries(options) {
|
|
95
96
|
return __async(this, null, function* () {
|
|
96
97
|
try {
|
|
97
98
|
const url = generateContentUrl(options);
|
|
98
|
-
const content = yield
|
|
99
|
+
const content = yield _fetchContent(options);
|
|
99
100
|
if (!checkContentHasResults(content)) {
|
|
100
101
|
logger.error("Error fetching data. ", {
|
|
101
102
|
url,
|
|
@@ -104,11 +105,12 @@ function getAllContent(options) {
|
|
|
104
105
|
});
|
|
105
106
|
return null;
|
|
106
107
|
}
|
|
107
|
-
return
|
|
108
|
+
return _processContentResult(options, content);
|
|
108
109
|
} catch (error) {
|
|
109
110
|
logger.error("Error fetching data. ", error);
|
|
110
111
|
return null;
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
const getAllContent = fetchEntries;
|
|
116
|
+
export { _processContentResult, fetchEntries, fetchOneEntry, getAllContent, getContent }
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
return a;
|
|
19
19
|
};
|
|
20
20
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
import { evaluate } from "./evaluate";
|
|
21
|
+
import { evaluate } from "./evaluate/index.js";
|
|
22
22
|
import { fastClone } from "./fast-clone.js";
|
|
23
23
|
import { set } from "./set.js";
|
|
24
24
|
import { transformBlock } from "./transform-block.js";
|
|
@@ -20,6 +20,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
20
20
|
function transformBlock(block) {
|
|
21
21
|
if (block.id.startsWith("builder-pixel-") && !block.component) {
|
|
22
22
|
return __spreadProps(__spreadValues({}, block), {
|
|
23
|
+
tagName: void 0,
|
|
23
24
|
component: {
|
|
24
25
|
name: "Image",
|
|
25
26
|
options: {
|
package/src/index.js
CHANGED
|
@@ -5,7 +5,8 @@ import { isPreviewing } from "./functions/is-previewing.js";
|
|
|
5
5
|
import { createRegisterComponentMessage } from "./functions/register-component.js";
|
|
6
6
|
import { register } from "./functions/register.js";
|
|
7
7
|
import { setEditorSettings } from "./functions/set-editor-settings.js";
|
|
8
|
-
import { getAllContent, getContent,
|
|
8
|
+
import { fetchEntries, fetchOneEntry, getAllContent, getContent, _processContentResult } from "./functions/get-content/index.js";
|
|
9
9
|
import { getBuilderSearchParams } from "./functions/get-builder-search-params/index.js";
|
|
10
10
|
import { track } from "./functions/track/index.js";
|
|
11
|
-
|
|
11
|
+
import { fetchBuilderProps } from "./functions/fetch-builder-props.js";
|
|
12
|
+
export { _processContentResult, createRegisterComponentMessage, fetchBuilderProps, fetchEntries, fetchOneEntry, getAllContent, getBuilderSearchParams, getContent, isEditing, isPreviewing, register, setEditorSettings, track }
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ifTarget = void 0;
|
|
4
|
-
const target_js_1 = require("../constants/target.js");
|
|
5
|
-
function ifTarget({ targets, doThing, elseThing }) {
|
|
6
|
-
if (target_js_1.TARGET && targets.includes(target_js_1.TARGET)) {
|
|
7
|
-
return doThing();
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return elseThing == null ? void 0 : elseThing();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.ifTarget = ifTarget;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TARGET } from "../constants/target.js";
|
|
2
|
-
function ifTarget({
|
|
3
|
-
targets,
|
|
4
|
-
doThing,
|
|
5
|
-
elseThing
|
|
6
|
-
}) {
|
|
7
|
-
if (TARGET && targets.includes(TARGET)) {
|
|
8
|
-
return doThing();
|
|
9
|
-
} else {
|
|
10
|
-
return elseThing == null ? void 0 : elseThing();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export { ifTarget }
|