@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.
@@ -5,6 +5,7 @@ import { useLocation, useHistory } from 'react-router-dom';
5
5
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
6
6
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
7
7
  import classnames from 'classnames';
8
+ import useStateWithDependency from '@bigbinary/neeto-commons-frontend/react-utils/useStateWithDependency';
8
9
  import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
9
10
  import Button from '@bigbinary/neetoui/Button';
10
11
  import Typography from '@bigbinary/neetoui/Typography';
@@ -138,8 +139,7 @@ var elementPopupEmbedCode$1 = function elementPopupEmbedCode(_ref5) {
138
139
  };
139
140
  var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
140
141
  var id = _ref6.id,
141
- customization = _ref6.customization,
142
- extraArgs = _ref6.extraArgs;
142
+ customization = _ref6.customization;
143
143
  var height = customization.height,
144
144
  width = customization.width,
145
145
  iframeTitle = customization.iframeTitle,
@@ -148,8 +148,7 @@ var iframeEmbedCode$1 = function iframeEmbedCode(_ref6) {
148
148
  var iframeSrc = buildIframeURL$1({
149
149
  id: id,
150
150
  iframeUrl: iframeUrl,
151
- queryParams: queryParams,
152
- extraArgs: extraArgs
151
+ queryParams: queryParams
153
152
  });
154
153
  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 -->");
155
154
  };
@@ -227,8 +226,7 @@ var elementPopupEmbedCode = function elementPopupEmbedCode(_ref5) {
227
226
  };
228
227
  var iframeEmbedCode = function iframeEmbedCode(_ref6) {
229
228
  var customization = _ref6.customization,
230
- id = _ref6.id,
231
- extraArgs = _ref6.extraArgs;
229
+ id = _ref6.id;
232
230
  var height = customization.height,
233
231
  width = customization.width,
234
232
  iframeTitle = customization.iframeTitle,
@@ -237,8 +235,7 @@ var iframeEmbedCode = function iframeEmbedCode(_ref6) {
237
235
  var iframeSrc = buildIframeURL$1({
238
236
  id: id,
239
237
  iframeUrl: iframeUrl,
240
- queryParams: queryParams,
241
- extraArgs: extraArgs
238
+ queryParams: queryParams
242
239
  });
243
240
  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 ");
244
241
  };
@@ -283,28 +280,17 @@ var toCamelCasedString = function toCamelCasedString(string) {
283
280
  };
284
281
  var buildIframeURL$1 = function buildIframeURL(_ref3) {
285
282
  var id = _ref3.id,
286
- iframeURL = _ref3.iframeURL,
287
- queryParams = _ref3.queryParams,
288
- extraArgs = _ref3.extraArgs;
289
- var url = new URL(iframeURL || "".concat(location.origin, "/embed/").concat(id));
290
- if (!queryParams && !extraArgs) return url.toString();
291
- if (queryParams) {
292
- var parsedQueryParams = JSON.parse(queryParams);
293
- Object.entries(parsedQueryParams).forEach(function (_ref4) {
294
- var _ref5 = _slicedToArray(_ref4, 2),
295
- key = _ref5[0],
296
- value = _ref5[1];
297
- url.searchParams.append(key, value);
298
- });
299
- }
300
- if (extraArgs) {
301
- Object.entries(extraArgs).forEach(function (_ref6) {
302
- var _ref7 = _slicedToArray(_ref6, 2),
303
- key = _ref7[0],
304
- value = _ref7[1];
305
- url.searchParams.append(key, value);
306
- });
307
- }
283
+ iframeUrl = _ref3.iframeUrl,
284
+ queryParams = _ref3.queryParams;
285
+ var url = new URL(iframeUrl || "".concat(location.origin, "/embed/").concat(id));
286
+ if (!queryParams) return url.toString();
287
+ var parsedQueryParams = JSON.parse(queryParams);
288
+ Object.entries(parsedQueryParams).forEach(function (_ref4) {
289
+ var _ref5 = _slicedToArray(_ref4, 2),
290
+ key = _ref5[0],
291
+ value = _ref5[1];
292
+ url.searchParams.append(key, value);
293
+ });
308
294
  return url.toString();
309
295
  };
310
296
 
@@ -1488,6 +1474,7 @@ n(css,{});
1488
1474
  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; }
1489
1475
  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; }
1490
1476
  var EmbedRenderer = function EmbedRenderer(_ref) {
1477
+ var _options$iframe;
1491
1478
  var className = _ref.className,
1492
1479
  customEmbedScriptPath = _ref.customEmbedScriptPath,
1493
1480
  customPreviewIframeUrl = _ref.customPreviewIframeUrl,
@@ -1506,12 +1493,12 @@ var EmbedRenderer = function EmbedRenderer(_ref) {
1506
1493
  _useState2 = _slicedToArray(_useState, 2),
1507
1494
  isScriptLoading = _useState2[0],
1508
1495
  setIsScriptLoading = _useState2[1];
1509
- var _useState3 = useState(function () {
1496
+ var _useStateWithDependen = useStateWithDependency(function () {
1510
1497
  return buildDefaultCustomization(options);
1511
- }),
1512
- _useState4 = _slicedToArray(_useState3, 2),
1513
- customizations = _useState4[0],
1514
- setCustomizations = _useState4[1];
1498
+ }, [options === null || options === void 0 || (_options$iframe = options.iframe) === null || _options$iframe === void 0 ? void 0 : _options$iframe.iframeUrl]),
1499
+ _useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
1500
+ customizations = _useStateWithDependen2[0],
1501
+ setCustomizations = _useStateWithDependen2[1];
1515
1502
  var description = customizations[selectedEmbed].description;
1516
1503
  var customization = customizations[selectedEmbed];
1517
1504
  var CustomizationComponent = EMBED_CUSTOMIZATION_COMPONENTS[selectedEmbed];