@builder.io/sdk-qwik 0.18.12 → 0.18.13

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.
Files changed (55) hide show
  1. package/lib/browser/blocks/personalization-container/component-info.qwik.cjs +48 -0
  2. package/lib/browser/blocks/personalization-container/component-info.qwik.mjs +48 -0
  3. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  4. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  5. package/lib/browser/blocks/personalization-container/helpers.qwik.cjs +86 -0
  6. package/lib/browser/blocks/personalization-container/helpers.qwik.mjs +87 -0
  7. package/lib/browser/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  8. package/lib/browser/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  9. package/lib/browser/components/blocks/blocks.qwik.cjs +37 -34
  10. package/lib/browser/components/blocks/blocks.qwik.mjs +38 -35
  11. package/lib/browser/components/content-variants/content-variants.qwik.cjs +42 -21
  12. package/lib/browser/components/content-variants/content-variants.qwik.mjs +42 -21
  13. package/lib/browser/constants/builder-registered-components.qwik.cjs +14 -10
  14. package/lib/browser/constants/builder-registered-components.qwik.mjs +14 -10
  15. package/lib/browser/constants/sdk-version.qwik.cjs +1 -1
  16. package/lib/browser/constants/sdk-version.qwik.mjs +1 -1
  17. package/lib/edge/blocks/personalization-container/component-info.qwik.cjs +48 -0
  18. package/lib/edge/blocks/personalization-container/component-info.qwik.mjs +48 -0
  19. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  20. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  21. package/lib/edge/blocks/personalization-container/helpers.qwik.cjs +86 -0
  22. package/lib/edge/blocks/personalization-container/helpers.qwik.mjs +87 -0
  23. package/lib/edge/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  24. package/lib/edge/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  25. package/lib/edge/components/blocks/blocks.qwik.cjs +37 -34
  26. package/lib/edge/components/blocks/blocks.qwik.mjs +38 -35
  27. package/lib/edge/components/content-variants/content-variants.qwik.cjs +42 -21
  28. package/lib/edge/components/content-variants/content-variants.qwik.mjs +42 -21
  29. package/lib/edge/constants/builder-registered-components.qwik.cjs +14 -11
  30. package/lib/edge/constants/builder-registered-components.qwik.mjs +14 -11
  31. package/lib/edge/constants/sdk-version.qwik.cjs +1 -1
  32. package/lib/edge/constants/sdk-version.qwik.mjs +1 -1
  33. package/lib/node/blocks/personalization-container/component-info.qwik.cjs +48 -0
  34. package/lib/node/blocks/personalization-container/component-info.qwik.mjs +48 -0
  35. package/lib/node/blocks/personalization-container/helpers/inlined-fns.qwik.cjs +82 -0
  36. package/lib/node/blocks/personalization-container/helpers/inlined-fns.qwik.mjs +82 -0
  37. package/lib/node/blocks/personalization-container/helpers.qwik.cjs +86 -0
  38. package/lib/node/blocks/personalization-container/helpers.qwik.mjs +87 -0
  39. package/lib/node/blocks/personalization-container/personalization-container.qwik.cjs +382 -0
  40. package/lib/node/blocks/personalization-container/personalization-container.qwik.mjs +382 -0
  41. package/lib/node/components/blocks/blocks.qwik.cjs +37 -34
  42. package/lib/node/components/blocks/blocks.qwik.mjs +38 -35
  43. package/lib/node/components/content-variants/content-variants.qwik.cjs +42 -21
  44. package/lib/node/components/content-variants/content-variants.qwik.mjs +42 -21
  45. package/lib/node/constants/builder-registered-components.qwik.cjs +14 -11
  46. package/lib/node/constants/builder-registered-components.qwik.mjs +14 -11
  47. package/lib/node/constants/sdk-version.qwik.cjs +1 -1
  48. package/lib/node/constants/sdk-version.qwik.mjs +1 -1
  49. package/package.json +2 -2
  50. package/types/src/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
  51. package/types/src/blocks/personalization-container/helpers.d.ts +24 -4
  52. package/types/src/blocks/personalization-container/personalization-container.types.d.ts +2 -2
  53. package/types/src/components/blocks/blocks-wrapper.d.ts +13 -1
  54. package/types/src/components/blocks/blocks.types.d.ts +1 -1
  55. package/types/src/constants/sdk-version.d.ts +1 -1
@@ -2,6 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const qwik = require("@builder.io/qwik");
4
4
  const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
5
+ const helpers$1 = require("../../blocks/personalization-container/helpers.qwik.cjs");
5
6
  const target = require("../../constants/target.qwik.cjs");
6
7
  const abTests = require("../../helpers/ab-tests.qwik.cjs");
7
8
  const canTrack = require("../../helpers/canTrack.qwik.cjs");
@@ -49,22 +50,42 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
49
50
  ]));
50
51
  return /* @__PURE__ */ qwik._jsxC(qwik.Fragment, {
51
52
  children: [
52
- !props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
53
- id: "builderio-init-variants-fns",
54
- get scriptStr() {
55
- return helpers.getInitVariantsFnsScriptString();
56
- },
57
- get nonce() {
58
- return props.nonce || "";
59
- },
60
- [qwik._IMMUTABLE]: {
61
- id: qwik._IMMUTABLE,
62
- nonce: qwik._fnSignal((p0) => p0.nonce || "", [
63
- props
64
- ], 'p0.nonce||""'),
65
- scriptStr: qwik._IMMUTABLE
66
- }
67
- }, 3, "XM_0") : null,
53
+ !props.isNestedRender && target.TARGET !== "reactNative" ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
54
+ children: [
55
+ /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
56
+ id: "builderio-init-variants-fns",
57
+ get scriptStr() {
58
+ return helpers.getInitVariantsFnsScriptString();
59
+ },
60
+ get nonce() {
61
+ return props.nonce || "";
62
+ },
63
+ [qwik._IMMUTABLE]: {
64
+ id: qwik._IMMUTABLE,
65
+ nonce: qwik._fnSignal((p0) => p0.nonce || "", [
66
+ props
67
+ ], 'p0.nonce||""'),
68
+ scriptStr: qwik._IMMUTABLE
69
+ }
70
+ }, 3, "XM_0"),
71
+ helpers$1.SDKS_SUPPORTING_PERSONALIZATION.includes(target.TARGET) ? /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
72
+ id: "builderio-init-personalization-variants-fns",
73
+ get nonce() {
74
+ return props.nonce || "";
75
+ },
76
+ get scriptStr() {
77
+ return helpers$1.getInitPersonalizationVariantsFnsScriptString();
78
+ },
79
+ [qwik._IMMUTABLE]: {
80
+ id: qwik._IMMUTABLE,
81
+ nonce: qwik._fnSignal((p0) => p0.nonce || "", [
82
+ props
83
+ ], 'p0.nonce||""'),
84
+ scriptStr: qwik._IMMUTABLE
85
+ }
86
+ }, 3, "XM_1") : null
87
+ ]
88
+ }, 1, "XM_2") : null,
68
89
  state.shouldRenderVariants ? /* @__PURE__ */ qwik._jsxC(jsxRuntime.Fragment, {
69
90
  children: [
70
91
  /* @__PURE__ */ qwik._jsxC(inlinedStyles.InlinedStyles, {
@@ -84,7 +105,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
84
105
  hideVariantsStyleString
85
106
  ], "p0.value")
86
107
  }
87
- }, 3, "XM_1"),
108
+ }, 3, "XM_3"),
88
109
  /* @__PURE__ */ qwik._jsxC(inlinedScript.InlinedScript, {
89
110
  id: "builderio-variants-visibility",
90
111
  get scriptStr() {
@@ -102,7 +123,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
102
123
  updateCookieAndStylesScriptStr
103
124
  ], "p0.value")
104
125
  }
105
- }, 3, "XM_2"),
126
+ }, 3, "XM_4"),
106
127
  (helpers.getVariants(props.content) || []).map((variant) => {
107
128
  return /* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
108
129
  get apiHost() {
@@ -227,7 +248,7 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
227
248
  }, 3, variant.testVariationId);
228
249
  })
229
250
  ]
230
- }, 1, "XM_3") : null,
251
+ }, 1, "XM_5") : null,
231
252
  /* @__PURE__ */ qwik._jsxC(content.ContentComponent, {
232
253
  get apiHost() {
233
254
  return props.apiHost;
@@ -353,9 +374,9 @@ const ContentVariants = /* @__PURE__ */ qwik.componentQrl(/* @__PURE__ */ qwik.i
353
374
  props
354
375
  ], "p0.trustedHosts")
355
376
  }
356
- }, 3, "XM_4")
377
+ }, 3, "XM_6")
357
378
  ]
358
- }, 1, "XM_5");
379
+ }, 1, "XM_7");
359
380
  }, "ContentVariants_component_4tFRiQMMEfM"));
360
381
  exports.ContentVariants = ContentVariants;
361
382
  exports.default = ContentVariants;
@@ -1,5 +1,6 @@
1
1
  import { componentQrl, inlinedQrl, _jsxBranch, useStore, useComputedQrl, useLexicalScope, _jsxC, Fragment, _IMMUTABLE, _fnSignal } from "@builder.io/qwik";
2
2
  import { Fragment as Fragment$1 } from "@builder.io/qwik/jsx-runtime";
3
+ import { SDKS_SUPPORTING_PERSONALIZATION, getInitPersonalizationVariantsFnsScriptString } from "../../blocks/personalization-container/helpers.qwik.mjs";
3
4
  import { TARGET } from "../../constants/target.qwik.mjs";
4
5
  import { handleABTestingSync } from "../../helpers/ab-tests.qwik.mjs";
5
6
  import { getDefaultCanTrack } from "../../helpers/canTrack.qwik.mjs";
@@ -47,22 +48,42 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
47
48
  ]));
48
49
  return /* @__PURE__ */ _jsxC(Fragment, {
49
50
  children: [
50
- !props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(InlinedScript, {
51
- id: "builderio-init-variants-fns",
52
- get scriptStr() {
53
- return getInitVariantsFnsScriptString();
54
- },
55
- get nonce() {
56
- return props.nonce || "";
57
- },
58
- [_IMMUTABLE]: {
59
- id: _IMMUTABLE,
60
- nonce: _fnSignal((p0) => p0.nonce || "", [
61
- props
62
- ], 'p0.nonce||""'),
63
- scriptStr: _IMMUTABLE
64
- }
65
- }, 3, "XM_0") : null,
51
+ !props.isNestedRender && TARGET !== "reactNative" ? /* @__PURE__ */ _jsxC(Fragment$1, {
52
+ children: [
53
+ /* @__PURE__ */ _jsxC(InlinedScript, {
54
+ id: "builderio-init-variants-fns",
55
+ get scriptStr() {
56
+ return getInitVariantsFnsScriptString();
57
+ },
58
+ get nonce() {
59
+ return props.nonce || "";
60
+ },
61
+ [_IMMUTABLE]: {
62
+ id: _IMMUTABLE,
63
+ nonce: _fnSignal((p0) => p0.nonce || "", [
64
+ props
65
+ ], 'p0.nonce||""'),
66
+ scriptStr: _IMMUTABLE
67
+ }
68
+ }, 3, "XM_0"),
69
+ SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? /* @__PURE__ */ _jsxC(InlinedScript, {
70
+ id: "builderio-init-personalization-variants-fns",
71
+ get nonce() {
72
+ return props.nonce || "";
73
+ },
74
+ get scriptStr() {
75
+ return getInitPersonalizationVariantsFnsScriptString();
76
+ },
77
+ [_IMMUTABLE]: {
78
+ id: _IMMUTABLE,
79
+ nonce: _fnSignal((p0) => p0.nonce || "", [
80
+ props
81
+ ], 'p0.nonce||""'),
82
+ scriptStr: _IMMUTABLE
83
+ }
84
+ }, 3, "XM_1") : null
85
+ ]
86
+ }, 1, "XM_2") : null,
66
87
  state.shouldRenderVariants ? /* @__PURE__ */ _jsxC(Fragment$1, {
67
88
  children: [
68
89
  /* @__PURE__ */ _jsxC(InlinedStyles, {
@@ -82,7 +103,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
82
103
  hideVariantsStyleString
83
104
  ], "p0.value")
84
105
  }
85
- }, 3, "XM_1"),
106
+ }, 3, "XM_3"),
86
107
  /* @__PURE__ */ _jsxC(InlinedScript, {
87
108
  id: "builderio-variants-visibility",
88
109
  get scriptStr() {
@@ -100,7 +121,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
100
121
  updateCookieAndStylesScriptStr
101
122
  ], "p0.value")
102
123
  }
103
- }, 3, "XM_2"),
124
+ }, 3, "XM_4"),
104
125
  (getVariants(props.content) || []).map((variant) => {
105
126
  return /* @__PURE__ */ _jsxC(ContentComponent, {
106
127
  get apiHost() {
@@ -225,7 +246,7 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
225
246
  }, 3, variant.testVariationId);
226
247
  })
227
248
  ]
228
- }, 1, "XM_3") : null,
249
+ }, 1, "XM_5") : null,
229
250
  /* @__PURE__ */ _jsxC(ContentComponent, {
230
251
  get apiHost() {
231
252
  return props.apiHost;
@@ -351,9 +372,9 @@ const ContentVariants = /* @__PURE__ */ componentQrl(/* @__PURE__ */ inlinedQrl(
351
372
  props
352
373
  ], "p0.trustedHosts")
353
374
  }
354
- }, 3, "XM_4")
375
+ }, 3, "XM_6")
355
376
  ]
356
- }, 1, "XM_5");
377
+ }, 1, "XM_7");
357
378
  }, "ContentVariants_component_4tFRiQMMEfM"));
358
379
  export {
359
380
  ContentVariants,
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const componentInfo$9 = require("../blocks/accordion/component-info.qwik.cjs");
3
+ const componentInfo$a = require("../blocks/accordion/component-info.qwik.cjs");
4
4
  const accordion = require("../blocks/accordion/accordion.qwik.cjs");
5
5
  const componentInfo = require("../blocks/button/component-info.qwik.cjs");
6
6
  const button = require("../blocks/button/button.qwik.cjs");
@@ -10,22 +10,21 @@ 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
+ const componentInfo$8 = require("../blocks/personalization-container/component-info.qwik.cjs");
14
+ const helpers = require("../blocks/personalization-container/helpers.qwik.cjs");
15
+ const personalizationContainer = require("../blocks/personalization-container/personalization-container.qwik.cjs");
18
16
  const componentInfo$4 = require("../blocks/section/component-info.qwik.cjs");
19
17
  const section = require("../blocks/section/section.qwik.cjs");
20
18
  const componentInfo$5 = require("../blocks/slot/component-info.qwik.cjs");
21
19
  const slot = require("../blocks/slot/slot.qwik.cjs");
22
20
  const componentInfo$6 = require("../blocks/symbol/component-info.qwik.cjs");
23
21
  const symbol = require("../blocks/symbol/symbol.qwik.cjs");
24
- const componentInfo$8 = require("../blocks/tabs/component-info.qwik.cjs");
22
+ const componentInfo$9 = require("../blocks/tabs/component-info.qwik.cjs");
25
23
  const tabs = require("../blocks/tabs/tabs.qwik.cjs");
26
24
  const componentInfo$7 = require("../blocks/text/component-info.qwik.cjs");
27
25
  const text = require("../blocks/text/text.qwik.cjs");
28
26
  const extraComponents = require("./extra-components.qwik.cjs");
27
+ const target = require("./target.qwik.cjs");
29
28
  const getDefaultRegisteredComponents = () => [
30
29
  {
31
30
  component: button.Button,
@@ -59,15 +58,20 @@ const getDefaultRegisteredComponents = () => [
59
58
  component: text.Text,
60
59
  ...componentInfo$7.componentInfo
61
60
  },
62
- ...[],
61
+ ...helpers.SDKS_SUPPORTING_PERSONALIZATION.includes(target.TARGET) ? [
62
+ {
63
+ component: personalizationContainer.PersonalizationContainer,
64
+ ...componentInfo$8.componentInfo
65
+ }
66
+ ] : [],
63
67
  ...[
64
68
  {
65
69
  component: tabs.Tabs,
66
- ...componentInfo$8.componentInfo
70
+ ...componentInfo$9.componentInfo
67
71
  },
68
72
  {
69
73
  component: accordion.Accordion,
70
- ...componentInfo$9.componentInfo
74
+ ...componentInfo$a.componentInfo
71
75
  }
72
76
  ],
73
77
  ...extraComponents.getExtraComponents()
@@ -1,4 +1,4 @@
1
- import { componentInfo as componentInfo$9 } from "../blocks/accordion/component-info.qwik.mjs";
1
+ import { componentInfo as componentInfo$a } from "../blocks/accordion/component-info.qwik.mjs";
2
2
  import { Accordion } from "../blocks/accordion/accordion.qwik.mjs";
3
3
  import { componentInfo } from "../blocks/button/component-info.qwik.mjs";
4
4
  import { Button } from "../blocks/button/button.qwik.mjs";
@@ -8,22 +8,21 @@ 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
+ import { componentInfo as componentInfo$8 } from "../blocks/personalization-container/component-info.qwik.mjs";
12
+ import { SDKS_SUPPORTING_PERSONALIZATION } from "../blocks/personalization-container/helpers.qwik.mjs";
13
+ import { PersonalizationContainer } from "../blocks/personalization-container/personalization-container.qwik.mjs";
16
14
  import { componentInfo as componentInfo$4 } from "../blocks/section/component-info.qwik.mjs";
17
15
  import { SectionComponent } from "../blocks/section/section.qwik.mjs";
18
16
  import { componentInfo as componentInfo$5 } from "../blocks/slot/component-info.qwik.mjs";
19
17
  import { Slot } from "../blocks/slot/slot.qwik.mjs";
20
18
  import { componentInfo as componentInfo$6 } from "../blocks/symbol/component-info.qwik.mjs";
21
19
  import { Symbol as Symbol$1 } from "../blocks/symbol/symbol.qwik.mjs";
22
- import { componentInfo as componentInfo$8 } from "../blocks/tabs/component-info.qwik.mjs";
20
+ import { componentInfo as componentInfo$9 } from "../blocks/tabs/component-info.qwik.mjs";
23
21
  import { Tabs } from "../blocks/tabs/tabs.qwik.mjs";
24
22
  import { componentInfo as componentInfo$7 } from "../blocks/text/component-info.qwik.mjs";
25
23
  import { Text } from "../blocks/text/text.qwik.mjs";
26
24
  import { getExtraComponents } from "./extra-components.qwik.mjs";
25
+ import { TARGET } from "./target.qwik.mjs";
27
26
  const getDefaultRegisteredComponents = () => [
28
27
  {
29
28
  component: Button,
@@ -57,15 +56,20 @@ const getDefaultRegisteredComponents = () => [
57
56
  component: Text,
58
57
  ...componentInfo$7
59
58
  },
60
- ...[],
59
+ ...SDKS_SUPPORTING_PERSONALIZATION.includes(TARGET) ? [
60
+ {
61
+ component: PersonalizationContainer,
62
+ ...componentInfo$8
63
+ }
64
+ ] : [],
61
65
  ...[
62
66
  {
63
67
  component: Tabs,
64
- ...componentInfo$8
68
+ ...componentInfo$9
65
69
  },
66
70
  {
67
71
  component: Accordion,
68
- ...componentInfo$9
72
+ ...componentInfo$a
69
73
  }
70
74
  ],
71
75
  ...getExtraComponents()
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SDK_VERSION = "0.18.12";
3
+ const SDK_VERSION = "0.18.13";
4
4
  exports.SDK_VERSION = SDK_VERSION;
@@ -1,4 +1,4 @@
1
- const SDK_VERSION = "0.18.12";
1
+ const SDK_VERSION = "0.18.13";
2
2
  export {
3
3
  SDK_VERSION
4
4
  };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const componentInfo = {
4
+ name: "PersonalizationContainer",
5
+ shouldReceiveBuilderProps: {
6
+ builderBlock: true,
7
+ builderContext: true,
8
+ builderComponents: true
9
+ },
10
+ noWrap: true,
11
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
12
+ canHaveChildren: true,
13
+ inputs: [
14
+ {
15
+ name: "variants",
16
+ defaultValue: [],
17
+ behavior: "personalizationVariantList",
18
+ type: "list",
19
+ subFields: [
20
+ {
21
+ name: "name",
22
+ type: "text"
23
+ },
24
+ {
25
+ name: "query",
26
+ friendlyName: "Targeting rules",
27
+ type: "BuilderQuery",
28
+ defaultValue: []
29
+ },
30
+ {
31
+ name: "startDate",
32
+ type: "date"
33
+ },
34
+ {
35
+ name: "endDate",
36
+ type: "date"
37
+ },
38
+ {
39
+ name: "blocks",
40
+ type: "uiBlocks",
41
+ hideFromUI: true,
42
+ defaultValue: []
43
+ }
44
+ ]
45
+ }
46
+ ]
47
+ };
48
+ exports.componentInfo = componentInfo;
@@ -0,0 +1,48 @@
1
+ const componentInfo = {
2
+ name: "PersonalizationContainer",
3
+ shouldReceiveBuilderProps: {
4
+ builderBlock: true,
5
+ builderContext: true,
6
+ builderComponents: true
7
+ },
8
+ noWrap: true,
9
+ image: "https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F37229ed30d8c41dfb10b8cca1992053a",
10
+ canHaveChildren: true,
11
+ inputs: [
12
+ {
13
+ name: "variants",
14
+ defaultValue: [],
15
+ behavior: "personalizationVariantList",
16
+ type: "list",
17
+ subFields: [
18
+ {
19
+ name: "name",
20
+ type: "text"
21
+ },
22
+ {
23
+ name: "query",
24
+ friendlyName: "Targeting rules",
25
+ type: "BuilderQuery",
26
+ defaultValue: []
27
+ },
28
+ {
29
+ name: "startDate",
30
+ type: "date"
31
+ },
32
+ {
33
+ name: "endDate",
34
+ type: "date"
35
+ },
36
+ {
37
+ name: "blocks",
38
+ type: "uiBlocks",
39
+ hideFromUI: true,
40
+ defaultValue: []
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ };
46
+ export {
47
+ componentInfo
48
+ };
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
4
+ function isString(val) {
5
+ return typeof val === "string";
6
+ }
7
+ function isNumber(val) {
8
+ return typeof val === "number";
9
+ }
10
+ function objectMatchesQuery(userattr, query2) {
11
+ const result = (() => {
12
+ const property = query2.property;
13
+ const operator = query2.operator;
14
+ let testValue = query2.value;
15
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/"))
16
+ testValue = query2.value.slice(0, -1);
17
+ if (!(property && operator))
18
+ return true;
19
+ if (Array.isArray(testValue)) {
20
+ if (operator === "isNot")
21
+ return testValue.every((val) => objectMatchesQuery(userattr, {
22
+ property,
23
+ operator,
24
+ value: val
25
+ }));
26
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
27
+ property,
28
+ operator,
29
+ value: val
30
+ }));
31
+ }
32
+ const value = userattr[property];
33
+ if (Array.isArray(value))
34
+ return value.includes(testValue);
35
+ switch (operator) {
36
+ case "is":
37
+ return value === testValue;
38
+ case "isNot":
39
+ return value !== testValue;
40
+ case "contains":
41
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
42
+ case "startsWith":
43
+ return isString(value) && value.startsWith(String(testValue));
44
+ case "endsWith":
45
+ return isString(value) && value.endsWith(String(testValue));
46
+ case "greaterThan":
47
+ return isNumber(value) && isNumber(testValue) && value > testValue;
48
+ case "lessThan":
49
+ return isNumber(value) && isNumber(testValue) && value < testValue;
50
+ case "greaterThanOrEqualTo":
51
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
52
+ case "lessThanOrEqualTo":
53
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
54
+ default:
55
+ return false;
56
+ }
57
+ })();
58
+ return result;
59
+ }
60
+ const item = {
61
+ query,
62
+ startDate,
63
+ endDate
64
+ };
65
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
66
+ if (item.startDate && new Date(item.startDate) > now)
67
+ return false;
68
+ else if (item.endDate && new Date(item.endDate) < now)
69
+ return false;
70
+ if (!item.query || !item.query.length)
71
+ return true;
72
+ return item.query.every((filter) => {
73
+ return objectMatchesQuery(userAttributes, filter);
74
+ });
75
+ }
76
+ const PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, isHydrationTarget, 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 const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const parentDiv = document.currentScript?.parentElement;\n const variantId = parentDiv?.getAttribute('data-variant-id');\n const isDefaultVariant = variantId === `${blockId}-default`;\n const isWinningVariant = winningVariantIndex !== -1 && variantId === `${blockId}-${winningVariantIndex}` || winningVariantIndex === -1 && isDefaultVariant;\n if (isWinningVariant && !isDefaultVariant) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultVariant) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n const itsStyleEl = parentDiv?.previousElementSibling;\n if (itsStyleEl) {\n itsStyleEl.remove();\n }\n parentDiv?.remove();\n }\n const thisScript = document.currentScript;\n if (thisScript) {\n thisScript.remove();\n }\n }\n}";
77
+ 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}";
78
+ const UPDATE_VISIBILITY_STYLES_SCRIPT = "function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {\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 visibilityStylesEl = document.currentScript?.previousElementSibling;\n if (!visibilityStylesEl) {\n return;\n }\n if (isHydrationTarget) {\n visibilityStylesEl.remove();\n const currentScript = document.currentScript;\n if (currentScript) {\n currentScript.remove();\n }\n } else {\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 window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n if (winningVariantIndex !== -1) {\n let newStyleStr = variants?.map((_, index) => {\n if (index === winningVariantIndex) return '';\n return `div[data-variant-id=\"${blockId}-${index}\"] { display: none !important; } `;\n }).join('') || '';\n newStyleStr += `div[data-variant-id=\"${blockId}-default\"] { display: none !important; } `;\n visibilityStylesEl.innerHTML = newStyleStr;\n }\n }\n}";
79
+ exports.FILTER_WITH_CUSTOM_TARGETING_SCRIPT = FILTER_WITH_CUSTOM_TARGETING_SCRIPT;
80
+ exports.PERSONALIZATION_SCRIPT = PERSONALIZATION_SCRIPT;
81
+ exports.UPDATE_VISIBILITY_STYLES_SCRIPT = UPDATE_VISIBILITY_STYLES_SCRIPT;
82
+ exports.filterWithCustomTargeting = filterWithCustomTargeting;
@@ -0,0 +1,82 @@
1
+ function filterWithCustomTargeting(userAttributes, query, startDate, endDate) {
2
+ function isString(val) {
3
+ return typeof val === "string";
4
+ }
5
+ function isNumber(val) {
6
+ return typeof val === "number";
7
+ }
8
+ function objectMatchesQuery(userattr, query2) {
9
+ const result = (() => {
10
+ const property = query2.property;
11
+ const operator = query2.operator;
12
+ let testValue = query2.value;
13
+ if (query2 && query2.property === "urlPath" && query2.value && typeof query2.value === "string" && query2.value !== "/" && query2.value.endsWith("/"))
14
+ testValue = query2.value.slice(0, -1);
15
+ if (!(property && operator))
16
+ return true;
17
+ if (Array.isArray(testValue)) {
18
+ if (operator === "isNot")
19
+ return testValue.every((val) => objectMatchesQuery(userattr, {
20
+ property,
21
+ operator,
22
+ value: val
23
+ }));
24
+ return !!testValue.find((val) => objectMatchesQuery(userattr, {
25
+ property,
26
+ operator,
27
+ value: val
28
+ }));
29
+ }
30
+ const value = userattr[property];
31
+ if (Array.isArray(value))
32
+ return value.includes(testValue);
33
+ switch (operator) {
34
+ case "is":
35
+ return value === testValue;
36
+ case "isNot":
37
+ return value !== testValue;
38
+ case "contains":
39
+ return (isString(value) || Array.isArray(value)) && value.includes(String(testValue));
40
+ case "startsWith":
41
+ return isString(value) && value.startsWith(String(testValue));
42
+ case "endsWith":
43
+ return isString(value) && value.endsWith(String(testValue));
44
+ case "greaterThan":
45
+ return isNumber(value) && isNumber(testValue) && value > testValue;
46
+ case "lessThan":
47
+ return isNumber(value) && isNumber(testValue) && value < testValue;
48
+ case "greaterThanOrEqualTo":
49
+ return isNumber(value) && isNumber(testValue) && value >= testValue;
50
+ case "lessThanOrEqualTo":
51
+ return isNumber(value) && isNumber(testValue) && value <= testValue;
52
+ default:
53
+ return false;
54
+ }
55
+ })();
56
+ return result;
57
+ }
58
+ const item = {
59
+ query,
60
+ startDate,
61
+ endDate
62
+ };
63
+ const now = userAttributes.date && new Date(userAttributes.date) || /* @__PURE__ */ new Date();
64
+ if (item.startDate && new Date(item.startDate) > now)
65
+ return false;
66
+ else if (item.endDate && new Date(item.endDate) < now)
67
+ return false;
68
+ if (!item.query || !item.query.length)
69
+ return true;
70
+ return item.query.every((filter) => {
71
+ return objectMatchesQuery(userAttributes, filter);
72
+ });
73
+ }
74
+ const PERSONALIZATION_SCRIPT = "function getPersonalizedVariant(variants, blockId, isHydrationTarget, 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 const attributes = JSON.parse(getCookie('builder.userAttributes') || '{}');\n if (locale) {\n attributes.locale = locale;\n }\n const winningVariantIndex = variants?.findIndex(function (variant) {\n return window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n const parentDiv = document.currentScript?.parentElement;\n const variantId = parentDiv?.getAttribute('data-variant-id');\n const isDefaultVariant = variantId === `${blockId}-default`;\n const isWinningVariant = winningVariantIndex !== -1 && variantId === `${blockId}-${winningVariantIndex}` || winningVariantIndex === -1 && isDefaultVariant;\n if (isWinningVariant && !isDefaultVariant) {\n parentDiv?.removeAttribute('hidden');\n parentDiv?.removeAttribute('aria-hidden');\n } else if (!isWinningVariant && isDefaultVariant) {\n parentDiv?.setAttribute('hidden', 'true');\n parentDiv?.setAttribute('aria-hidden', 'true');\n }\n if (isHydrationTarget) {\n if (!isWinningVariant) {\n const itsStyleEl = parentDiv?.previousElementSibling;\n if (itsStyleEl) {\n itsStyleEl.remove();\n }\n parentDiv?.remove();\n }\n const thisScript = document.currentScript;\n if (thisScript) {\n thisScript.remove();\n }\n }\n}";
75
+ 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}";
76
+ const UPDATE_VISIBILITY_STYLES_SCRIPT = "function updateVisibilityStylesScript(variants, blockId, isHydrationTarget, locale) {\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 visibilityStylesEl = document.currentScript?.previousElementSibling;\n if (!visibilityStylesEl) {\n return;\n }\n if (isHydrationTarget) {\n visibilityStylesEl.remove();\n const currentScript = document.currentScript;\n if (currentScript) {\n currentScript.remove();\n }\n } else {\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 window.filterWithCustomTargeting(attributes, variant.query, variant.startDate, variant.endDate);\n });\n if (winningVariantIndex !== -1) {\n let newStyleStr = variants?.map((_, index) => {\n if (index === winningVariantIndex) return '';\n return `div[data-variant-id=\"${blockId}-${index}\"] { display: none !important; } `;\n }).join('') || '';\n newStyleStr += `div[data-variant-id=\"${blockId}-default\"] { display: none !important; } `;\n visibilityStylesEl.innerHTML = newStyleStr;\n }\n }\n}";
77
+ export {
78
+ FILTER_WITH_CUSTOM_TARGETING_SCRIPT,
79
+ PERSONALIZATION_SCRIPT,
80
+ UPDATE_VISIBILITY_STYLES_SCRIPT,
81
+ filterWithCustomTargeting
82
+ };