@builder.io/sdk-react-nextjs 0.18.11 → 0.18.15
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/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/browser/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/browser/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/browser/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/browser/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/browser/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/browser/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/browser/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/browser/blocks/symbol/symbol.cjs +1 -1
- package/lib/browser/blocks/symbol/symbol.mjs +23 -23
- package/lib/browser/components/block/block.cjs +1 -1
- package/lib/browser/components/block/block.mjs +1 -0
- package/lib/browser/components/block/components/interactive-element.cjs +1 -1
- package/lib/browser/components/block/components/interactive-element.mjs +16 -12
- package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/browser/components/blocks/blocks.cjs +1 -1
- package/lib/browser/components/blocks/blocks.mjs +21 -18
- package/lib/browser/components/content-variants/content-variants.cjs +1 -1
- package/lib/browser/components/content-variants/content-variants.mjs +51 -40
- package/lib/browser/constants/builder-registered-components.cjs +1 -1
- package/lib/browser/constants/builder-registered-components.mjs +44 -36
- package/lib/browser/constants/extra-components.cjs +1 -1
- package/lib/browser/constants/extra-components.mjs +3 -2
- package/lib/browser/constants/sdk-version.cjs +1 -1
- package/lib/browser/constants/sdk-version.mjs +1 -1
- package/lib/browser/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/browser/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/browser/helpers/user-attributes.cjs +1 -1
- package/lib/browser/helpers/user-attributes.mjs +30 -24
- package/lib/edge/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/edge/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/edge/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/edge/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/edge/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/edge/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/edge/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/edge/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/edge/blocks/symbol/symbol.cjs +1 -1
- package/lib/edge/blocks/symbol/symbol.mjs +23 -23
- package/lib/edge/components/block/block.cjs +1 -1
- package/lib/edge/components/block/block.mjs +1 -0
- package/lib/edge/components/block/components/interactive-element.cjs +1 -1
- package/lib/edge/components/block/components/interactive-element.mjs +16 -12
- package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/edge/components/blocks/blocks.cjs +1 -1
- package/lib/edge/components/blocks/blocks.mjs +21 -18
- package/lib/edge/components/content-variants/content-variants.cjs +1 -1
- package/lib/edge/components/content-variants/content-variants.mjs +51 -40
- package/lib/edge/constants/builder-registered-components.cjs +1 -1
- package/lib/edge/constants/builder-registered-components.mjs +44 -36
- package/lib/edge/constants/extra-components.cjs +1 -1
- package/lib/edge/constants/extra-components.mjs +3 -2
- package/lib/edge/constants/sdk-version.cjs +1 -1
- package/lib/edge/constants/sdk-version.mjs +1 -1
- package/lib/edge/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/edge/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/edge/helpers/user-attributes.cjs +1 -1
- package/lib/edge/helpers/user-attributes.mjs +30 -24
- package/lib/node/blocks/personalization-container/component-info.cjs +1 -0
- package/lib/node/blocks/personalization-container/component-info.mjs +40 -0
- package/lib/node/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
- package/lib/node/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
- package/lib/node/blocks/personalization-container/helpers.cjs +5 -0
- package/lib/node/blocks/personalization-container/helpers.mjs +64 -0
- package/lib/node/blocks/personalization-container/personalization-container.cjs +1 -0
- package/lib/node/blocks/personalization-container/personalization-container.mjs +214 -0
- package/lib/node/blocks/symbol/symbol.cjs +1 -1
- package/lib/node/blocks/symbol/symbol.mjs +23 -23
- package/lib/node/components/block/block.cjs +1 -1
- package/lib/node/components/block/block.mjs +1 -0
- package/lib/node/components/block/components/interactive-element.cjs +1 -1
- package/lib/node/components/block/components/interactive-element.mjs +16 -12
- package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
- package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
- package/lib/node/components/blocks/blocks.cjs +1 -1
- package/lib/node/components/blocks/blocks.mjs +21 -18
- package/lib/node/components/content-variants/content-variants.cjs +1 -1
- package/lib/node/components/content-variants/content-variants.mjs +51 -40
- package/lib/node/constants/builder-registered-components.cjs +1 -1
- package/lib/node/constants/builder-registered-components.mjs +44 -36
- package/lib/node/constants/extra-components.cjs +1 -1
- package/lib/node/constants/extra-components.mjs +3 -2
- package/lib/node/constants/sdk-version.cjs +1 -1
- package/lib/node/constants/sdk-version.mjs +1 -1
- package/lib/node/helpers/no-serialize-wrapper.cjs +1 -0
- package/lib/node/helpers/no-serialize-wrapper.mjs +6 -0
- package/lib/node/helpers/user-attributes.cjs +1 -1
- package/lib/node/helpers/user-attributes.mjs +30 -24
- package/package.json +2 -2
- package/types/cjs/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
- package/types/cjs/blocks/personalization-container/helpers.d.ts +24 -4
- package/types/cjs/blocks/personalization-container/personalization-container.types.d.ts +2 -2
- package/types/cjs/components/blocks/blocks-wrapper.d.ts +13 -1
- package/types/cjs/components/blocks/blocks.types.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/cjs/helpers/no-serialize-wrapper.d.ts +1 -0
- package/types/cjs/helpers/user-attributes.d.ts +6 -2
- package/types/esm/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
- package/types/esm/blocks/personalization-container/helpers.d.ts +24 -4
- package/types/esm/blocks/personalization-container/personalization-container.types.d.ts +2 -2
- package/types/esm/components/blocks/blocks-wrapper.d.ts +13 -1
- package/types/esm/components/blocks/blocks.types.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/types/esm/helpers/no-serialize-wrapper.d.ts +1 -0
- package/types/esm/helpers/user-attributes.d.ts +6 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../functions/get-fetch.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./target.cjs");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");const n=require("../blocks/button/component-info.cjs"),e=require("../blocks/button/button.cjs"),t=require("../blocks/columns/component-info.cjs"),r=require("../blocks/columns/columns.cjs"),c=require("../blocks/fragment/component-info.cjs"),s=require("../blocks/fragment/fragment.cjs"),i=require("../blocks/image/component-info.cjs"),m=require("../blocks/image/image.cjs"),p=require("../blocks/personalization-container/component-info.cjs"),u=require("../blocks/personalization-container/helpers.cjs"),q=require("../blocks/personalization-container/personalization-container.cjs"),f=require("../blocks/section/component-info.cjs"),I=require("../blocks/section/section.cjs"),a=require("../blocks/slot/component-info.cjs"),l=require("../blocks/slot/slot.cjs"),g=require("../blocks/symbol/component-info.cjs"),$=require("../blocks/symbol/symbol.cjs"),S=require("../blocks/text/component-info.cjs"),d=require("../blocks/text/text.cjs"),C=require("./extra-components.cjs"),R=()=>[{component:e,...n.componentInfo},{component:r,...t.componentInfo},{component:s,...c.componentInfo},{component:m,...i.componentInfo},{component:I,...f.componentInfo},{component:l,...a.componentInfo},{component:$,...g.componentInfo},{component:d,...S.componentInfo},...u.SDKS_SUPPORTING_PERSONALIZATION.includes(o.TARGET)?[{component:q,...p.componentInfo}]:[],...C.getExtraComponents()];exports.getDefaultRegisteredComponents=R;
|
|
@@ -1,48 +1,56 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
+
import { TARGET as o } from "./target.mjs";
|
|
4
|
+
import "../helpers/user-attributes.mjs";
|
|
3
5
|
import "../functions/get-fetch.mjs";
|
|
4
|
-
import { componentInfo as
|
|
5
|
-
import
|
|
6
|
-
import { componentInfo as
|
|
7
|
-
import
|
|
8
|
-
import { componentInfo as
|
|
9
|
-
import
|
|
10
|
-
import { componentInfo as
|
|
11
|
-
import
|
|
12
|
-
import { componentInfo as c } from "../blocks/
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import s from "../blocks/
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import C from "../blocks/
|
|
20
|
-
import
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
6
|
+
import { componentInfo as n } from "../blocks/button/component-info.mjs";
|
|
7
|
+
import m from "../blocks/button/button.mjs";
|
|
8
|
+
import { componentInfo as t } from "../blocks/columns/component-info.mjs";
|
|
9
|
+
import p from "../blocks/columns/columns.mjs";
|
|
10
|
+
import { componentInfo as r } from "../blocks/fragment/component-info.mjs";
|
|
11
|
+
import e from "../blocks/fragment/fragment.mjs";
|
|
12
|
+
import { componentInfo as f } from "../blocks/image/component-info.mjs";
|
|
13
|
+
import i from "../blocks/image/image.mjs";
|
|
14
|
+
import { componentInfo as c } from "../blocks/personalization-container/component-info.mjs";
|
|
15
|
+
import { SDKS_SUPPORTING_PERSONALIZATION as I } from "../blocks/personalization-container/helpers.mjs";
|
|
16
|
+
import a from "../blocks/personalization-container/personalization-container.mjs";
|
|
17
|
+
import { componentInfo as s } from "../blocks/section/component-info.mjs";
|
|
18
|
+
import $ from "../blocks/section/section.mjs";
|
|
19
|
+
import { componentInfo as S } from "../blocks/slot/component-info.mjs";
|
|
20
|
+
import l from "../blocks/slot/slot.mjs";
|
|
21
|
+
import { componentInfo as C } from "../blocks/symbol/component-info.mjs";
|
|
22
|
+
import g from "../blocks/symbol/symbol.mjs";
|
|
23
|
+
import { componentInfo as T } from "../blocks/text/component-info.mjs";
|
|
24
|
+
import u from "../blocks/text/text.mjs";
|
|
25
|
+
import { getExtraComponents as P } from "./extra-components.mjs";
|
|
26
|
+
const H = () => [{
|
|
27
|
+
component: m,
|
|
28
|
+
...n
|
|
24
29
|
}, {
|
|
25
|
-
component:
|
|
26
|
-
...
|
|
30
|
+
component: p,
|
|
31
|
+
...t
|
|
27
32
|
}, {
|
|
28
|
-
component:
|
|
29
|
-
...
|
|
30
|
-
}, {
|
|
31
|
-
component: f,
|
|
32
|
-
...e
|
|
33
|
+
component: e,
|
|
34
|
+
...r
|
|
33
35
|
}, {
|
|
34
36
|
component: i,
|
|
35
|
-
...
|
|
36
|
-
}, {
|
|
37
|
-
component: s,
|
|
38
|
-
...I
|
|
37
|
+
...f
|
|
39
38
|
}, {
|
|
40
39
|
component: $,
|
|
41
|
-
...
|
|
40
|
+
...s
|
|
42
41
|
}, {
|
|
43
|
-
component:
|
|
44
|
-
...
|
|
45
|
-
},
|
|
42
|
+
component: l,
|
|
43
|
+
...S
|
|
44
|
+
}, {
|
|
45
|
+
component: g,
|
|
46
|
+
...C
|
|
47
|
+
}, {
|
|
48
|
+
component: u,
|
|
49
|
+
...T
|
|
50
|
+
}, ...I.includes(o) ? [{
|
|
51
|
+
component: a,
|
|
52
|
+
...c
|
|
53
|
+
}] : [], ...P()];
|
|
46
54
|
export {
|
|
47
|
-
|
|
55
|
+
H as getDefaultRegisteredComponents
|
|
48
56
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../blocks/custom-code/component-info.cjs"),e=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),t=require("../blocks/embed/embed.cjs");require("react/jsx-runtime");require("react");require("../functions/get-fetch.cjs");const r=require("../blocks/img/component-info.cjs"),c=require("../blocks/img/img.cjs"),m=require("../blocks/video/component-info.cjs"),i=require("../blocks/video/video.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../blocks/custom-code/component-info.cjs"),e=require("../blocks/custom-code/custom-code.cjs"),n=require("../blocks/embed/component-info.cjs"),t=require("../blocks/embed/embed.cjs");require("react/jsx-runtime");require("react");require("../helpers/user-attributes.cjs");require("../functions/get-fetch.cjs");const r=require("../blocks/img/component-info.cjs"),c=require("../blocks/img/img.cjs"),m=require("../blocks/video/component-info.cjs"),i=require("../blocks/video/video.cjs"),u=()=>[{component:e,...o.componentInfo},{component:t,...n.componentInfo},{component:c,...r.componentInfo},{component:i,...m.componentInfo}];exports.getExtraComponents=u;
|
|
@@ -4,12 +4,13 @@ import { componentInfo as n } from "../blocks/embed/component-info.mjs";
|
|
|
4
4
|
import t from "../blocks/embed/embed.mjs";
|
|
5
5
|
import "react/jsx-runtime";
|
|
6
6
|
import "react";
|
|
7
|
+
import "../helpers/user-attributes.mjs";
|
|
7
8
|
import "../functions/get-fetch.mjs";
|
|
8
9
|
import { componentInfo as p } from "../blocks/img/component-info.mjs";
|
|
9
10
|
import r from "../blocks/img/img.mjs";
|
|
10
11
|
import { componentInfo as e } from "../blocks/video/component-info.mjs";
|
|
11
12
|
import f from "../blocks/video/video.mjs";
|
|
12
|
-
const
|
|
13
|
+
const u = () => [{
|
|
13
14
|
component: m,
|
|
14
15
|
...o
|
|
15
16
|
}, {
|
|
@@ -23,5 +24,5 @@ const b = () => [{
|
|
|
23
24
|
...e
|
|
24
25
|
}];
|
|
25
26
|
export {
|
|
26
|
-
|
|
27
|
+
u as getExtraComponents
|
|
27
28
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.15";exports.SDK_VERSION=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e){return e}exports.noSerializeWrapper=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../constants/target.cjs"),i=require("../functions/is-browser.cjs"),_=require("./cookie.cjs"),A=require("./no-serialize-wrapper.cjs"),u="builder.userAttributes";function n(){let t=!0;const s=new Set;return{setUserAttributes(e){if(!i.isBrowser())return;const r={...this.getUserAttributes(),...e};_.setCookie({name:u,value:JSON.stringify(r),canTrack:t}),s.forEach(E=>E(r))},getUserAttributes(){return i.isBrowser()?JSON.parse(_.getCookieSync({name:u,canTrack:t})||"{}"):{}},subscribeOnUserAttributesChange(e,{fireImmediately:r}={}){return s.add(e),r&&e(this.getUserAttributes()),A.noSerializeWrapper(function(){s.delete(e)})},setCanTrack(e){t=e}}}let o;i.isBrowser()&&c.TARGET==="qwik"?(window.__BUILDER_USER_ATTRIBUTES_SERVICE__||(window.__BUILDER_USER_ATTRIBUTES_SERVICE__=n()),o=window.__BUILDER_USER_ATTRIBUTES_SERVICE__):o=n();const S=o,U=t=>{S.setUserAttributes(t)};exports.USER_ATTRIBUTES_COOKIE_NAME=u;exports.createUserAttributesService=n;exports.setClientUserAttributes=U;exports.userAttributesService=S;
|
|
@@ -1,45 +1,51 @@
|
|
|
1
|
+
import { TARGET as E } from "../constants/target.mjs";
|
|
1
2
|
import { isBrowser as i } from "../functions/is-browser.mjs";
|
|
2
|
-
import { setCookie as
|
|
3
|
+
import { setCookie as S, getCookieSync as U } from "./cookie.mjs";
|
|
4
|
+
import { noSerializeWrapper as A } from "./no-serialize-wrapper.mjs";
|
|
3
5
|
const u = "builder.userAttributes";
|
|
4
|
-
function
|
|
5
|
-
let
|
|
6
|
-
const
|
|
6
|
+
function o() {
|
|
7
|
+
let t = !0;
|
|
8
|
+
const s = /* @__PURE__ */ new Set();
|
|
7
9
|
return {
|
|
8
|
-
setUserAttributes(
|
|
10
|
+
setUserAttributes(e) {
|
|
9
11
|
if (!i())
|
|
10
12
|
return;
|
|
11
|
-
const
|
|
13
|
+
const r = {
|
|
12
14
|
...this.getUserAttributes(),
|
|
13
|
-
...
|
|
15
|
+
...e
|
|
14
16
|
};
|
|
15
|
-
|
|
17
|
+
S({
|
|
16
18
|
name: u,
|
|
17
|
-
value: JSON.stringify(
|
|
18
|
-
canTrack:
|
|
19
|
-
}),
|
|
19
|
+
value: JSON.stringify(r),
|
|
20
|
+
canTrack: t
|
|
21
|
+
}), s.forEach((_) => _(r));
|
|
20
22
|
},
|
|
21
23
|
getUserAttributes() {
|
|
22
|
-
return i() ? JSON.parse(
|
|
24
|
+
return i() ? JSON.parse(U({
|
|
23
25
|
name: u,
|
|
24
|
-
canTrack:
|
|
26
|
+
canTrack: t
|
|
25
27
|
}) || "{}") : {};
|
|
26
28
|
},
|
|
27
|
-
subscribeOnUserAttributesChange(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
subscribeOnUserAttributesChange(e, {
|
|
30
|
+
fireImmediately: r
|
|
31
|
+
} = {}) {
|
|
32
|
+
return s.add(e), r && e(this.getUserAttributes()), A(function() {
|
|
33
|
+
s.delete(e);
|
|
34
|
+
});
|
|
31
35
|
},
|
|
32
|
-
setCanTrack(
|
|
33
|
-
|
|
36
|
+
setCanTrack(e) {
|
|
37
|
+
t = e;
|
|
34
38
|
}
|
|
35
39
|
};
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
let n;
|
|
42
|
+
i() && E === "qwik" ? (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ || (window.__BUILDER_USER_ATTRIBUTES_SERVICE__ = o()), n = window.__BUILDER_USER_ATTRIBUTES_SERVICE__) : n = o();
|
|
43
|
+
const T = n, I = (t) => {
|
|
44
|
+
T.setUserAttributes(t);
|
|
39
45
|
};
|
|
40
46
|
export {
|
|
41
47
|
u as USER_ATTRIBUTES_COOKIE_NAME,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
o as createUserAttributesService,
|
|
49
|
+
I as setClientUserAttributes,
|
|
50
|
+
T as userAttributesService
|
|
45
51
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"PersonalizationContainer",shouldReceiveBuilderProps:{builderBlock:!0,builderContext:!0,builderComponents:!0},noWrap:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",canHaveChildren:!0,inputs:[{name:"variants",defaultValue:[],behavior:"personalizationVariantList",type:"list",subFields:[{name:"name",type:"text"},{name:"query",friendlyName:"Targeting rules",type:"BuilderQuery",defaultValue:[]},{name:"startDate",type:"date"},{name:"endDate",type:"date"},{name:"blocks",type:"uiBlocks",hideFromUI:!0,defaultValue:[]}]}]};exports.componentInfo=e;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
name: "PersonalizationContainer",
|
|
3
|
+
shouldReceiveBuilderProps: {
|
|
4
|
+
builderBlock: !0,
|
|
5
|
+
builderContext: !0,
|
|
6
|
+
builderComponents: !0
|
|
7
|
+
},
|
|
8
|
+
noWrap: !0,
|
|
9
|
+
image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
|
|
10
|
+
canHaveChildren: !0,
|
|
11
|
+
inputs: [{
|
|
12
|
+
name: "variants",
|
|
13
|
+
defaultValue: [],
|
|
14
|
+
behavior: "personalizationVariantList",
|
|
15
|
+
type: "list",
|
|
16
|
+
subFields: [{
|
|
17
|
+
name: "name",
|
|
18
|
+
type: "text"
|
|
19
|
+
}, {
|
|
20
|
+
name: "query",
|
|
21
|
+
friendlyName: "Targeting rules",
|
|
22
|
+
type: "BuilderQuery",
|
|
23
|
+
defaultValue: []
|
|
24
|
+
}, {
|
|
25
|
+
name: "startDate",
|
|
26
|
+
type: "date"
|
|
27
|
+
}, {
|
|
28
|
+
name: "endDate",
|
|
29
|
+
type: "date"
|
|
30
|
+
}, {
|
|
31
|
+
name: "blocks",
|
|
32
|
+
type: "uiBlocks",
|
|
33
|
+
hideFromUI: !0,
|
|
34
|
+
defaultValue: []
|
|
35
|
+
}]
|
|
36
|
+
}]
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
e as componentInfo
|
|
40
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(l,f,y,g){function o(r){return typeof r=="string"}function a(r){return typeof r=="number"}function c(r,n){return(()=>{const s=n.property,u=n.operator;let e=n.value;if(n&&n.property==="urlPath"&&n.value&&typeof n.value=="string"&&n.value!=="/"&&n.value.endsWith("/")&&(e=n.value.slice(0,-1)),!(s&&u))return!0;if(Array.isArray(e))return u==="isNot"?e.every(v=>c(r,{property:s,operator:u,value:v})):!!e.find(v=>c(r,{property:s,operator:u,value:v}));const t=r[s];if(Array.isArray(t))return t.includes(e);switch(u){case"is":return t===e;case"isNot":return t!==e;case"contains":return(o(t)||Array.isArray(t))&&t.includes(String(e));case"startsWith":return o(t)&&t.startsWith(String(e));case"endsWith":return o(t)&&t.endsWith(String(e));case"greaterThan":return a(t)&&a(e)&&t>e;case"lessThan":return a(t)&&a(e)&&t<e;case"greaterThanOrEqualTo":return a(t)&&a(e)&&t>=e;case"lessThanOrEqualTo":return a(t)&&a(e)&&t<=e;default:return!1}})()}const i={query:f,startDate:y,endDate:g},d=l.date&&new Date(l.date)||new Date;return i.startDate&&new Date(i.startDate)>d||i.endDate&&new Date(i.endDate)<d?!1:!i.query||!i.query.length?!0:i.query.every(r=>c(l,r))}const S=`function getPersonalizedVariant(variants, blockId, isHydrationTarget, locale) {
|
|
2
|
+
if (!navigator.cookieEnabled) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
function getCookie(name) {
|
|
6
|
+
const nameEQ = name + '=';
|
|
7
|
+
const ca = document.cookie.split(';');
|
|
8
|
+
for (let i = 0; i < ca.length; i++) {
|
|
9
|
+
let c = ca[i];
|
|
10
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
11
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
16
|
+
if (locale) {
|
|
17
|
+
attributes.locale = locale;
|
|
18
|
+
}
|
|
19
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
20
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
21
|
+
});
|
|
22
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
23
|
+
const variantId = parentDiv?.getAttribute('data-variant-id');
|
|
24
|
+
const isDefaultVariant = variantId === \`\${blockId}-default\`;
|
|
25
|
+
const isWinningVariant = winningVariantIndex !== -1 && variantId === \`\${blockId}-\${winningVariantIndex}\` || winningVariantIndex === -1 && isDefaultVariant;
|
|
26
|
+
if (isWinningVariant && !isDefaultVariant) {
|
|
27
|
+
parentDiv?.removeAttribute('hidden');
|
|
28
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
29
|
+
} else if (!isWinningVariant && isDefaultVariant) {
|
|
30
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
31
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
32
|
+
}
|
|
33
|
+
if (isHydrationTarget) {
|
|
34
|
+
if (!isWinningVariant) {
|
|
35
|
+
const itsStyleEl = parentDiv?.previousElementSibling;
|
|
36
|
+
if (itsStyleEl) {
|
|
37
|
+
itsStyleEl.remove();
|
|
38
|
+
}
|
|
39
|
+
parentDiv?.remove();
|
|
40
|
+
}
|
|
41
|
+
const thisScript = document.currentScript;
|
|
42
|
+
if (thisScript) {
|
|
43
|
+
thisScript.remove();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}`,m=`function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
|
|
47
|
+
function isString(val) {
|
|
48
|
+
return typeof val === 'string';
|
|
49
|
+
}
|
|
50
|
+
function isNumber(val) {
|
|
51
|
+
return typeof val === 'number';
|
|
52
|
+
}
|
|
53
|
+
function objectMatchesQuery(userattr, query) {
|
|
54
|
+
const result = (() => {
|
|
55
|
+
const property = query.property;
|
|
56
|
+
const operator = query.operator;
|
|
57
|
+
let testValue = query.value;
|
|
58
|
+
if (query && query.property === 'urlPath' && query.value && typeof query.value === 'string' && query.value !== '/' && query.value.endsWith('/')) {
|
|
59
|
+
testValue = query.value.slice(0, -1);
|
|
60
|
+
}
|
|
61
|
+
if (!(property && operator)) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(testValue)) {
|
|
65
|
+
if (operator === 'isNot') {
|
|
66
|
+
return testValue.every(val => objectMatchesQuery(userattr, {
|
|
67
|
+
property,
|
|
68
|
+
operator,
|
|
69
|
+
value: val
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
return !!testValue.find(val => objectMatchesQuery(userattr, {
|
|
73
|
+
property,
|
|
74
|
+
operator,
|
|
75
|
+
value: val
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
const value = userattr[property];
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
return value.includes(testValue);
|
|
81
|
+
}
|
|
82
|
+
switch (operator) {
|
|
83
|
+
case 'is':
|
|
84
|
+
return value === testValue;
|
|
85
|
+
case 'isNot':
|
|
86
|
+
return value !== testValue;
|
|
87
|
+
case 'contains':
|
|
88
|
+
return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
|
|
89
|
+
case 'startsWith':
|
|
90
|
+
return isString(value) && value.startsWith(String(testValue));
|
|
91
|
+
case 'endsWith':
|
|
92
|
+
return isString(value) && value.endsWith(String(testValue));
|
|
93
|
+
case 'greaterThan':
|
|
94
|
+
return isNumber(value) && isNumber(testValue) && value > testValue;
|
|
95
|
+
case 'lessThan':
|
|
96
|
+
return isNumber(value) && isNumber(testValue) && value < testValue;
|
|
97
|
+
case 'greaterThanOrEqualTo':
|
|
98
|
+
return isNumber(value) && isNumber(testValue) && value >= testValue;
|
|
99
|
+
case 'lessThanOrEqualTo':
|
|
100
|
+
return isNumber(value) && isNumber(testValue) && value <= testValue;
|
|
101
|
+
default:
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
})();
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
const item = {
|
|
108
|
+
query,
|
|
109
|
+
startDate,
|
|
110
|
+
endDate
|
|
111
|
+
};
|
|
112
|
+
const now = userAttributes.date && new Date(userAttributes.date) || new Date();
|
|
113
|
+
if (item.startDate && new Date(item.startDate) > now) {
|
|
114
|
+
return false;
|
|
115
|
+
} else if (item.endDate && new Date(item.endDate) < now) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (!item.query || !item.query.length) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
return item.query.every(filter => {
|
|
122
|
+
return objectMatchesQuery(userAttributes, filter);
|
|
123
|
+
});
|
|
124
|
+
}`,b=`function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {
|
|
125
|
+
function getCookie(name) {
|
|
126
|
+
const nameEQ = name + '=';
|
|
127
|
+
const ca = document.cookie.split(';');
|
|
128
|
+
for (let i = 0; i < ca.length; i++) {
|
|
129
|
+
let c = ca[i];
|
|
130
|
+
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
|
131
|
+
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
const visibilityStylesEl = document.currentScript?.previousElementSibling;
|
|
136
|
+
if (!visibilityStylesEl) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (isHydrationTarget) {
|
|
140
|
+
visibilityStylesEl.remove();
|
|
141
|
+
const currentScript = document.currentScript;
|
|
142
|
+
if (currentScript) {
|
|
143
|
+
currentScript.remove();
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');
|
|
147
|
+
if (locale) {
|
|
148
|
+
attributes.locale = locale;
|
|
149
|
+
}
|
|
150
|
+
const winningVariantIndex = variants?.findIndex(function (variant) {
|
|
151
|
+
return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);
|
|
152
|
+
});
|
|
153
|
+
if (winningVariantIndex !== -1) {
|
|
154
|
+
let newStyleStr = variants?.map((_, index) => {
|
|
155
|
+
if (index === winningVariantIndex) return '';
|
|
156
|
+
return \`div[data-variant-id="\${blockId}-\${index}"] { display: none !important; } \`;
|
|
157
|
+
}).join('') || '';
|
|
158
|
+
newStyleStr += \`div[data-variant-id="\${blockId}-default"] { display: none !important; } \`;
|
|
159
|
+
visibilityStylesEl.innerHTML = newStyleStr;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}`;exports.FILTER_WITH_CUSTOM_TARGETING_SCRIPT=m;exports.PERSONALIZATION_SCRIPT=S;exports.UPDATE_VISIBILITY_STYLES_SCRIPT=b;exports.filterWithCustomTargeting=p;
|