@bigbinary/neeto-molecules 3.16.76 → 3.16.77
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/ProductEmbed.js +22 -35
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +22 -35
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/ProductEmbed.js
CHANGED
|
@@ -7,6 +7,7 @@ var reactRouterDom = require('react-router-dom');
|
|
|
7
7
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
8
8
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
9
9
|
var classnames = require('classnames');
|
|
10
|
+
var useStateWithDependency = require('@bigbinary/neeto-commons-frontend/react-utils/useStateWithDependency');
|
|
10
11
|
var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
|
|
11
12
|
var Button = require('@bigbinary/neetoui/Button');
|
|
12
13
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
@@ -140,8 +141,7 @@ var elementPopupEmbedCode$1 = function elementPopupEmbedCode(_ref5) {
|
|
|
140
141
|
};
|
|
141
142
|
var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
|
|
142
143
|
var id = _ref6.id,
|
|
143
|
-
customization = _ref6.customization
|
|
144
|
-
extraArgs = _ref6.extraArgs;
|
|
144
|
+
customization = _ref6.customization;
|
|
145
145
|
var height = customization.height,
|
|
146
146
|
width = customization.width,
|
|
147
147
|
iframeTitle = customization.iframeTitle,
|
|
@@ -150,8 +150,7 @@ var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
|
|
|
150
150
|
var iframeSrc = buildIframeURL$1({
|
|
151
151
|
id: id,
|
|
152
152
|
iframeUrl: iframeUrl,
|
|
153
|
-
queryParams: queryParams
|
|
154
|
-
extraArgs: extraArgs
|
|
153
|
+
queryParams: queryParams
|
|
155
154
|
});
|
|
156
155
|
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 />\n <!-- ").concat(globalProps.appName, " iframe embed code ends -->");
|
|
157
156
|
};
|
|
@@ -229,8 +228,7 @@ var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
|
|
|
229
228
|
};
|
|
230
229
|
var iframeEmbedCode = function iframeEmbedCode(_ref6) {
|
|
231
230
|
var customization = _ref6.customization,
|
|
232
|
-
id = _ref6.id
|
|
233
|
-
extraArgs = _ref6.extraArgs;
|
|
231
|
+
id = _ref6.id;
|
|
234
232
|
var height = customization.height,
|
|
235
233
|
width = customization.width,
|
|
236
234
|
iframeTitle = customization.iframeTitle,
|
|
@@ -239,8 +237,7 @@ var iframeEmbedCode = function iframeEmbedCode(_ref6) {
|
|
|
239
237
|
var iframeSrc = buildIframeURL$1({
|
|
240
238
|
id: id,
|
|
241
239
|
iframeUrl: iframeUrl,
|
|
242
|
-
queryParams: queryParams
|
|
243
|
-
extraArgs: extraArgs
|
|
240
|
+
queryParams: queryParams
|
|
244
241
|
});
|
|
245
242
|
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 />\n {/* ").concat(globalProps.appName, " iframe embed code ends */}\n </>\n );\n };\n ");
|
|
246
243
|
};
|
|
@@ -285,28 +282,17 @@ var toCamelCasedString = function toCamelCasedString(string) {
|
|
|
285
282
|
};
|
|
286
283
|
var buildIframeURL$1 = function buildIframeURL(_ref3) {
|
|
287
284
|
var id = _ref3.id,
|
|
288
|
-
|
|
289
|
-
queryParams = _ref3.queryParams
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
url.searchParams.append(key, value);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
if (extraArgs) {
|
|
303
|
-
Object.entries(extraArgs).forEach(function (_ref6) {
|
|
304
|
-
var _ref7 = _slicedToArray(_ref6, 2),
|
|
305
|
-
key = _ref7[0],
|
|
306
|
-
value = _ref7[1];
|
|
307
|
-
url.searchParams.append(key, value);
|
|
308
|
-
});
|
|
309
|
-
}
|
|
285
|
+
iframeUrl = _ref3.iframeUrl,
|
|
286
|
+
queryParams = _ref3.queryParams;
|
|
287
|
+
var url = new URL(iframeUrl || "".concat(location.origin, "/embed/").concat(id));
|
|
288
|
+
if (!queryParams) return url.toString();
|
|
289
|
+
var parsedQueryParams = JSON.parse(queryParams);
|
|
290
|
+
Object.entries(parsedQueryParams).forEach(function (_ref4) {
|
|
291
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
292
|
+
key = _ref5[0],
|
|
293
|
+
value = _ref5[1];
|
|
294
|
+
url.searchParams.append(key, value);
|
|
295
|
+
});
|
|
310
296
|
return url.toString();
|
|
311
297
|
};
|
|
312
298
|
|
|
@@ -1490,6 +1476,7 @@ injectCss.n(css,{});
|
|
|
1490
1476
|
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; }
|
|
1491
1477
|
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(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; }
|
|
1492
1478
|
var EmbedRenderer = function EmbedRenderer(_ref) {
|
|
1479
|
+
var _options$iframe;
|
|
1493
1480
|
var className = _ref.className,
|
|
1494
1481
|
customEmbedScriptPath = _ref.customEmbedScriptPath,
|
|
1495
1482
|
customPreviewIframeUrl = _ref.customPreviewIframeUrl,
|
|
@@ -1508,12 +1495,12 @@ var EmbedRenderer = function EmbedRenderer(_ref) {
|
|
|
1508
1495
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1509
1496
|
isScriptLoading = _useState2[0],
|
|
1510
1497
|
setIsScriptLoading = _useState2[1];
|
|
1511
|
-
var
|
|
1498
|
+
var _useStateWithDependen = useStateWithDependency(function () {
|
|
1512
1499
|
return buildDefaultCustomization(options);
|
|
1513
|
-
}),
|
|
1514
|
-
|
|
1515
|
-
customizations =
|
|
1516
|
-
setCustomizations =
|
|
1500
|
+
}, [options === null || options === void 0 || (_options$iframe = options.iframe) === null || _options$iframe === void 0 ? void 0 : _options$iframe.iframeUrl]),
|
|
1501
|
+
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
1502
|
+
customizations = _useStateWithDependen2[0],
|
|
1503
|
+
setCustomizations = _useStateWithDependen2[1];
|
|
1517
1504
|
var description = customizations[selectedEmbed].description;
|
|
1518
1505
|
var customization = customizations[selectedEmbed];
|
|
1519
1506
|
var CustomizationComponent = EMBED_CUSTOMIZATION_COMPONENTS[selectedEmbed];
|