@builder.io/sdk-qwik 0.14.31 → 0.15.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 +165 -46
- package/lib/browser/index.qwik.mjs +165 -46
- package/lib/edge/index.qwik.cjs +165 -46
- package/lib/edge/index.qwik.mjs +165 -46
- package/lib/node/index.qwik.cjs +165 -46
- package/lib/node/index.qwik.mjs +165 -46
- package/package.json +1 -1
- package/types/src/components/block/block.helpers.d.ts +8 -8
- package/types/src/components/content-variants/inlined-fns.d.ts +1 -1
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/types/components.d.ts +31 -0
package/lib/node/index.qwik.mjs
CHANGED
|
@@ -769,53 +769,56 @@ const getRepeatItemData = ({ block, context }) => {
|
|
|
769
769
|
}));
|
|
770
770
|
return repeatArray;
|
|
771
771
|
};
|
|
772
|
+
const applyDefaults = (shouldReceiveBuilderProps) => {
|
|
773
|
+
return {
|
|
774
|
+
// once we bump to a major version, toggle this to `false`.
|
|
775
|
+
builderBlock: true,
|
|
776
|
+
// once we bump to a major version, toggle this to `false`.
|
|
777
|
+
builderContext: true,
|
|
778
|
+
builderComponents: false,
|
|
779
|
+
builderLinkComponent: false,
|
|
780
|
+
...shouldReceiveBuilderProps
|
|
781
|
+
};
|
|
782
|
+
};
|
|
772
783
|
const provideLinkComponent = (block, linkComponent) => {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
"Builder:Accordion"
|
|
780
|
-
].includes(block.name)) ? {
|
|
784
|
+
if (!block)
|
|
785
|
+
return {};
|
|
786
|
+
const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderLinkComponent;
|
|
787
|
+
if (!shouldReceiveProp)
|
|
788
|
+
return {};
|
|
789
|
+
return {
|
|
781
790
|
builderLinkComponent: linkComponent
|
|
782
|
-
}
|
|
791
|
+
};
|
|
783
792
|
};
|
|
784
793
|
const provideRegisteredComponents = (block, registeredComponents) => {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
].includes(block.name)) ? {
|
|
794
|
+
if (!block)
|
|
795
|
+
return {};
|
|
796
|
+
const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderComponents;
|
|
797
|
+
if (!shouldReceiveProp)
|
|
798
|
+
return {};
|
|
799
|
+
return {
|
|
792
800
|
builderComponents: registeredComponents
|
|
793
|
-
}
|
|
801
|
+
};
|
|
794
802
|
};
|
|
795
803
|
const provideBuilderBlock = (block, builderBlock) => {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
"Image",
|
|
803
|
-
"Video"
|
|
804
|
-
].includes(block.name)) ? {
|
|
804
|
+
if (!block)
|
|
805
|
+
return {};
|
|
806
|
+
const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderBlock;
|
|
807
|
+
if (!shouldReceiveProp)
|
|
808
|
+
return {};
|
|
809
|
+
return {
|
|
805
810
|
builderBlock
|
|
806
|
-
}
|
|
811
|
+
};
|
|
807
812
|
};
|
|
808
813
|
const provideBuilderContext = (block, context) => {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
"Slot"
|
|
816
|
-
].includes(block.name)) ? {
|
|
814
|
+
if (!block)
|
|
815
|
+
return {};
|
|
816
|
+
const shouldReceiveProp = applyDefaults(block.shouldReceiveBuilderProps).builderContext;
|
|
817
|
+
if (!shouldReceiveProp)
|
|
818
|
+
return {};
|
|
819
|
+
return {
|
|
817
820
|
builderContext: context
|
|
818
|
-
}
|
|
821
|
+
};
|
|
819
822
|
};
|
|
820
823
|
const SIZES = {
|
|
821
824
|
small: {
|
|
@@ -2397,7 +2400,13 @@ const componentInfo$i = {
|
|
|
2397
2400
|
options.set("items", []);
|
|
2398
2401
|
}
|
|
2399
2402
|
}
|
|
2400
|
-
]
|
|
2403
|
+
],
|
|
2404
|
+
shouldReceiveBuilderProps: {
|
|
2405
|
+
builderBlock: true,
|
|
2406
|
+
builderContext: true,
|
|
2407
|
+
builderComponents: true,
|
|
2408
|
+
builderLinkComponent: true
|
|
2409
|
+
}
|
|
2401
2410
|
};
|
|
2402
2411
|
const convertOrderNumberToString = (order) => {
|
|
2403
2412
|
return order.toString();
|
|
@@ -2643,7 +2652,13 @@ const componentInfo$h = {
|
|
|
2643
2652
|
}
|
|
2644
2653
|
],
|
|
2645
2654
|
static: true,
|
|
2646
|
-
noWrap: true
|
|
2655
|
+
noWrap: true,
|
|
2656
|
+
shouldReceiveBuilderProps: {
|
|
2657
|
+
builderBlock: false,
|
|
2658
|
+
builderContext: false,
|
|
2659
|
+
builderComponents: false,
|
|
2660
|
+
builderLinkComponent: true
|
|
2661
|
+
}
|
|
2647
2662
|
};
|
|
2648
2663
|
const componentInfo$g = {
|
|
2649
2664
|
// TODO: ways to statically preprocess JSON for references, functions, etc
|
|
@@ -2885,9 +2900,21 @@ const componentInfo$g = {
|
|
|
2885
2900
|
helperText: "When stacking columns for mobile devices, reverse the ordering",
|
|
2886
2901
|
advanced: true
|
|
2887
2902
|
}
|
|
2888
|
-
]
|
|
2903
|
+
],
|
|
2904
|
+
shouldReceiveBuilderProps: {
|
|
2905
|
+
builderBlock: true,
|
|
2906
|
+
builderContext: true,
|
|
2907
|
+
builderComponents: true,
|
|
2908
|
+
builderLinkComponent: true
|
|
2909
|
+
}
|
|
2889
2910
|
};
|
|
2890
2911
|
const componentInfo$f = {
|
|
2912
|
+
shouldReceiveBuilderProps: {
|
|
2913
|
+
builderBlock: false,
|
|
2914
|
+
builderContext: false,
|
|
2915
|
+
builderComponents: false,
|
|
2916
|
+
builderLinkComponent: false
|
|
2917
|
+
},
|
|
2891
2918
|
name: "Fragment",
|
|
2892
2919
|
static: true,
|
|
2893
2920
|
hidden: true,
|
|
@@ -3047,9 +3074,21 @@ const componentInfo$e = {
|
|
|
3047
3074
|
advanced: true,
|
|
3048
3075
|
defaultValue: 0.7041
|
|
3049
3076
|
}
|
|
3050
|
-
]
|
|
3077
|
+
],
|
|
3078
|
+
shouldReceiveBuilderProps: {
|
|
3079
|
+
builderBlock: true,
|
|
3080
|
+
builderContext: false,
|
|
3081
|
+
builderComponents: false,
|
|
3082
|
+
builderLinkComponent: false
|
|
3083
|
+
}
|
|
3051
3084
|
};
|
|
3052
3085
|
const componentInfo$d = {
|
|
3086
|
+
shouldReceiveBuilderProps: {
|
|
3087
|
+
builderBlock: false,
|
|
3088
|
+
builderContext: false,
|
|
3089
|
+
builderComponents: false,
|
|
3090
|
+
builderLinkComponent: false
|
|
3091
|
+
},
|
|
3053
3092
|
name: "Core:Section",
|
|
3054
3093
|
static: true,
|
|
3055
3094
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",
|
|
@@ -3108,7 +3147,13 @@ const componentInfo$c = {
|
|
|
3108
3147
|
required: true,
|
|
3109
3148
|
defaultValue: "children"
|
|
3110
3149
|
}
|
|
3111
|
-
]
|
|
3150
|
+
],
|
|
3151
|
+
shouldReceiveBuilderProps: {
|
|
3152
|
+
builderBlock: false,
|
|
3153
|
+
builderContext: true,
|
|
3154
|
+
builderComponents: false,
|
|
3155
|
+
builderLinkComponent: false
|
|
3156
|
+
}
|
|
3112
3157
|
};
|
|
3113
3158
|
const Slot = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
3114
3159
|
var _a, _b;
|
|
@@ -3187,7 +3232,13 @@ const componentInfo$b = {
|
|
|
3187
3232
|
hideFromUI: true,
|
|
3188
3233
|
type: "boolean"
|
|
3189
3234
|
}
|
|
3190
|
-
]
|
|
3235
|
+
],
|
|
3236
|
+
shouldReceiveBuilderProps: {
|
|
3237
|
+
builderBlock: true,
|
|
3238
|
+
builderContext: true,
|
|
3239
|
+
builderComponents: true,
|
|
3240
|
+
builderLinkComponent: true
|
|
3241
|
+
}
|
|
3191
3242
|
};
|
|
3192
3243
|
const defaultTab = {
|
|
3193
3244
|
"@type": "@builder.io/sdk:Element",
|
|
@@ -3355,7 +3406,13 @@ const componentInfo$a = {
|
|
|
3355
3406
|
}
|
|
3356
3407
|
]
|
|
3357
3408
|
}
|
|
3358
|
-
]
|
|
3409
|
+
],
|
|
3410
|
+
shouldReceiveBuilderProps: {
|
|
3411
|
+
builderBlock: true,
|
|
3412
|
+
builderContext: true,
|
|
3413
|
+
builderComponents: true,
|
|
3414
|
+
builderLinkComponent: true
|
|
3415
|
+
}
|
|
3359
3416
|
};
|
|
3360
3417
|
const activeTabContent = function activeTabContent2(props, state, active) {
|
|
3361
3418
|
return props.tabs && props.tabs[active].content;
|
|
@@ -3468,6 +3525,12 @@ const Tabs = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
3468
3525
|
], 1, "6k_3");
|
|
3469
3526
|
}, "Tabs_component_MhWcxXy0lMY"));
|
|
3470
3527
|
const componentInfo$9 = {
|
|
3528
|
+
shouldReceiveBuilderProps: {
|
|
3529
|
+
builderBlock: false,
|
|
3530
|
+
builderContext: false,
|
|
3531
|
+
builderComponents: false,
|
|
3532
|
+
builderLinkComponent: false
|
|
3533
|
+
},
|
|
3471
3534
|
name: "Text",
|
|
3472
3535
|
static: true,
|
|
3473
3536
|
isRSC: true,
|
|
@@ -3503,6 +3566,12 @@ const Text = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) =>
|
|
|
3503
3566
|
}, null, 3, "yO_0");
|
|
3504
3567
|
}, "Text_component_15p0cKUxgIE"));
|
|
3505
3568
|
const componentInfo$8 = {
|
|
3569
|
+
shouldReceiveBuilderProps: {
|
|
3570
|
+
builderBlock: false,
|
|
3571
|
+
builderContext: false,
|
|
3572
|
+
builderComponents: false,
|
|
3573
|
+
builderLinkComponent: false
|
|
3574
|
+
},
|
|
3506
3575
|
name: "Custom Code",
|
|
3507
3576
|
static: true,
|
|
3508
3577
|
requiredPermissions: [
|
|
@@ -3582,6 +3651,12 @@ const CustomCode = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((prop
|
|
|
3582
3651
|
}, null, 3, "bY_0");
|
|
3583
3652
|
}, "CustomCode_component_uYOSy7w7Zqw"));
|
|
3584
3653
|
const componentInfo$7 = {
|
|
3654
|
+
shouldReceiveBuilderProps: {
|
|
3655
|
+
builderBlock: false,
|
|
3656
|
+
builderContext: false,
|
|
3657
|
+
builderComponents: false,
|
|
3658
|
+
builderLinkComponent: false
|
|
3659
|
+
},
|
|
3585
3660
|
name: "Embed",
|
|
3586
3661
|
static: true,
|
|
3587
3662
|
inputs: [
|
|
@@ -3944,7 +4019,13 @@ const componentInfo$6 = {
|
|
|
3944
4019
|
}
|
|
3945
4020
|
}
|
|
3946
4021
|
}
|
|
3947
|
-
]
|
|
4022
|
+
],
|
|
4023
|
+
shouldReceiveBuilderProps: {
|
|
4024
|
+
builderBlock: true,
|
|
4025
|
+
builderContext: true,
|
|
4026
|
+
builderComponents: true,
|
|
4027
|
+
builderLinkComponent: true
|
|
4028
|
+
}
|
|
3948
4029
|
};
|
|
3949
4030
|
const validEnvList = [
|
|
3950
4031
|
"production",
|
|
@@ -4256,6 +4337,12 @@ const STYLES = `
|
|
|
4256
4337
|
}
|
|
4257
4338
|
`;
|
|
4258
4339
|
const componentInfo$5 = {
|
|
4340
|
+
shouldReceiveBuilderProps: {
|
|
4341
|
+
builderBlock: false,
|
|
4342
|
+
builderContext: false,
|
|
4343
|
+
builderComponents: false,
|
|
4344
|
+
builderLinkComponent: false
|
|
4345
|
+
},
|
|
4259
4346
|
name: "Form:Input",
|
|
4260
4347
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fad6f37889d9e40bbbbc72cdb5875d6ca",
|
|
4261
4348
|
inputs: [
|
|
@@ -4339,6 +4426,12 @@ const FormInputComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQ
|
|
|
4339
4426
|
});
|
|
4340
4427
|
}, "FormInputComponent_component_AUUjdN0ueMs"));
|
|
4341
4428
|
const componentInfo$4 = {
|
|
4429
|
+
shouldReceiveBuilderProps: {
|
|
4430
|
+
builderBlock: false,
|
|
4431
|
+
builderContext: false,
|
|
4432
|
+
builderComponents: false,
|
|
4433
|
+
builderLinkComponent: false
|
|
4434
|
+
},
|
|
4342
4435
|
name: "Form:Select",
|
|
4343
4436
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F83acca093fb24aaf94dee136e9a4b045",
|
|
4344
4437
|
defaultStyles: {
|
|
@@ -4408,6 +4501,12 @@ const SelectComponent = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
4408
4501
|
}));
|
|
4409
4502
|
}, "SelectComponent_component_SPKbsFLikZU"));
|
|
4410
4503
|
const componentInfo$3 = {
|
|
4504
|
+
shouldReceiveBuilderProps: {
|
|
4505
|
+
builderBlock: false,
|
|
4506
|
+
builderContext: false,
|
|
4507
|
+
builderComponents: false,
|
|
4508
|
+
builderLinkComponent: false
|
|
4509
|
+
},
|
|
4411
4510
|
name: "Form:SubmitButton",
|
|
4412
4511
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Fdf2820ffed1f4349a94c40b3221f5b98",
|
|
4413
4512
|
defaultStyles: {
|
|
@@ -4442,6 +4541,12 @@ const SubmitButton = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((pr
|
|
|
4442
4541
|
}, 0, "6z_0");
|
|
4443
4542
|
}, "SubmitButton_component_NXvMBMCDhwc"));
|
|
4444
4543
|
const componentInfo$2 = {
|
|
4544
|
+
shouldReceiveBuilderProps: {
|
|
4545
|
+
builderBlock: false,
|
|
4546
|
+
builderContext: false,
|
|
4547
|
+
builderComponents: false,
|
|
4548
|
+
builderLinkComponent: false
|
|
4549
|
+
},
|
|
4445
4550
|
name: "Form:TextArea",
|
|
4446
4551
|
image: "https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2Ff74a2f3de58c4c3e939204e5b6b8f6c3",
|
|
4447
4552
|
inputs: [
|
|
@@ -4506,6 +4611,12 @@ const Textarea = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props)
|
|
|
4506
4611
|
}, 0, "kE_0");
|
|
4507
4612
|
}, "Textarea_component_o1TcxV139Oc"));
|
|
4508
4613
|
const componentInfo$1 = {
|
|
4614
|
+
shouldReceiveBuilderProps: {
|
|
4615
|
+
builderBlock: false,
|
|
4616
|
+
builderContext: false,
|
|
4617
|
+
builderComponents: false,
|
|
4618
|
+
builderLinkComponent: false
|
|
4619
|
+
},
|
|
4509
4620
|
// friendlyName?
|
|
4510
4621
|
name: "Raw:Img",
|
|
4511
4622
|
hideFromInsertMenu: true,
|
|
@@ -4667,7 +4778,13 @@ const componentInfo = {
|
|
|
4667
4778
|
defaultValue: true,
|
|
4668
4779
|
advanced: true
|
|
4669
4780
|
}
|
|
4670
|
-
]
|
|
4781
|
+
],
|
|
4782
|
+
shouldReceiveBuilderProps: {
|
|
4783
|
+
builderBlock: true,
|
|
4784
|
+
builderContext: false,
|
|
4785
|
+
builderComponents: false,
|
|
4786
|
+
builderLinkComponent: false
|
|
4787
|
+
}
|
|
4671
4788
|
};
|
|
4672
4789
|
const Video = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((props) => {
|
|
4673
4790
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -5314,7 +5431,7 @@ function isFromTrustedHost(trustedHosts, e) {
|
|
|
5314
5431
|
const url = new URL(e.origin), hostname = url.hostname;
|
|
5315
5432
|
return (trustedHosts || DEFAULT_TRUSTED_HOSTS).findIndex((trustedHost) => trustedHost.startsWith("*.") ? hostname.endsWith(trustedHost.slice(1)) : trustedHost === hostname) > -1;
|
|
5316
5433
|
}
|
|
5317
|
-
const SDK_VERSION = "0.
|
|
5434
|
+
const SDK_VERSION = "0.15.0";
|
|
5318
5435
|
const registry = {};
|
|
5319
5436
|
function register(type, info) {
|
|
5320
5437
|
let typeList = registry[type];
|
|
@@ -6253,6 +6370,8 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
|
|
|
6253
6370
|
props,
|
|
6254
6371
|
state
|
|
6255
6372
|
]));
|
|
6373
|
+
useTaskQrl(/* @__PURE__ */ inlinedQrl(({ track: track2 }) => {
|
|
6374
|
+
}, "ContentVariants_component_useTask_lSvynevU008"));
|
|
6256
6375
|
return /* @__PURE__ */ _jsxC(Fragment$1, {
|
|
6257
6376
|
children: [
|
|
6258
6377
|
!props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
|
package/package.json
CHANGED
|
@@ -15,22 +15,22 @@ export declare const getInheritedStyles: ({ block, context }: {
|
|
|
15
15
|
context: BuilderContextInterface;
|
|
16
16
|
}) => Partial<CSSStyleDeclaration>;
|
|
17
17
|
export declare const provideLinkComponent: (block: RegisteredComponent | null | undefined, linkComponent: any) => {
|
|
18
|
-
builderLinkComponent: any;
|
|
19
|
-
} | {
|
|
20
18
|
builderLinkComponent?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
builderLinkComponent: any;
|
|
21
21
|
};
|
|
22
22
|
export declare const provideRegisteredComponents: (block: RegisteredComponent | null | undefined, registeredComponents: RegisteredComponents) => {
|
|
23
|
-
builderComponents: RegisteredComponents;
|
|
24
|
-
} | {
|
|
25
23
|
builderComponents?: undefined;
|
|
24
|
+
} | {
|
|
25
|
+
builderComponents: RegisteredComponents;
|
|
26
26
|
};
|
|
27
27
|
export declare const provideBuilderBlock: (block: RegisteredComponent | null | undefined, builderBlock: BuilderBlock) => {
|
|
28
|
-
builderBlock: BuilderBlock;
|
|
29
|
-
} | {
|
|
30
28
|
builderBlock?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
builderBlock: BuilderBlock;
|
|
31
31
|
};
|
|
32
32
|
export declare const provideBuilderContext: (block: RegisteredComponent | null | undefined, context: BuilderContextInterface) => {
|
|
33
|
-
builderContext: BuilderContextInterface;
|
|
34
|
-
} | {
|
|
35
33
|
builderContext?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
builderContext: BuilderContextInterface;
|
|
36
36
|
};
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
10
|
* For more information on how this works,
|
|
11
|
-
* see our [SSR A/B Test Docs](https://github.com/BuilderIO/builder/tree/main/packages/sdks/
|
|
11
|
+
* see our [SSR A/B Test Docs](https://github.com/BuilderIO/builder/tree/main/packages/sdks/docs/SSR_AB_TEST.md)
|
|
12
12
|
*/
|
|
13
13
|
export declare const UPDATE_COOKIES_AND_STYLES_SCRIPT = "function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {\n function getAndSetVariantId() {\n function setCookie(name, value, days) {\n let expires = '';\n if (days) {\n const date = new Date();\n date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);\n expires = '; expires=' + date.toUTCString();\n }\n document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${contentId}`;\n const variantInCookie = getCookie(cookieName);\n const availableIDs = variants.map(vr => vr.id).concat(contentId);\n if (variantInCookie && availableIDs.includes(variantInCookie)) {\n return variantInCookie;\n }\n let n = 0;\n const random = Math.random();\n for (let i = 0; i < variants.length; i++) {\n const variant = variants[i];\n const testRatio = variant.testRatio;\n n += testRatio;\n if (random < n) {\n setCookie(cookieName, variant.id);\n return variant.id;\n }\n }\n setCookie(cookieName, contentId);\n return contentId;\n }\n const winningVariantId = getAndSetVariantId();\n const styleEl = document.currentScript?.previousElementSibling;\n if (isHydrationTarget) {\n styleEl.remove();\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n } else {\n const newStyleStr = variants.concat({\n id: contentId\n }).filter(variant => variant.id !== winningVariantId).map(value => {\n return `.variant-${value.id} { display: none; }\n `;\n }).join('');\n styleEl.innerHTML = newStyleStr;\n }\n}";
|
|
14
14
|
export declare const UPDATE_VARIANT_VISIBILITY_SCRIPT = "function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {\n if (!navigator.cookieEnabled) {\n return;\n }\n function getCookie(name) {\n const nameEQ = name + '=';\n const ca = document.cookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i];\n while (c.charAt(0) === ' ') c = c.substring(1, c.length);\n if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);\n }\n return null;\n }\n const cookieName = `builder.tests.${defaultContentId}`;\n const winningVariant = getCookie(cookieName);\n const parentDiv = document.currentScript?.parentElement;\n const isDefaultContent = variantContentId === defaultContentId;\n const isWinningVariant = winningVariant === variantContentId;\n if (isWinningVariant && !isDefaultContent) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultContent) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n parentDiv?.remove();\n }\n const thisScriptEl = document.currentScript;\n thisScriptEl?.remove();\n }\n return;\n}";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.
|
|
1
|
+
export declare const SDK_VERSION = "0.15.0";
|
|
@@ -105,6 +105,37 @@ export interface ComponentInfo {
|
|
|
105
105
|
*/
|
|
106
106
|
requiredPermissions?: Array<Permission>;
|
|
107
107
|
hidden?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether or not the component should receive SDK-related props.
|
|
110
|
+
*/
|
|
111
|
+
shouldReceiveBuilderProps?: {
|
|
112
|
+
/**
|
|
113
|
+
* Whether or not the component should receive the `builderBlock` prop, containing the current Builder block being rendered.
|
|
114
|
+
*
|
|
115
|
+
* Defaults to `true`.
|
|
116
|
+
*/
|
|
117
|
+
builderBlock?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Whether or not the component should receive the `builderContext` prop, containing the current context.
|
|
120
|
+
* The Builder Context contains a lot of data relevant to the current `Content` render.
|
|
121
|
+
* You can see more information [here](https://github.com/BuilderIO/builder/blob/main/packages/sdks/src/context/types.ts).
|
|
122
|
+
*
|
|
123
|
+
* Defaults to `true`.
|
|
124
|
+
*/
|
|
125
|
+
builderContext?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Whether or not the component should receive the `builderComponents` array, containing the all registered components (custom and built-in).
|
|
128
|
+
*
|
|
129
|
+
* Defaults to `false`.
|
|
130
|
+
*/
|
|
131
|
+
builderComponents?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Whether or not the component should receive the `builderLinkComponent` prop, containing the custom link component provided to `Content`.
|
|
134
|
+
*
|
|
135
|
+
* Defaults to `false`.
|
|
136
|
+
*/
|
|
137
|
+
builderLinkComponent?: boolean;
|
|
138
|
+
};
|
|
108
139
|
}
|
|
109
140
|
type Permission = 'read' | 'publish' | 'editCode' | 'editDesigns' | 'admin' | 'create';
|
|
110
141
|
export {};
|