@builder.io/sdk-react-native 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/blocks/button/button.js +6 -2
  2. package/dist/blocks/button/component-info.js +4 -8
  3. package/dist/blocks/columns/columns.js +17 -21
  4. package/dist/blocks/columns/component-info.js +27 -48
  5. package/dist/blocks/custom-code/component-info.js +4 -8
  6. package/dist/blocks/custom-code/custom-code.js +1 -1
  7. package/dist/blocks/embed/component-info.js +7 -11
  8. package/dist/blocks/embed/embed.js +1 -1
  9. package/dist/blocks/embed/helpers.js +2 -6
  10. package/dist/blocks/form/component-info.js +33 -69
  11. package/dist/blocks/form/form.js +2 -203
  12. package/dist/blocks/fragment/fragment.js +1 -1
  13. package/dist/blocks/helpers.js +33 -0
  14. package/dist/blocks/image/component-info.js +21 -47
  15. package/dist/blocks/image/image.helpers.js +2 -2
  16. package/dist/blocks/img/component-info.js +2 -4
  17. package/dist/blocks/img/img.js +2 -1
  18. package/dist/blocks/input/component-info.js +8 -34
  19. package/dist/blocks/input/input.js +2 -1
  20. package/dist/blocks/raw-text/component-info.js +2 -4
  21. package/dist/blocks/raw-text/raw-text.js +3 -2
  22. package/dist/blocks/section/component-info.js +5 -10
  23. package/dist/blocks/section/section.js +2 -1
  24. package/dist/blocks/select/component-info.js +12 -24
  25. package/dist/blocks/select/select.js +2 -1
  26. package/dist/blocks/submit-button/component-info.js +2 -4
  27. package/dist/blocks/submit-button/submit-button.js +2 -1
  28. package/dist/blocks/symbol/component-info.js +7 -12
  29. package/dist/blocks/symbol/symbol.helpers.js +66 -0
  30. package/dist/blocks/symbol/symbol.js +23 -52
  31. package/dist/blocks/text/component-info.js +3 -4
  32. package/dist/blocks/textarea/component-info.js +6 -12
  33. package/dist/blocks/textarea/textarea.js +2 -1
  34. package/dist/blocks/video/component-info.js +21 -41
  35. package/dist/components/block/block.helpers.js +12 -23
  36. package/dist/components/block/block.js +40 -70
  37. package/dist/components/block/components/block-styles.js +1 -1
  38. package/dist/components/block/components/block-wrapper/block-wrapper.js +41 -0
  39. package/dist/components/block/components/block-wrapper.js +56 -0
  40. package/dist/components/block/components/component-ref/component-ref.helpers.js +40 -0
  41. package/dist/components/block/components/component-ref/component-ref.js +63 -0
  42. package/dist/components/block/components/component-ref.js +81 -0
  43. package/dist/components/block/components/interactive-element/interactive-element.helpers.js +35 -0
  44. package/dist/components/block/components/interactive-element/interactive-element.js +36 -0
  45. package/dist/components/block/components/interactive-element.js +46 -0
  46. package/dist/components/block/components/repeated-block.js +4 -4
  47. package/dist/components/blocks/blocks-wrapper.js +5 -2
  48. package/dist/components/blocks/blocks.js +2 -2
  49. package/dist/components/content/builder-editing.js +32 -0
  50. package/dist/components/content/components/enable-editor.js +30 -33
  51. package/dist/components/content/components/styles.helpers.js +55 -0
  52. package/dist/components/content/components/styles.js +61 -0
  53. package/dist/components/content/content.helpers.js +10 -3
  54. package/dist/components/content/content.js +25 -42
  55. package/dist/components/content/wrap-component-ref.js +1 -1
  56. package/dist/components/content-variants/content-variants.js +38 -34
  57. package/dist/components/content-variants/content-variants.types.js +1 -0
  58. package/dist/components/content-variants/helpers.js +61 -25
  59. package/dist/components/inlined-script.js +1 -1
  60. package/dist/components/inlined-styles.js +1 -1
  61. package/dist/constants/device-sizes.js +2 -2
  62. package/dist/constants/sdk-version.js +1 -1
  63. package/dist/context/builder.context.js +1 -1
  64. package/dist/functions/apply-patch-with-mutation.js +75 -0
  65. package/dist/functions/apply-patch-with-mutation.test.js +55 -0
  66. package/dist/functions/camel-to-kebab-case.js +1 -1
  67. package/dist/functions/evaluate/acorn.js +1691 -0
  68. package/dist/functions/evaluate/evaluate.js +72 -0
  69. package/dist/functions/evaluate/index.js +5 -0
  70. package/dist/functions/evaluate/interpreter.js +2903 -0
  71. package/dist/functions/evaluate/non-node-runtime.js +97 -0
  72. package/dist/functions/evaluate/types.js +1 -0
  73. package/dist/functions/evaluate.test.js +12 -6
  74. package/dist/functions/event-handler-name.js +1 -1
  75. package/dist/functions/extract-text-styles.js +3 -9
  76. package/dist/functions/fast-clone.js +1 -1
  77. package/dist/functions/get-block-actions-handler.js +2 -2
  78. package/dist/functions/get-block-actions.js +14 -1
  79. package/dist/functions/get-block-component-options.js +6 -1
  80. package/dist/functions/get-block-properties.js +21 -8
  81. package/dist/functions/get-builder-search-params/fn.test.js +3 -3
  82. package/dist/functions/get-builder-search-params/index.js +4 -4
  83. package/dist/functions/get-content/generate-content-url.js +12 -5
  84. package/dist/functions/get-content/generate-content-url.test.js +31 -17
  85. package/dist/functions/get-content/index.js +36 -12
  86. package/dist/functions/get-content/processCookies.js +7 -0
  87. package/dist/functions/get-processed-block.js +8 -3
  88. package/dist/functions/get-processed-block.test.js +3 -1
  89. package/dist/functions/get-react-native-block-styles.js +6 -1
  90. package/dist/functions/is-non-node-server.js +12 -0
  91. package/dist/functions/on-change.test.js +13 -3
  92. package/dist/functions/register-component.js +24 -19
  93. package/dist/functions/sanitize-react-native-block-styles.js +17 -6
  94. package/dist/functions/set.test.js +9 -3
  95. package/dist/functions/track/helpers.js +5 -5
  96. package/dist/functions/track/index.js +29 -18
  97. package/dist/functions/track/interaction.js +10 -4
  98. package/dist/functions/transform-block-properties.js +2 -0
  99. package/dist/helpers/ab-tests.js +35 -14
  100. package/dist/helpers/canTrack.js +2 -2
  101. package/dist/helpers/css.js +2 -2
  102. package/dist/helpers/flatten.js +10 -7
  103. package/dist/helpers/nullable.js +1 -1
  104. package/dist/helpers/preview-lru-cache/get.js +11 -0
  105. package/dist/helpers/preview-lru-cache/helpers.js +13 -0
  106. package/dist/helpers/preview-lru-cache/init.js +13 -0
  107. package/dist/helpers/preview-lru-cache/set.js +37 -0
  108. package/dist/helpers/preview-lru-cache/types.js +1 -0
  109. package/dist/helpers/sessionId.js +13 -6
  110. package/dist/helpers/url.js +1 -1
  111. package/dist/helpers/visitorId.js +4 -1
  112. package/dist/index-helpers/blocks-exports.js +2 -2
  113. package/dist/scripts/init-editing.js +61 -46
  114. package/package.json +2 -2
  115. package/src/blocks/button/button.jsx +11 -2
  116. package/src/blocks/button/component-info.js +16 -22
  117. package/src/blocks/columns/columns.jsx +27 -26
  118. package/src/blocks/columns/component-info.js +203 -226
  119. package/src/blocks/custom-code/component-info.js +19 -25
  120. package/src/blocks/custom-code/custom-code.jsx +1 -1
  121. package/src/blocks/embed/component-info.js +31 -37
  122. package/src/blocks/embed/embed.jsx +1 -1
  123. package/src/blocks/embed/helpers.js +3 -9
  124. package/src/blocks/form/component-info.js +174 -212
  125. package/src/blocks/form/form.jsx +3 -247
  126. package/src/blocks/fragment/component-info.js +1 -3
  127. package/src/blocks/fragment/fragment.jsx +1 -1
  128. package/src/blocks/helpers.js +27 -0
  129. package/src/blocks/image/component-info.js +105 -133
  130. package/src/blocks/image/image.helpers.js +3 -5
  131. package/src/blocks/img/component-info.js +8 -12
  132. package/src/blocks/img/img.jsx +3 -1
  133. package/src/blocks/input/component-info.js +29 -57
  134. package/src/blocks/input/input.jsx +3 -1
  135. package/src/blocks/raw-text/component-info.js +7 -11
  136. package/src/blocks/raw-text/raw-text.jsx +4 -2
  137. package/src/blocks/section/component-info.js +24 -31
  138. package/src/blocks/section/section.jsx +3 -1
  139. package/src/blocks/select/component-info.js +34 -48
  140. package/src/blocks/select/select.jsx +3 -1
  141. package/src/blocks/submit-button/component-info.js +6 -10
  142. package/src/blocks/submit-button/submit-button.jsx +3 -2
  143. package/src/blocks/symbol/component-info.js +30 -37
  144. package/src/blocks/symbol/symbol.helpers.js +60 -0
  145. package/src/blocks/symbol/symbol.jsx +33 -61
  146. package/src/blocks/text/component-info.js +10 -13
  147. package/src/blocks/textarea/component-info.js +22 -30
  148. package/src/blocks/textarea/textarea.jsx +3 -1
  149. package/src/blocks/video/component-info.js +74 -96
  150. package/src/components/{render-block/render-block.helpers.js → block/block.helpers.js} +26 -44
  151. package/src/components/{render-block/render-block.jsx → block/block.jsx} +68 -81
  152. package/src/components/{render-block → block/components}/block-styles.jsx +18 -17
  153. package/src/components/block/components/block-wrapper.jsx +58 -0
  154. package/src/components/block/components/component-ref/component-ref.helpers.js +41 -0
  155. package/src/components/block/components/component-ref/component-ref.jsx +72 -0
  156. package/src/components/block/components/interactive-element.jsx +37 -0
  157. package/src/components/{render-block/render-repeated-block.jsx → block/components/repeated-block.jsx} +10 -6
  158. package/src/components/blocks/blocks-wrapper.jsx +74 -0
  159. package/src/components/blocks/blocks.jsx +51 -0
  160. package/src/components/{render-content/render-content.jsx → content/components/enable-editor.jsx} +77 -163
  161. package/src/components/{render-content/components/render-styles.helpers.js → content/components/styles.helpers.js} +6 -7
  162. package/src/components/{render-content/components/render-styles.jsx → content/components/styles.jsx} +5 -5
  163. package/src/components/{render-content/render-content.helpers.js → content/content.helpers.js} +15 -15
  164. package/src/components/content/content.jsx +141 -0
  165. package/src/components/content/index.js +2 -0
  166. package/src/components/content/wrap-component-ref.js +2 -0
  167. package/src/components/{render-content-variants/render-content-variants.jsx → content-variants/content-variants.jsx} +20 -23
  168. package/src/components/{render-content-variants → content-variants}/helpers.js +28 -40
  169. package/src/components/inlined-script.jsx +1 -1
  170. package/src/components/inlined-styles.jsx +1 -1
  171. package/src/constants/device-sizes.js +6 -6
  172. package/src/constants/sdk-version.js +1 -1
  173. package/src/context/builder.context.js +1 -1
  174. package/src/functions/apply-patch-with-mutation.js +66 -0
  175. package/src/functions/camel-to-kebab-case.js +2 -4
  176. package/src/functions/evaluate/acorn.js +1595 -0
  177. package/src/functions/{evaluate.js → evaluate/evaluate.js} +36 -10
  178. package/src/functions/evaluate/index.js +2 -0
  179. package/src/functions/evaluate/interpreter.js +2801 -0
  180. package/src/functions/evaluate/non-node-runtime.js +92 -0
  181. package/src/functions/evaluate/types.js +0 -0
  182. package/src/functions/event-handler-name.js +2 -4
  183. package/src/functions/extract-text-styles.js +4 -12
  184. package/src/functions/fast-clone.js +2 -4
  185. package/src/functions/get-block-actions-handler.js +3 -5
  186. package/src/functions/get-block-actions.js +15 -4
  187. package/src/functions/get-block-component-options.js +11 -12
  188. package/src/functions/get-block-properties.js +29 -19
  189. package/src/functions/get-builder-search-params/index.js +5 -10
  190. package/src/functions/get-content/generate-content-url.js +17 -19
  191. package/src/functions/get-content/index.js +43 -29
  192. package/src/functions/get-fetch.js +1 -3
  193. package/src/functions/get-global-this.js +1 -3
  194. package/src/functions/get-processed-block.js +12 -13
  195. package/src/functions/get-react-native-block-styles.js +11 -12
  196. package/src/functions/if-target.js +1 -3
  197. package/src/functions/is-browser.js +1 -3
  198. package/src/functions/is-editing.js +1 -3
  199. package/src/functions/is-iframe.js +1 -3
  200. package/src/functions/is-non-node-server.js +9 -0
  201. package/src/functions/is-previewing.js +1 -3
  202. package/src/functions/on-change.js +1 -4
  203. package/src/functions/register-component.js +34 -42
  204. package/src/functions/register.js +1 -3
  205. package/src/functions/sanitize-react-native-block-styles.js +22 -17
  206. package/src/functions/set-editor-settings.js +1 -3
  207. package/src/functions/set.js +1 -3
  208. package/src/functions/track/helpers.js +3 -5
  209. package/src/functions/track/index.js +45 -43
  210. package/src/functions/track/interaction.js +11 -7
  211. package/src/functions/transform-block-properties.js +2 -0
  212. package/src/helpers/ab-tests.js +45 -28
  213. package/src/helpers/canTrack.js +3 -5
  214. package/src/helpers/css.js +3 -7
  215. package/src/helpers/flatten.js +15 -18
  216. package/src/helpers/localStorage.js +1 -4
  217. package/src/helpers/logger.js +1 -3
  218. package/src/helpers/nullable.js +2 -4
  219. package/src/helpers/preview-lru-cache/get.js +8 -0
  220. package/src/helpers/preview-lru-cache/helpers.js +10 -0
  221. package/src/helpers/preview-lru-cache/init.js +10 -0
  222. package/src/helpers/preview-lru-cache/set.js +35 -0
  223. package/src/helpers/preview-lru-cache/types.js +0 -0
  224. package/src/helpers/sessionId.js +14 -11
  225. package/src/helpers/time.js +1 -3
  226. package/src/helpers/url.js +2 -4
  227. package/src/helpers/uuid.js +4 -6
  228. package/src/helpers/visitorId.js +8 -7
  229. package/src/index-helpers/blocks-exports.js +1 -1
  230. package/src/index.js +2 -17
  231. package/src/scripts/init-editing.js +62 -48
  232. package/src/types/api-version.js +1 -3
  233. package/src/types/builder-props.js +0 -0
  234. package/src/blocks/util.js +0 -8
  235. package/src/components/render-block/render-component.jsx +0 -55
  236. package/src/components/render-blocks.jsx +0 -101
  237. package/src/components/render-content/builder-editing.jsx +0 -16
  238. package/src/components/render-content/index.js +0 -4
  239. package/src/components/render-content/wrap-component-ref.js +0 -4
  240. package/src/functions/evaluate.test.js +0 -17
  241. package/src/functions/get-builder-search-params/fn.test.js +0 -13
  242. package/src/functions/get-content/generate-content-url.test.js +0 -97
  243. package/src/functions/get-processed-block.test.js +0 -34
  244. package/src/functions/on-change.test.js +0 -19
  245. package/src/functions/set.test.js +0 -16
  246. package/src/helpers/url.test.js +0 -21
  247. /package/src/components/{render-block → block}/types.js +0 -0
  248. /package/src/components/{render-content/render-content.types.js → content/content.types.js} +0 -0
  249. /package/src/components/{render-content-variants/render-content-variants.types.js → content-variants/content-variants.types.js} +0 -0
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ const React = __importStar(require("react"));
28
+ const react_native_1 = require("react-native");
29
+ function BuilderEditing(props) {
30
+ return React.createElement(react_native_1.View, null);
31
+ }
32
+ exports.default = BuilderEditing;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- 'use client';
2
+ "use client";
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -30,27 +30,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
30
30
  const React = __importStar(require("react"));
31
31
  const react_native_1 = require("react-native");
32
32
  const react_1 = require("react");
33
- const evaluate_js_1 = require("../../../functions/evaluate.js");
34
- const index_js_1 = require("../../../functions/get-content/index.js");
33
+ const evaluate_1 = require("../../../functions/evaluate");
35
34
  const get_fetch_js_1 = require("../../../functions/get-fetch.js");
36
35
  const is_browser_js_1 = require("../../../functions/is-browser.js");
37
36
  const is_editing_js_1 = require("../../../functions/is-editing.js");
38
- const is_previewing_js_1 = require("../../../functions/is-previewing.js");
39
37
  const register_component_js_1 = require("../../../functions/register-component.js");
40
- const index_js_2 = require("../../../functions/track/index.js");
41
- const builder_context_js_1 = __importDefault(require("../../../context/builder.context.js"));
38
+ const index_js_1 = require("../../../functions/track/index.js");
39
+ const builder_context_1 = __importDefault(require("../../../context/builder.context"));
42
40
  const init_editing_js_1 = require("../../../scripts/init-editing.js");
43
41
  const nullable_js_1 = require("../../../helpers/nullable.js");
44
42
  const interaction_js_1 = require("../../../functions/track/interaction.js");
45
- const target_js_1 = require("../../../constants/target.js");
46
43
  const logger_js_1 = require("../../../helpers/logger.js");
44
+ const index_js_2 = require("../../../functions/get-content/index.js");
45
+ const is_previewing_js_1 = require("../../../functions/is-previewing.js");
46
+ const set_js_1 = require("../../../helpers/preview-lru-cache/set.js");
47
47
  function EnableEditor(props) {
48
48
  var _a, _b, _c, _d, _e;
49
49
  const elementRef = (0, react_1.useRef)(null);
50
+ const [canTrackToUse, setCanTrackToUse] = (0, react_1.useState)(() => (0, nullable_js_1.checkIsDefined)(props.canTrack) ? props.canTrack : true);
50
51
  const [forceReRenderCount, setForceReRenderCount] = (0, react_1.useState)(() => 0);
51
52
  function mergeNewContent(newContent) {
52
53
  var _a, _b, _c, _d, _e;
53
- props.builderContextSignal.content = {
54
+ const newContentValue = {
54
55
  ...props.builderContextSignal.content,
55
56
  ...newContent,
56
57
  data: {
@@ -64,8 +65,10 @@ function EnableEditor(props) {
64
65
  ((_e = (_d = props.builderContextSignal.content) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.breakpoints),
65
66
  },
66
67
  };
68
+ props.builderContextSignal.content = newContentValue;
67
69
  }
68
- const [canTrackToUse, setCanTrackToUse] = (0, react_1.useState)(() => (0, nullable_js_1.checkIsDefined)(props.canTrack) ? props.canTrack : true);
70
+ const [lastUpdated, setLastUpdated] = (0, react_1.useState)(() => 0);
71
+ const [shouldSendResetCookie, setShouldSendResetCookie] = (0, react_1.useState)(() => false);
69
72
  function processMessage(event) {
70
73
  var _a;
71
74
  const { data } = event;
@@ -101,10 +104,6 @@ function EnableEditor(props) {
101
104
  }
102
105
  break;
103
106
  }
104
- case "builder.patchUpdates": {
105
- // TODO
106
- break;
107
- }
108
107
  }
109
108
  }
110
109
  }
@@ -113,7 +112,7 @@ function EnableEditor(props) {
113
112
  // run any dynamic JS code attached to content
114
113
  const jsCode = (_b = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.jsCode;
115
114
  if (jsCode) {
116
- (0, evaluate_js_1.evaluate)({
115
+ (0, evaluate_1.evaluate)({
117
116
  code: jsCode,
118
117
  context: props.context || {},
119
118
  localState: undefined,
@@ -129,7 +128,7 @@ function EnableEditor(props) {
129
128
  if (props.builderContextSignal.content) {
130
129
  const variationId = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.testVariationId;
131
130
  const contentId = (_b = props.builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.id;
132
- (0, index_js_2._track)({
131
+ (0, index_js_1._track)({
133
132
  type: "click",
134
133
  canTrack: canTrackToUse,
135
134
  contentId,
@@ -144,7 +143,7 @@ function EnableEditor(props) {
144
143
  }
145
144
  }
146
145
  function evalExpression(expression) {
147
- return expression.replace(/{{([^}]+)}}/g, (_match, group) => (0, evaluate_js_1.evaluate)({
146
+ return expression.replace(/{{([^}]+)}}/g, (_match, group) => (0, evaluate_1.evaluate)({
148
147
  code: group,
149
148
  context: props.context || {},
150
149
  localState: undefined,
@@ -201,6 +200,7 @@ function EnableEditor(props) {
201
200
  if ((0, is_browser_js_1.isBrowser)()) {
202
201
  if ((0, is_editing_js_1.isEditing)()) {
203
202
  setForceReRenderCount(forceReRenderCount + 1);
203
+ window.addEventListener("message", processMessage);
204
204
  (0, init_editing_js_1.registerInsertMenu)();
205
205
  (0, init_editing_js_1.setupBrowserForEditing)({
206
206
  ...(props.locale
@@ -219,18 +219,17 @@ function EnableEditor(props) {
219
219
  }
220
220
  : {}),
221
221
  });
222
- Object.values(props.builderContextSignal.registeredComponents).forEach((registeredComponent) => {
222
+ Object.values(props.builderContextSignal.componentInfos).forEach((registeredComponent) => {
223
223
  var _a;
224
224
  const message = (0, register_component_js_1.createRegisterComponentMessage)(registeredComponent);
225
225
  (_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage(message, "*");
226
226
  });
227
- window.addEventListener("message", processMessage);
228
227
  window.addEventListener("builder:component:stateChangeListenerActivated", emitStateUpdate);
229
228
  }
230
229
  if (props.builderContextSignal.content) {
231
230
  const variationId = (_a = props.builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.testVariationId;
232
231
  const contentId = (_b = props.builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.id;
233
- (0, index_js_2._track)({
232
+ (0, index_js_1._track)({
234
233
  type: "impression",
235
234
  canTrack: canTrackToUse,
236
235
  contentId,
@@ -254,10 +253,10 @@ function EnableEditor(props) {
254
253
  if (searchParamPreviewModel === props.model &&
255
254
  previewApiKey === props.apiKey &&
256
255
  (!props.content || searchParamPreviewId === props.content.id)) {
257
- (0, index_js_1.getContent)({
256
+ (0, index_js_2.getContent)({
258
257
  model: props.model,
259
258
  apiKey: props.apiKey,
260
- apiVersion: props.apiVersion,
259
+ apiVersion: props.builderContextSignal.apiVersion,
261
260
  }).then((content) => {
262
261
  if (content) {
263
262
  mergeNewContent(content);
@@ -275,6 +274,7 @@ function EnableEditor(props) {
275
274
  mergeNewContent(props.content);
276
275
  }
277
276
  }, [props.content]);
277
+ (0, react_1.useEffect)(() => { }, [shouldSendResetCookie]);
278
278
  (0, react_1.useEffect)(() => {
279
279
  evaluateJsCode();
280
280
  }, [
@@ -295,19 +295,16 @@ function EnableEditor(props) {
295
295
  }
296
296
  };
297
297
  }, []);
298
- return (React.createElement(builder_context_js_1.default.Provider, { value: props.builderContextSignal }, props.builderContextSignal.content ? (React.createElement(React.Fragment, null,
299
- React.createElement(react_native_1.View, { ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": (_e = props.builderContextSignal.content) === null || _e === void 0 ? void 0 : _e.id, "builder-model": props.model, key: forceReRenderCount, ...(target_js_1.TARGET === "reactNative"
300
- ? {
301
- dataSet: {
302
- // currently, we can't set the actual ID here. // we don't need it right now, we just need to identify content divs for testing.
303
- "builder-content-id": "",
304
- },
305
- }
306
- : {}), ...(props.hideContent
307
- ? {
298
+ return (React.createElement(builder_context_1.default.Provider, { value: props.builderContextSignal }, props.builderContextSignal.content ? (React.createElement(React.Fragment, null,
299
+ React.createElement(react_native_1.View, { key: forceReRenderCount, ref: elementRef, onClick: (event) => onClick(event), "builder-content-id": (_e = props.builderContextSignal.content) === null || _e === void 0 ? void 0 : _e.id, "builder-model": props.model,
300
+ // currently, we can't set the actual ID here. // we don't need it right now, we just need to identify content divs for testing.
301
+ dataSet: {
302
+ "builder-content-id": "",
303
+ }, ...(props.showContent
304
+ ? {}
305
+ : {
308
306
  hidden: true,
309
307
  "aria-hidden": true,
310
- }
311
- : {}) }, props.children))) : null));
308
+ }) }, props.children))) : null));
312
309
  }
313
310
  exports.default = EnableEditor;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFontCss = exports.getCss = void 0;
4
+ const getCssFromFont = font => {
5
+ var _a, _b;
6
+ const family = font.family + (font.kind && !font.kind.includes("#") ? ", " + font.kind : "");
7
+ const name = family.split(",")[0];
8
+ const url = (_b = font.fileUrl) != null ? _b : (_a = font == null ? void 0 : font.files) == null ? void 0 : _a.regular;
9
+ let str = "";
10
+ if (url && family && name) {
11
+ str += `
12
+ @font-face {
13
+ font-family: "${family}";
14
+ src: local("${name}"), url('${url}') format('woff2');
15
+ font-display: fallback;
16
+ font-weight: 400;
17
+ }
18
+ `.trim();
19
+ }
20
+ if (font.files) {
21
+ for (const weight in font.files) {
22
+ const isNumber = String(Number(weight)) === weight;
23
+ if (!isNumber) {
24
+ continue;
25
+ }
26
+ const weightUrl = font.files[weight];
27
+ if (weightUrl && weightUrl !== url) {
28
+ str += `
29
+ @font-face {
30
+ font-family: "${family}";
31
+ src: url('${weightUrl}') format('woff2');
32
+ font-display: fallback;
33
+ font-weight: ${weight};
34
+ }
35
+ `.trim();
36
+ }
37
+ }
38
+ }
39
+ return str;
40
+ };
41
+ const getFontCss = ({ customFonts }) => {
42
+ var _a;
43
+ return ((_a = customFonts == null ? void 0 : customFonts.map(font => getCssFromFont(font))) == null ? void 0 : _a.join(" ")) || "";
44
+ };
45
+ exports.getFontCss = getFontCss;
46
+ const getCss = ({ cssCode, contentId }) => {
47
+ if (!cssCode) {
48
+ return "";
49
+ }
50
+ if (!contentId) {
51
+ return cssCode;
52
+ }
53
+ return (cssCode == null ? void 0 : cssCode.replace(/&/g, `div[builder-content-id="${contentId}"]`)) || "";
54
+ };
55
+ exports.getCss = getCss;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ "use client";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || function (mod) {
20
+ if (mod && mod.__esModule) return mod;
21
+ var result = {};
22
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
+ __setModuleDefault(result, mod);
24
+ return result;
25
+ };
26
+ var __importDefault = (this && this.__importDefault) || function (mod) {
27
+ return (mod && mod.__esModule) ? mod : { "default": mod };
28
+ };
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ const React = __importStar(require("react"));
31
+ const react_native_1 = require("react-native");
32
+ const react_1 = require("react");
33
+ const inlined_styles_1 = __importDefault(require("../../inlined-styles"));
34
+ const styles_helpers_js_1 = require("./styles.helpers.js");
35
+ const styles_helpers_js_2 = require("./styles.helpers.js");
36
+ function ContentStyles(props) {
37
+ const [injectedStyles, setInjectedStyles] = (0, react_1.useState)(() => `
38
+ ${(0, styles_helpers_js_1.getCss)({
39
+ cssCode: props.cssCode,
40
+ contentId: props.contentId,
41
+ })}
42
+ ${(0, styles_helpers_js_2.getFontCss)({
43
+ customFonts: props.customFonts,
44
+ })}
45
+
46
+ .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
47
+ margin: 0;
48
+ }
49
+ .builder-text > p, .builder-text > .builder-paragraph {
50
+ color: inherit;
51
+ line-height: inherit;
52
+ letter-spacing: inherit;
53
+ font-weight: inherit;
54
+ font-size: inherit;
55
+ text-align: inherit;
56
+ font-family: inherit;
57
+ }
58
+ `.trim());
59
+ return React.createElement(inlined_styles_1.default, { styles: injectedStyles });
60
+ }
61
+ exports.default = ContentStyles;
@@ -7,7 +7,12 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
11
+ enumerable: true,
12
+ configurable: true,
13
+ writable: true,
14
+ value
15
+ }) : obj[key] = value;
11
16
  var __spreadValues = (a, b) => {
12
17
  for (var prop in b || (b = {}))
13
18
  if (__hasOwnProp.call(b, prop))
@@ -23,13 +28,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
28
  const getContextStateInitialValue = ({ content, data, locale }) => {
24
29
  var _a, _b, _c;
25
30
  const defaultValues = {};
26
- (_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach((input) => {
31
+ (_b = (_a = content == null ? void 0 : content.data) == null ? void 0 : _a.inputs) == null ? void 0 : _b.forEach(input => {
27
32
  var _a2;
28
33
  if (input.name && input.defaultValue !== void 0 && ((_a2 = content == null ? void 0 : content.data) == null ? void 0 : _a2.state) && content.data.state[input.name] === void 0) {
29
34
  defaultValues[input.name] = input.defaultValue;
30
35
  }
31
36
  });
32
- const stateToUse = __spreadValues(__spreadValues(__spreadValues({}, (_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state), data), locale ? { locale } : {});
37
+ const stateToUse = __spreadValues(__spreadValues(__spreadValues({}, (_c = content == null ? void 0 : content.data) == null ? void 0 : _c.state), data), locale ? {
38
+ locale
39
+ } : {});
33
40
  return __spreadValues(__spreadValues({}, defaultValues), stateToUse);
34
41
  };
35
42
  exports.getContextStateInitialValue = getContextStateInitialValue;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- 'use client';
2
+ "use client";
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -33,26 +33,28 @@ const react_1 = require("react");
33
33
  const builder_registered_components_js_1 = require("../../constants/builder-registered-components.js");
34
34
  const register_component_js_1 = require("../../functions/register-component.js");
35
35
  const blocks_1 = __importDefault(require("../blocks/blocks"));
36
- const content_styles_1 = __importDefault(require("./components/content-styles"));
36
+ const styles_1 = __importDefault(require("./components/styles"));
37
37
  const content_helpers_js_1 = require("./content.helpers.js");
38
38
  const target_js_1 = require("../../constants/target.js");
39
39
  const helpers_js_1 = require("../content-variants/helpers.js");
40
- const wrap_component_ref_js_1 = require("./wrap-component-ref.js");
41
40
  const enable_editor_1 = __importDefault(require("./components/enable-editor"));
42
- function Content(props) {
41
+ const inlined_script_1 = __importDefault(require("../inlined-script"));
42
+ const wrap_component_ref_js_1 = require("./wrap-component-ref.js");
43
+ function ContentComponent(props) {
43
44
  var _a, _b, _c, _d, _e, _f, _g;
44
45
  const [scriptStr, setScriptStr] = (0, react_1.useState)(() => {
45
- var _a;
46
+ var _a, _b;
46
47
  return (0, helpers_js_1.getRenderContentScriptString)({
47
48
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
48
- contentId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.id,
49
- parentContentId: props.parentContentId,
49
+ variationId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.testVariationId,
50
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
51
+ contentId: (_b = props.content) === null || _b === void 0 ? void 0 : _b.id,
50
52
  });
51
53
  });
52
54
  function contentSetState(newRootState) {
53
55
  builderContextSignal.rootState = newRootState;
54
56
  }
55
- const [customComps, setCustomComps] = (0, react_1.useState)(() => [
57
+ const [registeredComponents, setRegisteredComponents] = (0, react_1.useState)(() => [
56
58
  ...(0, builder_registered_components_js_1.getDefaultRegisteredComponents)(),
57
59
  // While this `components` object is deprecated, we must maintain support for it.
58
60
  // Since users are able to override our default components, we need to make sure that we do not break such
@@ -61,20 +63,13 @@ function Content(props) {
61
63
  // which is the new standard way of providing custom components, and must therefore take precedence.
62
64
  ...register_component_js_1.components,
63
65
  ...(props.customComponents || []),
64
- ].reduce((acc, info) => ({
66
+ ].reduce((acc, { component, ...info }) => ({
65
67
  ...acc,
66
- [info.name]: info,
68
+ [info.name]: {
69
+ component: component,
70
+ ...(0, register_component_js_1.serializeComponentInfo)(info),
71
+ },
67
72
  }), {}));
68
- function customComponentsInfo() {
69
- // TO-DO: fix once we remove `useStore<any>` hack in Qwik generator.
70
- return Object.values(customComps).reduce((acc, { component: _, ...info }) => ({
71
- ...acc,
72
- [info.name]: info,
73
- }), {});
74
- }
75
- function tempContextSignalSetter() {
76
- return undefined;
77
- }
78
73
  const [builderContextSignal, setBuilderContextSignal] = (0, react_1.useState)(() => ({
79
74
  content: (0, content_helpers_js_1.getContentInitialValue)({
80
75
  content: props.content,
@@ -90,7 +85,7 @@ function Content(props) {
90
85
  context: props.context || {},
91
86
  apiKey: props.apiKey,
92
87
  apiVersion: props.apiVersion,
93
- registeredComponents: [
88
+ componentInfos: [
94
89
  ...(0, builder_registered_components_js_1.getDefaultRegisteredComponents)(),
95
90
  // While this `components` object is deprecated, we must maintain support for it.
96
91
  // Since users are able to override our default components, we need to make sure that we do not break such
@@ -99,29 +94,17 @@ function Content(props) {
99
94
  // which is the new standard way of providing custom components, and must therefore take precedence.
100
95
  ...register_component_js_1.components,
101
96
  ...(props.customComponents || []),
102
- ].reduce((acc, { component, ...curr }) => ({
97
+ ].reduce((acc, { component: _, ...info }) => ({
103
98
  ...acc,
104
- [curr.name]: {
105
- component: target_js_1.TARGET === "vue3" ? (0, wrap_component_ref_js_1.wrapComponentRef)(component) : component,
106
- ...curr,
107
- },
99
+ [info.name]: (0, register_component_js_1.serializeComponentInfo)(info),
108
100
  }), {}),
109
101
  inheritedStyles: {},
110
102
  }));
111
- (0, react_1.useEffect)(() => {
112
- if (!builderContextSignal.content) {
113
- builderContextSignal.content = (0, content_helpers_js_1.getContentInitialValue)({
114
- content: props.content,
115
- data: props.data,
116
- });
117
- }
118
- }, [props.content, props.data, props.locale]);
119
- return (React.createElement(React.Fragment, null, builderContextSignal.content ? (React.createElement(React.Fragment, null,
120
- React.createElement(enable_editor_1.default, { content: props.content, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: customComponentsInfo(), canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, hideContent: props.hideContent, parentContentId: props.parentContentId, isSsrAbTest: props.isSsrAbTest, builderContextSignal: builderContextSignal, setBuilderContextSignal: tempContextSignalSetter() },
121
- props.isSsrAbTest ? (React.createElement(React.Fragment, null,
122
- React.createElement(react_native_1.ScrollView, { dangerouslySetInnerHTML: { __html: scriptStr } }))) : null,
123
- target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
124
- React.createElement(content_styles_1.default, { contentId: (_a = builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.id, cssCode: (_c = (_b = builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.cssCode, customFonts: (_e = (_d = builderContextSignal.content) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.customFonts }))) : null,
125
- React.createElement(blocks_1.default, { blocks: (_g = (_f = builderContextSignal.content) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.blocks, context: builderContextSignal, components: customComps })))) : null));
103
+ return (React.createElement(enable_editor_1.default, { content: props.content, model: props.model, context: props.context, apiKey: props.apiKey, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, classNameProp: props.classNameProp, showContent: props.showContent, builderContextSignal: builderContextSignal, setBuilderContextSignal: setBuilderContextSignal },
104
+ props.isSsrAbTest ? (React.createElement(React.Fragment, null,
105
+ React.createElement(inlined_script_1.default, { scriptStr: scriptStr }))) : null,
106
+ target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
107
+ React.createElement(styles_1.default, { contentId: (_a = builderContextSignal.content) === null || _a === void 0 ? void 0 : _a.id, cssCode: (_c = (_b = builderContextSignal.content) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.cssCode, customFonts: (_e = (_d = builderContextSignal.content) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.customFonts }))) : null,
108
+ React.createElement(blocks_1.default, { blocks: (_g = (_f = builderContextSignal.content) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.blocks, context: builderContextSignal, registeredComponents: registeredComponents })));
126
109
  }
127
- exports.default = Content;
110
+ exports.default = ContentComponent;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wrapComponentRef = void 0;
4
- const wrapComponentRef = (component) => component;
4
+ const wrapComponentRef = component => component;
5
5
  exports.wrapComponentRef = wrapComponentRef;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- 'use client';
2
+ "use client";
3
3
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
4
  if (k2 === undefined) k2 = k;
5
5
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -30,44 +30,48 @@ Object.defineProperty(exports, "__esModule", { value: true });
30
30
  const React = __importStar(require("react"));
31
31
  const react_native_1 = require("react-native");
32
32
  const react_1 = require("react");
33
- const helpers_1 = require("./helpers");
33
+ const helpers_js_1 = require("./helpers.js");
34
34
  const content_1 = __importDefault(require("../content/content"));
35
- const canTrack_1 = require("../../helpers/canTrack");
35
+ const canTrack_js_1 = require("../../helpers/canTrack.js");
36
36
  const inlined_styles_1 = __importDefault(require("../inlined-styles"));
37
- const ab_tests_1 = require("../../helpers/ab-tests");
38
- function RenderContentVariants(props) {
39
- var _a, _b, _c, _d, _e;
40
- const [variantScriptStr, setVariantScriptStr] = (0, react_1.useState)(() => {
37
+ const ab_tests_js_1 = require("../../helpers/ab-tests.js");
38
+ const inlined_script_1 = __importDefault(require("../inlined-script"));
39
+ const target_js_1 = require("../../constants/target.js");
40
+ function ContentVariants(props) {
41
+ var _a, _b, _c;
42
+ const [shouldRenderVariants, setShouldRenderVariants] = (0, react_1.useState)(() => (0, helpers_js_1.checkShouldRunVariants)({
43
+ canTrack: (0, canTrack_js_1.getDefaultCanTrack)(props.canTrack),
44
+ content: props.content,
45
+ }));
46
+ function variantScriptStr() {
41
47
  var _a;
42
- return (0, helpers_1.getVariantsScriptString)((0, helpers_1.getVariants)(props.content).map((value) => ({
43
- id: value.id,
48
+ return (0, helpers_js_1.getVariantsScriptString)((0, helpers_js_1.getVariants)(props.content).map((value) => ({
49
+ id: value.testVariationId,
44
50
  testRatio: value.testRatio,
45
51
  })), ((_a = props.content) === null || _a === void 0 ? void 0 : _a.id) || "");
46
- });
47
- const [shouldRenderVariants, setShouldRenderVariants] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
48
- canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
49
- content: props.content,
50
- }));
51
- const [hideVariantsStyleString, setHideVariantsStyleString] = (0, react_1.useState)(() => (0, helpers_1.getVariants)(props.content)
52
- .map((value) => `.variant-${value.id} { display: none; } `)
53
- .join(""));
54
- const [contentToRender, setContentToRender] = (0, react_1.useState)(() => (0, helpers_1.checkShouldRunVariants)({
55
- canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
56
- content: props.content,
57
- })
58
- ? props.content
59
- : (0, ab_tests_1.handleABTestingSync)({
60
- item: props.content,
61
- canTrack: (0, canTrack_1.getDefaultCanTrack)(props.canTrack),
62
- }));
52
+ }
53
+ function hideVariantsStyleString() {
54
+ return (0, helpers_js_1.getVariants)(props.content)
55
+ .map((value) => `.variant-${value.testVariationId} { display: none; } `)
56
+ .join("");
57
+ }
58
+ (0, react_1.useEffect)(() => {
59
+ /**
60
+ * We unmount the non-winning variants post-hydration in Vue.
61
+ */
62
+ }, []);
63
63
  return (React.createElement(React.Fragment, null,
64
+ !props.__isNestedRender && target_js_1.TARGET !== "reactNative" ? (React.createElement(React.Fragment, null,
65
+ React.createElement(inlined_script_1.default, { scriptStr: (0, helpers_js_1.getScriptString)() }))) : null,
64
66
  shouldRenderVariants ? (React.createElement(React.Fragment, null,
65
- React.createElement(inlined_styles_1.default, { id: `variants-styles-${(_a = props.content) === null || _a === void 0 ? void 0 : _a.id}`, styles: hideVariantsStyleString }),
66
- React.createElement(react_native_1.View, { id: `variants-script-${(_b = props.content) === null || _b === void 0 ? void 0 : _b.id}`, dangerouslySetInnerHTML: { __html: variantScriptStr } }), (_c = (0, helpers_1.getVariants)(props.content)) === null || _c === void 0 ? void 0 :
67
- _c.map((variant) => {
68
- var _a;
69
- return (React.createElement(content_1.default, { key: variant.id, content: variant, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents, hideContent: true, parentContentId: (_a = props.content) === null || _a === void 0 ? void 0 : _a.id, isSsrAbTest: shouldRenderVariants }));
70
- }))) : null,
71
- React.createElement(content_1.default, { model: props.model, content: contentToRender, apiKey: props.apiKey, apiVersion: props.apiVersion, canTrack: props.canTrack, customComponents: props.customComponents, classNameProp: `variant-${(_d = props.content) === null || _d === void 0 ? void 0 : _d.id}`, parentContentId: (_e = props.content) === null || _e === void 0 ? void 0 : _e.id, isSsrAbTest: shouldRenderVariants })));
67
+ React.createElement(inlined_styles_1.default, { id: `variants-styles-${(_a = props.content) === null || _a === void 0 ? void 0 : _a.id}`, styles: hideVariantsStyleString() }),
68
+ React.createElement(inlined_script_1.default, { scriptStr: variantScriptStr() }), (_b = (0, helpers_js_1.getVariants)(props.content)) === null || _b === void 0 ? void 0 :
69
+ _b.map((variant) => (React.createElement(content_1.default, { key: variant.testVariationId, content: variant, showContent: false, classNameProp: undefined, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants }))))) : null,
70
+ React.createElement(content_1.default, { content: shouldRenderVariants
71
+ ? props.content
72
+ : (0, ab_tests_js_1.handleABTestingSync)({
73
+ item: props.content,
74
+ canTrack: (0, canTrack_js_1.getDefaultCanTrack)(props.canTrack),
75
+ }), classNameProp: `variant-${(_c = props.content) === null || _c === void 0 ? void 0 : _c.id}`, showContent: true, model: props.model, data: props.data, context: props.context, apiKey: props.apiKey, apiVersion: props.apiVersion, customComponents: props.customComponents, canTrack: props.canTrack, locale: props.locale, includeRefs: props.includeRefs, enrich: props.enrich, isSsrAbTest: shouldRenderVariants })));
72
76
  }
73
- exports.default = RenderContentVariants;
77
+ exports.default = ContentVariants;