@builder.io/sdk-react-nextjs 0.18.10 → 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 (105) hide show
  1. package/lib/browser/blocks/image/image.cjs +4 -4
  2. package/lib/browser/blocks/image/image.mjs +19 -17
  3. package/lib/browser/blocks/personalization-container/component-info.cjs +1 -0
  4. package/lib/browser/blocks/personalization-container/component-info.mjs +40 -0
  5. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
  6. package/lib/browser/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
  7. package/lib/browser/blocks/personalization-container/helpers.cjs +5 -0
  8. package/lib/browser/blocks/personalization-container/helpers.mjs +64 -0
  9. package/lib/browser/blocks/personalization-container/personalization-container.cjs +1 -0
  10. package/lib/browser/blocks/personalization-container/personalization-container.mjs +211 -0
  11. package/lib/browser/blocks/symbol/symbol.cjs +1 -1
  12. package/lib/browser/blocks/symbol/symbol.mjs +23 -23
  13. package/lib/browser/blocks/text/component-info.cjs +1 -1
  14. package/lib/browser/blocks/text/component-info.mjs +1 -4
  15. package/lib/browser/components/block/block.cjs +1 -1
  16. package/lib/browser/components/block/block.helpers.cjs +2 -2
  17. package/lib/browser/components/block/block.helpers.mjs +19 -18
  18. package/lib/browser/components/block/block.mjs +34 -34
  19. package/lib/browser/components/block/components/interactive-element.cjs +1 -1
  20. package/lib/browser/components/block/components/interactive-element.mjs +18 -11
  21. package/lib/browser/components/blocks/blocks-wrapper.cjs +1 -1
  22. package/lib/browser/components/blocks/blocks-wrapper.mjs +2 -2
  23. package/lib/browser/components/blocks/blocks.cjs +1 -1
  24. package/lib/browser/components/blocks/blocks.mjs +21 -18
  25. package/lib/browser/components/content-variants/content-variants.cjs +1 -1
  26. package/lib/browser/components/content-variants/content-variants.mjs +51 -40
  27. package/lib/browser/constants/builder-registered-components.cjs +1 -1
  28. package/lib/browser/constants/builder-registered-components.mjs +43 -36
  29. package/lib/browser/constants/sdk-version.cjs +1 -1
  30. package/lib/browser/constants/sdk-version.mjs +1 -1
  31. package/lib/edge/blocks/image/image.cjs +4 -4
  32. package/lib/edge/blocks/image/image.mjs +19 -17
  33. package/lib/edge/blocks/personalization-container/component-info.cjs +1 -0
  34. package/lib/edge/blocks/personalization-container/component-info.mjs +40 -0
  35. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
  36. package/lib/edge/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
  37. package/lib/edge/blocks/personalization-container/helpers.cjs +5 -0
  38. package/lib/edge/blocks/personalization-container/helpers.mjs +64 -0
  39. package/lib/edge/blocks/personalization-container/personalization-container.cjs +1 -0
  40. package/lib/edge/blocks/personalization-container/personalization-container.mjs +211 -0
  41. package/lib/edge/blocks/symbol/symbol.cjs +1 -1
  42. package/lib/edge/blocks/symbol/symbol.mjs +23 -23
  43. package/lib/edge/blocks/text/component-info.cjs +1 -1
  44. package/lib/edge/blocks/text/component-info.mjs +1 -4
  45. package/lib/edge/components/block/block.cjs +1 -1
  46. package/lib/edge/components/block/block.helpers.cjs +2 -2
  47. package/lib/edge/components/block/block.helpers.mjs +19 -18
  48. package/lib/edge/components/block/block.mjs +34 -34
  49. package/lib/edge/components/block/components/interactive-element.cjs +1 -1
  50. package/lib/edge/components/block/components/interactive-element.mjs +18 -11
  51. package/lib/edge/components/blocks/blocks-wrapper.cjs +1 -1
  52. package/lib/edge/components/blocks/blocks-wrapper.mjs +2 -2
  53. package/lib/edge/components/blocks/blocks.cjs +1 -1
  54. package/lib/edge/components/blocks/blocks.mjs +21 -18
  55. package/lib/edge/components/content-variants/content-variants.cjs +1 -1
  56. package/lib/edge/components/content-variants/content-variants.mjs +51 -40
  57. package/lib/edge/constants/builder-registered-components.cjs +1 -1
  58. package/lib/edge/constants/builder-registered-components.mjs +41 -34
  59. package/lib/edge/constants/sdk-version.cjs +1 -1
  60. package/lib/edge/constants/sdk-version.mjs +1 -1
  61. package/lib/node/blocks/image/image.cjs +4 -4
  62. package/lib/node/blocks/image/image.mjs +19 -17
  63. package/lib/node/blocks/personalization-container/component-info.cjs +1 -0
  64. package/lib/node/blocks/personalization-container/component-info.mjs +40 -0
  65. package/lib/node/blocks/personalization-container/helpers/inlined-fns.cjs +162 -0
  66. package/lib/node/blocks/personalization-container/helpers/inlined-fns.mjs +225 -0
  67. package/lib/node/blocks/personalization-container/helpers.cjs +5 -0
  68. package/lib/node/blocks/personalization-container/helpers.mjs +64 -0
  69. package/lib/node/blocks/personalization-container/personalization-container.cjs +1 -0
  70. package/lib/node/blocks/personalization-container/personalization-container.mjs +211 -0
  71. package/lib/node/blocks/symbol/symbol.cjs +1 -1
  72. package/lib/node/blocks/symbol/symbol.mjs +23 -23
  73. package/lib/node/blocks/text/component-info.cjs +1 -1
  74. package/lib/node/blocks/text/component-info.mjs +1 -4
  75. package/lib/node/components/block/block.cjs +1 -1
  76. package/lib/node/components/block/block.helpers.cjs +2 -2
  77. package/lib/node/components/block/block.helpers.mjs +19 -18
  78. package/lib/node/components/block/block.mjs +34 -34
  79. package/lib/node/components/block/components/interactive-element.cjs +1 -1
  80. package/lib/node/components/block/components/interactive-element.mjs +18 -11
  81. package/lib/node/components/blocks/blocks-wrapper.cjs +1 -1
  82. package/lib/node/components/blocks/blocks-wrapper.mjs +2 -2
  83. package/lib/node/components/blocks/blocks.cjs +1 -1
  84. package/lib/node/components/blocks/blocks.mjs +21 -18
  85. package/lib/node/components/content-variants/content-variants.cjs +1 -1
  86. package/lib/node/components/content-variants/content-variants.mjs +51 -40
  87. package/lib/node/constants/builder-registered-components.cjs +1 -1
  88. package/lib/node/constants/builder-registered-components.mjs +41 -34
  89. package/lib/node/constants/sdk-version.cjs +1 -1
  90. package/lib/node/constants/sdk-version.mjs +1 -1
  91. package/package.json +2 -2
  92. package/types/cjs/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
  93. package/types/cjs/blocks/personalization-container/helpers.d.ts +24 -4
  94. package/types/cjs/blocks/personalization-container/personalization-container.types.d.ts +2 -2
  95. package/types/cjs/components/block/block.helpers.d.ts +1 -0
  96. package/types/cjs/components/blocks/blocks-wrapper.d.ts +13 -1
  97. package/types/cjs/components/blocks/blocks.types.d.ts +1 -1
  98. package/types/cjs/constants/sdk-version.d.ts +1 -1
  99. package/types/esm/blocks/personalization-container/helpers/inlined-fns.d.ts +4 -1
  100. package/types/esm/blocks/personalization-container/helpers.d.ts +24 -4
  101. package/types/esm/blocks/personalization-container/personalization-container.types.d.ts +2 -2
  102. package/types/esm/components/block/block.helpers.d.ts +1 -0
  103. package/types/esm/components/blocks/blocks-wrapper.d.ts +13 -1
  104. package/types/esm/components/blocks/blocks.types.d.ts +1 -1
  105. package/types/esm/constants/sdk-version.d.ts +1 -1
@@ -1,27 +1,28 @@
1
- import { jsxs as d, Fragment as s, jsx as i } from "react/jsx-runtime";
2
- import { TARGET as f } from "../../constants/target.mjs";
1
+ import { jsxs as o, Fragment as c, jsx as e } from "react/jsx-runtime";
2
+ import { SDKS_SUPPORTING_PERSONALIZATION as T, getInitPersonalizationVariantsFnsScriptString as V } from "../../blocks/personalization-container/helpers.mjs";
3
+ import { TARGET as m } from "../../constants/target.mjs";
3
4
  import { handleABTestingSync as W } from "../../helpers/ab-tests.mjs";
4
- import { getDefaultCanTrack as l } from "../../helpers/canTrack.mjs";
5
- import m from "../content/content.mjs";
6
- import u from "../inlined-script.mjs";
7
- import V from "../inlined-styles.mjs";
8
- import { checkShouldRenderVariants as b, getInitVariantsFnsScriptString as h, getVariants as o, getUpdateCookieAndStylesScript as y } from "./helpers.mjs";
9
- function N(t) {
10
- var c;
11
- const a = b({
12
- canTrack: l(t.canTrack),
5
+ import { getDefaultCanTrack as u } from "../../helpers/canTrack.mjs";
6
+ import S from "../content/content.mjs";
7
+ import r from "../inlined-script.mjs";
8
+ import b from "../inlined-styles.mjs";
9
+ import { checkShouldRenderVariants as h, getInitVariantsFnsScriptString as y, getVariants as d, getUpdateCookieAndStylesScript as P } from "./helpers.mjs";
10
+ function j(t) {
11
+ var s;
12
+ const a = h({
13
+ canTrack: u(t.canTrack),
13
14
  content: t.content
14
15
  }), k = function() {
15
16
  var n;
16
- return y(
17
- o(t.content).map((r) => ({
18
- id: r.testVariationId,
19
- testRatio: r.testRatio
17
+ return P(
18
+ d(t.content).map((l) => ({
19
+ id: l.testVariationId,
20
+ testRatio: l.testRatio
20
21
  })),
21
22
  ((n = t.content) == null ? void 0 : n.id) || ""
22
23
  );
23
- }, S = function() {
24
- return o(t.content).map((n) => `.variant-${n.testVariationId} { display: none; } `).join("");
24
+ }, f = function() {
25
+ return d(t.content).map((n) => `.variant-${n.testVariationId} { display: none; } `).join("");
25
26
  }, C = function() {
26
27
  var n;
27
28
  return a ? {
@@ -29,42 +30,52 @@ function N(t) {
29
30
  testVariationId: (n = t.content) == null ? void 0 : n.id
30
31
  } : W({
31
32
  item: t.content,
32
- canTrack: l(t.canTrack)
33
+ canTrack: u(t.canTrack)
33
34
  });
34
35
  };
35
- return /* @__PURE__ */ d(s, { children: [
36
- !t.isNestedRender && f !== "reactNative" ? /* @__PURE__ */ i(
37
- u,
38
- {
39
- id: "builderio-init-variants-fns",
40
- scriptStr: h(),
41
- nonce: t.nonce || ""
42
- }
43
- ) : null,
44
- a ? /* @__PURE__ */ d(s, { children: [
45
- /* @__PURE__ */ i(
46
- V,
36
+ return /* @__PURE__ */ o(c, { children: [
37
+ !t.isNestedRender && m !== "reactNative" ? /* @__PURE__ */ o(c, { children: [
38
+ /* @__PURE__ */ e(
39
+ r,
40
+ {
41
+ id: "builderio-init-variants-fns",
42
+ scriptStr: y(),
43
+ nonce: t.nonce || ""
44
+ }
45
+ ),
46
+ T.includes(m) ? /* @__PURE__ */ e(
47
+ r,
48
+ {
49
+ id: "builderio-init-personalization-variants-fns",
50
+ nonce: t.nonce || "",
51
+ scriptStr: V()
52
+ }
53
+ ) : null
54
+ ] }) : null,
55
+ a ? /* @__PURE__ */ o(c, { children: [
56
+ /* @__PURE__ */ e(
57
+ b,
47
58
  {
48
59
  id: "builderio-variants",
49
- styles: S(),
60
+ styles: f(),
50
61
  nonce: t.nonce || ""
51
62
  }
52
63
  ),
53
- /* @__PURE__ */ i(
54
- u,
64
+ /* @__PURE__ */ e(
65
+ r,
55
66
  {
56
67
  id: "builderio-variants-visibility",
57
68
  scriptStr: k(),
58
69
  nonce: t.nonce || ""
59
70
  }
60
71
  ),
61
- (c = o(t.content)) == null ? void 0 : c.map((e) => /* @__PURE__ */ i(
62
- m,
72
+ (s = d(t.content)) == null ? void 0 : s.map((i) => /* @__PURE__ */ e(
73
+ S,
63
74
  {
64
75
  apiHost: t.apiHost,
65
76
  isNestedRender: t.isNestedRender,
66
77
  nonce: t.nonce,
67
- content: e,
78
+ content: i,
68
79
  showContent: !1,
69
80
  model: t.model,
70
81
  data: t.data,
@@ -83,11 +94,11 @@ function N(t) {
83
94
  contentWrapperProps: t.contentWrapperProps,
84
95
  trustedHosts: t.trustedHosts
85
96
  },
86
- e.testVariationId
97
+ i.testVariationId
87
98
  ))
88
99
  ] }) : null,
89
- /* @__PURE__ */ i(
90
- m,
100
+ /* @__PURE__ */ e(
101
+ S,
91
102
  {
92
103
  apiHost: t.apiHost,
93
104
  nonce: t.nonce,
@@ -115,5 +126,5 @@ function N(t) {
115
126
  ] });
116
127
  }
117
128
  export {
118
- N as default
129
+ j as default
119
130
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");require("../functions/evaluate/edge-runtime/edge-runtime.cjs");require("../functions/get-fetch.cjs");const o=require("../blocks/button/component-info.cjs"),n=require("../blocks/button/button.cjs"),e=require("../blocks/columns/component-info.cjs"),t=require("../blocks/columns/columns.cjs"),r=require("../blocks/fragment/component-info.cjs"),c=require("../blocks/fragment/fragment.cjs"),m=require("../blocks/image/component-info.cjs"),s=require("../blocks/image/image.cjs"),p=require("../blocks/section/component-info.cjs"),i=require("../blocks/section/section.cjs"),u=require("../blocks/slot/component-info.cjs"),q=require("../blocks/slot/slot.cjs"),f=require("../blocks/symbol/component-info.cjs"),I=require("../blocks/symbol/symbol.cjs"),g=require("../blocks/text/component-info.cjs"),a=require("../blocks/text/text.cjs"),l=require("./extra-components.cjs"),$=()=>[{component:n,...o.componentInfo},{component:t,...e.componentInfo},{component:c,...r.componentInfo},{component:s,...m.componentInfo},{component:i,...p.componentInfo},{component:q,...u.componentInfo},{component:I,...f.componentInfo},{component:a,...g.componentInfo},...l.getExtraComponents()];exports.getDefaultRegisteredComponents=$;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("react/jsx-runtime");require("react");const o=require("./target.cjs");require("../functions/evaluate/edge-runtime/edge-runtime.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,49 +1,56 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
+ import { TARGET as o } from "./target.mjs";
3
4
  import "../functions/evaluate/edge-runtime/edge-runtime.mjs";
4
5
  import "../functions/get-fetch.mjs";
5
- import { componentInfo as o } from "../blocks/button/component-info.mjs";
6
- import n from "../blocks/button/button.mjs";
7
- import { componentInfo as m } from "../blocks/columns/component-info.mjs";
8
- import t from "../blocks/columns/columns.mjs";
9
- import { componentInfo as p } from "../blocks/fragment/component-info.mjs";
10
- import r from "../blocks/fragment/fragment.mjs";
11
- import { componentInfo as e } from "../blocks/image/component-info.mjs";
12
- import f from "../blocks/image/image.mjs";
13
- import { componentInfo as c } from "../blocks/section/component-info.mjs";
14
- import i from "../blocks/section/section.mjs";
15
- import { componentInfo as I } from "../blocks/slot/component-info.mjs";
16
- import s from "../blocks/slot/slot.mjs";
17
- import { componentInfo as a } from "../blocks/symbol/component-info.mjs";
18
- import $ from "../blocks/symbol/symbol.mjs";
19
- import { componentInfo as g } from "../blocks/text/component-info.mjs";
20
- import C from "../blocks/text/text.mjs";
21
- import { getExtraComponents as l } from "./extra-components.mjs";
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";
22
26
  const H = () => [{
23
- component: n,
24
- ...o
27
+ component: m,
28
+ ...n
25
29
  }, {
26
- component: t,
27
- ...m
30
+ component: p,
31
+ ...t
28
32
  }, {
29
- component: r,
30
- ...p
31
- }, {
32
- component: f,
33
- ...e
33
+ component: e,
34
+ ...r
34
35
  }, {
35
36
  component: i,
36
- ...c
37
- }, {
38
- component: s,
39
- ...I
37
+ ...f
40
38
  }, {
41
39
  component: $,
42
- ...a
40
+ ...s
43
41
  }, {
44
- component: C,
45
- ...g
46
- }, ...l()];
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()];
47
54
  export {
48
55
  H as getDefaultRegisteredComponents
49
56
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.10";exports.SDK_VERSION=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.18.13";exports.SDK_VERSION=e;
@@ -1,4 +1,4 @@
1
- const o = "0.18.10";
1
+ const o = "0.18.13";
2
2
  export {
3
3
  o as SDK_VERSION
4
4
  };
@@ -1,11 +1,11 @@
1
- "use client";"use strict";const t=require("react/jsx-runtime"),l=require("./image.helpers.cjs");function f(e){var s,r,u,d,o,g;function n(){var h;const i=e.image||e.src;if(!i||!(typeof i=="string"&&(i.match(/builder\.io/)||i.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),l.getSrcSet(i)}else if(e.image&&!e.srcset)return l.getSrcSet(i);return l.getSrcSet(i)}}function a(){var c;return(c=n==null?void 0:n())!=null&&c.match(/builder\.io/)&&!e.noWebp?n().replace(/\?/g,"?format=webp&"):""}function m(){const c={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?c:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[a()?t.jsx("source",{type:"image/webp",srcSet:a()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,title:e.title,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...m()},className:"builder-image"+(e.className?" "+e.className:"")+" img-0525a549",src:e.image,srcSet:n(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(s=e.builderBlock)==null?void 0:s.children)!=null&&r.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-0525a549",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(d=(u=e.builderBlock)==null?void 0:u.children)!=null&&d.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((g=(o=e.builderBlock)==null?void 0:o.children)!=null&&g.length)?t.jsx("div",{className:"div-0525a549-2",children:e.children}):null]}),t.jsx("style",{children:`.img-0525a549 {
1
+ "use client";"use strict";const t=require("react/jsx-runtime"),f=require("react"),c=require("./image.helpers.cjs");function b(e){var s,r,u,o,d,g;function n(){var h;const i=e.image||e.src;if(!i||!(typeof i=="string"&&(i.match(/builder\.io/)||i.match(/cdn\.shopify\.com/))))return e.srcset;if(!e.noWebp){if(e.srcset&&((h=e.image)!=null&&h.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),c.getSrcSet(i)}else if(e.image&&!e.srcset)return c.getSrcSet(i);return c.getSrcSet(i)}}function l(){var a;return(a=n==null?void 0:n())!=null&&a.match(/builder\.io/)&&!e.noWebp?n().replace(/\?/g,"?format=webp&"):""}function m(){const a={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?a:void 0}return f.useEffect(()=>{},[]),t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[l()?t.jsx("source",{type:"image/webp",srcSet:l()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,title:e.title,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...m()},className:"builder-image"+(e.className?" "+e.className:"")+" img-0aa95e74",src:e.image,srcSet:n(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(s=e.builderBlock)==null?void 0:s.children)!=null&&r.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-0aa95e74",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(o=(u=e.builderBlock)==null?void 0:u.children)!=null&&o.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((g=(d=e.builderBlock)==null?void 0:d.children)!=null&&g.length)?t.jsx("div",{className:"div-0aa95e74-2",children:e.children}):null]}),t.jsx("style",{children:`.img-0aa95e74 {
2
2
  opacity: 1;
3
3
  transition: opacity 0.2s ease-in-out;
4
- }.div-0525a549 {
4
+ }.div-0aa95e74 {
5
5
  width: 100%;
6
6
  pointer-events: none;
7
7
  font-size: 0;
8
- }.div-0525a549-2 {
8
+ }.div-0aa95e74-2 {
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  align-items: stretch;
@@ -14,4 +14,4 @@
14
14
  left: 0;
15
15
  width: 100%;
16
16
  height: 100%;
17
- }`})]})}module.exports=f;
17
+ }`})]})}module.exports=b;
@@ -1,8 +1,9 @@
1
1
  "use client";
2
- import { jsxs as a, Fragment as c, jsx as t } from "react/jsx-runtime";
2
+ import { jsxs as l, Fragment as c, jsx as t } from "react/jsx-runtime";
3
+ import { useEffect as v } from "react";
3
4
  import { getSrcSet as o } from "./image.helpers.mjs";
4
- function x(e) {
5
- var d, u, s, g, h, m;
5
+ function w(e) {
6
+ var d, u, s, g, m, h;
6
7
  function n() {
7
8
  var f;
8
9
  const i = e.image || e.src;
@@ -20,22 +21,23 @@ function x(e) {
20
21
  }
21
22
  }
22
23
  function r() {
23
- var l;
24
- return (l = n == null ? void 0 : n()) != null && l.match(/builder\.io/) && !e.noWebp ? n().replace(/\?/g, "?format=webp&") : "";
24
+ var a;
25
+ return (a = n == null ? void 0 : n()) != null && a.match(/builder\.io/) && !e.noWebp ? n().replace(/\?/g, "?format=webp&") : "";
25
26
  }
26
27
  function b() {
27
- const l = {
28
+ const a = {
28
29
  position: "absolute",
29
30
  height: "100%",
30
31
  width: "100%",
31
32
  left: "0px",
32
33
  top: "0px"
33
34
  };
34
- return e.aspectRatio ? l : void 0;
35
+ return e.aspectRatio ? a : void 0;
35
36
  }
36
- return /* @__PURE__ */ a(c, { children: [
37
- /* @__PURE__ */ a(c, { children: [
38
- /* @__PURE__ */ a("picture", { children: [
37
+ return v(() => {
38
+ }, []), /* @__PURE__ */ l(c, { children: [
39
+ /* @__PURE__ */ l(c, { children: [
40
+ /* @__PURE__ */ l("picture", { children: [
39
41
  r() ? /* @__PURE__ */ t("source", { type: "image/webp", srcSet: r() }) : null,
40
42
  /* @__PURE__ */ t(
41
43
  "img",
@@ -50,7 +52,7 @@ function x(e) {
50
52
  objectFit: e.backgroundSize || "cover",
51
53
  ...b()
52
54
  },
53
- className: "builder-image" + (e.className ? " " + e.className : "") + " img-0525a549",
55
+ className: "builder-image" + (e.className ? " " + e.className : "") + " img-0aa95e74",
54
56
  src: e.image,
55
57
  srcSet: n(),
56
58
  sizes: e.sizes
@@ -60,23 +62,23 @@ function x(e) {
60
62
  e.aspectRatio && !((u = (d = e.builderBlock) == null ? void 0 : d.children) != null && u.length && e.fitContent) ? /* @__PURE__ */ t(
61
63
  "div",
62
64
  {
63
- className: "builder-image-sizer div-0525a549",
65
+ className: "builder-image-sizer div-0aa95e74",
64
66
  style: {
65
67
  paddingTop: e.aspectRatio * 100 + "%"
66
68
  }
67
69
  }
68
70
  ) : null,
69
71
  (g = (s = e.builderBlock) == null ? void 0 : s.children) != null && g.length && e.fitContent ? /* @__PURE__ */ t(c, { children: e.children }) : null,
70
- !e.fitContent && ((m = (h = e.builderBlock) == null ? void 0 : h.children) != null && m.length) ? /* @__PURE__ */ t("div", { className: "div-0525a549-2", children: e.children }) : null
72
+ !e.fitContent && ((h = (m = e.builderBlock) == null ? void 0 : m.children) != null && h.length) ? /* @__PURE__ */ t("div", { className: "div-0aa95e74-2", children: e.children }) : null
71
73
  ] }),
72
- /* @__PURE__ */ t("style", { children: `.img-0525a549 {
74
+ /* @__PURE__ */ t("style", { children: `.img-0aa95e74 {
73
75
  opacity: 1;
74
76
  transition: opacity 0.2s ease-in-out;
75
- }.div-0525a549 {
77
+ }.div-0aa95e74 {
76
78
  width: 100%;
77
79
  pointer-events: none;
78
80
  font-size: 0;
79
- }.div-0525a549-2 {
81
+ }.div-0aa95e74-2 {
80
82
  display: flex;
81
83
  flex-direction: column;
82
84
  align-items: stretch;
@@ -89,5 +91,5 @@ function x(e) {
89
91
  ] });
90
92
  }
91
93
  export {
92
- x as default
94
+ w as default
93
95
  };
@@ -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;