@bigbinary/neeto-molecules 4.0.58 → 4.0.60
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.
- package/dist/FloatingActionMenu.js +160 -47
- package/dist/FloatingActionMenu.js.map +1 -1
- package/dist/ProductEmbed.js +94 -58
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/cjs/FloatingActionMenu.js +157 -44
- package/dist/cjs/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +92 -56
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/package.json +1 -1
- package/types/ProductEmbed.d.ts +40 -18
package/dist/cjs/ProductEmbed.js
CHANGED
|
@@ -117,8 +117,10 @@ var inlineEmbedCode$1 = function inlineEmbedCode(_ref3) {
|
|
|
117
117
|
inlineWrapperStyle = _ref3.inlineWrapperStyle,
|
|
118
118
|
iframeStyle = _ref3.iframeStyle,
|
|
119
119
|
queryParams = _ref3.queryParams;
|
|
120
|
-
var elementSelector = customization.elementSelector
|
|
121
|
-
|
|
120
|
+
var elementSelector = customization.elementSelector,
|
|
121
|
+
dynamicHeight = customization.dynamicHeight;
|
|
122
|
+
var processedInlineWrapperStyle = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? removeHeightFromStyle(inlineWrapperStyle) : inlineWrapperStyle;
|
|
123
|
+
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 -->");
|
|
122
124
|
};
|
|
123
125
|
var floatingPopupEmbedCode$1 = function floatingPopupEmbedCode(_ref4) {
|
|
124
126
|
var customization = _ref4.customization,
|
|
@@ -150,13 +152,15 @@ var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
|
|
|
150
152
|
var height = customization.height,
|
|
151
153
|
width = customization.width,
|
|
152
154
|
iframeTitle = customization.iframeTitle,
|
|
153
|
-
iframeUrl = customization.iframeUrl
|
|
155
|
+
iframeUrl = customization.iframeUrl,
|
|
156
|
+
dynamicHeight = customization.dynamicHeight;
|
|
154
157
|
var iframeSrc = buildIframeURL$1({
|
|
155
158
|
id: id,
|
|
156
159
|
iframeUrl: iframeUrl,
|
|
157
160
|
queryParams: queryParams
|
|
158
161
|
});
|
|
159
|
-
|
|
162
|
+
var heightAttribute = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? "" : "\n".concat(TAB_STRING, "height=\"").concat(height, "\"");
|
|
163
|
+
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 -->");
|
|
160
164
|
};
|
|
161
165
|
var htmlCodeGenerators = {
|
|
162
166
|
inline: inlineEmbedCode$1,
|
|
@@ -175,7 +179,7 @@ var embedEnv = function embedEnv() {
|
|
|
175
179
|
return globalProps.railsEnv !== "production" ? "\n".concat(TAB_STRING).concat(TAB_STRING, " env: \"").concat(globalProps.railsEnv, "\",") : "";
|
|
176
180
|
};
|
|
177
181
|
var embedQueryParam = function embedQueryParam(queryParams) {
|
|
178
|
-
return queryParams ? "\n".concat(TAB_STRING).concat(TAB_STRING, "queryParams: ").concat(queryParams, ",") : "";
|
|
182
|
+
return queryParams ? "\n".concat(TAB_STRING).concat(TAB_STRING, " queryParams: ").concat(queryParams, ",") : "";
|
|
179
183
|
};
|
|
180
184
|
var parseExtraArgs = function parseExtraArgs(extraArgs) {
|
|
181
185
|
return ramda.toPairs(extraArgs).map(function (_ref) {
|
|
@@ -204,8 +208,10 @@ var inlineEmbedCode = function inlineEmbedCode(_ref3) {
|
|
|
204
208
|
inlineWrapperStyle = _ref3.inlineWrapperStyle,
|
|
205
209
|
iframeStyle = _ref3.iframeStyle,
|
|
206
210
|
queryParams = _ref3.queryParams;
|
|
207
|
-
var elementSelector = customization.elementSelector
|
|
208
|
-
|
|
211
|
+
var elementSelector = customization.elementSelector,
|
|
212
|
+
dynamicHeight = customization.dynamicHeight;
|
|
213
|
+
var processedInlineWrapperStyle = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? removeHeightFromStyle(inlineWrapperStyle) : inlineWrapperStyle;
|
|
214
|
+
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 };");
|
|
209
215
|
};
|
|
210
216
|
var floatingPopupEmbedCode = function floatingPopupEmbedCode(_ref4) {
|
|
211
217
|
var customization = _ref4.customization,
|
|
@@ -237,13 +243,15 @@ var iframeEmbedCode = function iframeEmbedCode(_ref6) {
|
|
|
237
243
|
var height = customization.height,
|
|
238
244
|
width = customization.width,
|
|
239
245
|
iframeTitle = customization.iframeTitle,
|
|
240
|
-
iframeUrl = customization.iframeUrl
|
|
246
|
+
iframeUrl = customization.iframeUrl,
|
|
247
|
+
dynamicHeight = customization.dynamicHeight;
|
|
241
248
|
var iframeSrc = buildIframeURL$1({
|
|
242
249
|
id: id,
|
|
243
250
|
iframeUrl: iframeUrl,
|
|
244
251
|
queryParams: queryParams
|
|
245
252
|
});
|
|
246
|
-
|
|
253
|
+
var heightAttribute = dynamicHeight !== null && dynamicHeight !== void 0 && dynamicHeight.value ? "" : "\n".concat(TAB_STRING).concat(TAB_STRING, " height=\"").concat(height, "\"");
|
|
254
|
+
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");
|
|
247
255
|
};
|
|
248
256
|
var reactCodeGenerators = {
|
|
249
257
|
inline: inlineEmbedCode,
|
|
@@ -252,17 +260,19 @@ var reactCodeGenerators = {
|
|
|
252
260
|
iframe: iframeEmbedCode
|
|
253
261
|
};
|
|
254
262
|
|
|
255
|
-
var _excluded = ["selectedLanguage", "type"];
|
|
256
|
-
function ownKeys$
|
|
257
|
-
function _objectSpread$
|
|
258
|
-
var buildQueryParams = function buildQueryParams() {
|
|
263
|
+
var _excluded$1 = ["selectedLanguage", "type"];
|
|
264
|
+
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; }
|
|
265
|
+
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; }
|
|
266
|
+
var buildQueryParams$1 = function buildQueryParams() {
|
|
259
267
|
var customization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
260
268
|
var existingQueryParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
261
|
-
var
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
var activeOptions = Object.keys(SWITCH_OPTIONS).reduce(function (acc, key) {
|
|
270
|
+
var _customization$key;
|
|
271
|
+
var value = (_customization$key = customization[key]) === null || _customization$key === void 0 ? void 0 : _customization$key.value;
|
|
272
|
+
if (value) acc[key] = value;
|
|
273
|
+
return acc;
|
|
274
|
+
}, {});
|
|
275
|
+
var mergedQueryParams = _objectSpread$6(_objectSpread$6({}, existingQueryParams), activeOptions);
|
|
266
276
|
if (ramda.isEmpty(mergedQueryParams)) return "";
|
|
267
277
|
return JSON.stringify(mergedQueryParams, null, 2).replace(/\n/g, " ").replace(/\s\s+/g, " ");
|
|
268
278
|
};
|
|
@@ -270,11 +280,11 @@ var generateCode = function generateCode(options) {
|
|
|
270
280
|
var _embeddedCodeOptions$, _reactCodeGenerators$, _htmlCodeGenerators$t;
|
|
271
281
|
var selectedLanguage = options.selectedLanguage,
|
|
272
282
|
type = options.type,
|
|
273
|
-
embeddedCodeOptions = _objectWithoutProperties(options, _excluded);
|
|
283
|
+
embeddedCodeOptions = _objectWithoutProperties(options, _excluded$1);
|
|
274
284
|
var queryParams = ((_embeddedCodeOptions$ = embeddedCodeOptions.customization) === null || _embeddedCodeOptions$ === void 0 ? void 0 : _embeddedCodeOptions$.queryParams) || {};
|
|
275
285
|
var customization = embeddedCodeOptions.customization || {};
|
|
276
|
-
var codeOptions = _objectSpread$
|
|
277
|
-
queryParams: buildQueryParams(customization, queryParams)
|
|
286
|
+
var codeOptions = _objectSpread$6(_objectSpread$6({}, embeddedCodeOptions), {}, {
|
|
287
|
+
queryParams: buildQueryParams$1(customization, queryParams)
|
|
278
288
|
});
|
|
279
289
|
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);
|
|
280
290
|
};
|
|
@@ -314,9 +324,12 @@ var buildIframeURL$1 = function buildIframeURL(_ref3) {
|
|
|
314
324
|
});
|
|
315
325
|
return url.toString();
|
|
316
326
|
};
|
|
327
|
+
var removeHeightFromStyle = function removeHeightFromStyle(style) {
|
|
328
|
+
return style.replace(/height\s*:\s*[^;]+;?\s*/g, "").trim();
|
|
329
|
+
};
|
|
317
330
|
|
|
318
|
-
function ownKeys$
|
|
319
|
-
function _objectSpread$
|
|
331
|
+
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; }
|
|
332
|
+
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; }
|
|
320
333
|
var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
321
334
|
var updateCustomization = _ref.updateCustomization;
|
|
322
335
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -342,7 +355,7 @@ var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
|
342
355
|
};
|
|
343
356
|
var handleInputChange = function handleInputChange(index, field, value) {
|
|
344
357
|
var newQueryParams = queryParams.map(function (param, i) {
|
|
345
|
-
return i === index ? _objectSpread$
|
|
358
|
+
return i === index ? _objectSpread$5(_objectSpread$5({}, param), {}, _defineProperty({}, field, value)) : param;
|
|
346
359
|
});
|
|
347
360
|
setQueryParams(newQueryParams);
|
|
348
361
|
};
|
|
@@ -358,7 +371,7 @@ var DynamicQueryParams = function DynamicQueryParams(_ref) {
|
|
|
358
371
|
"data-cy": "dynamic-query-params-label",
|
|
359
372
|
"data-testid": "dynamic-query-params-label",
|
|
360
373
|
children: queryParamsProps.label || t("neetoMolecules.productEmbed.queryParam.label")
|
|
361
|
-
}), neetoCist.isPresent(queryParamsProps.helpPopoverProps) && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$
|
|
374
|
+
}), neetoCist.isPresent(queryParamsProps.helpPopoverProps) && /*#__PURE__*/jsxRuntime.jsx(HelpPopover, _objectSpread$5({
|
|
362
375
|
className: "ml-1"
|
|
363
376
|
}, queryParamsProps.helpPopoverProps))]
|
|
364
377
|
}), queryParams.map(function (param, index) {
|
|
@@ -544,6 +557,9 @@ var FloatingPopup$1 = function FloatingPopup(_ref) {
|
|
|
544
557
|
});
|
|
545
558
|
};
|
|
546
559
|
|
|
560
|
+
var _excluded = ["value", "label", "helpIconProps"];
|
|
561
|
+
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; }
|
|
562
|
+
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; }
|
|
547
563
|
var SwitchOptions = function SwitchOptions(_ref) {
|
|
548
564
|
var _ref$customization = _ref.customization,
|
|
549
565
|
customization = _ref$customization === void 0 ? {} : _ref$customization,
|
|
@@ -558,25 +574,28 @@ var SwitchOptions = function SwitchOptions(_ref) {
|
|
|
558
574
|
className: "flex flex-col gap-4",
|
|
559
575
|
children: visibleOptions.map(function (_ref2) {
|
|
560
576
|
var _ref3 = _slicedToArray(_ref2, 2),
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
helpIconProps
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
} : undefined;
|
|
571
|
-
return /*#__PURE__*/React.createElement(Switch, {
|
|
572
|
-
labelProps: labelProps,
|
|
577
|
+
option = _ref3[0],
|
|
578
|
+
_ref3$ = _ref3[1],
|
|
579
|
+
value = _ref3$.value,
|
|
580
|
+
label = _ref3$.label,
|
|
581
|
+
helpIconProps = _ref3$.helpIconProps,
|
|
582
|
+
rest = _objectWithoutProperties(_ref3$, _excluded);
|
|
583
|
+
return /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
573
584
|
checked: value,
|
|
574
|
-
|
|
575
|
-
|
|
585
|
+
label: label || SWITCH_OPTIONS[option].label,
|
|
586
|
+
labelProps: helpIconProps && {
|
|
587
|
+
helpIconProps: _objectSpread$4({
|
|
588
|
+
"data-testid": "help-icon-button"
|
|
589
|
+
}, helpIconProps)
|
|
590
|
+
},
|
|
576
591
|
onChange: function onChange(e) {
|
|
577
|
-
return updateCustomization(_defineProperty({},
|
|
592
|
+
return updateCustomization(_defineProperty({}, option, _objectSpread$4(_objectSpread$4({}, rest), {}, {
|
|
593
|
+
label: label,
|
|
594
|
+
helpIconProps: helpIconProps,
|
|
595
|
+
value: e.target.checked
|
|
596
|
+
})));
|
|
578
597
|
}
|
|
579
|
-
});
|
|
598
|
+
}, option);
|
|
580
599
|
})
|
|
581
600
|
});
|
|
582
601
|
};
|
|
@@ -654,11 +673,11 @@ var Inline$1 = function Inline(_ref) {
|
|
|
654
673
|
});
|
|
655
674
|
};
|
|
656
675
|
|
|
657
|
-
function ownKeys$
|
|
658
|
-
function _objectSpread$
|
|
676
|
+
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; }
|
|
677
|
+
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; }
|
|
659
678
|
var InlineEmbedIcon = function InlineEmbedIcon(_ref) {
|
|
660
679
|
var other = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
661
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
680
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$3(_objectSpread$3({
|
|
662
681
|
fill: "none",
|
|
663
682
|
height: "163",
|
|
664
683
|
viewBox: "0 0 278 163",
|
|
@@ -907,7 +926,7 @@ var InlineEmbedIcon = function InlineEmbedIcon(_ref) {
|
|
|
907
926
|
};
|
|
908
927
|
var FloatingPopupIcon = function FloatingPopupIcon(_ref2) {
|
|
909
928
|
var other = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
910
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
929
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$3(_objectSpread$3({
|
|
911
930
|
fill: "none",
|
|
912
931
|
height: "163",
|
|
913
932
|
viewBox: "0 0 278 163",
|
|
@@ -1051,7 +1070,7 @@ var FloatingPopupIcon = function FloatingPopupIcon(_ref2) {
|
|
|
1051
1070
|
};
|
|
1052
1071
|
var ElementPopupIcon = function ElementPopupIcon(_ref3) {
|
|
1053
1072
|
var other = Object.assign({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
1054
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
1073
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$3(_objectSpread$3({
|
|
1055
1074
|
fill: "none",
|
|
1056
1075
|
height: "163",
|
|
1057
1076
|
viewBox: "0 0 278 163",
|
|
@@ -1202,8 +1221,7 @@ var SCRIPT_ID = "embed-script";
|
|
|
1202
1221
|
var TAB_STRING = " ";
|
|
1203
1222
|
var SWITCH_OPTIONS = {
|
|
1204
1223
|
dynamicHeight: {
|
|
1205
|
-
label: i18next.t("neetoMolecules.productEmbed.dynamicHeight")
|
|
1206
|
-
helpText: i18next.t("neetoMolecules.productEmbed.dynamicHeightHelpText")
|
|
1224
|
+
label: i18next.t("neetoMolecules.productEmbed.dynamicHeight")
|
|
1207
1225
|
},
|
|
1208
1226
|
hideTitle: {
|
|
1209
1227
|
label: i18next.t("neetoMolecules.productEmbed.hideTitle")
|
|
@@ -1279,11 +1297,11 @@ var Code = function Code(_ref) {
|
|
|
1279
1297
|
});
|
|
1280
1298
|
};
|
|
1281
1299
|
|
|
1282
|
-
function ownKeys$
|
|
1283
|
-
function _objectSpread$
|
|
1300
|
+
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; }
|
|
1301
|
+
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; }
|
|
1284
1302
|
var FloatingPopupPlaceholderImage = function FloatingPopupPlaceholderImage(_ref) {
|
|
1285
1303
|
var other = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
1286
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
1304
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$2(_objectSpread$2({
|
|
1287
1305
|
fill: "none",
|
|
1288
1306
|
height: "518",
|
|
1289
1307
|
viewBox: "0 0 796 518",
|
|
@@ -1343,7 +1361,7 @@ var FloatingPopupPlaceholderImage = function FloatingPopupPlaceholderImage(_ref)
|
|
|
1343
1361
|
};
|
|
1344
1362
|
var ElementPopupPlaceholderImage = function ElementPopupPlaceholderImage(_ref2) {
|
|
1345
1363
|
var other = Object.assign({}, (_objectDestructuringEmpty(_ref2), _ref2));
|
|
1346
|
-
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$
|
|
1364
|
+
return /*#__PURE__*/jsxRuntime.jsxs("svg", _objectSpread$2(_objectSpread$2({
|
|
1347
1365
|
fill: "none",
|
|
1348
1366
|
height: "518",
|
|
1349
1367
|
viewBox: "0 0 748 518",
|
|
@@ -1509,10 +1527,27 @@ var Inline = function Inline(_ref) {
|
|
|
1509
1527
|
});
|
|
1510
1528
|
};
|
|
1511
1529
|
|
|
1512
|
-
var
|
|
1530
|
+
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; }
|
|
1531
|
+
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; }
|
|
1532
|
+
var buildQueryParams = function buildQueryParams() {
|
|
1533
|
+
var customization = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1534
|
+
var existingQueryParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1535
|
+
var activeOptions = Object.keys(SWITCH_OPTIONS).reduce(function (acc, key) {
|
|
1536
|
+
var _customization$key;
|
|
1537
|
+
var value = (_customization$key = customization[key]) === null || _customization$key === void 0 ? void 0 : _customization$key.value;
|
|
1538
|
+
if (value) acc[key] = value;
|
|
1539
|
+
return acc;
|
|
1540
|
+
}, {});
|
|
1541
|
+
return _objectSpread$1(_objectSpread$1({}, existingQueryParams), activeOptions);
|
|
1542
|
+
};
|
|
1543
|
+
var buildIframeURL = function buildIframeURL(iframeURL, queryParams, customization) {
|
|
1513
1544
|
var url = new URL(iframeURL);
|
|
1514
|
-
|
|
1515
|
-
|
|
1545
|
+
var params = buildQueryParams(customization, queryParams);
|
|
1546
|
+
Object.entries(params).forEach(function (_ref) {
|
|
1547
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
1548
|
+
name = _ref2[0],
|
|
1549
|
+
value = _ref2[1];
|
|
1550
|
+
url.searchParams.append(name, value);
|
|
1516
1551
|
});
|
|
1517
1552
|
return url.toString();
|
|
1518
1553
|
};
|
|
@@ -1531,7 +1566,8 @@ var Preview = function Preview(_ref) {
|
|
|
1531
1566
|
}, shallow.shallow),
|
|
1532
1567
|
queryParams = _useProductEmbedStore.queryParams;
|
|
1533
1568
|
var preview = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, EMBED_OPTIONS.INLINE, Inline), EMBED_OPTIONS.FLOATING_POPUP, FloatingPopup), EMBED_OPTIONS.ELEMENT_POPUP, ElementPopup), EMBED_OPTIONS.IFRAME, Iframe);
|
|
1534
|
-
var
|
|
1569
|
+
var previewURL = customPreviewIframeUrl || "".concat(location.origin, "/embed/").concat(id);
|
|
1570
|
+
var iframeURL = buildIframeURL(previewURL, queryParams, customization);
|
|
1535
1571
|
var Component = preview[selectedEmbed];
|
|
1536
1572
|
if (isScriptLoading) {
|
|
1537
1573
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|