@builder.io/sdk-qwik 0.6.5-4 → 0.7.1-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/index.qwik.cjs +91 -91
- package/lib/browser/index.qwik.mjs +91 -91
- package/lib/edge/index.qwik.cjs +91 -91
- package/lib/edge/index.qwik.mjs +91 -91
- package/lib/node/index.qwik.cjs +91 -91
- package/lib/node/index.qwik.mjs +91 -91
- package/package.json +1 -1
- package/types/src/components/content/components/enable-editor.d.ts +0 -4
- package/types/src/constants/sdk-version.d.ts +1 -1
|
@@ -2815,7 +2815,8 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
2815
2815
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
2816
2816
|
const DEFAULT_API_VERSION = "v3";
|
|
2817
2817
|
const generateContentUrl = (options) => {
|
|
2818
|
-
|
|
2818
|
+
let { noTraverse = false } = options;
|
|
2819
|
+
const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
2819
2820
|
if (!apiKey)
|
|
2820
2821
|
throw new Error("Missing API key");
|
|
2821
2822
|
if (![
|
|
@@ -2823,6 +2824,8 @@ const generateContentUrl = (options) => {
|
|
|
2823
2824
|
"v3"
|
|
2824
2825
|
].includes(apiVersion))
|
|
2825
2826
|
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
2827
|
+
if ((options.limit === void 0 || options.limit > 1) && !("noTraverse" in options))
|
|
2828
|
+
noTraverse = true;
|
|
2826
2829
|
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
|
|
2827
2830
|
const queryOptions = {
|
|
2828
2831
|
...getBuilderSearchParamsFromWindow(),
|
|
@@ -3097,7 +3100,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
3097
3100
|
}
|
|
3098
3101
|
};
|
|
3099
3102
|
};
|
|
3100
|
-
const SDK_VERSION = "0.
|
|
3103
|
+
const SDK_VERSION = "0.7.1-0";
|
|
3101
3104
|
const registry = {};
|
|
3102
3105
|
function register(type, info) {
|
|
3103
3106
|
let typeList = registry[type];
|
|
@@ -3354,44 +3357,8 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3354
3357
|
}
|
|
3355
3358
|
}));
|
|
3356
3359
|
};
|
|
3357
|
-
const initEditing = function initEditing2(props, state, elementRef, _event) {
|
|
3358
|
-
state.forceReRenderCount = state.forceReRenderCount + 1;
|
|
3359
|
-
window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
|
|
3360
|
-
registerInsertMenu();
|
|
3361
|
-
setupBrowserForEditing({
|
|
3362
|
-
...props.locale ? {
|
|
3363
|
-
locale: props.locale
|
|
3364
|
-
} : {},
|
|
3365
|
-
...props.includeRefs ? {
|
|
3366
|
-
includeRefs: props.includeRefs
|
|
3367
|
-
} : {},
|
|
3368
|
-
...props.enrich ? {
|
|
3369
|
-
enrich: props.enrich
|
|
3370
|
-
} : {}
|
|
3371
|
-
});
|
|
3372
|
-
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3373
|
-
var _a;
|
|
3374
|
-
const message = createRegisterComponentMessage(registeredComponent);
|
|
3375
|
-
(_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
|
|
3376
|
-
});
|
|
3377
|
-
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
|
|
3378
|
-
};
|
|
3379
|
-
const initPreview = function initPreview2(props, state, elementRef, _event) {
|
|
3380
|
-
const searchParams = new URL(location.href).searchParams;
|
|
3381
|
-
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
3382
|
-
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
|
3383
|
-
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
3384
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
|
|
3385
|
-
fetchOneEntry({
|
|
3386
|
-
model: props.model,
|
|
3387
|
-
apiKey: props.apiKey,
|
|
3388
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
3389
|
-
}).then((content) => {
|
|
3390
|
-
if (content)
|
|
3391
|
-
mergeNewContent(props, state, elementRef, content);
|
|
3392
|
-
});
|
|
3393
|
-
};
|
|
3394
3360
|
const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
3361
|
+
var _a, _b, _c;
|
|
3395
3362
|
qwik._jsxBranch();
|
|
3396
3363
|
const elementRef = qwik.useSignal();
|
|
3397
3364
|
const state = qwik.useStore({
|
|
@@ -3403,55 +3370,94 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
3403
3370
|
}, {
|
|
3404
3371
|
deep: true
|
|
3405
3372
|
});
|
|
3406
|
-
qwik.useOn("
|
|
3373
|
+
qwik.useOn("initeditingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
3407
3374
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3408
|
-
|
|
3375
|
+
state2.forceReRenderCount = state2.forceReRenderCount + 1;
|
|
3376
|
+
window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
3377
|
+
registerInsertMenu();
|
|
3378
|
+
setupBrowserForEditing({
|
|
3379
|
+
...props2.locale ? {
|
|
3380
|
+
locale: props2.locale
|
|
3381
|
+
} : {},
|
|
3382
|
+
...props2.includeRefs ? {
|
|
3383
|
+
includeRefs: props2.includeRefs
|
|
3384
|
+
} : {},
|
|
3385
|
+
...props2.enrich ? {
|
|
3386
|
+
enrich: props2.enrich
|
|
3387
|
+
} : {}
|
|
3388
|
+
});
|
|
3389
|
+
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3390
|
+
var _a2;
|
|
3391
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
3392
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
|
|
3393
|
+
});
|
|
3394
|
+
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3409
3395
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
3410
3396
|
elementRef,
|
|
3411
3397
|
props,
|
|
3412
3398
|
state
|
|
3413
3399
|
]));
|
|
3414
|
-
qwik.useOn("
|
|
3400
|
+
qwik.useOn("initpreviewingbldr", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
3415
3401
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3416
|
-
|
|
3402
|
+
const searchParams = new URL(location.href).searchParams;
|
|
3403
|
+
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
3404
|
+
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
|
3405
|
+
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
3406
|
+
if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
|
|
3407
|
+
fetchOneEntry({
|
|
3408
|
+
model: props2.model,
|
|
3409
|
+
apiKey: props2.apiKey,
|
|
3410
|
+
apiVersion: props2.builderContextSignal.apiVersion
|
|
3411
|
+
}).then((content) => {
|
|
3412
|
+
if (content)
|
|
3413
|
+
mergeNewContent(props2, state2, elementRef2, content);
|
|
3414
|
+
});
|
|
3417
3415
|
}, "EnableEditor_component_useOn_1_F94YipmknvI", [
|
|
3418
3416
|
elementRef,
|
|
3419
3417
|
props,
|
|
3420
3418
|
state
|
|
3421
3419
|
]));
|
|
3422
|
-
qwik.
|
|
3423
|
-
|
|
3424
|
-
var _a, _b;
|
|
3425
|
-
const [elementRef2, props2] = qwik.useLexicalScope();
|
|
3426
|
-
if (!props2.apiKey)
|
|
3427
|
-
logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
3420
|
+
qwik.useOn("qvisible", /* @__PURE__ */ qwik.inlinedQrl((event, element) => {
|
|
3421
|
+
var _a2, _b2, _c2, _d;
|
|
3428
3422
|
if (isBrowser()) {
|
|
3429
|
-
if (isEditing() &&
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
const
|
|
3423
|
+
if (isEditing() && element)
|
|
3424
|
+
element.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
3425
|
+
const shouldTrackImpression = ((_a2 = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a2.value) === "true";
|
|
3426
|
+
if (shouldTrackImpression) {
|
|
3427
|
+
const variationId = (_b2 = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b2.value;
|
|
3428
|
+
const contentId = (_c2 = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c2.value;
|
|
3429
|
+
const apiKeyProp = (_d = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d.value;
|
|
3434
3430
|
_track({
|
|
3435
3431
|
type: "impression",
|
|
3436
|
-
canTrack:
|
|
3432
|
+
canTrack: true,
|
|
3437
3433
|
contentId,
|
|
3438
|
-
apiKey:
|
|
3434
|
+
apiKey: apiKeyProp,
|
|
3439
3435
|
variationId: variationId !== contentId ? variationId : void 0
|
|
3440
3436
|
});
|
|
3441
3437
|
}
|
|
3442
|
-
if (isPreviewing() &&
|
|
3443
|
-
|
|
3438
|
+
if (isPreviewing() && element)
|
|
3439
|
+
element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
3444
3440
|
}
|
|
3445
|
-
}, "
|
|
3441
|
+
}, "EnableEditor_component_useOn_2_FyR0YPSlJlw"));
|
|
3442
|
+
qwik.useContextProvider(builderContext, props.builderContextSignal);
|
|
3443
|
+
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
3444
|
+
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3445
|
+
if (!props2.apiKey)
|
|
3446
|
+
logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
3447
|
+
evaluateJsCode(props2);
|
|
3448
|
+
runHttpRequests(props2, state2, elementRef2);
|
|
3449
|
+
emitStateUpdate(props2);
|
|
3450
|
+
}, "EnableEditor_component_useTask_Nb2VI04qp0M", [
|
|
3446
3451
|
elementRef,
|
|
3447
|
-
props
|
|
3452
|
+
props,
|
|
3453
|
+
state
|
|
3448
3454
|
]));
|
|
3449
3455
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3450
3456
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3451
3457
|
track2(() => props2.content);
|
|
3452
3458
|
if (props2.content)
|
|
3453
3459
|
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3454
|
-
}, "
|
|
3460
|
+
}, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
|
|
3455
3461
|
elementRef,
|
|
3456
3462
|
props,
|
|
3457
3463
|
state
|
|
@@ -3459,18 +3465,18 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
3459
3465
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3460
3466
|
const [state2] = qwik.useLexicalScope();
|
|
3461
3467
|
track2(() => state2.shouldSendResetCookie);
|
|
3462
|
-
}, "
|
|
3468
|
+
}, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
|
|
3463
3469
|
state
|
|
3464
3470
|
]));
|
|
3465
3471
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3466
3472
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3467
3473
|
track2(() => {
|
|
3468
|
-
var
|
|
3469
|
-
return (
|
|
3474
|
+
var _a2, _b2;
|
|
3475
|
+
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
3470
3476
|
});
|
|
3471
3477
|
track2(() => props2.builderContextSignal.rootState);
|
|
3472
3478
|
evaluateJsCode(props2);
|
|
3473
|
-
}, "
|
|
3479
|
+
}, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
|
|
3474
3480
|
elementRef,
|
|
3475
3481
|
props,
|
|
3476
3482
|
state
|
|
@@ -3478,11 +3484,11 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
3478
3484
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3479
3485
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3480
3486
|
track2(() => {
|
|
3481
|
-
var
|
|
3482
|
-
return (
|
|
3487
|
+
var _a2, _b2;
|
|
3488
|
+
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
3483
3489
|
});
|
|
3484
3490
|
runHttpRequests(props2, state2, elementRef2);
|
|
3485
|
-
}, "
|
|
3491
|
+
}, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
|
|
3486
3492
|
elementRef,
|
|
3487
3493
|
props,
|
|
3488
3494
|
state
|
|
@@ -3491,41 +3497,35 @@ const EnableEditor = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
3491
3497
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3492
3498
|
track2(() => props2.builderContextSignal.rootState);
|
|
3493
3499
|
emitStateUpdate(props2);
|
|
3494
|
-
}, "
|
|
3500
|
+
}, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
|
|
3495
3501
|
elementRef,
|
|
3496
3502
|
props,
|
|
3497
3503
|
state
|
|
3498
3504
|
]));
|
|
3499
3505
|
return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
3500
|
-
children: props.builderContextSignal.content ? /* @__PURE__ */ qwik.
|
|
3506
|
+
children: props.builderContextSignal.content ? /* @__PURE__ */ qwik.createElement("div", {
|
|
3507
|
+
apiKey: props.apiKey,
|
|
3508
|
+
contentId: (_a = props.builderContextSignal.content) == null ? void 0 : _a.id,
|
|
3509
|
+
variationId: (_b = props.builderContextSignal.content) == null ? void 0 : _b.testVariationId,
|
|
3510
|
+
shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
|
|
3511
|
+
key: state.forceReRenderCount,
|
|
3501
3512
|
ref: elementRef,
|
|
3502
|
-
...props.showContent ? {} : {
|
|
3503
|
-
hidden: true,
|
|
3504
|
-
"aria-hidden": true
|
|
3505
|
-
},
|
|
3506
|
-
children: /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "06_0"),
|
|
3507
3513
|
onClick$: /* @__PURE__ */ qwik.inlinedQrl((event) => {
|
|
3508
3514
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3509
3515
|
return onClick(props2, state2, elementRef2, event);
|
|
3510
|
-
}, "
|
|
3516
|
+
}, "EnableEditor_component__Fragment__createElement_PT7eU9x80Lw", [
|
|
3511
3517
|
elementRef,
|
|
3512
3518
|
props,
|
|
3513
3519
|
state
|
|
3514
|
-
])
|
|
3515
|
-
|
|
3516
|
-
"builder-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
props
|
|
3524
|
-
], "p0.model"),
|
|
3525
|
-
class: qwik._fnSignal((p0) => p0.classNameProp, [
|
|
3526
|
-
props
|
|
3527
|
-
], "p0.classNameProp")
|
|
3528
|
-
}, 0, state.forceReRenderCount) : null
|
|
3520
|
+
]),
|
|
3521
|
+
"builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
|
|
3522
|
+
"builder-model": props.model,
|
|
3523
|
+
...props.showContent ? {} : {
|
|
3524
|
+
hidden: true,
|
|
3525
|
+
"aria-hidden": true
|
|
3526
|
+
},
|
|
3527
|
+
class: props.classNameProp
|
|
3528
|
+
}, /* @__PURE__ */ qwik._jsxC(qwik.Slot, null, 3, "06_0")) : null
|
|
3529
3529
|
}, 1, "06_1");
|
|
3530
3530
|
}, "EnableEditor_component_ko1mO8oaj8k"));
|
|
3531
3531
|
const getCssFromFont = (font) => {
|
|
@@ -2813,7 +2813,8 @@ const getBuilderSearchParamsFromWindow = () => {
|
|
|
2813
2813
|
const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams ? convertSearchParamsToQueryObject(searchParams) : searchParams;
|
|
2814
2814
|
const DEFAULT_API_VERSION = "v3";
|
|
2815
2815
|
const generateContentUrl = (options) => {
|
|
2816
|
-
|
|
2816
|
+
let { noTraverse = false } = options;
|
|
2817
|
+
const { limit = 30, userAttributes, query, model, apiKey, includeRefs = true, enrich, locale, apiVersion = DEFAULT_API_VERSION } = options;
|
|
2817
2818
|
if (!apiKey)
|
|
2818
2819
|
throw new Error("Missing API key");
|
|
2819
2820
|
if (![
|
|
@@ -2821,6 +2822,8 @@ const generateContentUrl = (options) => {
|
|
|
2821
2822
|
"v3"
|
|
2822
2823
|
].includes(apiVersion))
|
|
2823
2824
|
throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${apiVersion}'`);
|
|
2825
|
+
if ((options.limit === void 0 || options.limit > 1) && !("noTraverse" in options))
|
|
2826
|
+
noTraverse = true;
|
|
2824
2827
|
const url = new URL(`https://cdn.builder.io/api/${apiVersion}/content/${model}?apiKey=${apiKey}&limit=${limit}&noTraverse=${noTraverse}&includeRefs=${includeRefs}${locale ? `&locale=${locale}` : ""}${enrich ? `&enrich=${enrich}` : ""}`);
|
|
2825
2828
|
const queryOptions = {
|
|
2826
2829
|
...getBuilderSearchParamsFromWindow(),
|
|
@@ -3095,7 +3098,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
3095
3098
|
}
|
|
3096
3099
|
};
|
|
3097
3100
|
};
|
|
3098
|
-
const SDK_VERSION = "0.
|
|
3101
|
+
const SDK_VERSION = "0.7.1-0";
|
|
3099
3102
|
const registry = {};
|
|
3100
3103
|
function register(type, info) {
|
|
3101
3104
|
let typeList = registry[type];
|
|
@@ -3352,44 +3355,8 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3352
3355
|
}
|
|
3353
3356
|
}));
|
|
3354
3357
|
};
|
|
3355
|
-
const initEditing = function initEditing2(props, state, elementRef, _event) {
|
|
3356
|
-
state.forceReRenderCount = state.forceReRenderCount + 1;
|
|
3357
|
-
window.addEventListener("message", processMessage.bind(null, props, state, elementRef));
|
|
3358
|
-
registerInsertMenu();
|
|
3359
|
-
setupBrowserForEditing({
|
|
3360
|
-
...props.locale ? {
|
|
3361
|
-
locale: props.locale
|
|
3362
|
-
} : {},
|
|
3363
|
-
...props.includeRefs ? {
|
|
3364
|
-
includeRefs: props.includeRefs
|
|
3365
|
-
} : {},
|
|
3366
|
-
...props.enrich ? {
|
|
3367
|
-
enrich: props.enrich
|
|
3368
|
-
} : {}
|
|
3369
|
-
});
|
|
3370
|
-
Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3371
|
-
var _a;
|
|
3372
|
-
const message = createRegisterComponentMessage(registeredComponent);
|
|
3373
|
-
(_a = window.parent) == null ? void 0 : _a.postMessage(message, "*");
|
|
3374
|
-
});
|
|
3375
|
-
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props, state, elementRef));
|
|
3376
|
-
};
|
|
3377
|
-
const initPreview = function initPreview2(props, state, elementRef, _event) {
|
|
3378
|
-
const searchParams = new URL(location.href).searchParams;
|
|
3379
|
-
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
3380
|
-
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
|
3381
|
-
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
3382
|
-
if (searchParamPreviewModel === props.model && previewApiKey === props.apiKey && (!props.content || searchParamPreviewId === props.content.id))
|
|
3383
|
-
fetchOneEntry({
|
|
3384
|
-
model: props.model,
|
|
3385
|
-
apiKey: props.apiKey,
|
|
3386
|
-
apiVersion: props.builderContextSignal.apiVersion
|
|
3387
|
-
}).then((content) => {
|
|
3388
|
-
if (content)
|
|
3389
|
-
mergeNewContent(props, state, elementRef, content);
|
|
3390
|
-
});
|
|
3391
|
-
};
|
|
3392
3358
|
const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3359
|
+
var _a, _b, _c;
|
|
3393
3360
|
_jsxBranch();
|
|
3394
3361
|
const elementRef = useSignal();
|
|
3395
3362
|
const state = useStore({
|
|
@@ -3401,55 +3368,94 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3401
3368
|
}, {
|
|
3402
3369
|
deep: true
|
|
3403
3370
|
});
|
|
3404
|
-
useOn("
|
|
3371
|
+
useOn("initeditingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
3405
3372
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3406
|
-
|
|
3373
|
+
state2.forceReRenderCount = state2.forceReRenderCount + 1;
|
|
3374
|
+
window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
3375
|
+
registerInsertMenu();
|
|
3376
|
+
setupBrowserForEditing({
|
|
3377
|
+
...props2.locale ? {
|
|
3378
|
+
locale: props2.locale
|
|
3379
|
+
} : {},
|
|
3380
|
+
...props2.includeRefs ? {
|
|
3381
|
+
includeRefs: props2.includeRefs
|
|
3382
|
+
} : {},
|
|
3383
|
+
...props2.enrich ? {
|
|
3384
|
+
enrich: props2.enrich
|
|
3385
|
+
} : {}
|
|
3386
|
+
});
|
|
3387
|
+
Object.values(props2.builderContextSignal.componentInfos).forEach((registeredComponent) => {
|
|
3388
|
+
var _a2;
|
|
3389
|
+
const message = createRegisterComponentMessage(registeredComponent);
|
|
3390
|
+
(_a2 = window.parent) == null ? void 0 : _a2.postMessage(message, "*");
|
|
3391
|
+
});
|
|
3392
|
+
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3407
3393
|
}, "EnableEditor_component_useOn_Qs8c0yql2i0", [
|
|
3408
3394
|
elementRef,
|
|
3409
3395
|
props,
|
|
3410
3396
|
state
|
|
3411
3397
|
]));
|
|
3412
|
-
useOn("
|
|
3398
|
+
useOn("initpreviewingbldr", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
3413
3399
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3414
|
-
|
|
3400
|
+
const searchParams = new URL(location.href).searchParams;
|
|
3401
|
+
const searchParamPreviewModel = searchParams.get("builder.preview");
|
|
3402
|
+
const searchParamPreviewId = searchParams.get(`builder.preview.${searchParamPreviewModel}`);
|
|
3403
|
+
const previewApiKey = searchParams.get("apiKey") || searchParams.get("builder.space");
|
|
3404
|
+
if (searchParamPreviewModel === props2.model && previewApiKey === props2.apiKey && (!props2.content || searchParamPreviewId === props2.content.id))
|
|
3405
|
+
fetchOneEntry({
|
|
3406
|
+
model: props2.model,
|
|
3407
|
+
apiKey: props2.apiKey,
|
|
3408
|
+
apiVersion: props2.builderContextSignal.apiVersion
|
|
3409
|
+
}).then((content) => {
|
|
3410
|
+
if (content)
|
|
3411
|
+
mergeNewContent(props2, state2, elementRef2, content);
|
|
3412
|
+
});
|
|
3415
3413
|
}, "EnableEditor_component_useOn_1_F94YipmknvI", [
|
|
3416
3414
|
elementRef,
|
|
3417
3415
|
props,
|
|
3418
3416
|
state
|
|
3419
3417
|
]));
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
var _a, _b;
|
|
3423
|
-
const [elementRef2, props2] = useLexicalScope();
|
|
3424
|
-
if (!props2.apiKey)
|
|
3425
|
-
logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
3418
|
+
useOn("qvisible", /* @__PURE__ */ inlinedQrl((event, element) => {
|
|
3419
|
+
var _a2, _b2, _c2, _d;
|
|
3426
3420
|
if (isBrowser()) {
|
|
3427
|
-
if (isEditing() &&
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
const
|
|
3421
|
+
if (isEditing() && element)
|
|
3422
|
+
element.dispatchEvent(new CustomEvent("initeditingbldr"));
|
|
3423
|
+
const shouldTrackImpression = ((_a2 = element.attributes.getNamedItem("shouldTrack")) == null ? void 0 : _a2.value) === "true";
|
|
3424
|
+
if (shouldTrackImpression) {
|
|
3425
|
+
const variationId = (_b2 = element.attributes.getNamedItem("variationId")) == null ? void 0 : _b2.value;
|
|
3426
|
+
const contentId = (_c2 = element.attributes.getNamedItem("contentId")) == null ? void 0 : _c2.value;
|
|
3427
|
+
const apiKeyProp = (_d = element.attributes.getNamedItem("apiKey")) == null ? void 0 : _d.value;
|
|
3432
3428
|
_track({
|
|
3433
3429
|
type: "impression",
|
|
3434
|
-
canTrack:
|
|
3430
|
+
canTrack: true,
|
|
3435
3431
|
contentId,
|
|
3436
|
-
apiKey:
|
|
3432
|
+
apiKey: apiKeyProp,
|
|
3437
3433
|
variationId: variationId !== contentId ? variationId : void 0
|
|
3438
3434
|
});
|
|
3439
3435
|
}
|
|
3440
|
-
if (isPreviewing() &&
|
|
3441
|
-
|
|
3436
|
+
if (isPreviewing() && element)
|
|
3437
|
+
element.dispatchEvent(new CustomEvent("initpreviewingbldr"));
|
|
3442
3438
|
}
|
|
3443
|
-
}, "
|
|
3439
|
+
}, "EnableEditor_component_useOn_2_FyR0YPSlJlw"));
|
|
3440
|
+
useContextProvider(builderContext, props.builderContextSignal);
|
|
3441
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3442
|
+
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3443
|
+
if (!props2.apiKey)
|
|
3444
|
+
logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop.");
|
|
3445
|
+
evaluateJsCode(props2);
|
|
3446
|
+
runHttpRequests(props2, state2, elementRef2);
|
|
3447
|
+
emitStateUpdate(props2);
|
|
3448
|
+
}, "EnableEditor_component_useTask_Nb2VI04qp0M", [
|
|
3444
3449
|
elementRef,
|
|
3445
|
-
props
|
|
3450
|
+
props,
|
|
3451
|
+
state
|
|
3446
3452
|
]));
|
|
3447
3453
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3448
3454
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3449
3455
|
track2(() => props2.content);
|
|
3450
3456
|
if (props2.content)
|
|
3451
3457
|
mergeNewContent(props2, state2, elementRef2, props2.content);
|
|
3452
|
-
}, "
|
|
3458
|
+
}, "EnableEditor_component_useTask_1_m0y1Z9vk4eQ", [
|
|
3453
3459
|
elementRef,
|
|
3454
3460
|
props,
|
|
3455
3461
|
state
|
|
@@ -3457,18 +3463,18 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3457
3463
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3458
3464
|
const [state2] = useLexicalScope();
|
|
3459
3465
|
track2(() => state2.shouldSendResetCookie);
|
|
3460
|
-
}, "
|
|
3466
|
+
}, "EnableEditor_component_useTask_2_xVyv0tDqZLs", [
|
|
3461
3467
|
state
|
|
3462
3468
|
]));
|
|
3463
3469
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3464
3470
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3465
3471
|
track2(() => {
|
|
3466
|
-
var
|
|
3467
|
-
return (
|
|
3472
|
+
var _a2, _b2;
|
|
3473
|
+
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.jsCode;
|
|
3468
3474
|
});
|
|
3469
3475
|
track2(() => props2.builderContextSignal.rootState);
|
|
3470
3476
|
evaluateJsCode(props2);
|
|
3471
|
-
}, "
|
|
3477
|
+
}, "EnableEditor_component_useTask_3_bQ0e5LHZwWE", [
|
|
3472
3478
|
elementRef,
|
|
3473
3479
|
props,
|
|
3474
3480
|
state
|
|
@@ -3476,11 +3482,11 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3476
3482
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3477
3483
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3478
3484
|
track2(() => {
|
|
3479
|
-
var
|
|
3480
|
-
return (
|
|
3485
|
+
var _a2, _b2;
|
|
3486
|
+
return (_b2 = (_a2 = props2.builderContextSignal.content) == null ? void 0 : _a2.data) == null ? void 0 : _b2.httpRequests;
|
|
3481
3487
|
});
|
|
3482
3488
|
runHttpRequests(props2, state2, elementRef2);
|
|
3483
|
-
}, "
|
|
3489
|
+
}, "EnableEditor_component_useTask_4_moHYZG8uNVU", [
|
|
3484
3490
|
elementRef,
|
|
3485
3491
|
props,
|
|
3486
3492
|
state
|
|
@@ -3489,41 +3495,35 @@ const EnableEditor = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
3489
3495
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3490
3496
|
track2(() => props2.builderContextSignal.rootState);
|
|
3491
3497
|
emitStateUpdate(props2);
|
|
3492
|
-
}, "
|
|
3498
|
+
}, "EnableEditor_component_useTask_5_24QxS0r0KF8", [
|
|
3493
3499
|
elementRef,
|
|
3494
3500
|
props,
|
|
3495
3501
|
state
|
|
3496
3502
|
]));
|
|
3497
3503
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3498
|
-
children: props.builderContextSignal.content ? /* @__PURE__ */
|
|
3504
|
+
children: props.builderContextSignal.content ? /* @__PURE__ */ createElement("div", {
|
|
3505
|
+
apiKey: props.apiKey,
|
|
3506
|
+
contentId: (_a = props.builderContextSignal.content) == null ? void 0 : _a.id,
|
|
3507
|
+
variationId: (_b = props.builderContextSignal.content) == null ? void 0 : _b.testVariationId,
|
|
3508
|
+
shouldTrack: String(props.builderContextSignal.content && getDefaultCanTrack(props.canTrack)),
|
|
3509
|
+
key: state.forceReRenderCount,
|
|
3499
3510
|
ref: elementRef,
|
|
3500
|
-
...props.showContent ? {} : {
|
|
3501
|
-
hidden: true,
|
|
3502
|
-
"aria-hidden": true
|
|
3503
|
-
},
|
|
3504
|
-
children: /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0"),
|
|
3505
3511
|
onClick$: /* @__PURE__ */ inlinedQrl((event) => {
|
|
3506
3512
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3507
3513
|
return onClick(props2, state2, elementRef2, event);
|
|
3508
|
-
}, "
|
|
3514
|
+
}, "EnableEditor_component__Fragment__createElement_PT7eU9x80Lw", [
|
|
3509
3515
|
elementRef,
|
|
3510
3516
|
props,
|
|
3511
3517
|
state
|
|
3512
|
-
])
|
|
3513
|
-
|
|
3514
|
-
"builder-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
props
|
|
3522
|
-
], "p0.model"),
|
|
3523
|
-
class: _fnSignal((p0) => p0.classNameProp, [
|
|
3524
|
-
props
|
|
3525
|
-
], "p0.classNameProp")
|
|
3526
|
-
}, 0, state.forceReRenderCount) : null
|
|
3518
|
+
]),
|
|
3519
|
+
"builder-content-id": (_c = props.builderContextSignal.content) == null ? void 0 : _c.id,
|
|
3520
|
+
"builder-model": props.model,
|
|
3521
|
+
...props.showContent ? {} : {
|
|
3522
|
+
hidden: true,
|
|
3523
|
+
"aria-hidden": true
|
|
3524
|
+
},
|
|
3525
|
+
class: props.classNameProp
|
|
3526
|
+
}, /* @__PURE__ */ _jsxC(Slot, null, 3, "06_0")) : null
|
|
3527
3527
|
}, 1, "06_1");
|
|
3528
3528
|
}, "EnableEditor_component_ko1mO8oaj8k"));
|
|
3529
3529
|
const getCssFromFont = (font) => {
|