@bigbinary/neeto-molecules 1.16.3 → 1.17.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.
@@ -10,6 +10,7 @@ var ramda = require('ramda');
10
10
  var reactI18next = require('react-i18next');
11
11
  var Codeblock = require('./Codeblock.js');
12
12
  var i18next = require('i18next');
13
+ var toConsumableArray = require('./toConsumableArray-9abb3858.js');
13
14
  var injectCss = require('./inject-css-80a5faa3.js');
14
15
  require('./extends-1b35a664.js');
15
16
  require('react-syntax-highlighter');
@@ -67,12 +68,211 @@ var DEFAULT_CUSTOMIZATION = defineProperty._defineProperty(defineProperty._defin
67
68
  });
68
69
  var SCRIPT_ID = "embed-script";
69
70
 
71
+ var FLOATING_BUTTON_POSITIONS = [{
72
+ label: i18next.t("neetoMolecules.productEmbed.customization.position.bottomLeft"),
73
+ value: "bottomLeft"
74
+ }, {
75
+ label: i18next.t("neetoMolecules.productEmbed.customization.position.bottomRight"),
76
+ value: "bottomRight"
77
+ }];
78
+ var INITIAL_QUERY_PARAM = {
79
+ name: "",
80
+ value: ""
81
+ };
82
+
83
+ var embedBaseScript = function embedBaseScript(embedScriptLink) {
84
+ return "<script>window.".concat(globalProps.appName, " = window.").concat(globalProps.appName, " || { embed: function(){(").concat(globalProps.appName, ".q=").concat(globalProps.appName, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
85
+ };
86
+ var embedEnv = function embedEnv() {
87
+ return globalProps.railsEnv !== "production" ? "\n\t env: \"".concat(globalProps.railsEnv, "\",") : "";
88
+ };
89
+ var embedQueryParam = function embedQueryParam(queryParams) {
90
+ return queryParams ? "\n\t queryParams: ".concat(queryParams, ",") : "";
91
+ };
92
+ var parseExtraArgs = function parseExtraArgs(extraArgs) {
93
+ return ramda.toPairs(extraArgs).map(function (_ref) {
94
+ var _ref2 = slicedToArray._slicedToArray(_ref, 2),
95
+ key = _ref2[0],
96
+ value = _ref2[1];
97
+ return "\n\t ".concat(key, ": \"").concat(value, "\"");
98
+ });
99
+ };
100
+ var inlineEmbedCode = function inlineEmbedCode(_ref3) {
101
+ var customization = _ref3.customization,
102
+ id = _ref3.id,
103
+ embedScriptLink = _ref3.embedScriptLink,
104
+ extraArgs = _ref3.extraArgs;
105
+ var elementSelector = customization.elementSelector,
106
+ _customization$width = customization.width,
107
+ width = _customization$width === void 0 ? 100 : _customization$width,
108
+ _customization$height = customization.height,
109
+ height = _customization$height === void 0 ? 100 : _customization$height,
110
+ queryParams = customization.queryParams;
111
+ return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"min-width: 90vw; height: 90vh;\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
112
+ };
113
+ var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
114
+ var customization = _ref4.customization,
115
+ id = _ref4.id,
116
+ embedScriptLink = _ref4.embedScriptLink,
117
+ extraArgs = _ref4.extraArgs;
118
+ var btnTextColor = customization.btnTextColor,
119
+ showIcon = customization.showIcon,
120
+ btnText = customization.btnText,
121
+ btnPosition = customization.btnPosition,
122
+ btnColor = customization.btnColor,
123
+ icon = customization.icon,
124
+ queryParams = customization.queryParams;
125
+ return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n\t\tshowIcon: ".concat(showIcon, ",") : "", "\n },").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
126
+ };
127
+ var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
128
+ var customization = _ref5.customization,
129
+ id = _ref5.id,
130
+ embedScriptLink = _ref5.embedScriptLink,
131
+ extraArgs = _ref5.extraArgs;
132
+ var elementSelector = customization.elementSelector,
133
+ queryParams = customization.queryParams;
134
+ return "\n <!-- ".concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedQueryParam(queryParams)).concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
135
+ };
136
+ var embedCode = function embedCode(_ref6) {
137
+ var type = _ref6.type,
138
+ customization = _ref6.customization,
139
+ id = _ref6.id,
140
+ embedScriptLink = _ref6.embedScriptLink,
141
+ _ref6$extraArgs = _ref6.extraArgs,
142
+ extraArgs = _ref6$extraArgs === void 0 ? {} : _ref6$extraArgs;
143
+ switch (type) {
144
+ case "inline":
145
+ return inlineEmbedCode({
146
+ customization: customization,
147
+ id: id,
148
+ embedScriptLink: embedScriptLink,
149
+ extraArgs: extraArgs
150
+ });
151
+ case "floatingPopup":
152
+ return floatingPopupEmbedCode({
153
+ customization: customization,
154
+ id: id,
155
+ embedScriptLink: embedScriptLink,
156
+ extraArgs: extraArgs
157
+ });
158
+ case "elementPopup":
159
+ return elementPopupEmbedCode({
160
+ customization: customization,
161
+ id: id,
162
+ embedScriptLink: embedScriptLink,
163
+ extraArgs: extraArgs
164
+ });
165
+ default:
166
+ return "";
167
+ }
168
+ };
169
+ var buildDefaultCustomization = function buildDefaultCustomization(defaultCustomizations) {
170
+ return ramda.mergeDeepLeft(defaultCustomizations, DEFAULT_CUSTOMIZATION);
171
+ };
172
+ var buildQueryParamsFromInputFields = function buildQueryParamsFromInputFields(inputFields) {
173
+ var filteredInputFields = inputFields.filter(function (_ref7) {
174
+ var name = _ref7.name,
175
+ value = _ref7.value;
176
+ return name && value;
177
+ });
178
+ var queryParams = filteredInputFields.reduce(function (queryParams, _ref8) {
179
+ var name = _ref8.name,
180
+ value = _ref8.value;
181
+ queryParams[name] = value;
182
+ return queryParams;
183
+ }, {});
184
+ if (ramda.isEmpty(queryParams)) return "";
185
+ var queryParamJsonString = JSON.stringify(queryParams, null, 2);
186
+ return queryParamJsonString.replace(/"([^"]+)":/g, "$1: ").replace(/\n/g, " ").replace(/\s\s+/g, " ");
187
+ };
188
+
189
+ 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; }
190
+ 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), !0).forEach(function (r) { defineProperty._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; }
191
+ var DynamicQueryParams = function DynamicQueryParams(_ref) {
192
+ var updateCustomization = _ref.updateCustomization;
193
+ var _useTranslation = reactI18next.useTranslation(),
194
+ t = _useTranslation.t;
195
+ var _useState = React.useState([INITIAL_QUERY_PARAM]),
196
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
197
+ queryParams = _useState2[0],
198
+ setQueryParams = _useState2[1];
199
+ var handleAddQueryParam = function handleAddQueryParam() {
200
+ setQueryParams([].concat(toConsumableArray._toConsumableArray(queryParams), [INITIAL_QUERY_PARAM]));
201
+ };
202
+ var handleRemoveQueryParam = function handleRemoveQueryParam(index) {
203
+ var newQueryParams = queryParams.filter(function (_, i) {
204
+ return i !== index;
205
+ });
206
+ setQueryParams(newQueryParams);
207
+ };
208
+ var handleInputChange = function handleInputChange(index, field, value) {
209
+ var newQueryParams = queryParams.map(function (param, i) {
210
+ return i === index ? _objectSpread$1(_objectSpread$1({}, param), {}, defineProperty._defineProperty({}, field, value)) : param;
211
+ });
212
+ setQueryParams(newQueryParams);
213
+ };
214
+ React.useEffect(function () {
215
+ updateCustomization({
216
+ queryParams: buildQueryParamsFromInputFields(queryParams)
217
+ });
218
+ }, [queryParams]);
219
+ return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
220
+ className: "mb-2",
221
+ "data-cy": "dynamic-query-params-label"
222
+ }, t("neetoMolecules.productEmbed.customization.queryParam.label")), queryParams.map(function (param, index) {
223
+ return /*#__PURE__*/React__default["default"].createElement("div", {
224
+ className: "mb-1 flex gap-1",
225
+ key: index
226
+ }, /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
227
+ "data-cy": "dynamic-query-key-name-input",
228
+ "data-testid": "dynamic-query-key-name-input",
229
+ name: "queryParams.".concat(index, ".name"),
230
+ value: param.name,
231
+ placeholder: t("neetoMolecules.productEmbed.customization.queryParam.keyNamePlaceholder"),
232
+ onChange: function onChange(e) {
233
+ return handleInputChange(index, "name", e.target.value);
234
+ }
235
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Input, {
236
+ "data-cy": "dynamic-query-key-value-input",
237
+ "data-testid": "dynamic-query-key-value-input",
238
+ name: "queryParams.".concat(index, ".value"),
239
+ value: param.value,
240
+ placeholder: t("neetoMolecules.productEmbed.customization.queryParam.keyValuePlaceholder"),
241
+ onChange: function onChange(e) {
242
+ return handleInputChange(index, "value", e.target.value);
243
+ }
244
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
245
+ "data-cy": "dynamic-query-delete-button",
246
+ icon: neetoIcons.Delete,
247
+ style: "text",
248
+ onClick: function onClick() {
249
+ return handleRemoveQueryParam(index);
250
+ }
251
+ }));
252
+ }), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
253
+ className: "my-2",
254
+ "data-cy": "dynamic-query-add-new-button",
255
+ icon: neetoIcons.Plus,
256
+ iconPosition: "left",
257
+ style: "link",
258
+ label: t("neetoMolecules.productEmbed.customization.queryParam.addQueryParam"),
259
+ onClick: handleAddQueryParam
260
+ }));
261
+ };
262
+
70
263
  var ElementPopup$1 = function ElementPopup(_ref) {
71
264
  var customization = _ref.customization,
72
- updateCustomization = _ref.updateCustomization;
265
+ updateCustomization = _ref.updateCustomization,
266
+ isQueryParamsEnabled = _ref.isQueryParamsEnabled;
73
267
  var elementSelector = customization.elementSelector;
74
268
  var _useTranslation = reactI18next.useTranslation(),
75
269
  t = _useTranslation.t;
270
+ React.useEffect(function () {
271
+ if (isQueryParamsEnabled) return;
272
+ updateCustomization({
273
+ queryParams: undefined
274
+ });
275
+ }, []);
76
276
  return /*#__PURE__*/React__default["default"].createElement("div", {
77
277
  className: "space-y-6"
78
278
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
@@ -92,20 +292,15 @@ var ElementPopup$1 = function ElementPopup(_ref) {
92
292
  elementSelector: e.target.value
93
293
  });
94
294
  }
295
+ }), isQueryParamsEnabled && /*#__PURE__*/React__default["default"].createElement(DynamicQueryParams, {
296
+ updateCustomization: updateCustomization
95
297
  }));
96
298
  };
97
299
 
98
- var FLOATING_BUTTON_POSITIONS = [{
99
- label: i18next.t("neetoMolecules.productEmbed.customization.position.bottomLeft"),
100
- value: "bottomLeft"
101
- }, {
102
- label: i18next.t("neetoMolecules.productEmbed.customization.position.bottomRight"),
103
- value: "bottomRight"
104
- }];
105
-
106
300
  var FloatingPopup$1 = function FloatingPopup(_ref) {
107
301
  var customization = _ref.customization,
108
- updateCustomization = _ref.updateCustomization;
302
+ updateCustomization = _ref.updateCustomization,
303
+ isQueryParamsEnabled = _ref.isQueryParamsEnabled;
109
304
  var _useTranslation = reactI18next.useTranslation(),
110
305
  t = _useTranslation.t;
111
306
  var btnTextColor = customization.btnTextColor,
@@ -114,6 +309,12 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
114
309
  btnPosition = customization.btnPosition,
115
310
  btnColor = customization.btnColor,
116
311
  icon = customization.icon;
312
+ React.useEffect(function () {
313
+ if (isQueryParamsEnabled) return;
314
+ updateCustomization({
315
+ queryParams: undefined
316
+ });
317
+ }, []);
117
318
  return /*#__PURE__*/React__default["default"].createElement("div", {
118
319
  className: "space-y-6"
119
320
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
@@ -177,12 +378,15 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
177
378
  btnTextColor: e.hex
178
379
  });
179
380
  }
180
- })));
381
+ })), isQueryParamsEnabled && /*#__PURE__*/React__default["default"].createElement(DynamicQueryParams, {
382
+ updateCustomization: updateCustomization
383
+ }));
181
384
  };
182
385
 
183
386
  var Inline$1 = function Inline(_ref) {
184
387
  var customization = _ref.customization,
185
- updateCustomization = _ref.updateCustomization;
388
+ updateCustomization = _ref.updateCustomization,
389
+ isQueryParamsEnabled = _ref.isQueryParamsEnabled;
186
390
  var height = customization.height,
187
391
  width = customization.width,
188
392
  elementSelector = customization.elementSelector;
@@ -192,6 +396,12 @@ var Inline$1 = function Inline(_ref) {
192
396
  var value = _ref2.target.value;
193
397
  return updateCustomization(defineProperty._defineProperty({}, attribute, value));
194
398
  };
399
+ React.useEffect(function () {
400
+ if (isQueryParamsEnabled) return;
401
+ updateCustomization({
402
+ queryParams: undefined
403
+ });
404
+ }, []);
195
405
  return /*#__PURE__*/React__default["default"].createElement("div", {
196
406
  className: "flex flex-col gap-y-6"
197
407
  }, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
@@ -240,17 +450,21 @@ var Inline$1 = function Inline(_ref) {
240
450
  onChange: function onChange(e) {
241
451
  return handleInputChange(e, "elementSelector");
242
452
  }
243
- })));
453
+ })), isQueryParamsEnabled && /*#__PURE__*/React__default["default"].createElement(DynamicQueryParams, {
454
+ updateCustomization: updateCustomization
455
+ }));
244
456
  };
245
457
 
246
458
  var Customization = function Customization(_ref) {
247
459
  var option = _ref.option,
248
460
  customization = _ref.customization,
249
- updateCustomization = _ref.updateCustomization;
461
+ updateCustomization = _ref.updateCustomization,
462
+ isQueryParamsEnabled = _ref.isQueryParamsEnabled;
250
463
  var type = defineProperty._defineProperty(defineProperty._defineProperty(defineProperty._defineProperty({}, EMBED_OPTIONS.INLINE, Inline$1), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup$1), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup$1);
251
464
  var Component = type[option];
252
465
  return /*#__PURE__*/React__default["default"].createElement(Component, {
253
466
  customization: customization,
467
+ isQueryParamsEnabled: isQueryParamsEnabled,
254
468
  updateCustomization: updateCustomization
255
469
  });
256
470
  };
@@ -443,90 +657,6 @@ var Preview = function Preview(_ref) {
443
657
  var css = ".neeto-molecules-product-embed-size-input.neeto-ui-input__wrapper .neeto-ui-input__prefix{align-self:stretch;background-color:rgb(var(--neeto-ui-gray-200));margin-left:0!important;padding-left:12px;padding-right:12px}.neeto-molecules-product-embed-tab{gap:.5rem}.neeto-molecules-product-embed-tab .neeto-ui-tab{border-radius:var(--neeto-ui-btn-border-radius);color:rgb(var(--neeto-ui-gray-800))}.neeto-molecules-product-embed-tab .neeto-ui-tab:not(.active):hover{background-color:rgb(var(--neeto-ui-gray-100))}.neeto-molecules-product-embed-tab .neeto-ui-tab.active{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-embed-left-sidebar{align-items:flex-start;display:flex;flex-direction:column;flex-shrink:0;max-width:28rem;overflow-y:auto;padding:1.5rem;width:100%}";
444
658
  injectCss.n(css,{});
445
659
 
446
- var embedBaseScript = function embedBaseScript(embedScriptLink) {
447
- return "<script>window.".concat(globalProps.appName, " = window.").concat(globalProps.appName, " || { embed: function(){(").concat(globalProps.appName, ".q=").concat(globalProps.appName, ".q||[]).push(arguments)} };</script>\n <script async\n src=\"").concat(embedScriptLink, "\">\n </script>");
448
- };
449
- var embedEnv = function embedEnv() {
450
- return globalProps.railsEnv !== "production" ? "\n\t env: \"".concat(globalProps.railsEnv, "\",") : "";
451
- };
452
- var parseExtraArgs = function parseExtraArgs(extraArgs) {
453
- return ramda.toPairs(extraArgs).map(function (_ref) {
454
- var _ref2 = slicedToArray._slicedToArray(_ref, 2),
455
- key = _ref2[0],
456
- value = _ref2[1];
457
- return "\n\t ".concat(key, ": \"").concat(value, "\"");
458
- });
459
- };
460
- var inlineEmbedCode = function inlineEmbedCode(_ref3) {
461
- var customization = _ref3.customization,
462
- id = _ref3.id,
463
- embedScriptLink = _ref3.embedScriptLink,
464
- extraArgs = _ref3.extraArgs;
465
- var elementSelector = customization.elementSelector,
466
- _customization$width = customization.width,
467
- width = _customization$width === void 0 ? 100 : _customization$width,
468
- _customization$height = customization.height,
469
- height = _customization$height === void 0 ? 100 : _customization$height;
470
- return "\n <!-- ".concat(globalProps.appName, " inline embed code begins -->\n <div style=\"min-width: 90vw; height: 90vh;\" id=\"").concat(elementSelector, "\">\n <!-- ").concat(globalProps.appName, " widget will be added here -->\n </div>\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"inline\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",\n styles: { height: \"").concat(height, "%\", width: \"").concat(width, "%\"},").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " inline embed code ends -->");
471
- };
472
- var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
473
- var customization = _ref4.customization,
474
- id = _ref4.id,
475
- embedScriptLink = _ref4.embedScriptLink,
476
- extraArgs = _ref4.extraArgs;
477
- var btnTextColor = customization.btnTextColor,
478
- showIcon = customization.showIcon,
479
- btnText = customization.btnText,
480
- btnPosition = customization.btnPosition,
481
- btnColor = customization.btnColor,
482
- icon = customization.icon;
483
- return "\n <!-- ".concat(globalProps.appName, " floating-popup embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"floatingPopup\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n styles: {\n btnTextColor: \"").concat(btnTextColor, "\",\n btnPosition: \"").concat(btnPosition, "\",\n btnColor: \"").concat(btnColor, "\",\n btnText: \"").concat(btnText, "\", ").concat(icon ? "\n\t\tshowIcon: ".concat(showIcon, ",") : "", "\n },").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " floating-popup embed code ends -->");
484
- };
485
- var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
486
- var customization = _ref5.customization,
487
- id = _ref5.id,
488
- embedScriptLink = _ref5.embedScriptLink,
489
- extraArgs = _ref5.extraArgs;
490
- var elementSelector = customization.elementSelector;
491
- return "\n <!-- ".concat(globalProps.appName, " element-click embed code begins -->\n ").concat(embedBaseScript(embedScriptLink), "\n <script>\n ").concat(globalProps.appName, ".embed({\n type: \"elementClick\",\n id: \"").concat(id, "\",\n organization: \"").concat(globalProps.organization.subdomain, "\",\n elementSelector: \"#").concat(elementSelector, "\",").concat(embedEnv()).concat(parseExtraArgs(extraArgs), "\n });\n </script>\n <!-- ").concat(globalProps.appName, " element-click embed code ends -->");
492
- };
493
- var embedCode = function embedCode(_ref6) {
494
- var type = _ref6.type,
495
- customization = _ref6.customization,
496
- id = _ref6.id,
497
- embedScriptLink = _ref6.embedScriptLink,
498
- _ref6$extraArgs = _ref6.extraArgs,
499
- extraArgs = _ref6$extraArgs === void 0 ? {} : _ref6$extraArgs;
500
- switch (type) {
501
- case "inline":
502
- return inlineEmbedCode({
503
- customization: customization,
504
- id: id,
505
- embedScriptLink: embedScriptLink,
506
- extraArgs: extraArgs
507
- });
508
- case "floatingPopup":
509
- return floatingPopupEmbedCode({
510
- customization: customization,
511
- id: id,
512
- embedScriptLink: embedScriptLink,
513
- extraArgs: extraArgs
514
- });
515
- case "elementPopup":
516
- return elementPopupEmbedCode({
517
- customization: customization,
518
- id: id,
519
- embedScriptLink: embedScriptLink,
520
- extraArgs: extraArgs
521
- });
522
- default:
523
- return "";
524
- }
525
- };
526
- var buildDefaultCustomization = function buildDefaultCustomization(defaultCustomizations) {
527
- return ramda.mergeDeepLeft(defaultCustomizations, DEFAULT_CUSTOMIZATION);
528
- };
529
-
530
660
  function ownKeys(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; }
531
661
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { defineProperty._defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
532
662
  var ProductEmbed = function ProductEmbed(_ref) {
@@ -539,6 +669,8 @@ var ProductEmbed = function ProductEmbed(_ref) {
539
669
  _ref$goBackLink = _ref.goBackLink,
540
670
  goBackLink = _ref$goBackLink === void 0 ? "" : _ref$goBackLink,
541
671
  id = _ref.id,
672
+ _ref$isQueryParamsEna = _ref.isQueryParamsEnabled,
673
+ isQueryParamsEnabled = _ref$isQueryParamsEna === void 0 ? false : _ref$isQueryParamsEna,
542
674
  _ref$options = _ref.options,
543
675
  options = _ref$options === void 0 ? {} : _ref$options,
544
676
  _ref$extraArgs = _ref.extraArgs,
@@ -616,6 +748,7 @@ var ProductEmbed = function ProductEmbed(_ref) {
616
748
  selectedOption: selectedOption,
617
749
  setSelectedOption: setSelectedOption
618
750
  }), /*#__PURE__*/React__default["default"].createElement(Customization, {
751
+ isQueryParamsEnabled: isQueryParamsEnabled,
619
752
  updateCustomization: updateCustomization,
620
753
  customization: customizations[selectedOption],
621
754
  option: selectedOption