@builder.io/sdk-qwik 0.4.0 → 0.4.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/index.qwik.cjs +106 -124
- package/lib/index.qwik.mjs +107 -125
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-builder-search-params/index.d.ts +6 -0
- package/types/index.d.ts +1 -0
package/lib/index.qwik.cjs
CHANGED
|
@@ -456,38 +456,32 @@ const RenderComponent = (props) => {
|
|
|
456
456
|
}, 1, "R9_1");
|
|
457
457
|
};
|
|
458
458
|
const RenderRepeatedBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
rootSetState: props.repeatContext.rootSetState,
|
|
464
|
-
context: props.repeatContext.context,
|
|
465
|
-
apiKey: props.repeatContext.apiKey,
|
|
466
|
-
registeredComponents: props.repeatContext.registeredComponents,
|
|
467
|
-
inheritedStyles: props.repeatContext.inheritedStyles,
|
|
468
|
-
apiVersion: props.repeatContext.apiVersion
|
|
469
|
-
}));
|
|
459
|
+
const state = qwik.useStore({
|
|
460
|
+
store: props.repeatContext
|
|
461
|
+
});
|
|
462
|
+
qwik.useContextProvider(BuilderContext, state.store);
|
|
470
463
|
return /* @__PURE__ */ qwik._jsxC(RenderBlock, {
|
|
471
464
|
get block() {
|
|
472
465
|
return props.block;
|
|
473
466
|
},
|
|
474
467
|
get context() {
|
|
475
|
-
return
|
|
468
|
+
return state.store;
|
|
476
469
|
},
|
|
477
470
|
[qwik._IMMUTABLE]: {
|
|
478
471
|
block: qwik._fnSignal((p0) => p0.block, [
|
|
479
472
|
props
|
|
480
473
|
], "p0.block"),
|
|
481
|
-
context: qwik._fnSignal((p0) => p0.
|
|
482
|
-
|
|
483
|
-
], "p0.
|
|
474
|
+
context: qwik._fnSignal((p0) => p0.store, [
|
|
475
|
+
state
|
|
476
|
+
], "p0.store")
|
|
484
477
|
}
|
|
485
478
|
}, 3, "K5_0");
|
|
486
479
|
}, "RenderRepeatedBlock_component_nRyVBtbGKc8"));
|
|
487
480
|
const RenderBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlinedQrl((props) => {
|
|
488
481
|
qwik._jsxBranch();
|
|
489
482
|
const state = qwik.useStore({
|
|
490
|
-
Tag: props.block.tagName || "div"
|
|
483
|
+
Tag: props.block.tagName || "div",
|
|
484
|
+
childrenContext: props.context
|
|
491
485
|
});
|
|
492
486
|
const component = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
493
487
|
const [props2] = qwik.useLexicalScope();
|
|
@@ -564,29 +558,8 @@ const RenderBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
|
|
|
564
558
|
repeatItem,
|
|
565
559
|
useBlock
|
|
566
560
|
]));
|
|
567
|
-
const childrenContext = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
568
|
-
const [attributes2, props2, useBlock2] = qwik.useLexicalScope();
|
|
569
|
-
const getInheritedTextStyles = () => {
|
|
570
|
-
return {};
|
|
571
|
-
};
|
|
572
|
-
return {
|
|
573
|
-
apiKey: props2.context.apiKey,
|
|
574
|
-
apiVersion: props2.context.apiVersion,
|
|
575
|
-
localState: props2.context.localState,
|
|
576
|
-
rootState: props2.context.rootState,
|
|
577
|
-
rootSetState: props2.context.rootSetState,
|
|
578
|
-
content: props2.context.content,
|
|
579
|
-
context: props2.context.context,
|
|
580
|
-
registeredComponents: props2.context.registeredComponents,
|
|
581
|
-
inheritedStyles: getInheritedTextStyles()
|
|
582
|
-
};
|
|
583
|
-
}, "RenderBlock_component_childrenContext_useComputed_gskFnyBnHDI", [
|
|
584
|
-
attributes,
|
|
585
|
-
props,
|
|
586
|
-
useBlock
|
|
587
|
-
]));
|
|
588
561
|
const renderComponentProps = qwik.useComputedQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
589
|
-
const [actions2, attributes2,
|
|
562
|
+
const [actions2, attributes2, component2, state2, useBlock2] = qwik.useLexicalScope();
|
|
590
563
|
return {
|
|
591
564
|
blockChildren: useBlock2.value.children ?? [],
|
|
592
565
|
componentRef: component2.value?.component,
|
|
@@ -599,13 +572,13 @@ const RenderBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
|
|
|
599
572
|
}
|
|
600
573
|
}
|
|
601
574
|
},
|
|
602
|
-
context:
|
|
575
|
+
context: state2.childrenContext
|
|
603
576
|
};
|
|
604
577
|
}, "RenderBlock_component_renderComponentProps_useComputed_tWa1cp0r7XY", [
|
|
605
578
|
actions,
|
|
606
579
|
attributes,
|
|
607
|
-
childrenContext,
|
|
608
580
|
component,
|
|
581
|
+
state,
|
|
609
582
|
useBlock
|
|
610
583
|
]));
|
|
611
584
|
return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
@@ -640,12 +613,12 @@ const RenderBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
|
|
|
640
613
|
return /* @__PURE__ */ qwik._jsxC(RenderBlock, {
|
|
641
614
|
block: child,
|
|
642
615
|
get context() {
|
|
643
|
-
return childrenContext
|
|
616
|
+
return state.childrenContext;
|
|
644
617
|
},
|
|
645
618
|
[qwik._IMMUTABLE]: {
|
|
646
|
-
context: qwik._fnSignal((p0) => p0.
|
|
647
|
-
|
|
648
|
-
], "p0.
|
|
619
|
+
context: qwik._fnSignal((p0) => p0.childrenContext, [
|
|
620
|
+
state
|
|
621
|
+
], "p0.childrenContext")
|
|
649
622
|
}
|
|
650
623
|
}, 3, "render-block-" + child.id);
|
|
651
624
|
}),
|
|
@@ -653,12 +626,12 @@ const RenderBlock = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inlin
|
|
|
653
626
|
return /* @__PURE__ */ qwik._jsxC(BlockStyles, {
|
|
654
627
|
block: child,
|
|
655
628
|
get context() {
|
|
656
|
-
return childrenContext
|
|
629
|
+
return state.childrenContext;
|
|
657
630
|
},
|
|
658
631
|
[qwik._IMMUTABLE]: {
|
|
659
|
-
context: qwik._fnSignal((p0) => p0.
|
|
660
|
-
|
|
661
|
-
], "p0.
|
|
632
|
+
context: qwik._fnSignal((p0) => p0.childrenContext, [
|
|
633
|
+
state
|
|
634
|
+
], "p0.childrenContext")
|
|
662
635
|
}
|
|
663
636
|
}, 3, "block-style-" + child.id);
|
|
664
637
|
})
|
|
@@ -716,6 +689,14 @@ const RenderBlocks = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inli
|
|
|
716
689
|
builderContext,
|
|
717
690
|
props,
|
|
718
691
|
state
|
|
692
|
+
]),
|
|
693
|
+
onKeyPress$: /* @__PURE__ */ qwik.inlinedQrl((event) => {
|
|
694
|
+
const [builderContext2, props2, state2] = qwik.useLexicalScope();
|
|
695
|
+
return onClick$1(props2);
|
|
696
|
+
}, "RenderBlocks_component_div_onKeyPress_N5bJZwtuEmI", [
|
|
697
|
+
builderContext,
|
|
698
|
+
props,
|
|
699
|
+
state
|
|
719
700
|
])
|
|
720
701
|
}, {
|
|
721
702
|
class: qwik._fnSignal((p0) => p0.value + " div-RenderBlocks", [
|
|
@@ -1950,7 +1931,9 @@ const componentInfo$1 = {
|
|
|
1950
1931
|
"jpeg",
|
|
1951
1932
|
"jpg",
|
|
1952
1933
|
"png",
|
|
1953
|
-
"svg"
|
|
1934
|
+
"svg",
|
|
1935
|
+
"gif",
|
|
1936
|
+
"webp"
|
|
1954
1937
|
],
|
|
1955
1938
|
required: true
|
|
1956
1939
|
}
|
|
@@ -2671,7 +2654,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
2671
2654
|
}
|
|
2672
2655
|
};
|
|
2673
2656
|
};
|
|
2674
|
-
const SDK_VERSION = "0.4.
|
|
2657
|
+
const SDK_VERSION = "0.4.2";
|
|
2675
2658
|
const registry = {};
|
|
2676
2659
|
function register(type, info) {
|
|
2677
2660
|
let typeList = registry[type];
|
|
@@ -3028,31 +3011,31 @@ const getContentInitialValue = ({ content, data }) => {
|
|
|
3028
3011
|
};
|
|
3029
3012
|
};
|
|
3030
3013
|
const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
|
|
3031
|
-
state.
|
|
3032
|
-
...state.
|
|
3014
|
+
state.builderContextSignal.content = {
|
|
3015
|
+
...state.builderContextSignal.content,
|
|
3033
3016
|
...newContent,
|
|
3034
3017
|
data: {
|
|
3035
|
-
...state.
|
|
3018
|
+
...state.builderContextSignal.content?.data,
|
|
3036
3019
|
...newContent?.data
|
|
3037
3020
|
},
|
|
3038
3021
|
meta: {
|
|
3039
|
-
...state.
|
|
3022
|
+
...state.builderContextSignal.content?.meta,
|
|
3040
3023
|
...newContent?.meta,
|
|
3041
|
-
breakpoints: newContent?.meta?.breakpoints || state.
|
|
3024
|
+
breakpoints: newContent?.meta?.breakpoints || state.builderContextSignal.content?.meta?.breakpoints
|
|
3042
3025
|
}
|
|
3043
3026
|
};
|
|
3044
3027
|
};
|
|
3045
3028
|
const setBreakpoints = function setBreakpoints2(props, state, elementRef, breakpoints) {
|
|
3046
|
-
state.
|
|
3047
|
-
...state.
|
|
3029
|
+
state.builderContextSignal.content = {
|
|
3030
|
+
...state.builderContextSignal.content,
|
|
3048
3031
|
meta: {
|
|
3049
|
-
...state.
|
|
3032
|
+
...state.builderContextSignal.content?.meta,
|
|
3050
3033
|
breakpoints
|
|
3051
3034
|
}
|
|
3052
3035
|
};
|
|
3053
3036
|
};
|
|
3054
3037
|
const contentSetState = function contentSetState2(props, state, elementRef, newRootState) {
|
|
3055
|
-
state.
|
|
3038
|
+
state.builderContextSignal.rootState = newRootState;
|
|
3056
3039
|
};
|
|
3057
3040
|
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
3058
3041
|
const { data } = event;
|
|
@@ -3061,7 +3044,7 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3061
3044
|
case "builder.configureSdk": {
|
|
3062
3045
|
const messageContent = data.data;
|
|
3063
3046
|
const { breakpoints, contentId } = messageContent;
|
|
3064
|
-
if (!contentId || contentId !== state.
|
|
3047
|
+
if (!contentId || contentId !== state.builderContextSignal.content?.id)
|
|
3065
3048
|
return;
|
|
3066
3049
|
if (breakpoints)
|
|
3067
3050
|
setBreakpoints(props, state, elementRef, breakpoints);
|
|
@@ -3081,20 +3064,20 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3081
3064
|
}
|
|
3082
3065
|
};
|
|
3083
3066
|
const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
3084
|
-
const jsCode = state.
|
|
3067
|
+
const jsCode = state.builderContextSignal.content?.data?.jsCode;
|
|
3085
3068
|
if (jsCode)
|
|
3086
3069
|
evaluate({
|
|
3087
3070
|
code: jsCode,
|
|
3088
3071
|
context: props.context || {},
|
|
3089
3072
|
localState: void 0,
|
|
3090
|
-
rootState: state.
|
|
3073
|
+
rootState: state.builderContextSignal.rootState,
|
|
3091
3074
|
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3092
3075
|
});
|
|
3093
3076
|
};
|
|
3094
3077
|
const onClick = function onClick22(props, state, elementRef, event) {
|
|
3095
|
-
if (state.
|
|
3096
|
-
const variationId = state.
|
|
3097
|
-
const contentId = state.
|
|
3078
|
+
if (state.builderContextSignal.content) {
|
|
3079
|
+
const variationId = state.builderContextSignal.content?.testVariationId;
|
|
3080
|
+
const contentId = state.builderContextSignal.content?.id;
|
|
3098
3081
|
_track({
|
|
3099
3082
|
type: "click",
|
|
3100
3083
|
canTrack: state.canTrackToUse,
|
|
@@ -3113,14 +3096,14 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
|
|
|
3113
3096
|
code: group,
|
|
3114
3097
|
context: props.context || {},
|
|
3115
3098
|
localState: void 0,
|
|
3116
|
-
rootState: state.
|
|
3099
|
+
rootState: state.builderContextSignal.rootState,
|
|
3117
3100
|
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3118
3101
|
}));
|
|
3119
3102
|
};
|
|
3120
3103
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
3121
3104
|
fetch$1(url).then((response) => response.json()).then((json) => {
|
|
3122
3105
|
const newState = {
|
|
3123
|
-
...state.
|
|
3106
|
+
...state.builderContextSignal.rootState,
|
|
3124
3107
|
[key]: json
|
|
3125
3108
|
};
|
|
3126
3109
|
contentSetState(props, state, elementRef, newState);
|
|
@@ -3129,7 +3112,7 @@ const handleRequest = function handleRequest2(props, state, elementRef, { url, k
|
|
|
3129
3112
|
});
|
|
3130
3113
|
};
|
|
3131
3114
|
const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
|
|
3132
|
-
const requests = state.
|
|
3115
|
+
const requests = state.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
3133
3116
|
Object.entries(requests).forEach(([key, url]) => {
|
|
3134
3117
|
if (url && (!state.httpReqsData[key] || isEditing())) {
|
|
3135
3118
|
const evaluatedUrl = evalExpression(props, state, elementRef, url);
|
|
@@ -3144,7 +3127,7 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3144
3127
|
if (isEditing())
|
|
3145
3128
|
window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
|
|
3146
3129
|
detail: {
|
|
3147
|
-
state: state.
|
|
3130
|
+
state: state.builderContextSignal.rootState,
|
|
3148
3131
|
ref: {
|
|
3149
3132
|
name: props.model
|
|
3150
3133
|
}
|
|
@@ -3155,24 +3138,36 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3155
3138
|
qwik._jsxBranch();
|
|
3156
3139
|
const elementRef = qwik.useSignal();
|
|
3157
3140
|
const state = qwik.useStore({
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3141
|
+
builderContextSignal: {
|
|
3142
|
+
content: getContentInitialValue({
|
|
3143
|
+
content: props.content,
|
|
3144
|
+
data: props.data
|
|
3145
|
+
}),
|
|
3146
|
+
localState: void 0,
|
|
3147
|
+
rootState: getContextStateInitialValue({
|
|
3148
|
+
content: props.content,
|
|
3149
|
+
data: props.data,
|
|
3150
|
+
locale: props.locale
|
|
3151
|
+
}),
|
|
3152
|
+
rootSetState: void 0,
|
|
3153
|
+
context: props.context || {},
|
|
3154
|
+
apiKey: props.apiKey,
|
|
3155
|
+
apiVersion: props.apiVersion,
|
|
3156
|
+
registeredComponents: [
|
|
3157
|
+
...getDefaultRegisteredComponents(),
|
|
3158
|
+
...components,
|
|
3159
|
+
...props.customComponents || []
|
|
3160
|
+
].reduce((acc, { component, ...curr }) => ({
|
|
3161
|
+
...acc,
|
|
3162
|
+
[curr.name]: {
|
|
3163
|
+
component,
|
|
3164
|
+
...curr
|
|
3165
|
+
}
|
|
3166
|
+
}), {}),
|
|
3167
|
+
inheritedStyles: {}
|
|
3168
|
+
},
|
|
3169
3169
|
canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
|
|
3170
3170
|
clicked: false,
|
|
3171
|
-
contentState: getContextStateInitialValue({
|
|
3172
|
-
content: props.content,
|
|
3173
|
-
data: props.data,
|
|
3174
|
-
locale: props.locale
|
|
3175
|
-
}),
|
|
3176
3171
|
forceReRenderCount: 0,
|
|
3177
3172
|
httpReqsData: {},
|
|
3178
3173
|
overrideContent: null,
|
|
@@ -3180,25 +3175,11 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3180
3175
|
contentId: props.content?.id,
|
|
3181
3176
|
parentContentId: props.parentContentId
|
|
3182
3177
|
}),
|
|
3183
|
-
update: 0
|
|
3184
|
-
useContent: getContentInitialValue({
|
|
3185
|
-
content: props.content,
|
|
3186
|
-
data: props.data
|
|
3187
|
-
})
|
|
3178
|
+
update: 0
|
|
3188
3179
|
}, {
|
|
3189
3180
|
deep: true
|
|
3190
3181
|
});
|
|
3191
|
-
qwik.useContextProvider(BuilderContext,
|
|
3192
|
-
content: state.useContent,
|
|
3193
|
-
localState: void 0,
|
|
3194
|
-
rootState: state.contentState,
|
|
3195
|
-
rootSetState: void 0,
|
|
3196
|
-
context: props.context || {},
|
|
3197
|
-
apiKey: props.apiKey,
|
|
3198
|
-
apiVersion: props.apiVersion,
|
|
3199
|
-
registeredComponents: state.allRegisteredComponents,
|
|
3200
|
-
inheritedStyles: {}
|
|
3201
|
-
}));
|
|
3182
|
+
qwik.useContextProvider(BuilderContext, state.builderContextSignal);
|
|
3202
3183
|
qwik.useVisibleTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(() => {
|
|
3203
3184
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3204
3185
|
if (!props2.apiKey)
|
|
@@ -3218,16 +3199,16 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3218
3199
|
enrich: props2.enrich
|
|
3219
3200
|
} : {}
|
|
3220
3201
|
});
|
|
3221
|
-
Object.values(state2.
|
|
3202
|
+
Object.values(state2.builderContextSignal.registeredComponents).forEach((registeredComponent) => {
|
|
3222
3203
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
3223
3204
|
window.parent?.postMessage(message, "*");
|
|
3224
3205
|
});
|
|
3225
3206
|
window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
3226
3207
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3227
3208
|
}
|
|
3228
|
-
if (state2.
|
|
3229
|
-
const variationId = state2.
|
|
3230
|
-
const contentId = state2.
|
|
3209
|
+
if (state2.builderContextSignal.content) {
|
|
3210
|
+
const variationId = state2.builderContextSignal.content?.testVariationId;
|
|
3211
|
+
const contentId = state2.builderContextSignal.content?.id;
|
|
3231
3212
|
_track({
|
|
3232
3213
|
type: "impression",
|
|
3233
3214
|
canTrack: state2.canTrackToUse,
|
|
@@ -3272,8 +3253,8 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3272
3253
|
]));
|
|
3273
3254
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3274
3255
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3275
|
-
track2(() => state2.
|
|
3276
|
-
track2(() => state2.
|
|
3256
|
+
track2(() => state2.builderContextSignal.content?.data?.jsCode);
|
|
3257
|
+
track2(() => state2.builderContextSignal.rootState);
|
|
3277
3258
|
evaluateJsCode(props2, state2, elementRef2);
|
|
3278
3259
|
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3279
3260
|
elementRef,
|
|
@@ -3282,7 +3263,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3282
3263
|
]));
|
|
3283
3264
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3284
3265
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3285
|
-
track2(() => state2.
|
|
3266
|
+
track2(() => state2.builderContextSignal.content?.data?.httpRequests);
|
|
3286
3267
|
runHttpRequests(props2, state2, elementRef2);
|
|
3287
3268
|
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3288
3269
|
elementRef,
|
|
@@ -3291,7 +3272,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3291
3272
|
]));
|
|
3292
3273
|
qwik.useTaskQrl(/* @__PURE__ */ qwik.inlinedQrl(({ track: track2 }) => {
|
|
3293
3274
|
const [elementRef2, props2, state2] = qwik.useLexicalScope();
|
|
3294
|
-
track2(() => state2.
|
|
3275
|
+
track2(() => state2.builderContextSignal.rootState);
|
|
3295
3276
|
emitStateUpdate(props2, state2);
|
|
3296
3277
|
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3297
3278
|
elementRef,
|
|
@@ -3299,7 +3280,7 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3299
3280
|
state
|
|
3300
3281
|
]));
|
|
3301
3282
|
return /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
|
|
3302
|
-
children: state.
|
|
3283
|
+
children: state.builderContextSignal.content ? /* @__PURE__ */ qwik._jsxS("div", {
|
|
3303
3284
|
ref: elementRef,
|
|
3304
3285
|
...{},
|
|
3305
3286
|
...props.hideContent ? {
|
|
@@ -3314,34 +3295,34 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3314
3295
|
}, null, 3, "03_0") : null,
|
|
3315
3296
|
/* @__PURE__ */ qwik._jsxC(RenderContentStyles, {
|
|
3316
3297
|
get contentId() {
|
|
3317
|
-
return state.
|
|
3298
|
+
return state.builderContextSignal.content?.id;
|
|
3318
3299
|
},
|
|
3319
3300
|
get cssCode() {
|
|
3320
|
-
return state.
|
|
3301
|
+
return state.builderContextSignal.content?.data?.cssCode;
|
|
3321
3302
|
},
|
|
3322
3303
|
get customFonts() {
|
|
3323
|
-
return state.
|
|
3304
|
+
return state.builderContextSignal.content?.data?.customFonts;
|
|
3324
3305
|
},
|
|
3325
3306
|
[qwik._IMMUTABLE]: {
|
|
3326
|
-
contentId: qwik._fnSignal((p0) => p0.
|
|
3307
|
+
contentId: qwik._fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3327
3308
|
state
|
|
3328
|
-
], "p0.
|
|
3329
|
-
cssCode: qwik._fnSignal((p0) => p0.
|
|
3309
|
+
], "p0.builderContextSignal.content?.id"),
|
|
3310
|
+
cssCode: qwik._fnSignal((p0) => p0.builderContextSignal.content?.data?.cssCode, [
|
|
3330
3311
|
state
|
|
3331
|
-
], "p0.
|
|
3332
|
-
customFonts: qwik._fnSignal((p0) => p0.
|
|
3312
|
+
], "p0.builderContextSignal.content?.data?.cssCode"),
|
|
3313
|
+
customFonts: qwik._fnSignal((p0) => p0.builderContextSignal.content?.data?.customFonts, [
|
|
3333
3314
|
state
|
|
3334
|
-
], "p0.
|
|
3315
|
+
], "p0.builderContextSignal.content?.data?.customFonts")
|
|
3335
3316
|
}
|
|
3336
3317
|
}, 3, "03_1"),
|
|
3337
3318
|
/* @__PURE__ */ qwik._jsxC(RenderBlocks, {
|
|
3338
3319
|
get blocks() {
|
|
3339
|
-
return state.
|
|
3320
|
+
return state.builderContextSignal.content?.data?.blocks;
|
|
3340
3321
|
},
|
|
3341
3322
|
[qwik._IMMUTABLE]: {
|
|
3342
|
-
blocks: qwik._fnSignal((p0) => p0.
|
|
3323
|
+
blocks: qwik._fnSignal((p0) => p0.builderContextSignal.content?.data?.blocks, [
|
|
3343
3324
|
state
|
|
3344
|
-
], "p0.
|
|
3325
|
+
], "p0.builderContextSignal.content?.data?.blocks")
|
|
3345
3326
|
}
|
|
3346
3327
|
}, 3, state.forceReRenderCount)
|
|
3347
3328
|
],
|
|
@@ -3354,9 +3335,9 @@ const RenderContent = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
3354
3335
|
state
|
|
3355
3336
|
])
|
|
3356
3337
|
}, {
|
|
3357
|
-
"builder-content-id": qwik._fnSignal((p0) => p0.
|
|
3338
|
+
"builder-content-id": qwik._fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3358
3339
|
state
|
|
3359
|
-
], "p0.
|
|
3340
|
+
], "p0.builderContextSignal.content?.id"),
|
|
3360
3341
|
"builder-model": qwik._fnSignal((p0) => p0.model, [
|
|
3361
3342
|
props
|
|
3362
3343
|
], "p0.model"),
|
|
@@ -3655,6 +3636,7 @@ exports.Text = Text;
|
|
|
3655
3636
|
exports.Video = Video;
|
|
3656
3637
|
exports.createRegisterComponentMessage = createRegisterComponentMessage;
|
|
3657
3638
|
exports.getAllContent = getAllContent;
|
|
3639
|
+
exports.getBuilderSearchParams = getBuilderSearchParams;
|
|
3658
3640
|
exports.getContent = getContent;
|
|
3659
3641
|
exports.isEditing = isEditing;
|
|
3660
3642
|
exports.isPreviewing = isPreviewing;
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, _wrapProp,
|
|
1
|
+
import { componentQrl, inlinedQrl, useStylesScopedQrl, _jsxC, _jsxS, _fnSignal, createContextId, _jsxQ, _jsxBranch, useComputedQrl, useLexicalScope, _IMMUTABLE, _wrapProp, useStore, useContextProvider, useContext, Slot, Fragment as Fragment$1, useSignal, useTaskQrl, useVisibleTaskQrl } from "@builder.io/qwik";
|
|
2
2
|
import { Fragment } from "@builder.io/qwik/jsx-runtime";
|
|
3
3
|
const Button = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4
4
|
useStylesScopedQrl(/* @__PURE__ */ inlinedQrl(STYLES$3, "Button_component_useStylesScoped_a1JZ0Q0Q2Oc"));
|
|
@@ -454,38 +454,32 @@ const RenderComponent = (props) => {
|
|
|
454
454
|
}, 1, "R9_1");
|
|
455
455
|
};
|
|
456
456
|
const RenderRepeatedBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
rootSetState: props.repeatContext.rootSetState,
|
|
462
|
-
context: props.repeatContext.context,
|
|
463
|
-
apiKey: props.repeatContext.apiKey,
|
|
464
|
-
registeredComponents: props.repeatContext.registeredComponents,
|
|
465
|
-
inheritedStyles: props.repeatContext.inheritedStyles,
|
|
466
|
-
apiVersion: props.repeatContext.apiVersion
|
|
467
|
-
}));
|
|
457
|
+
const state = useStore({
|
|
458
|
+
store: props.repeatContext
|
|
459
|
+
});
|
|
460
|
+
useContextProvider(BuilderContext, state.store);
|
|
468
461
|
return /* @__PURE__ */ _jsxC(RenderBlock, {
|
|
469
462
|
get block() {
|
|
470
463
|
return props.block;
|
|
471
464
|
},
|
|
472
465
|
get context() {
|
|
473
|
-
return
|
|
466
|
+
return state.store;
|
|
474
467
|
},
|
|
475
468
|
[_IMMUTABLE]: {
|
|
476
469
|
block: _fnSignal((p0) => p0.block, [
|
|
477
470
|
props
|
|
478
471
|
], "p0.block"),
|
|
479
|
-
context: _fnSignal((p0) => p0.
|
|
480
|
-
|
|
481
|
-
], "p0.
|
|
472
|
+
context: _fnSignal((p0) => p0.store, [
|
|
473
|
+
state
|
|
474
|
+
], "p0.store")
|
|
482
475
|
}
|
|
483
476
|
}, 3, "K5_0");
|
|
484
477
|
}, "RenderRepeatedBlock_component_nRyVBtbGKc8"));
|
|
485
478
|
const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
486
479
|
_jsxBranch();
|
|
487
480
|
const state = useStore({
|
|
488
|
-
Tag: props.block.tagName || "div"
|
|
481
|
+
Tag: props.block.tagName || "div",
|
|
482
|
+
childrenContext: props.context
|
|
489
483
|
});
|
|
490
484
|
const component = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
491
485
|
const [props2] = useLexicalScope();
|
|
@@ -562,29 +556,8 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
562
556
|
repeatItem,
|
|
563
557
|
useBlock
|
|
564
558
|
]));
|
|
565
|
-
const childrenContext = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
566
|
-
const [attributes2, props2, useBlock2] = useLexicalScope();
|
|
567
|
-
const getInheritedTextStyles = () => {
|
|
568
|
-
return {};
|
|
569
|
-
};
|
|
570
|
-
return {
|
|
571
|
-
apiKey: props2.context.apiKey,
|
|
572
|
-
apiVersion: props2.context.apiVersion,
|
|
573
|
-
localState: props2.context.localState,
|
|
574
|
-
rootState: props2.context.rootState,
|
|
575
|
-
rootSetState: props2.context.rootSetState,
|
|
576
|
-
content: props2.context.content,
|
|
577
|
-
context: props2.context.context,
|
|
578
|
-
registeredComponents: props2.context.registeredComponents,
|
|
579
|
-
inheritedStyles: getInheritedTextStyles()
|
|
580
|
-
};
|
|
581
|
-
}, "RenderBlock_component_childrenContext_useComputed_gskFnyBnHDI", [
|
|
582
|
-
attributes,
|
|
583
|
-
props,
|
|
584
|
-
useBlock
|
|
585
|
-
]));
|
|
586
559
|
const renderComponentProps = useComputedQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
587
|
-
const [actions2, attributes2,
|
|
560
|
+
const [actions2, attributes2, component2, state2, useBlock2] = useLexicalScope();
|
|
588
561
|
return {
|
|
589
562
|
blockChildren: useBlock2.value.children ?? [],
|
|
590
563
|
componentRef: component2.value?.component,
|
|
@@ -597,13 +570,13 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
597
570
|
}
|
|
598
571
|
}
|
|
599
572
|
},
|
|
600
|
-
context:
|
|
573
|
+
context: state2.childrenContext
|
|
601
574
|
};
|
|
602
575
|
}, "RenderBlock_component_renderComponentProps_useComputed_tWa1cp0r7XY", [
|
|
603
576
|
actions,
|
|
604
577
|
attributes,
|
|
605
|
-
childrenContext,
|
|
606
578
|
component,
|
|
579
|
+
state,
|
|
607
580
|
useBlock
|
|
608
581
|
]));
|
|
609
582
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
@@ -638,12 +611,12 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
638
611
|
return /* @__PURE__ */ _jsxC(RenderBlock, {
|
|
639
612
|
block: child,
|
|
640
613
|
get context() {
|
|
641
|
-
return childrenContext
|
|
614
|
+
return state.childrenContext;
|
|
642
615
|
},
|
|
643
616
|
[_IMMUTABLE]: {
|
|
644
|
-
context: _fnSignal((p0) => p0.
|
|
645
|
-
|
|
646
|
-
], "p0.
|
|
617
|
+
context: _fnSignal((p0) => p0.childrenContext, [
|
|
618
|
+
state
|
|
619
|
+
], "p0.childrenContext")
|
|
647
620
|
}
|
|
648
621
|
}, 3, "render-block-" + child.id);
|
|
649
622
|
}),
|
|
@@ -651,12 +624,12 @@ const RenderBlock = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pro
|
|
|
651
624
|
return /* @__PURE__ */ _jsxC(BlockStyles, {
|
|
652
625
|
block: child,
|
|
653
626
|
get context() {
|
|
654
|
-
return childrenContext
|
|
627
|
+
return state.childrenContext;
|
|
655
628
|
},
|
|
656
629
|
[_IMMUTABLE]: {
|
|
657
|
-
context: _fnSignal((p0) => p0.
|
|
658
|
-
|
|
659
|
-
], "p0.
|
|
630
|
+
context: _fnSignal((p0) => p0.childrenContext, [
|
|
631
|
+
state
|
|
632
|
+
], "p0.childrenContext")
|
|
660
633
|
}
|
|
661
634
|
}, 3, "block-style-" + child.id);
|
|
662
635
|
})
|
|
@@ -714,6 +687,14 @@ const RenderBlocks = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
714
687
|
builderContext,
|
|
715
688
|
props,
|
|
716
689
|
state
|
|
690
|
+
]),
|
|
691
|
+
onKeyPress$: /* @__PURE__ */ inlinedQrl((event) => {
|
|
692
|
+
const [builderContext2, props2, state2] = useLexicalScope();
|
|
693
|
+
return onClick$1(props2);
|
|
694
|
+
}, "RenderBlocks_component_div_onKeyPress_N5bJZwtuEmI", [
|
|
695
|
+
builderContext,
|
|
696
|
+
props,
|
|
697
|
+
state
|
|
717
698
|
])
|
|
718
699
|
}, {
|
|
719
700
|
class: _fnSignal((p0) => p0.value + " div-RenderBlocks", [
|
|
@@ -1948,7 +1929,9 @@ const componentInfo$1 = {
|
|
|
1948
1929
|
"jpeg",
|
|
1949
1930
|
"jpg",
|
|
1950
1931
|
"png",
|
|
1951
|
-
"svg"
|
|
1932
|
+
"svg",
|
|
1933
|
+
"gif",
|
|
1934
|
+
"webp"
|
|
1952
1935
|
],
|
|
1953
1936
|
required: true
|
|
1954
1937
|
}
|
|
@@ -2669,7 +2652,7 @@ const getInteractionPropertiesForEvent = (event) => {
|
|
|
2669
2652
|
}
|
|
2670
2653
|
};
|
|
2671
2654
|
};
|
|
2672
|
-
const SDK_VERSION = "0.4.
|
|
2655
|
+
const SDK_VERSION = "0.4.2";
|
|
2673
2656
|
const registry = {};
|
|
2674
2657
|
function register(type, info) {
|
|
2675
2658
|
let typeList = registry[type];
|
|
@@ -3026,31 +3009,31 @@ const getContentInitialValue = ({ content, data }) => {
|
|
|
3026
3009
|
};
|
|
3027
3010
|
};
|
|
3028
3011
|
const mergeNewContent = function mergeNewContent2(props, state, elementRef, newContent) {
|
|
3029
|
-
state.
|
|
3030
|
-
...state.
|
|
3012
|
+
state.builderContextSignal.content = {
|
|
3013
|
+
...state.builderContextSignal.content,
|
|
3031
3014
|
...newContent,
|
|
3032
3015
|
data: {
|
|
3033
|
-
...state.
|
|
3016
|
+
...state.builderContextSignal.content?.data,
|
|
3034
3017
|
...newContent?.data
|
|
3035
3018
|
},
|
|
3036
3019
|
meta: {
|
|
3037
|
-
...state.
|
|
3020
|
+
...state.builderContextSignal.content?.meta,
|
|
3038
3021
|
...newContent?.meta,
|
|
3039
|
-
breakpoints: newContent?.meta?.breakpoints || state.
|
|
3022
|
+
breakpoints: newContent?.meta?.breakpoints || state.builderContextSignal.content?.meta?.breakpoints
|
|
3040
3023
|
}
|
|
3041
3024
|
};
|
|
3042
3025
|
};
|
|
3043
3026
|
const setBreakpoints = function setBreakpoints2(props, state, elementRef, breakpoints) {
|
|
3044
|
-
state.
|
|
3045
|
-
...state.
|
|
3027
|
+
state.builderContextSignal.content = {
|
|
3028
|
+
...state.builderContextSignal.content,
|
|
3046
3029
|
meta: {
|
|
3047
|
-
...state.
|
|
3030
|
+
...state.builderContextSignal.content?.meta,
|
|
3048
3031
|
breakpoints
|
|
3049
3032
|
}
|
|
3050
3033
|
};
|
|
3051
3034
|
};
|
|
3052
3035
|
const contentSetState = function contentSetState2(props, state, elementRef, newRootState) {
|
|
3053
|
-
state.
|
|
3036
|
+
state.builderContextSignal.rootState = newRootState;
|
|
3054
3037
|
};
|
|
3055
3038
|
const processMessage = function processMessage2(props, state, elementRef, event) {
|
|
3056
3039
|
const { data } = event;
|
|
@@ -3059,7 +3042,7 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3059
3042
|
case "builder.configureSdk": {
|
|
3060
3043
|
const messageContent = data.data;
|
|
3061
3044
|
const { breakpoints, contentId } = messageContent;
|
|
3062
|
-
if (!contentId || contentId !== state.
|
|
3045
|
+
if (!contentId || contentId !== state.builderContextSignal.content?.id)
|
|
3063
3046
|
return;
|
|
3064
3047
|
if (breakpoints)
|
|
3065
3048
|
setBreakpoints(props, state, elementRef, breakpoints);
|
|
@@ -3079,20 +3062,20 @@ const processMessage = function processMessage2(props, state, elementRef, event)
|
|
|
3079
3062
|
}
|
|
3080
3063
|
};
|
|
3081
3064
|
const evaluateJsCode = function evaluateJsCode2(props, state, elementRef) {
|
|
3082
|
-
const jsCode = state.
|
|
3065
|
+
const jsCode = state.builderContextSignal.content?.data?.jsCode;
|
|
3083
3066
|
if (jsCode)
|
|
3084
3067
|
evaluate({
|
|
3085
3068
|
code: jsCode,
|
|
3086
3069
|
context: props.context || {},
|
|
3087
3070
|
localState: void 0,
|
|
3088
|
-
rootState: state.
|
|
3071
|
+
rootState: state.builderContextSignal.rootState,
|
|
3089
3072
|
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3090
3073
|
});
|
|
3091
3074
|
};
|
|
3092
3075
|
const onClick = function onClick22(props, state, elementRef, event) {
|
|
3093
|
-
if (state.
|
|
3094
|
-
const variationId = state.
|
|
3095
|
-
const contentId = state.
|
|
3076
|
+
if (state.builderContextSignal.content) {
|
|
3077
|
+
const variationId = state.builderContextSignal.content?.testVariationId;
|
|
3078
|
+
const contentId = state.builderContextSignal.content?.id;
|
|
3096
3079
|
_track({
|
|
3097
3080
|
type: "click",
|
|
3098
3081
|
canTrack: state.canTrackToUse,
|
|
@@ -3111,14 +3094,14 @@ const evalExpression = function evalExpression2(props, state, elementRef, expres
|
|
|
3111
3094
|
code: group,
|
|
3112
3095
|
context: props.context || {},
|
|
3113
3096
|
localState: void 0,
|
|
3114
|
-
rootState: state.
|
|
3097
|
+
rootState: state.builderContextSignal.rootState,
|
|
3115
3098
|
rootSetState: contentSetState.bind(null, props, state, elementRef)
|
|
3116
3099
|
}));
|
|
3117
3100
|
};
|
|
3118
3101
|
const handleRequest = function handleRequest2(props, state, elementRef, { url, key }) {
|
|
3119
3102
|
fetch$1(url).then((response) => response.json()).then((json) => {
|
|
3120
3103
|
const newState = {
|
|
3121
|
-
...state.
|
|
3104
|
+
...state.builderContextSignal.rootState,
|
|
3122
3105
|
[key]: json
|
|
3123
3106
|
};
|
|
3124
3107
|
contentSetState(props, state, elementRef, newState);
|
|
@@ -3127,7 +3110,7 @@ const handleRequest = function handleRequest2(props, state, elementRef, { url, k
|
|
|
3127
3110
|
});
|
|
3128
3111
|
};
|
|
3129
3112
|
const runHttpRequests = function runHttpRequests2(props, state, elementRef) {
|
|
3130
|
-
const requests = state.
|
|
3113
|
+
const requests = state.builderContextSignal.content?.data?.httpRequests ?? {};
|
|
3131
3114
|
Object.entries(requests).forEach(([key, url]) => {
|
|
3132
3115
|
if (url && (!state.httpReqsData[key] || isEditing())) {
|
|
3133
3116
|
const evaluatedUrl = evalExpression(props, state, elementRef, url);
|
|
@@ -3142,7 +3125,7 @@ const emitStateUpdate = function emitStateUpdate2(props, state, elementRef) {
|
|
|
3142
3125
|
if (isEditing())
|
|
3143
3126
|
window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
|
|
3144
3127
|
detail: {
|
|
3145
|
-
state: state.
|
|
3128
|
+
state: state.builderContextSignal.rootState,
|
|
3146
3129
|
ref: {
|
|
3147
3130
|
name: props.model
|
|
3148
3131
|
}
|
|
@@ -3153,24 +3136,36 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3153
3136
|
_jsxBranch();
|
|
3154
3137
|
const elementRef = useSignal();
|
|
3155
3138
|
const state = useStore({
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3139
|
+
builderContextSignal: {
|
|
3140
|
+
content: getContentInitialValue({
|
|
3141
|
+
content: props.content,
|
|
3142
|
+
data: props.data
|
|
3143
|
+
}),
|
|
3144
|
+
localState: void 0,
|
|
3145
|
+
rootState: getContextStateInitialValue({
|
|
3146
|
+
content: props.content,
|
|
3147
|
+
data: props.data,
|
|
3148
|
+
locale: props.locale
|
|
3149
|
+
}),
|
|
3150
|
+
rootSetState: void 0,
|
|
3151
|
+
context: props.context || {},
|
|
3152
|
+
apiKey: props.apiKey,
|
|
3153
|
+
apiVersion: props.apiVersion,
|
|
3154
|
+
registeredComponents: [
|
|
3155
|
+
...getDefaultRegisteredComponents(),
|
|
3156
|
+
...components,
|
|
3157
|
+
...props.customComponents || []
|
|
3158
|
+
].reduce((acc, { component, ...curr }) => ({
|
|
3159
|
+
...acc,
|
|
3160
|
+
[curr.name]: {
|
|
3161
|
+
component,
|
|
3162
|
+
...curr
|
|
3163
|
+
}
|
|
3164
|
+
}), {}),
|
|
3165
|
+
inheritedStyles: {}
|
|
3166
|
+
},
|
|
3167
3167
|
canTrackToUse: checkIsDefined(props.canTrack) ? props.canTrack : true,
|
|
3168
3168
|
clicked: false,
|
|
3169
|
-
contentState: getContextStateInitialValue({
|
|
3170
|
-
content: props.content,
|
|
3171
|
-
data: props.data,
|
|
3172
|
-
locale: props.locale
|
|
3173
|
-
}),
|
|
3174
3169
|
forceReRenderCount: 0,
|
|
3175
3170
|
httpReqsData: {},
|
|
3176
3171
|
overrideContent: null,
|
|
@@ -3178,25 +3173,11 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3178
3173
|
contentId: props.content?.id,
|
|
3179
3174
|
parentContentId: props.parentContentId
|
|
3180
3175
|
}),
|
|
3181
|
-
update: 0
|
|
3182
|
-
useContent: getContentInitialValue({
|
|
3183
|
-
content: props.content,
|
|
3184
|
-
data: props.data
|
|
3185
|
-
})
|
|
3176
|
+
update: 0
|
|
3186
3177
|
}, {
|
|
3187
3178
|
deep: true
|
|
3188
3179
|
});
|
|
3189
|
-
useContextProvider(BuilderContext,
|
|
3190
|
-
content: state.useContent,
|
|
3191
|
-
localState: void 0,
|
|
3192
|
-
rootState: state.contentState,
|
|
3193
|
-
rootSetState: void 0,
|
|
3194
|
-
context: props.context || {},
|
|
3195
|
-
apiKey: props.apiKey,
|
|
3196
|
-
apiVersion: props.apiVersion,
|
|
3197
|
-
registeredComponents: state.allRegisteredComponents,
|
|
3198
|
-
inheritedStyles: {}
|
|
3199
|
-
}));
|
|
3180
|
+
useContextProvider(BuilderContext, state.builderContextSignal);
|
|
3200
3181
|
useVisibleTaskQrl(/* @__PURE__ */ inlinedQrl(() => {
|
|
3201
3182
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3202
3183
|
if (!props2.apiKey)
|
|
@@ -3216,16 +3197,16 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3216
3197
|
enrich: props2.enrich
|
|
3217
3198
|
} : {}
|
|
3218
3199
|
});
|
|
3219
|
-
Object.values(state2.
|
|
3200
|
+
Object.values(state2.builderContextSignal.registeredComponents).forEach((registeredComponent) => {
|
|
3220
3201
|
const message = createRegisterComponentMessage(registeredComponent);
|
|
3221
3202
|
window.parent?.postMessage(message, "*");
|
|
3222
3203
|
});
|
|
3223
3204
|
window.addEventListener("message", processMessage.bind(null, props2, state2, elementRef2));
|
|
3224
3205
|
window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate.bind(null, props2, state2, elementRef2));
|
|
3225
3206
|
}
|
|
3226
|
-
if (state2.
|
|
3227
|
-
const variationId = state2.
|
|
3228
|
-
const contentId = state2.
|
|
3207
|
+
if (state2.builderContextSignal.content) {
|
|
3208
|
+
const variationId = state2.builderContextSignal.content?.testVariationId;
|
|
3209
|
+
const contentId = state2.builderContextSignal.content?.id;
|
|
3229
3210
|
_track({
|
|
3230
3211
|
type: "impression",
|
|
3231
3212
|
canTrack: state2.canTrackToUse,
|
|
@@ -3270,8 +3251,8 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3270
3251
|
]));
|
|
3271
3252
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3272
3253
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3273
|
-
track2(() => state2.
|
|
3274
|
-
track2(() => state2.
|
|
3254
|
+
track2(() => state2.builderContextSignal.content?.data?.jsCode);
|
|
3255
|
+
track2(() => state2.builderContextSignal.rootState);
|
|
3275
3256
|
evaluateJsCode(props2, state2, elementRef2);
|
|
3276
3257
|
}, "RenderContent_component_useTask_1_X59YMGOetns", [
|
|
3277
3258
|
elementRef,
|
|
@@ -3280,7 +3261,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3280
3261
|
]));
|
|
3281
3262
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3282
3263
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3283
|
-
track2(() => state2.
|
|
3264
|
+
track2(() => state2.builderContextSignal.content?.data?.httpRequests);
|
|
3284
3265
|
runHttpRequests(props2, state2, elementRef2);
|
|
3285
3266
|
}, "RenderContent_component_useTask_2_u3gn3Pj2b2s", [
|
|
3286
3267
|
elementRef,
|
|
@@ -3289,7 +3270,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3289
3270
|
]));
|
|
3290
3271
|
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
3291
3272
|
const [elementRef2, props2, state2] = useLexicalScope();
|
|
3292
|
-
track2(() => state2.
|
|
3273
|
+
track2(() => state2.builderContextSignal.rootState);
|
|
3293
3274
|
emitStateUpdate(props2, state2);
|
|
3294
3275
|
}, "RenderContent_component_useTask_3_xLCHvjhJYRM", [
|
|
3295
3276
|
elementRef,
|
|
@@ -3297,7 +3278,7 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3297
3278
|
state
|
|
3298
3279
|
]));
|
|
3299
3280
|
return /* @__PURE__ */ _jsxC(Fragment, {
|
|
3300
|
-
children: state.
|
|
3281
|
+
children: state.builderContextSignal.content ? /* @__PURE__ */ _jsxS("div", {
|
|
3301
3282
|
ref: elementRef,
|
|
3302
3283
|
...{},
|
|
3303
3284
|
...props.hideContent ? {
|
|
@@ -3312,34 +3293,34 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3312
3293
|
}, null, 3, "03_0") : null,
|
|
3313
3294
|
/* @__PURE__ */ _jsxC(RenderContentStyles, {
|
|
3314
3295
|
get contentId() {
|
|
3315
|
-
return state.
|
|
3296
|
+
return state.builderContextSignal.content?.id;
|
|
3316
3297
|
},
|
|
3317
3298
|
get cssCode() {
|
|
3318
|
-
return state.
|
|
3299
|
+
return state.builderContextSignal.content?.data?.cssCode;
|
|
3319
3300
|
},
|
|
3320
3301
|
get customFonts() {
|
|
3321
|
-
return state.
|
|
3302
|
+
return state.builderContextSignal.content?.data?.customFonts;
|
|
3322
3303
|
},
|
|
3323
3304
|
[_IMMUTABLE]: {
|
|
3324
|
-
contentId: _fnSignal((p0) => p0.
|
|
3305
|
+
contentId: _fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3325
3306
|
state
|
|
3326
|
-
], "p0.
|
|
3327
|
-
cssCode: _fnSignal((p0) => p0.
|
|
3307
|
+
], "p0.builderContextSignal.content?.id"),
|
|
3308
|
+
cssCode: _fnSignal((p0) => p0.builderContextSignal.content?.data?.cssCode, [
|
|
3328
3309
|
state
|
|
3329
|
-
], "p0.
|
|
3330
|
-
customFonts: _fnSignal((p0) => p0.
|
|
3310
|
+
], "p0.builderContextSignal.content?.data?.cssCode"),
|
|
3311
|
+
customFonts: _fnSignal((p0) => p0.builderContextSignal.content?.data?.customFonts, [
|
|
3331
3312
|
state
|
|
3332
|
-
], "p0.
|
|
3313
|
+
], "p0.builderContextSignal.content?.data?.customFonts")
|
|
3333
3314
|
}
|
|
3334
3315
|
}, 3, "03_1"),
|
|
3335
3316
|
/* @__PURE__ */ _jsxC(RenderBlocks, {
|
|
3336
3317
|
get blocks() {
|
|
3337
|
-
return state.
|
|
3318
|
+
return state.builderContextSignal.content?.data?.blocks;
|
|
3338
3319
|
},
|
|
3339
3320
|
[_IMMUTABLE]: {
|
|
3340
|
-
blocks: _fnSignal((p0) => p0.
|
|
3321
|
+
blocks: _fnSignal((p0) => p0.builderContextSignal.content?.data?.blocks, [
|
|
3341
3322
|
state
|
|
3342
|
-
], "p0.
|
|
3323
|
+
], "p0.builderContextSignal.content?.data?.blocks")
|
|
3343
3324
|
}
|
|
3344
3325
|
}, 3, state.forceReRenderCount)
|
|
3345
3326
|
],
|
|
@@ -3352,9 +3333,9 @@ const RenderContent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
3352
3333
|
state
|
|
3353
3334
|
])
|
|
3354
3335
|
}, {
|
|
3355
|
-
"builder-content-id": _fnSignal((p0) => p0.
|
|
3336
|
+
"builder-content-id": _fnSignal((p0) => p0.builderContextSignal.content?.id, [
|
|
3356
3337
|
state
|
|
3357
|
-
], "p0.
|
|
3338
|
+
], "p0.builderContextSignal.content?.id"),
|
|
3358
3339
|
"builder-model": _fnSignal((p0) => p0.model, [
|
|
3359
3340
|
props
|
|
3360
3341
|
], "p0.model"),
|
|
@@ -3654,6 +3635,7 @@ export {
|
|
|
3654
3635
|
Video,
|
|
3655
3636
|
createRegisterComponentMessage,
|
|
3656
3637
|
getAllContent,
|
|
3638
|
+
getBuilderSearchParams,
|
|
3657
3639
|
getContent,
|
|
3658
3640
|
isEditing,
|
|
3659
3641
|
isPreviewing,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.4.
|
|
1
|
+
export declare const SDK_VERSION = "0.4.2";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
type QueryObject = Record<string, string | string[]>;
|
|
2
2
|
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
3
|
+
/**
|
|
4
|
+
* Receives a `URLSearchParams` object or a regular query object, and returns the subset of query params that are
|
|
5
|
+
* relevant to the Builder SDK.
|
|
6
|
+
*
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
3
9
|
export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
|
|
4
10
|
export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
|
|
5
11
|
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
package/types/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type { InsertMenuConfig, InsertMenuItem } from './functions/register.js';
|
|
|
8
8
|
export { setEditorSettings } from './functions/set-editor-settings.js';
|
|
9
9
|
export type { Settings } from './functions/set-editor-settings.js';
|
|
10
10
|
export { getAllContent, getContent, processContentResult, } from './functions/get-content/index.js';
|
|
11
|
+
export { getBuilderSearchParams } from './functions/get-builder-search-params/index.js';
|
|
11
12
|
export { track } from './functions/track/index.js';
|
|
12
13
|
export type { RegisteredComponent } from './context/types';
|
|
13
14
|
export type { ComponentInfo } from './types/components';
|