@bigbinary/neeto-molecules 4.0.58 → 4.0.59

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.
@@ -1,5 +1,5 @@
1
1
  import { shallow } from 'zustand/shallow';
2
- import { useEffect, createElement, useState, useMemo } from 'react';
2
+ import { useEffect, useState, useMemo } from 'react';
3
3
  import { isPresent, filterBy, hyphenate, noop } from '@bigbinary/neeto-cist';
4
4
  import { useLocation, useHistory } from 'react-router-dom';
5
5
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
@@ -9,7 +9,7 @@ import useStateWithDependency from '@bigbinary/neeto-commons-frontend/react-util
9
9
  import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
10
10
  import Button from '@bigbinary/neetoui/Button';
11
11
  import Typography from '@bigbinary/neetoui/Typography';
12
- import { toPairs, mergeDeepLeft, pick, isEmpty, mergeLeft } from 'ramda';
12
+ import { toPairs, mergeDeepLeft, isEmpty, mergeLeft } from 'ramda';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import Container from './Container.js';
15
15
  import Header from './Header.js';
@@ -115,8 +115,10 @@ var inlineEmbedCode$1 = function inlineEmbedCode(_ref3) {
115
115
  inlineWrapperStyle = _ref3.inlineWrapperStyle,
116
116
  iframeStyle = _ref3.iframeStyle,
117
117
  queryParams = _ref3.queryParams;
118
- var elementSelector = customization.elementSelector;
119
- return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"").concat(inlineWrapperStyle, "\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName$1, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: \"").concat(iframeStyle, "\", ").concat(embedQueryParam$1(queryParams)).concat(embedEnv$1()).concat(parseExtraArgs$1(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
118
+ var elementSelector = customization.elementSelector,
119
+ dynamicHeight = customization.dynamicHeight;
120
+ var processedInlineWrapperStyle = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? removeHeightFromStyle(inlineWrapperStyle) : inlineWrapperStyle;
121
+ return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"").concat(processedInlineWrapperStyle, "\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(camelCasedAppName$1, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: \"").concat(iframeStyle, "\", ").concat(embedQueryParam$1(queryParams)).concat(embedEnv$1()).concat(parseExtraArgs$1(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
120
122
  };
121
123
  var floatingPopupEmbedCode$1 = function floatingPopupEmbedCode(_ref4) {
122
124
  var customization = _ref4.customization,
@@ -148,13 +150,15 @@ var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
148
150
  var height = customization.height,
149
151
  width = customization.width,
150
152
  iframeTitle = customization.iframeTitle,
151
- iframeUrl = customization.iframeUrl;
153
+ iframeUrl = customization.iframeUrl,
154
+ dynamicHeight = customization.dynamicHeight;
152
155
  var iframeSrc = buildIframeURL$1({
153
156
  id: id,
154
157
  iframeUrl: iframeUrl,
155
158
  queryParams: queryParams
156
159
  });
157
- return "\n <!-- ".concat(globalProps.appName, " iframe embed code begins -->\n <iframe\n allowfullscreen\n height=\"").concat(height, "\"\n width=\"").concat(width, "\"\n frameborder=\"0\"\n title=\"").concat(iframeTitle, "\"\n src=\"").concat(iframeSrc, "\"\n ></iframe>\n <!-- ").concat(globalProps.appName, " iframe embed code ends -->");
160
+ var heightAttribute = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? "" : "\n".concat(TAB_STRING, "height=\"").concat(height, "\"");
161
+ return "\n <!-- ".concat(globalProps.appName, " iframe embed code begins -->\n <iframe\n allowfullscreen").concat(heightAttribute, "\n width=\"").concat(width, "\"\n frameborder=\"0\"\n title=\"").concat(iframeTitle, "\"\n src=\"").concat(iframeSrc, "\"\n ></iframe>\n <!-- ").concat(globalProps.appName, " iframe embed code ends -->");
158
162
  };
159
163
  var htmlCodeGenerators = {
160
164
  inline: inlineEmbedCode$1,
@@ -173,7 +177,7 @@ var embedEnv = function embedEnv() {
173
177
  return globalProps.railsEnv !== "production" ? "\n".concat(TAB_STRING).concat(TAB_STRING, " env: \"").concat(globalProps.railsEnv, "\",") : "";
174
178
  };
175
179
  var embedQueryParam = function embedQueryParam(queryParams) {
176
- return queryParams ? "\n".concat(TAB_STRING).concat(TAB_STRING, "queryParams: ").concat(queryParams, ",") : "";
180
+ return queryParams ? "\n".concat(TAB_STRING).concat(TAB_STRING, " queryParams: ").concat(queryParams, ",") : "";
177
181
  };
178
182
  var parseExtraArgs = function parseExtraArgs(extraArgs) {
179
183
  return toPairs(extraArgs).map(function (_ref) {
@@ -202,8 +206,10 @@ var inlineEmbedCode = function inlineEmbedCode(_ref3) {
202
206
  inlineWrapperStyle = _ref3.inlineWrapperStyle,
203
207
  iframeStyle = _ref3.iframeStyle,
204
208
  queryParams = _ref3.queryParams;
205
- var elementSelector = customization.elementSelector;
206
- return "\n import { useEffect } from \"react\";\n\n const App = () => {\n const ".concat(embedFunctionName, " = () => {\n ").concat(embedScript(embedScriptLink), "\n embedScript.onload = () => {\n window.").concat(camelCasedAppName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: \"").concat(iframeStyle, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n };\n\n document.body.appendChild(embedScript);\n ").concat(cleanupFunction, "\n };\n\n useEffect(() => ").concat(embedFunctionName, "(), []);\n\n return (\n <div\n id=\"inline-embed-container\"\n style={{ ").concat(parseInlineStyle(inlineWrapperStyle), " }}\n />\n );\n };");
209
+ var elementSelector = customization.elementSelector,
210
+ dynamicHeight = customization.dynamicHeight;
211
+ var processedInlineWrapperStyle = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? removeHeightFromStyle(inlineWrapperStyle) : inlineWrapperStyle;
212
+ return "\n import { useEffect } from \"react\";\n\n const App = () => {\n const ".concat(embedFunctionName, " = () => {\n ").concat(embedScript(embedScriptLink), "\n embedScript.onload = () => {\n window.").concat(camelCasedAppName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: \"").concat(iframeStyle, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n };\n\n document.body.appendChild(embedScript);\n ").concat(cleanupFunction, "\n };\n\n useEffect(() => ").concat(embedFunctionName, "(), []);\n\n return (\n <div\n id=\"inline-embed-container\"\n style={{ ").concat(parseInlineStyle(processedInlineWrapperStyle), " }}\n />\n );\n };");
207
213
  };
208
214
  var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
209
215
  var customization = _ref4.customization,
@@ -235,13 +241,15 @@ var iframeEmbedCode = function iframeEmbedCode(_ref6) {
235
241
  var height = customization.height,
236
242
  width = customization.width,
237
243
  iframeTitle = customization.iframeTitle,
238
- iframeUrl = customization.iframeUrl;
244
+ iframeUrl = customization.iframeUrl,
245
+ dynamicHeight = customization.dynamicHeight;
239
246
  var iframeSrc = buildIframeURL$1({
240
247
  id: id,
241
248
  iframeUrl: iframeUrl,
242
249
  queryParams: queryParams
243
250
  });
244
- return "\n const App = () => {\n return (\n <>\n {/* ".concat(globalProps.appName, " iframe embed code begins */}\n <iframe\n allowFullScreen\n height=\"").concat(height, "\"\n width=\"").concat(width, "\"\n frameBorder=\"0\"\n title=\"").concat(iframeTitle, "\"\n src=\"").concat(iframeSrc, "\"\n ></iframe>\n {/* ").concat(globalProps.appName, " iframe embed code ends */}\n </>\n );\n };\n");
251
+ var heightAttribute = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? "" : "\n".concat(TAB_STRING).concat(TAB_STRING, " height=\"").concat(height, "\"");
252
+ return "\n const App = () => {\n return (\n <>\n {/* ".concat(globalProps.appName, " iframe embed code begins */}\n <iframe\n allowFullScreen").concat(heightAttribute, "\n width=\"").concat(width, "\"\n frameBorder=\"0\"\n title=\"").concat(iframeTitle, "\"\n src=\"").concat(iframeSrc, "\"\n ></iframe>\n {/* ").concat(globalProps.appName, " iframe embed code ends */}\n </>\n );\n };\n");
245
253
  };
246
254
  var reactCodeGenerators = {
247
255
  inline: inlineEmbedCode,
@@ -250,17 +258,19 @@ var reactCodeGenerators = {
250
258
  iframe: iframeEmbedCode
251
259
  };
252
260
 
253
- var _excluded = ["selectedLanguage", "type"];
254
- function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
255
- function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
256
- var buildQueryParams = function buildQueryParams() {
261
+ var _excluded$1 = ["selectedLanguage", "type"];
262
+ function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
263
+ function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
264
+ var buildQueryParams$1 = function buildQueryParams() {
257
265
  var customization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
258
266
  var existingQueryParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
259
- var activeKeys = Object.keys(SWITCH_OPTIONS).filter(function (key) {
260
- return customization[key];
261
- });
262
- var activeOptions = pick(activeKeys, customization);
263
- var mergedQueryParams = _objectSpread$4(_objectSpread$4({}, existingQueryParams), activeOptions);
267
+ var activeOptions = Object.keys(SWITCH_OPTIONS).reduce(function (acc, key) {
268
+ var _customization$key;
269
+ var value = (_customization$key = customization[key]) === null || _customization$key === void 0 ? void 0 : _customization$key.value;
270
+ if (value) acc[key] = value;
271
+ return acc;
272
+ }, {});
273
+ var mergedQueryParams = _objectSpread$6(_objectSpread$6({}, existingQueryParams), activeOptions);
264
274
  if (isEmpty(mergedQueryParams)) return "";
265
275
  return JSON.stringify(mergedQueryParams, null, 2).replace(/\n/g, " ").replace(/\s\s+/g, " ");
266
276
  };
@@ -268,11 +278,11 @@ var generateCode = function generateCode(options) {
268
278
  var _embeddedCodeOptions$, _reactCodeGenerators$, _htmlCodeGenerators$t;
269
279
  var selectedLanguage = options.selectedLanguage,
270
280
  type = options.type,
271
- embeddedCodeOptions = _objectWithoutProperties(options, _excluded);
281
+ embeddedCodeOptions = _objectWithoutProperties(options, _excluded$1);
272
282
  var queryParams = ((_embeddedCodeOptions$ = embeddedCodeOptions.customization) === null || _embeddedCodeOptions$ === void 0 ? void 0 : _embeddedCodeOptions$.queryParams) || {};
273
283
  var customization = embeddedCodeOptions.customization || {};
274
- var codeOptions = _objectSpread$4(_objectSpread$4({}, embeddedCodeOptions), {}, {
275
- queryParams: buildQueryParams(customization, queryParams)
284
+ var codeOptions = _objectSpread$6(_objectSpread$6({}, embeddedCodeOptions), {}, {
285
+ queryParams: buildQueryParams$1(customization, queryParams)
276
286
  });
277
287
  return selectedLanguage === "react" ? (_reactCodeGenerators$ = reactCodeGenerators[type]) === null || _reactCodeGenerators$ === void 0 ? void 0 : _reactCodeGenerators$.call(reactCodeGenerators, codeOptions) : (_htmlCodeGenerators$t = htmlCodeGenerators[type]) === null || _htmlCodeGenerators$t === void 0 ? void 0 : _htmlCodeGenerators$t.call(htmlCodeGenerators, codeOptions);
278
288
  };
@@ -312,9 +322,12 @@ var buildIframeURL$1 = function buildIframeURL(_ref3) {
312
322
  });
313
323
  return url.toString();
314
324
  };
325
+ var removeHeightFromStyle = function removeHeightFromStyle(style) {
326
+ return style.replace(/height\s*:\s*[^;]+;?\s*/g, "").trim();
327
+ };
315
328
 
316
- function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
317
- function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
329
+ function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
330
+ function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
318
331
  var DynamicQueryParams = function DynamicQueryParams(_ref) {
319
332
  var updateCustomization = _ref.updateCustomization;
320
333
  var _useTranslation = useTranslation(),
@@ -340,7 +353,7 @@ var DynamicQueryParams = function DynamicQueryParams(_ref) {
340
353
  };
341
354
  var handleInputChange = function handleInputChange(index, field, value) {
342
355
  var newQueryParams = queryParams.map(function (param, i) {
343
- return i === index ? _objectSpread$3(_objectSpread$3({}, param), {}, _defineProperty({}, field, value)) : param;
356
+ return i === index ? _objectSpread$5(_objectSpread$5({}, param), {}, _defineProperty({}, field, value)) : param;
344
357
  });
345
358
  setQueryParams(newQueryParams);
346
359
  };
@@ -356,7 +369,7 @@ var DynamicQueryParams = function DynamicQueryParams(_ref) {
356
369
  "data-cy": "dynamic-query-params-label",
357
370
  "data-testid": "dynamic-query-params-label",
358
371
  children: queryParamsProps.label || t("neetoMolecules.productEmbed.queryParam.label")
359
- }), isPresent(queryParamsProps.helpPopoverProps) && /*#__PURE__*/jsx(HelpPopover, _objectSpread$3({
372
+ }), isPresent(queryParamsProps.helpPopoverProps) && /*#__PURE__*/jsx(HelpPopover, _objectSpread$5({
360
373
  className: "ml-1"
361
374
  }, queryParamsProps.helpPopoverProps))]
362
375
  }), queryParams.map(function (param, index) {
@@ -542,6 +555,9 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
542
555
  });
543
556
  };
544
557
 
558
+ var _excluded = ["value", "label", "helpIconProps"];
559
+ function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
560
+ function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
545
561
  var SwitchOptions = function SwitchOptions(_ref) {
546
562
  var _ref$customization = _ref.customization,
547
563
  customization = _ref$customization === void 0 ? {} : _ref$customization,
@@ -556,25 +572,28 @@ var SwitchOptions = function SwitchOptions(_ref) {
556
572
  className: "flex flex-col gap-4",
557
573
  children: visibleOptions.map(function (_ref2) {
558
574
  var _ref3 = _slicedToArray(_ref2, 2),
559
- key = _ref3[0],
560
- value = _ref3[1];
561
- var helpText = SWITCH_OPTIONS[key].helpText;
562
- var labelProps = helpText ? {
563
- helpIconProps: {
564
- tooltipProps: {
565
- content: helpText
566
- }
567
- }
568
- } : undefined;
569
- return /*#__PURE__*/createElement(Switch, {
570
- labelProps: labelProps,
575
+ option = _ref3[0],
576
+ _ref3$ = _ref3[1],
577
+ value = _ref3$.value,
578
+ label = _ref3$.label,
579
+ helpIconProps = _ref3$.helpIconProps,
580
+ rest = _objectWithoutProperties(_ref3$, _excluded);
581
+ return /*#__PURE__*/jsx(Switch, {
571
582
  checked: value,
572
- key: key,
573
- label: SWITCH_OPTIONS[key].label,
583
+ label: label || SWITCH_OPTIONS[option].label,
584
+ labelProps: helpIconProps && {
585
+ helpIconProps: _objectSpread$4({
586
+ "data-testid": "help-icon-button"
587
+ }, helpIconProps)
588
+ },
574
589
  onChange: function onChange(e) {
575
- return updateCustomization(_defineProperty({}, key, e.target.checked));
590
+ return updateCustomization(_defineProperty({}, option, _objectSpread$4(_objectSpread$4({}, rest), {}, {
591
+ label: label,
592
+ helpIconProps: helpIconProps,
593
+ value: e.target.checked
594
+ })));
576
595
  }
577
- });
596
+ }, option);
578
597
  })
579
598
  });
580
599
  };
@@ -652,11 +671,11 @@ var Inline$1 = function Inline(_ref) {
652
671
  });
653
672
  };
654
673
 
655
- function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
656
- function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
674
+ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
675
+ function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
657
676
  var InlineEmbedIcon = function InlineEmbedIcon(_ref) {
658
677
  var other = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
659
- return /*#__PURE__*/jsxs("svg", _objectSpread$2(_objectSpread$2({
678
+ return /*#__PURE__*/jsxs("svg", _objectSpread$3(_objectSpread$3({
660
679
  fill: "none",
661
680
  height: "163",
662
681
  viewBox: "0 0 278 163",
@@ -905,7 +924,7 @@ var InlineEmbedIcon = function InlineEmbedIcon(_ref) {
905
924
  };
906
925
  var FloatingPopupIcon = function FloatingPopupIcon(_ref2) {
907
926
  var other = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
908
- return /*#__PURE__*/jsxs("svg", _objectSpread$2(_objectSpread$2({
927
+ return /*#__PURE__*/jsxs("svg", _objectSpread$3(_objectSpread$3({
909
928
  fill: "none",
910
929
  height: "163",
911
930
  viewBox: "0 0 278 163",
@@ -1049,7 +1068,7 @@ var FloatingPopupIcon = function FloatingPopupIcon(_ref2) {
1049
1068
  };
1050
1069
  var ElementPopupIcon = function ElementPopupIcon(_ref3) {
1051
1070
  var other = Object.assign({}, (_objectDestructuringEmpty(_ref3), _ref3));
1052
- return /*#__PURE__*/jsxs("svg", _objectSpread$2(_objectSpread$2({
1071
+ return /*#__PURE__*/jsxs("svg", _objectSpread$3(_objectSpread$3({
1053
1072
  fill: "none",
1054
1073
  height: "163",
1055
1074
  viewBox: "0 0 278 163",
@@ -1200,8 +1219,7 @@ var SCRIPT_ID = "embed-script";
1200
1219
  var TAB_STRING = " ";
1201
1220
  var SWITCH_OPTIONS = {
1202
1221
  dynamicHeight: {
1203
- label: t("neetoMolecules.productEmbed.dynamicHeight"),
1204
- helpText: t("neetoMolecules.productEmbed.dynamicHeightHelpText")
1222
+ label: t("neetoMolecules.productEmbed.dynamicHeight")
1205
1223
  },
1206
1224
  hideTitle: {
1207
1225
  label: t("neetoMolecules.productEmbed.hideTitle")
@@ -1277,11 +1295,11 @@ var Code = function Code(_ref) {
1277
1295
  });
1278
1296
  };
1279
1297
 
1280
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1281
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1298
+ function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1299
+ function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1282
1300
  var FloatingPopupPlaceholderImage = function FloatingPopupPlaceholderImage(_ref) {
1283
1301
  var other = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
1284
- return /*#__PURE__*/jsxs("svg", _objectSpread$1(_objectSpread$1({
1302
+ return /*#__PURE__*/jsxs("svg", _objectSpread$2(_objectSpread$2({
1285
1303
  fill: "none",
1286
1304
  height: "518",
1287
1305
  viewBox: "0 0 796 518",
@@ -1341,7 +1359,7 @@ var FloatingPopupPlaceholderImage = function FloatingPopupPlaceholderImage(_ref)
1341
1359
  };
1342
1360
  var ElementPopupPlaceholderImage = function ElementPopupPlaceholderImage(_ref2) {
1343
1361
  var other = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
1344
- return /*#__PURE__*/jsxs("svg", _objectSpread$1(_objectSpread$1({
1362
+ return /*#__PURE__*/jsxs("svg", _objectSpread$2(_objectSpread$2({
1345
1363
  fill: "none",
1346
1364
  height: "518",
1347
1365
  viewBox: "0 0 748 518",
@@ -1507,10 +1525,27 @@ var Inline = function Inline(_ref) {
1507
1525
  });
1508
1526
  };
1509
1527
 
1510
- var buildIframeURL = function buildIframeURL(iframeURL, queryParams) {
1528
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1529
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1530
+ var buildQueryParams = function buildQueryParams() {
1531
+ var customization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1532
+ var existingQueryParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1533
+ var activeOptions = Object.keys(SWITCH_OPTIONS).reduce(function (acc, key) {
1534
+ var _customization$key;
1535
+ var value = (_customization$key = customization[key]) === null || _customization$key === void 0 ? void 0 : _customization$key.value;
1536
+ if (value) acc[key] = value;
1537
+ return acc;
1538
+ }, {});
1539
+ return _objectSpread$1(_objectSpread$1({}, existingQueryParams), activeOptions);
1540
+ };
1541
+ var buildIframeURL = function buildIframeURL(iframeURL, queryParams, customization) {
1511
1542
  var url = new URL(iframeURL);
1512
- queryParams.forEach(function (param) {
1513
- url.searchParams.append(param.name, param.value);
1543
+ var params = buildQueryParams(customization, queryParams);
1544
+ Object.entries(params).forEach(function (_ref) {
1545
+ var _ref2 = _slicedToArray(_ref, 2),
1546
+ name = _ref2[0],
1547
+ value = _ref2[1];
1548
+ url.searchParams.append(name, value);
1514
1549
  });
1515
1550
  return url.toString();
1516
1551
  };
@@ -1529,7 +1564,8 @@ var Preview = function Preview(_ref) {
1529
1564
  }, shallow),
1530
1565
  queryParams = _useProductEmbedStore.queryParams;
1531
1566
  var preview = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, EMBED_OPTIONS.INLINE, Inline), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup), EMBED_OPTIONS.IFRAME, Iframe);
1532
- var iframeURL = buildIframeURL(customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id), queryParams);
1567
+ var previewURL = customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id);
1568
+ var iframeURL = buildIframeURL(previewURL, queryParams, customization);
1533
1569
  var Component = preview[selectedEmbed];
1534
1570
  if (isScriptLoading) {
1535
1571
  return /*#__PURE__*/jsx("div", {