@builder.io/sdk-qwik 0.17.6 → 0.17.7
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/components/blocks/blocks-wrapper.qwik.cjs +2 -1
- package/lib/browser/components/blocks/blocks-wrapper.qwik.mjs +2 -1
- package/lib/browser/constants/builder-registered-components.qwik.cjs +6 -0
- package/lib/browser/constants/builder-registered-components.qwik.mjs +6 -0
- package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
- package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
- package/lib/browser/helpers/canTrack.qwik.cjs +6 -1
- package/lib/browser/helpers/canTrack.qwik.mjs +6 -1
- package/lib/browser/helpers/user-attributes.qwik.cjs +50 -0
- package/lib/browser/helpers/user-attributes.qwik.mjs +50 -0
- package/lib/browser/index.qwik.cjs +2 -0
- package/lib/browser/index.qwik.mjs +2 -0
- package/lib/browser/scripts/init-editing.qwik.cjs +2 -1
- package/lib/browser/scripts/init-editing.qwik.mjs +2 -1
- package/lib/edge/components/blocks/blocks-wrapper.qwik.cjs +2 -1
- package/lib/edge/components/blocks/blocks-wrapper.qwik.mjs +2 -1
- package/lib/edge/constants/builder-registered-components.qwik.cjs +7 -0
- package/lib/edge/constants/builder-registered-components.qwik.mjs +7 -0
- package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
- package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
- package/lib/edge/helpers/canTrack.qwik.cjs +6 -1
- package/lib/edge/helpers/canTrack.qwik.mjs +6 -1
- package/lib/edge/helpers/user-attributes.qwik.cjs +50 -0
- package/lib/edge/helpers/user-attributes.qwik.mjs +50 -0
- package/lib/edge/index.qwik.cjs +2 -0
- package/lib/edge/index.qwik.mjs +2 -0
- package/lib/edge/scripts/init-editing.qwik.cjs +2 -1
- package/lib/edge/scripts/init-editing.qwik.mjs +2 -1
- package/lib/node/components/blocks/blocks-wrapper.qwik.cjs +2 -1
- package/lib/node/components/blocks/blocks-wrapper.qwik.mjs +2 -1
- package/lib/node/constants/builder-registered-components.qwik.cjs +7 -0
- package/lib/node/constants/builder-registered-components.qwik.mjs +7 -0
- package/lib/node/constants/sdk-version.qwik.cjs +1 -1
- package/lib/node/constants/sdk-version.qwik.mjs +1 -1
- package/lib/node/helpers/canTrack.qwik.cjs +6 -1
- package/lib/node/helpers/canTrack.qwik.mjs +6 -1
- package/lib/node/helpers/user-attributes.qwik.cjs +50 -0
- package/lib/node/helpers/user-attributes.qwik.mjs +50 -0
- package/lib/node/index.qwik.cjs +2 -0
- package/lib/node/index.qwik.mjs +2 -0
- package/lib/node/scripts/init-editing.qwik.cjs +2 -1
- package/lib/node/scripts/init-editing.qwik.mjs +2 -1
- package/package.json +1 -1
- package/types/src/blocks/personalization-container/component-info.d.ts +2 -0
- package/types/src/blocks/personalization-container/helpers/inlined-fns.d.ts +8 -0
- package/types/src/blocks/personalization-container/helpers.d.ts +27 -0
- package/types/src/blocks/personalization-container/index.d.ts +1 -0
- package/types/src/blocks/personalization-container/personalization-container.d.ts +3 -0
- package/types/src/blocks/personalization-container/personalization-container.types.d.ts +14 -0
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/helpers/user-attributes.d.ts +17 -0
- package/types/src/index-helpers/blocks-exports.d.ts +1 -0
- package/types/src/types/input.d.ts +1 -0
|
@@ -41,8 +41,9 @@ const BlocksWrapper = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
41
41
|
const [props2] = qwik.useLexicalScope();
|
|
42
42
|
if (!props2.path)
|
|
43
43
|
return void 0;
|
|
44
|
+
const thisPrefix = "this.";
|
|
44
45
|
const pathPrefix = "component.options.";
|
|
45
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
47
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
47
48
|
props
|
|
48
49
|
]));
|
|
@@ -39,8 +39,9 @@ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
39
39
|
const [props2] = useLexicalScope();
|
|
40
40
|
if (!props2.path)
|
|
41
41
|
return void 0;
|
|
42
|
+
const thisPrefix = "this.";
|
|
42
43
|
const pathPrefix = "component.options.";
|
|
43
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
45
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
45
46
|
props
|
|
46
47
|
]));
|
|
@@ -10,6 +10,11 @@ const componentInfo$2 = require("../blocks/fragment/component-info.qwik.cjs");
|
|
|
10
10
|
const fragment = require("../blocks/fragment/fragment.qwik.cjs");
|
|
11
11
|
const componentInfo$3 = require("../blocks/image/component-info.qwik.cjs");
|
|
12
12
|
const image = require("../blocks/image/image.qwik.cjs");
|
|
13
|
+
require("@builder.io/qwik");
|
|
14
|
+
require("@builder.io/qwik/jsx-runtime");
|
|
15
|
+
require("../context/builder.context.qwik.cjs");
|
|
16
|
+
require("../context/components.context.qwik.cjs");
|
|
17
|
+
require("@builder.io/qwik/build");
|
|
13
18
|
const componentInfo$4 = require("../blocks/section/component-info.qwik.cjs");
|
|
14
19
|
const section = require("../blocks/section/section.qwik.cjs");
|
|
15
20
|
const componentInfo$5 = require("../blocks/slot/component-info.qwik.cjs");
|
|
@@ -54,6 +59,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
54
59
|
component: text.Text,
|
|
55
60
|
...componentInfo$7.componentInfo
|
|
56
61
|
},
|
|
62
|
+
...[],
|
|
57
63
|
...[
|
|
58
64
|
{
|
|
59
65
|
component: tabs.Tabs,
|
|
@@ -8,6 +8,11 @@ import { componentInfo as componentInfo$2 } from "../blocks/fragment/component-i
|
|
|
8
8
|
import { FragmentComponent } from "../blocks/fragment/fragment.qwik.mjs";
|
|
9
9
|
import { componentInfo as componentInfo$3 } from "../blocks/image/component-info.qwik.mjs";
|
|
10
10
|
import { Image } from "../blocks/image/image.qwik.mjs";
|
|
11
|
+
import "@builder.io/qwik";
|
|
12
|
+
import "@builder.io/qwik/jsx-runtime";
|
|
13
|
+
import "../context/builder.context.qwik.mjs";
|
|
14
|
+
import "../context/components.context.qwik.mjs";
|
|
15
|
+
import "@builder.io/qwik/build";
|
|
11
16
|
import { componentInfo as componentInfo$4 } from "../blocks/section/component-info.qwik.mjs";
|
|
12
17
|
import { SectionComponent } from "../blocks/section/section.qwik.mjs";
|
|
13
18
|
import { componentInfo as componentInfo$5 } from "../blocks/slot/component-info.qwik.mjs";
|
|
@@ -52,6 +57,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
52
57
|
component: Text,
|
|
53
58
|
...componentInfo$7
|
|
54
59
|
},
|
|
60
|
+
...[],
|
|
55
61
|
...[
|
|
56
62
|
{
|
|
57
63
|
component: Tabs,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const nullable = require("./nullable.qwik.cjs");
|
|
4
|
-
const
|
|
4
|
+
const userAttributes = require("./user-attributes.qwik.cjs");
|
|
5
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
6
|
+
const result = nullable.checkIsDefined(canTrack) ? canTrack : true;
|
|
7
|
+
userAttributes.userAttributesService.setCanTrack(result);
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
5
10
|
exports.getDefaultCanTrack = getDefaultCanTrack;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { checkIsDefined } from "./nullable.qwik.mjs";
|
|
2
|
-
|
|
2
|
+
import { userAttributesService } from "./user-attributes.qwik.mjs";
|
|
3
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
4
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
5
|
+
userAttributesService.setCanTrack(result);
|
|
6
|
+
return result;
|
|
7
|
+
};
|
|
3
8
|
export {
|
|
4
9
|
getDefaultCanTrack
|
|
5
10
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const isBrowser = require("../functions/is-browser.qwik.cjs");
|
|
4
|
+
const cookie = require("./cookie.qwik.cjs");
|
|
5
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
6
|
+
function createUserAttributesService() {
|
|
7
|
+
let canTrack = true;
|
|
8
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
9
|
+
return {
|
|
10
|
+
setUserAttributes(newAttrs) {
|
|
11
|
+
if (!isBrowser.isBrowser())
|
|
12
|
+
return;
|
|
13
|
+
const userAttributes = {
|
|
14
|
+
...this.getUserAttributes(),
|
|
15
|
+
...newAttrs
|
|
16
|
+
};
|
|
17
|
+
cookie.setCookie({
|
|
18
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
19
|
+
value: JSON.stringify(userAttributes),
|
|
20
|
+
canTrack
|
|
21
|
+
});
|
|
22
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
23
|
+
},
|
|
24
|
+
getUserAttributes() {
|
|
25
|
+
if (!isBrowser.isBrowser())
|
|
26
|
+
return {};
|
|
27
|
+
return JSON.parse(cookie.getCookieSync({
|
|
28
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
29
|
+
canTrack
|
|
30
|
+
}) || "{}");
|
|
31
|
+
},
|
|
32
|
+
subscribeOnUserAttributesChange(callback) {
|
|
33
|
+
subscribers.add(callback);
|
|
34
|
+
return () => {
|
|
35
|
+
subscribers.delete(callback);
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
setCanTrack(value) {
|
|
39
|
+
canTrack = value;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const userAttributesService = createUserAttributesService();
|
|
44
|
+
const setClientUserAttributes = (attributes) => {
|
|
45
|
+
userAttributesService.setUserAttributes(attributes);
|
|
46
|
+
};
|
|
47
|
+
exports.USER_ATTRIBUTES_COOKIE_NAME = USER_ATTRIBUTES_COOKIE_NAME;
|
|
48
|
+
exports.createUserAttributesService = createUserAttributesService;
|
|
49
|
+
exports.setClientUserAttributes = setClientUserAttributes;
|
|
50
|
+
exports.userAttributesService = userAttributesService;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isBrowser } from "../functions/is-browser.qwik.mjs";
|
|
2
|
+
import { setCookie, getCookieSync } from "./cookie.qwik.mjs";
|
|
3
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
4
|
+
function createUserAttributesService() {
|
|
5
|
+
let canTrack = true;
|
|
6
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
7
|
+
return {
|
|
8
|
+
setUserAttributes(newAttrs) {
|
|
9
|
+
if (!isBrowser())
|
|
10
|
+
return;
|
|
11
|
+
const userAttributes = {
|
|
12
|
+
...this.getUserAttributes(),
|
|
13
|
+
...newAttrs
|
|
14
|
+
};
|
|
15
|
+
setCookie({
|
|
16
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
17
|
+
value: JSON.stringify(userAttributes),
|
|
18
|
+
canTrack
|
|
19
|
+
});
|
|
20
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
21
|
+
},
|
|
22
|
+
getUserAttributes() {
|
|
23
|
+
if (!isBrowser())
|
|
24
|
+
return {};
|
|
25
|
+
return JSON.parse(getCookieSync({
|
|
26
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
27
|
+
canTrack
|
|
28
|
+
}) || "{}");
|
|
29
|
+
},
|
|
30
|
+
subscribeOnUserAttributesChange(callback) {
|
|
31
|
+
subscribers.add(callback);
|
|
32
|
+
return () => {
|
|
33
|
+
subscribers.delete(callback);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
setCanTrack(value) {
|
|
37
|
+
canTrack = value;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const userAttributesService = createUserAttributesService();
|
|
42
|
+
const setClientUserAttributes = (attributes) => {
|
|
43
|
+
userAttributesService.setUserAttributes(attributes);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
USER_ATTRIBUTES_COOKIE_NAME,
|
|
47
|
+
createUserAttributesService,
|
|
48
|
+
setClientUserAttributes,
|
|
49
|
+
userAttributesService
|
|
50
|
+
};
|
|
@@ -11,6 +11,7 @@ const video = require("./blocks/video/video.qwik.cjs");
|
|
|
11
11
|
const blocks = require("./components/blocks/blocks.qwik.cjs");
|
|
12
12
|
const contentVariants = require("./components/content-variants/content-variants.qwik.cjs");
|
|
13
13
|
const builder_context = require("./context/builder.context.qwik.cjs");
|
|
14
|
+
const userAttributes = require("./helpers/user-attributes.qwik.cjs");
|
|
14
15
|
const isEditing = require("./functions/is-editing.qwik.cjs");
|
|
15
16
|
const isPreviewing = require("./functions/is-previewing.qwik.cjs");
|
|
16
17
|
const registerComponent = require("./functions/register-component.qwik.cjs");
|
|
@@ -32,6 +33,7 @@ exports.Video = video.Video;
|
|
|
32
33
|
exports.Blocks = blocks.Blocks;
|
|
33
34
|
exports.Content = contentVariants.ContentVariants;
|
|
34
35
|
exports.BuilderContext = builder_context;
|
|
36
|
+
exports.setClientUserAttributes = userAttributes.setClientUserAttributes;
|
|
35
37
|
exports.isEditing = isEditing.isEditing;
|
|
36
38
|
exports.isPreviewing = isPreviewing.isPreviewing;
|
|
37
39
|
exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
|
|
@@ -9,6 +9,7 @@ import { Video } from "./blocks/video/video.qwik.mjs";
|
|
|
9
9
|
import { Blocks } from "./components/blocks/blocks.qwik.mjs";
|
|
10
10
|
import { ContentVariants } from "./components/content-variants/content-variants.qwik.mjs";
|
|
11
11
|
import { default as default2 } from "./context/builder.context.qwik.mjs";
|
|
12
|
+
import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
|
|
12
13
|
import { isEditing } from "./functions/is-editing.qwik.mjs";
|
|
13
14
|
import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
|
|
14
15
|
import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
isEditing,
|
|
41
42
|
isPreviewing,
|
|
42
43
|
register,
|
|
44
|
+
setClientUserAttributes,
|
|
43
45
|
setEditorSettings,
|
|
44
46
|
subscribeToEditor,
|
|
45
47
|
track
|
|
@@ -55,7 +55,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
55
55
|
// Supports builder-model="..." attribute which is needed to
|
|
56
56
|
// scope our '+ add block' button styling
|
|
57
57
|
supportsAddBlockScoping: true,
|
|
58
|
-
supportsCustomBreakpoints: true
|
|
58
|
+
supportsCustomBreakpoints: true,
|
|
59
|
+
blockLevelPersonalization: true
|
|
59
60
|
}
|
|
60
61
|
}, "*");
|
|
61
62
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
@@ -53,7 +53,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
53
53
|
// Supports builder-model="..." attribute which is needed to
|
|
54
54
|
// scope our '+ add block' button styling
|
|
55
55
|
supportsAddBlockScoping: true,
|
|
56
|
-
supportsCustomBreakpoints: true
|
|
56
|
+
supportsCustomBreakpoints: true,
|
|
57
|
+
blockLevelPersonalization: true
|
|
57
58
|
}
|
|
58
59
|
}, "*");
|
|
59
60
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
@@ -41,8 +41,9 @@ const BlocksWrapper = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
41
41
|
const [props2] = qwik.useLexicalScope();
|
|
42
42
|
if (!props2.path)
|
|
43
43
|
return void 0;
|
|
44
|
+
const thisPrefix = "this.";
|
|
44
45
|
const pathPrefix = "component.options.";
|
|
45
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
47
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
47
48
|
props
|
|
48
49
|
]));
|
|
@@ -39,8 +39,9 @@ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
39
39
|
const [props2] = useLexicalScope();
|
|
40
40
|
if (!props2.path)
|
|
41
41
|
return void 0;
|
|
42
|
+
const thisPrefix = "this.";
|
|
42
43
|
const pathPrefix = "component.options.";
|
|
43
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
45
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
45
46
|
props
|
|
46
47
|
]));
|
|
@@ -10,6 +10,12 @@ const componentInfo$2 = require("../blocks/fragment/component-info.qwik.cjs");
|
|
|
10
10
|
const fragment = require("../blocks/fragment/fragment.qwik.cjs");
|
|
11
11
|
const componentInfo$3 = require("../blocks/image/component-info.qwik.cjs");
|
|
12
12
|
const image = require("../blocks/image/image.qwik.cjs");
|
|
13
|
+
require("@builder.io/qwik");
|
|
14
|
+
require("@builder.io/qwik/jsx-runtime");
|
|
15
|
+
require("../context/builder.context.qwik.cjs");
|
|
16
|
+
require("../context/components.context.qwik.cjs");
|
|
17
|
+
require("@builder.io/qwik/build");
|
|
18
|
+
require("../functions/evaluate/edge-runtime/edge-runtime.qwik.cjs");
|
|
13
19
|
const componentInfo$4 = require("../blocks/section/component-info.qwik.cjs");
|
|
14
20
|
const section = require("../blocks/section/section.qwik.cjs");
|
|
15
21
|
const componentInfo$5 = require("../blocks/slot/component-info.qwik.cjs");
|
|
@@ -54,6 +60,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
54
60
|
component: text.Text,
|
|
55
61
|
...componentInfo$7.componentInfo
|
|
56
62
|
},
|
|
63
|
+
...[],
|
|
57
64
|
...[
|
|
58
65
|
{
|
|
59
66
|
component: tabs.Tabs,
|
|
@@ -8,6 +8,12 @@ import { componentInfo as componentInfo$2 } from "../blocks/fragment/component-i
|
|
|
8
8
|
import { FragmentComponent } from "../blocks/fragment/fragment.qwik.mjs";
|
|
9
9
|
import { componentInfo as componentInfo$3 } from "../blocks/image/component-info.qwik.mjs";
|
|
10
10
|
import { Image } from "../blocks/image/image.qwik.mjs";
|
|
11
|
+
import "@builder.io/qwik";
|
|
12
|
+
import "@builder.io/qwik/jsx-runtime";
|
|
13
|
+
import "../context/builder.context.qwik.mjs";
|
|
14
|
+
import "../context/components.context.qwik.mjs";
|
|
15
|
+
import "@builder.io/qwik/build";
|
|
16
|
+
import "../functions/evaluate/edge-runtime/edge-runtime.qwik.mjs";
|
|
11
17
|
import { componentInfo as componentInfo$4 } from "../blocks/section/component-info.qwik.mjs";
|
|
12
18
|
import { SectionComponent } from "../blocks/section/section.qwik.mjs";
|
|
13
19
|
import { componentInfo as componentInfo$5 } from "../blocks/slot/component-info.qwik.mjs";
|
|
@@ -52,6 +58,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
52
58
|
component: Text,
|
|
53
59
|
...componentInfo$7
|
|
54
60
|
},
|
|
61
|
+
...[],
|
|
55
62
|
...[
|
|
56
63
|
{
|
|
57
64
|
component: Tabs,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const nullable = require("./nullable.qwik.cjs");
|
|
4
|
-
const
|
|
4
|
+
const userAttributes = require("./user-attributes.qwik.cjs");
|
|
5
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
6
|
+
const result = nullable.checkIsDefined(canTrack) ? canTrack : true;
|
|
7
|
+
userAttributes.userAttributesService.setCanTrack(result);
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
5
10
|
exports.getDefaultCanTrack = getDefaultCanTrack;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { checkIsDefined } from "./nullable.qwik.mjs";
|
|
2
|
-
|
|
2
|
+
import { userAttributesService } from "./user-attributes.qwik.mjs";
|
|
3
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
4
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
5
|
+
userAttributesService.setCanTrack(result);
|
|
6
|
+
return result;
|
|
7
|
+
};
|
|
3
8
|
export {
|
|
4
9
|
getDefaultCanTrack
|
|
5
10
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const isBrowser = require("../functions/is-browser.qwik.cjs");
|
|
4
|
+
const cookie = require("./cookie.qwik.cjs");
|
|
5
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
6
|
+
function createUserAttributesService() {
|
|
7
|
+
let canTrack = true;
|
|
8
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
9
|
+
return {
|
|
10
|
+
setUserAttributes(newAttrs) {
|
|
11
|
+
if (!isBrowser.isBrowser())
|
|
12
|
+
return;
|
|
13
|
+
const userAttributes = {
|
|
14
|
+
...this.getUserAttributes(),
|
|
15
|
+
...newAttrs
|
|
16
|
+
};
|
|
17
|
+
cookie.setCookie({
|
|
18
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
19
|
+
value: JSON.stringify(userAttributes),
|
|
20
|
+
canTrack
|
|
21
|
+
});
|
|
22
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
23
|
+
},
|
|
24
|
+
getUserAttributes() {
|
|
25
|
+
if (!isBrowser.isBrowser())
|
|
26
|
+
return {};
|
|
27
|
+
return JSON.parse(cookie.getCookieSync({
|
|
28
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
29
|
+
canTrack
|
|
30
|
+
}) || "{}");
|
|
31
|
+
},
|
|
32
|
+
subscribeOnUserAttributesChange(callback) {
|
|
33
|
+
subscribers.add(callback);
|
|
34
|
+
return () => {
|
|
35
|
+
subscribers.delete(callback);
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
setCanTrack(value) {
|
|
39
|
+
canTrack = value;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const userAttributesService = createUserAttributesService();
|
|
44
|
+
const setClientUserAttributes = (attributes) => {
|
|
45
|
+
userAttributesService.setUserAttributes(attributes);
|
|
46
|
+
};
|
|
47
|
+
exports.USER_ATTRIBUTES_COOKIE_NAME = USER_ATTRIBUTES_COOKIE_NAME;
|
|
48
|
+
exports.createUserAttributesService = createUserAttributesService;
|
|
49
|
+
exports.setClientUserAttributes = setClientUserAttributes;
|
|
50
|
+
exports.userAttributesService = userAttributesService;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isBrowser } from "../functions/is-browser.qwik.mjs";
|
|
2
|
+
import { setCookie, getCookieSync } from "./cookie.qwik.mjs";
|
|
3
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
4
|
+
function createUserAttributesService() {
|
|
5
|
+
let canTrack = true;
|
|
6
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
7
|
+
return {
|
|
8
|
+
setUserAttributes(newAttrs) {
|
|
9
|
+
if (!isBrowser())
|
|
10
|
+
return;
|
|
11
|
+
const userAttributes = {
|
|
12
|
+
...this.getUserAttributes(),
|
|
13
|
+
...newAttrs
|
|
14
|
+
};
|
|
15
|
+
setCookie({
|
|
16
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
17
|
+
value: JSON.stringify(userAttributes),
|
|
18
|
+
canTrack
|
|
19
|
+
});
|
|
20
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
21
|
+
},
|
|
22
|
+
getUserAttributes() {
|
|
23
|
+
if (!isBrowser())
|
|
24
|
+
return {};
|
|
25
|
+
return JSON.parse(getCookieSync({
|
|
26
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
27
|
+
canTrack
|
|
28
|
+
}) || "{}");
|
|
29
|
+
},
|
|
30
|
+
subscribeOnUserAttributesChange(callback) {
|
|
31
|
+
subscribers.add(callback);
|
|
32
|
+
return () => {
|
|
33
|
+
subscribers.delete(callback);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
setCanTrack(value) {
|
|
37
|
+
canTrack = value;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const userAttributesService = createUserAttributesService();
|
|
42
|
+
const setClientUserAttributes = (attributes) => {
|
|
43
|
+
userAttributesService.setUserAttributes(attributes);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
USER_ATTRIBUTES_COOKIE_NAME,
|
|
47
|
+
createUserAttributesService,
|
|
48
|
+
setClientUserAttributes,
|
|
49
|
+
userAttributesService
|
|
50
|
+
};
|
package/lib/edge/index.qwik.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const video = require("./blocks/video/video.qwik.cjs");
|
|
|
11
11
|
const blocks = require("./components/blocks/blocks.qwik.cjs");
|
|
12
12
|
const contentVariants = require("./components/content-variants/content-variants.qwik.cjs");
|
|
13
13
|
const builder_context = require("./context/builder.context.qwik.cjs");
|
|
14
|
+
const userAttributes = require("./helpers/user-attributes.qwik.cjs");
|
|
14
15
|
const isEditing = require("./functions/is-editing.qwik.cjs");
|
|
15
16
|
const isPreviewing = require("./functions/is-previewing.qwik.cjs");
|
|
16
17
|
const registerComponent = require("./functions/register-component.qwik.cjs");
|
|
@@ -32,6 +33,7 @@ exports.Video = video.Video;
|
|
|
32
33
|
exports.Blocks = blocks.Blocks;
|
|
33
34
|
exports.Content = contentVariants.ContentVariants;
|
|
34
35
|
exports.BuilderContext = builder_context;
|
|
36
|
+
exports.setClientUserAttributes = userAttributes.setClientUserAttributes;
|
|
35
37
|
exports.isEditing = isEditing.isEditing;
|
|
36
38
|
exports.isPreviewing = isPreviewing.isPreviewing;
|
|
37
39
|
exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
|
package/lib/edge/index.qwik.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { Video } from "./blocks/video/video.qwik.mjs";
|
|
|
9
9
|
import { Blocks } from "./components/blocks/blocks.qwik.mjs";
|
|
10
10
|
import { ContentVariants } from "./components/content-variants/content-variants.qwik.mjs";
|
|
11
11
|
import { default as default2 } from "./context/builder.context.qwik.mjs";
|
|
12
|
+
import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
|
|
12
13
|
import { isEditing } from "./functions/is-editing.qwik.mjs";
|
|
13
14
|
import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
|
|
14
15
|
import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
isEditing,
|
|
41
42
|
isPreviewing,
|
|
42
43
|
register,
|
|
44
|
+
setClientUserAttributes,
|
|
43
45
|
setEditorSettings,
|
|
44
46
|
subscribeToEditor,
|
|
45
47
|
track
|
|
@@ -55,7 +55,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
55
55
|
// Supports builder-model="..." attribute which is needed to
|
|
56
56
|
// scope our '+ add block' button styling
|
|
57
57
|
supportsAddBlockScoping: true,
|
|
58
|
-
supportsCustomBreakpoints: true
|
|
58
|
+
supportsCustomBreakpoints: true,
|
|
59
|
+
blockLevelPersonalization: true
|
|
59
60
|
}
|
|
60
61
|
}, "*");
|
|
61
62
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
@@ -53,7 +53,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
53
53
|
// Supports builder-model="..." attribute which is needed to
|
|
54
54
|
// scope our '+ add block' button styling
|
|
55
55
|
supportsAddBlockScoping: true,
|
|
56
|
-
supportsCustomBreakpoints: true
|
|
56
|
+
supportsCustomBreakpoints: true,
|
|
57
|
+
blockLevelPersonalization: true
|
|
57
58
|
}
|
|
58
59
|
}, "*");
|
|
59
60
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
@@ -41,8 +41,9 @@ const BlocksWrapper = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.inl
|
|
|
41
41
|
const [props2] = qwik.useLexicalScope();
|
|
42
42
|
if (!props2.path)
|
|
43
43
|
return void 0;
|
|
44
|
+
const thisPrefix = "this.";
|
|
44
45
|
const pathPrefix = "component.options.";
|
|
45
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
46
47
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
47
48
|
props
|
|
48
49
|
]));
|
|
@@ -39,8 +39,9 @@ const BlocksWrapper = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl((p
|
|
|
39
39
|
const [props2] = useLexicalScope();
|
|
40
40
|
if (!props2.path)
|
|
41
41
|
return void 0;
|
|
42
|
+
const thisPrefix = "this.";
|
|
42
43
|
const pathPrefix = "component.options.";
|
|
43
|
-
return props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
|
+
return props2.path.startsWith(thisPrefix) ? props2.path.replace(thisPrefix, "") : props2.path.startsWith(pathPrefix) ? props2.path : `${pathPrefix}${props2.path || ""}`;
|
|
44
45
|
}, "BlocksWrapper_component_dataPath_useComputed_csBNeJbWH7k", [
|
|
45
46
|
props
|
|
46
47
|
]));
|
|
@@ -10,6 +10,12 @@ const componentInfo$2 = require("../blocks/fragment/component-info.qwik.cjs");
|
|
|
10
10
|
const fragment = require("../blocks/fragment/fragment.qwik.cjs");
|
|
11
11
|
const componentInfo$3 = require("../blocks/image/component-info.qwik.cjs");
|
|
12
12
|
const image = require("../blocks/image/image.qwik.cjs");
|
|
13
|
+
require("@builder.io/qwik");
|
|
14
|
+
require("@builder.io/qwik/jsx-runtime");
|
|
15
|
+
require("../context/builder.context.qwik.cjs");
|
|
16
|
+
require("../context/components.context.qwik.cjs");
|
|
17
|
+
require("@builder.io/qwik/build");
|
|
18
|
+
require("../functions/evaluate/node-runtime/safeDynamicRequire.qwik.cjs");
|
|
13
19
|
const componentInfo$4 = require("../blocks/section/component-info.qwik.cjs");
|
|
14
20
|
const section = require("../blocks/section/section.qwik.cjs");
|
|
15
21
|
const componentInfo$5 = require("../blocks/slot/component-info.qwik.cjs");
|
|
@@ -54,6 +60,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
54
60
|
component: text.Text,
|
|
55
61
|
...componentInfo$7.componentInfo
|
|
56
62
|
},
|
|
63
|
+
...[],
|
|
57
64
|
...[
|
|
58
65
|
{
|
|
59
66
|
component: tabs.Tabs,
|
|
@@ -8,6 +8,12 @@ import { componentInfo as componentInfo$2 } from "../blocks/fragment/component-i
|
|
|
8
8
|
import { FragmentComponent } from "../blocks/fragment/fragment.qwik.mjs";
|
|
9
9
|
import { componentInfo as componentInfo$3 } from "../blocks/image/component-info.qwik.mjs";
|
|
10
10
|
import { Image } from "../blocks/image/image.qwik.mjs";
|
|
11
|
+
import "@builder.io/qwik";
|
|
12
|
+
import "@builder.io/qwik/jsx-runtime";
|
|
13
|
+
import "../context/builder.context.qwik.mjs";
|
|
14
|
+
import "../context/components.context.qwik.mjs";
|
|
15
|
+
import "@builder.io/qwik/build";
|
|
16
|
+
import "../functions/evaluate/node-runtime/safeDynamicRequire.qwik.mjs";
|
|
11
17
|
import { componentInfo as componentInfo$4 } from "../blocks/section/component-info.qwik.mjs";
|
|
12
18
|
import { SectionComponent } from "../blocks/section/section.qwik.mjs";
|
|
13
19
|
import { componentInfo as componentInfo$5 } from "../blocks/slot/component-info.qwik.mjs";
|
|
@@ -52,6 +58,7 @@ const getDefaultRegisteredComponents = () => [
|
|
|
52
58
|
component: Text,
|
|
53
59
|
...componentInfo$7
|
|
54
60
|
},
|
|
61
|
+
...[],
|
|
55
62
|
...[
|
|
56
63
|
{
|
|
57
64
|
component: Tabs,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const nullable = require("./nullable.qwik.cjs");
|
|
4
|
-
const
|
|
4
|
+
const userAttributes = require("./user-attributes.qwik.cjs");
|
|
5
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
6
|
+
const result = nullable.checkIsDefined(canTrack) ? canTrack : true;
|
|
7
|
+
userAttributes.userAttributesService.setCanTrack(result);
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
5
10
|
exports.getDefaultCanTrack = getDefaultCanTrack;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { checkIsDefined } from "./nullable.qwik.mjs";
|
|
2
|
-
|
|
2
|
+
import { userAttributesService } from "./user-attributes.qwik.mjs";
|
|
3
|
+
const getDefaultCanTrack = (canTrack) => {
|
|
4
|
+
const result = checkIsDefined(canTrack) ? canTrack : true;
|
|
5
|
+
userAttributesService.setCanTrack(result);
|
|
6
|
+
return result;
|
|
7
|
+
};
|
|
3
8
|
export {
|
|
4
9
|
getDefaultCanTrack
|
|
5
10
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const isBrowser = require("../functions/is-browser.qwik.cjs");
|
|
4
|
+
const cookie = require("./cookie.qwik.cjs");
|
|
5
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
6
|
+
function createUserAttributesService() {
|
|
7
|
+
let canTrack = true;
|
|
8
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
9
|
+
return {
|
|
10
|
+
setUserAttributes(newAttrs) {
|
|
11
|
+
if (!isBrowser.isBrowser())
|
|
12
|
+
return;
|
|
13
|
+
const userAttributes = {
|
|
14
|
+
...this.getUserAttributes(),
|
|
15
|
+
...newAttrs
|
|
16
|
+
};
|
|
17
|
+
cookie.setCookie({
|
|
18
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
19
|
+
value: JSON.stringify(userAttributes),
|
|
20
|
+
canTrack
|
|
21
|
+
});
|
|
22
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
23
|
+
},
|
|
24
|
+
getUserAttributes() {
|
|
25
|
+
if (!isBrowser.isBrowser())
|
|
26
|
+
return {};
|
|
27
|
+
return JSON.parse(cookie.getCookieSync({
|
|
28
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
29
|
+
canTrack
|
|
30
|
+
}) || "{}");
|
|
31
|
+
},
|
|
32
|
+
subscribeOnUserAttributesChange(callback) {
|
|
33
|
+
subscribers.add(callback);
|
|
34
|
+
return () => {
|
|
35
|
+
subscribers.delete(callback);
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
setCanTrack(value) {
|
|
39
|
+
canTrack = value;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const userAttributesService = createUserAttributesService();
|
|
44
|
+
const setClientUserAttributes = (attributes) => {
|
|
45
|
+
userAttributesService.setUserAttributes(attributes);
|
|
46
|
+
};
|
|
47
|
+
exports.USER_ATTRIBUTES_COOKIE_NAME = USER_ATTRIBUTES_COOKIE_NAME;
|
|
48
|
+
exports.createUserAttributesService = createUserAttributesService;
|
|
49
|
+
exports.setClientUserAttributes = setClientUserAttributes;
|
|
50
|
+
exports.userAttributesService = userAttributesService;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { isBrowser } from "../functions/is-browser.qwik.mjs";
|
|
2
|
+
import { setCookie, getCookieSync } from "./cookie.qwik.mjs";
|
|
3
|
+
const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
4
|
+
function createUserAttributesService() {
|
|
5
|
+
let canTrack = true;
|
|
6
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
7
|
+
return {
|
|
8
|
+
setUserAttributes(newAttrs) {
|
|
9
|
+
if (!isBrowser())
|
|
10
|
+
return;
|
|
11
|
+
const userAttributes = {
|
|
12
|
+
...this.getUserAttributes(),
|
|
13
|
+
...newAttrs
|
|
14
|
+
};
|
|
15
|
+
setCookie({
|
|
16
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
17
|
+
value: JSON.stringify(userAttributes),
|
|
18
|
+
canTrack
|
|
19
|
+
});
|
|
20
|
+
subscribers.forEach((callback) => callback(userAttributes));
|
|
21
|
+
},
|
|
22
|
+
getUserAttributes() {
|
|
23
|
+
if (!isBrowser())
|
|
24
|
+
return {};
|
|
25
|
+
return JSON.parse(getCookieSync({
|
|
26
|
+
name: USER_ATTRIBUTES_COOKIE_NAME,
|
|
27
|
+
canTrack
|
|
28
|
+
}) || "{}");
|
|
29
|
+
},
|
|
30
|
+
subscribeOnUserAttributesChange(callback) {
|
|
31
|
+
subscribers.add(callback);
|
|
32
|
+
return () => {
|
|
33
|
+
subscribers.delete(callback);
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
setCanTrack(value) {
|
|
37
|
+
canTrack = value;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const userAttributesService = createUserAttributesService();
|
|
42
|
+
const setClientUserAttributes = (attributes) => {
|
|
43
|
+
userAttributesService.setUserAttributes(attributes);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
USER_ATTRIBUTES_COOKIE_NAME,
|
|
47
|
+
createUserAttributesService,
|
|
48
|
+
setClientUserAttributes,
|
|
49
|
+
userAttributesService
|
|
50
|
+
};
|
package/lib/node/index.qwik.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const video = require("./blocks/video/video.qwik.cjs");
|
|
|
11
11
|
const blocks = require("./components/blocks/blocks.qwik.cjs");
|
|
12
12
|
const contentVariants = require("./components/content-variants/content-variants.qwik.cjs");
|
|
13
13
|
const builder_context = require("./context/builder.context.qwik.cjs");
|
|
14
|
+
const userAttributes = require("./helpers/user-attributes.qwik.cjs");
|
|
14
15
|
const isEditing = require("./functions/is-editing.qwik.cjs");
|
|
15
16
|
const isPreviewing = require("./functions/is-previewing.qwik.cjs");
|
|
16
17
|
const registerComponent = require("./functions/register-component.qwik.cjs");
|
|
@@ -32,6 +33,7 @@ exports.Video = video.Video;
|
|
|
32
33
|
exports.Blocks = blocks.Blocks;
|
|
33
34
|
exports.Content = contentVariants.ContentVariants;
|
|
34
35
|
exports.BuilderContext = builder_context;
|
|
36
|
+
exports.setClientUserAttributes = userAttributes.setClientUserAttributes;
|
|
35
37
|
exports.isEditing = isEditing.isEditing;
|
|
36
38
|
exports.isPreviewing = isPreviewing.isPreviewing;
|
|
37
39
|
exports.createRegisterComponentMessage = registerComponent.createRegisterComponentMessage;
|
package/lib/node/index.qwik.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { Video } from "./blocks/video/video.qwik.mjs";
|
|
|
9
9
|
import { Blocks } from "./components/blocks/blocks.qwik.mjs";
|
|
10
10
|
import { ContentVariants } from "./components/content-variants/content-variants.qwik.mjs";
|
|
11
11
|
import { default as default2 } from "./context/builder.context.qwik.mjs";
|
|
12
|
+
import { setClientUserAttributes } from "./helpers/user-attributes.qwik.mjs";
|
|
12
13
|
import { isEditing } from "./functions/is-editing.qwik.mjs";
|
|
13
14
|
import { isPreviewing } from "./functions/is-previewing.qwik.mjs";
|
|
14
15
|
import { createRegisterComponentMessage } from "./functions/register-component.qwik.mjs";
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
isEditing,
|
|
41
42
|
isPreviewing,
|
|
42
43
|
register,
|
|
44
|
+
setClientUserAttributes,
|
|
43
45
|
setEditorSettings,
|
|
44
46
|
subscribeToEditor,
|
|
45
47
|
track
|
|
@@ -55,7 +55,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
55
55
|
// Supports builder-model="..." attribute which is needed to
|
|
56
56
|
// scope our '+ add block' button styling
|
|
57
57
|
supportsAddBlockScoping: true,
|
|
58
|
-
supportsCustomBreakpoints: true
|
|
58
|
+
supportsCustomBreakpoints: true,
|
|
59
|
+
blockLevelPersonalization: true
|
|
59
60
|
}
|
|
60
61
|
}, "*");
|
|
61
62
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
|
@@ -53,7 +53,8 @@ const setupBrowserForEditing = (options = {}) => {
|
|
|
53
53
|
// Supports builder-model="..." attribute which is needed to
|
|
54
54
|
// scope our '+ add block' button styling
|
|
55
55
|
supportsAddBlockScoping: true,
|
|
56
|
-
supportsCustomBreakpoints: true
|
|
56
|
+
supportsCustomBreakpoints: true,
|
|
57
|
+
blockLevelPersonalization: true
|
|
57
58
|
}
|
|
58
59
|
}, "*");
|
|
59
60
|
(_b = window.parent) == null ? void 0 : _b.postMessage({
|
package/package.json
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WARNING: This file contains functions that get stringified and inlined into the HTML at build-time.
|
|
3
|
+
* They cannot import anything.
|
|
4
|
+
*/
|
|
5
|
+
import type { Query, UserAttributes } from '../helpers';
|
|
6
|
+
export declare function filterWithCustomTargeting(userAttributes: UserAttributes, query: Query[], startDate?: string, endDate?: string): boolean;
|
|
7
|
+
export declare const PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, locale) {\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 function removeVariants() {\n variants?.forEach(function (_, index) {\n document.querySelector('template[data-variant-id=\"' + blockId + '-' + index + '\"]')?.remove();\n });\n document.querySelector('script[data-id=\"variants-script-' + blockId + '\"]')?.remove();\n document.querySelector('style[data-id=\"variants-styles-' + blockId + '\"]')?.remove();\n }\n const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const isDebug = location.href.includes('builder.debug=true');\n if (isDebug) {\n console.debug('PersonalizationContainer', {\n attributes,\n variants,\n winningVariantIndex\n });\n }\n if (winningVariantIndex !== -1) {\n const winningVariant = document.querySelector('template[data-variant-id=\"' + blockId + '-' + winningVariantIndex + '\"]');\n if (winningVariant) {\n const parentNode = winningVariant.parentNode;\n if (parentNode) {\n const newParent = parentNode.cloneNode(false);\n newParent.appendChild(winningVariant.content.firstChild);\n newParent.appendChild(winningVariant.content.lastChild);\n parentNode.parentNode?.replaceChild(newParent, parentNode);\n }\n if (isDebug) {\n console.debug('PersonalizationContainer', 'Winning variant Replaced:', winningVariant);\n }\n }\n } else if (variants && variants.length > 0) {\n removeVariants();\n }\n}";
|
|
8
|
+
export declare const FILTER_WITH_CUSTOM_TARGETING_SCRIPT = "function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {\n function isString(val) {\n return typeof val === 'string';\n }\n function isNumber(val) {\n return typeof val === 'number';\n }\n function objectMatchesQuery(userattr, query) {\n const result = (() => {\n const property = query.property;\n const operator = query.operator;\n let testValue = query.value;\n if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {\n testValue = query.value.slice(0, -1);\n }\n if (!(property && operator)) {\n return true;\n }\n if (Array.isArray(testValue)) {\n if (operator === 'isNot') {\n return testValue.every(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n return !!testValue.find(val => objectMatchesQuery(userattr, {\n property,\n operator,\n value: val\n }));\n }\n const value = userattr[property];\n if (Array.isArray(value)) {\n return value.includes(testValue);\n }\n switch (operator) {\n case 'is':\n return value === testValue;\n case 'isNot':\n return value !== testValue;\n case 'contains':\n return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));\n case 'startsWith':\n return isString(value) && value.startsWith(String(testValue));\n case 'endsWith':\n return isString(value) && value.endsWith(String(testValue));\n case 'greaterThan':\n return isNumber(value) && isNumber(testValue) && value > testValue;\n case 'lessThan':\n return isNumber(value) && isNumber(testValue) && value < testValue;\n case 'greaterThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value >= testValue;\n case 'lessThanOrEqualTo':\n return isNumber(value) && isNumber(testValue) && value <= testValue;\n default:\n return false;\n }\n })();\n return result;\n }\n const item = {\n query,\n startDate,\n endDate\n };\n const now = userAttributes.date && new Date(userAttributes.date) || new Date();\n if (item.startDate && new Date(item.startDate) > now) {\n return false;\n } else if (item.endDate && new Date(item.endDate) < now) {\n return false;\n }\n if (!item.query || !item.query.length) {\n return true;\n }\n return item.query.every(filter => {\n return objectMatchesQuery(userAttributes, filter);\n });\n}";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BuilderBlock } from '../../types/builder-block';
|
|
2
|
+
import type { PersonalizationContainerProps } from './personalization-container.types';
|
|
3
|
+
export type UserAttributes = {
|
|
4
|
+
date?: string | Date;
|
|
5
|
+
urlPath?: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
type QueryOperator = 'is' | 'isNot' | 'contains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'lessThan' | 'greaterThanOrEqualTo' | 'lessThanOrEqualTo';
|
|
9
|
+
type QueryValue = string | number | boolean | Array<string | number | boolean>;
|
|
10
|
+
export type Query = {
|
|
11
|
+
property: string;
|
|
12
|
+
operator: QueryOperator;
|
|
13
|
+
value: QueryValue;
|
|
14
|
+
};
|
|
15
|
+
export declare function checkShouldRenderVariants(variants: PersonalizationContainerProps['variants'], canTrack: boolean): boolean;
|
|
16
|
+
export declare function getBlocksToRender({ variants, previewingIndex, isHydrated, filteredVariants, fallbackBlocks }: {
|
|
17
|
+
variants: PersonalizationContainerProps['variants'];
|
|
18
|
+
previewingIndex?: number | null;
|
|
19
|
+
isHydrated: boolean;
|
|
20
|
+
filteredVariants: PersonalizationContainerProps['variants'];
|
|
21
|
+
fallbackBlocks?: BuilderBlock[];
|
|
22
|
+
}): {
|
|
23
|
+
blocks: BuilderBlock[];
|
|
24
|
+
path: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export declare const getPersonalizationScript: (variants: PersonalizationContainerProps["variants"], blockId: string, locale?: string) => string;
|
|
27
|
+
export { filterWithCustomTargeting } from './helpers/inlined-fns';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './personalization-container.jsx';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BuilderBlock } from '../../types/builder-block';
|
|
2
|
+
import type { BuilderDataProps } from '../../types/builder-props';
|
|
3
|
+
import type { Query } from './helpers';
|
|
4
|
+
export type PersonalizationContainerProps = {
|
|
5
|
+
children?: any;
|
|
6
|
+
attributes?: any;
|
|
7
|
+
previewingIndex?: number | null;
|
|
8
|
+
variants?: Array<{
|
|
9
|
+
blocks: BuilderBlock[];
|
|
10
|
+
query: Query[];
|
|
11
|
+
startDate?: string;
|
|
12
|
+
endDate?: string;
|
|
13
|
+
}>;
|
|
14
|
+
} & BuilderDataProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.17.
|
|
1
|
+
export declare const SDK_VERSION = "0.17.7";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface UserAttributes {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export declare const USER_ATTRIBUTES_COOKIE_NAME = "builder.userAttributes";
|
|
5
|
+
export declare function createUserAttributesService(): {
|
|
6
|
+
setUserAttributes(newAttrs: UserAttributes): void;
|
|
7
|
+
getUserAttributes(): any;
|
|
8
|
+
subscribeOnUserAttributesChange(callback: (attrs: UserAttributes) => void): () => void;
|
|
9
|
+
setCanTrack(value: boolean): void;
|
|
10
|
+
};
|
|
11
|
+
export declare const userAttributesService: {
|
|
12
|
+
setUserAttributes(newAttrs: UserAttributes): void;
|
|
13
|
+
getUserAttributes(): any;
|
|
14
|
+
subscribeOnUserAttributesChange(callback: (attrs: UserAttributes) => void): () => void;
|
|
15
|
+
setCanTrack(value: boolean): void;
|
|
16
|
+
};
|
|
17
|
+
export declare const setClientUserAttributes: (attributes: UserAttributes) => void;
|