@bigbinary/neeto-molecules 3.16.7 → 3.16.9

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,13 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var neetoCist = require('@bigbinary/neeto-cist');
4
- var ramda = require('ramda');
4
+ var reactRouterDom = require('react-router-dom');
5
+ var ErrorPage = require('./ErrorPage.js');
5
6
  var classnames = require('classnames');
6
7
  var Typography = require('@bigbinary/neetoui/Typography');
8
+ var ramda = require('ramda');
7
9
  var reactI18next = require('react-i18next');
10
+ var Container = require('./Container.js');
8
11
  var jsxRuntime = require('react/jsx-runtime');
9
12
  var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
10
13
  var React = require('react');
14
+ var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
11
15
  var ExternalLink = require('@bigbinary/neeto-icons/ExternalLink');
12
16
  var Button = require('@bigbinary/neetoui/Button');
13
17
  var CopyToClipboardButton = require('./CopyToClipboardButton.js');
@@ -21,6 +25,9 @@ var Facebook = require('@bigbinary/neeto-icons/Facebook');
21
25
  var Linkedin = require('@bigbinary/neeto-icons/Linkedin');
22
26
  var Twitter = require('@bigbinary/neeto-icons/Twitter');
23
27
  var yup = require('yup');
28
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
29
+ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
30
+ var _regeneratorRuntime = require('@babel/runtime/regenerator');
24
31
  var general = require('@bigbinary/neeto-commons-frontend/utils/general');
25
32
  var injectCss = require('./inject-css-vQvjPR2x.js');
26
33
  var utils = require('@bigbinary/neeto-commons-frontend/utils');
@@ -29,15 +36,31 @@ var Modal = require('@bigbinary/neetoui/Modal');
29
36
  var Input$1 = require('@bigbinary/neetoui/Input');
30
37
  var Select = require('@bigbinary/neetoui/Select');
31
38
  var DatePicker = require('@bigbinary/neetoui/DatePicker');
32
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
33
- var reactRouterDom = require('react-router-dom');
34
- require('@babel/runtime/helpers/objectWithoutProperties');
39
+ var Share = require('@bigbinary/neeto-icons/Share');
40
+ var QrCode = require('@bigbinary/neeto-icons/QrCode');
41
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
42
+ var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
43
+ var CardLayout = require('./CardLayout.js');
44
+ var Header$1 = require('./Header.js');
45
+ require('zustand/shallow');
46
+ require('@bigbinary/neeto-commons-frontend/react-utils/useDisplayErrorPage');
47
+ require('react-helmet');
48
+ require('./index-JY2zVpnv.js');
49
+ require('./_commonjsHelpers-BJu3ubxk.js');
35
50
  require('@bigbinary/neeto-icons/Copy');
36
51
  require('@bigbinary/neeto-icons/Check');
37
52
  require('@bigbinary/neeto-icons/MenuHorizontal');
38
53
  require('@bigbinary/neeto-icons/MenuVertical');
39
54
  require('@bigbinary/neetoui/Dropdown');
40
55
  require('@bigbinary/neetoui/Tooltip');
56
+ require('./Breadcrumbs.js');
57
+ require('./HelpPopover.js');
58
+ require('@bigbinary/neetoui/Popover');
59
+ require('./Search.js');
60
+ require('@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce');
61
+ require('@bigbinary/neeto-commons-frontend/react-utils/useQueryParams');
62
+ require('@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect');
63
+ require('@bigbinary/neeto-icons/Search');
41
64
 
42
65
  function _interopNamespaceDefault(e) {
43
66
  var n = Object.create(null);
@@ -119,6 +142,49 @@ var downloadCanvas = function downloadCanvas(canvas) {
119
142
  element.click();
120
143
  element.remove();
121
144
  };
145
+ var copyCanvasToClipboard = /*#__PURE__*/function () {
146
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, handleDownloadQRCode) {
147
+ var blob, clipboardItem;
148
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
149
+ while (1) switch (_context.prev = _context.next) {
150
+ case 0:
151
+ if (canvas) {
152
+ _context.next = 2;
153
+ break;
154
+ }
155
+ return _context.abrupt("return");
156
+ case 2:
157
+ _context.prev = 2;
158
+ _context.next = 5;
159
+ return new Promise(function (resolve) {
160
+ return canvas.toBlob(resolve);
161
+ });
162
+ case 5:
163
+ blob = _context.sent;
164
+ if (blob) {
165
+ _context.next = 8;
166
+ break;
167
+ }
168
+ return _context.abrupt("return");
169
+ case 8:
170
+ clipboardItem = new ClipboardItem(_defineProperty({}, blob.type, blob));
171
+ navigator.clipboard.write([clipboardItem]);
172
+ _context.next = 15;
173
+ break;
174
+ case 12:
175
+ _context.prev = 12;
176
+ _context.t0 = _context["catch"](2);
177
+ handleDownloadQRCode();
178
+ case 15:
179
+ case "end":
180
+ return _context.stop();
181
+ }
182
+ }, _callee, null, [[2, 12]]);
183
+ }));
184
+ return function copyCanvasToClipboard(_x, _x2) {
185
+ return _ref4.apply(this, arguments);
186
+ };
187
+ }();
122
188
  var getPathname = function getPathname(url) {
123
189
  return new URL(url).pathname.slice(1);
124
190
  };
@@ -158,8 +224,8 @@ var PATH_VALIDATION_SCHEMA = yup__namespace.object().shape({
158
224
  path: yup__namespace.string().required(i18next.t("neetoMolecules.shareViaLink.editUrl.validationError")).matches(/^[A-Za-z0-9]([\w/-])*$/, i18next.t("neetoMolecules.shareViaLink.editUrl.validationError"))
159
225
  });
160
226
 
161
- var css = ".no-padding .neeto-ui-input.neeto-ui-input--medium input{padding:0}.no-padding .neeto-ui-input__prefix{color:rgb(var(--neeto-ui-gray-600))!important}";
162
- injectCss.n(css,{});
227
+ var css$1 = ".no-padding .neeto-ui-input.neeto-ui-input--medium input{padding:0}.no-padding .neeto-ui-input__prefix{color:rgb(var(--neeto-ui-gray-600))!important}";
228
+ injectCss.n(css$1,{});
163
229
 
164
230
  var Header = Pane.Header,
165
231
  Body = Pane.Body,
@@ -410,25 +476,32 @@ var Link = function Link(_ref) {
410
476
  setIsEditURLModalOpen = _useState4[1];
411
477
  var _useTranslation = reactI18next.useTranslation(),
412
478
  t = _useTranslation.t;
479
+ var _useBreakpoints = useBreakpoints(),
480
+ isSize = _useBreakpoints.isSize;
481
+ var isMobile = isSize("mobile");
413
482
  var isDropdownEnabled = enabledOptions.regenerate || enabledOptions.edit;
414
483
  return /*#__PURE__*/jsxRuntime.jsx("div", {
415
484
  className: "space-y-4",
416
485
  "data-cy": "link-block",
417
486
  "data-testid": "link-block",
418
487
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
419
- className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-1",
420
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
421
- className: "neeto-ui-rounded-md neeto-ui-border-gray-200 relative min-w-0 flex-grow truncate border p-2 leading-none",
488
+ className: "flex items-center gap-1 sm:gap-2",
489
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
490
+ className: "neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-ui-bg-gray-50 relative flex min-w-0 flex-grow items-center truncate border leading-none",
422
491
  "data-cy": "nui-input-field",
423
- children: url
424
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
425
- className: "flex w-full flex-shrink-0 items-center gap-1 sm:w-auto",
426
- children: [/*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
492
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
493
+ className: "relative min-w-0 flex-grow truncate p-2 leading-none",
494
+ children: url
495
+ }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
496
+ className: "rounded-l-none",
427
497
  "data-cy": "link-copy-button",
428
498
  "data-testid": "link-copy-button",
429
- label: t("neetoMolecules.shareViaLink.copyLink"),
499
+ label: !isMobile ? t("neetoMolecules.shareViaLink.copyLink") : null,
430
500
  value: url
431
- }), /*#__PURE__*/jsxRuntime.jsx(Button, {
501
+ })]
502
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
503
+ className: "flex flex-shrink-0 items-center gap-1 sm:gap-2",
504
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
432
505
  "data-cy": "preview-button",
433
506
  "data-testid": "preview-button",
434
507
  href: previewUrl || url,
@@ -488,6 +561,189 @@ var Link = function Link(_ref) {
488
561
  });
489
562
  };
490
563
 
564
+ var _excluded = ["title", "link", "description", "Icon", "onClick"];
565
+ 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; }
566
+ 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; }
567
+ var Card = function Card(_ref) {
568
+ var title = _ref.title,
569
+ link = _ref.link,
570
+ description = _ref.description,
571
+ Icon = _ref.Icon,
572
+ _ref$onClick = _ref.onClick,
573
+ onClick = _ref$onClick === void 0 ? neetoCist.noop : _ref$onClick,
574
+ otherProps = _objectWithoutProperties(_ref, _excluded);
575
+ var Component = neetoCist.isPresent(link) ? reactRouterDom.Link : "div";
576
+ return /*#__PURE__*/jsxRuntime.jsxs(Component, _objectSpread(_objectSpread({
577
+ onClick: onClick,
578
+ className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-molecules-share-landing__card flex cursor-pointer flex-col gap-3 border p-3",
579
+ to: link
580
+ }, otherProps), {}, {
581
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
582
+ className: "flex items-center gap-2",
583
+ children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
584
+ className: "neeto-ui-text-gray-500 flex-shrink-0",
585
+ size: 24
586
+ }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
587
+ className: "min-w-0 flex-grow break-words",
588
+ style: "h4",
589
+ children: title
590
+ })]
591
+ }), description && /*#__PURE__*/jsxRuntime.jsx(Typography, {
592
+ className: "break-words",
593
+ lineHeight: "normal",
594
+ style: "body2",
595
+ children: description
596
+ })]
597
+ }));
598
+ };
599
+
600
+ var ShareBlock = function ShareBlock(_ref) {
601
+ var moreOptions = _ref.moreOptions,
602
+ disableShareSocialMedia = _ref.disableShareSocialMedia,
603
+ disableQRDownload = _ref.disableQRDownload,
604
+ socialMediaProps = _ref.socialMediaProps,
605
+ qrCodeProps = _ref.qrCodeProps,
606
+ entity = _ref.entity;
607
+ var location = reactRouterDom.useLocation();
608
+ var history = reactRouterDom.useHistory();
609
+ var _useTranslation = reactI18next.useTranslation(),
610
+ t = _useTranslation.t;
611
+ var handleNavigate = function handleNavigate(subPath) {
612
+ // eslint-disable-next-line @bigbinary/neeto/use-common-routes
613
+ history.push("".concat(location.pathname, "/").concat(subPath));
614
+ };
615
+ var hasMoreOptions = neetoCist.isPresent(moreOptions);
616
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
617
+ className: "neeto-ui-border-gray-200 mt-8 grid grid-cols-1 gap-4 border-t pt-8 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
618
+ children: [hasMoreOptions && moreOptions.map(function (_ref2) {
619
+ var title = _ref2.title,
620
+ link = _ref2.link,
621
+ Icon = _ref2.icon,
622
+ onClick = _ref2.onClick,
623
+ dataCy = _ref2.dataCy,
624
+ description = _ref2.description;
625
+ return /*#__PURE__*/React.createElement(Card, {
626
+ Icon: Icon,
627
+ description: description,
628
+ link: link,
629
+ onClick: onClick,
630
+ title: title,
631
+ "data-cy": dataCy,
632
+ "data-testid": dataCy,
633
+ key: link
634
+ });
635
+ }), !disableShareSocialMedia && /*#__PURE__*/jsxRuntime.jsx(Card, {
636
+ Icon: Share,
637
+ "data-cy": "social-share-card",
638
+ "data-testid": "social-share-card",
639
+ description: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description"),
640
+ title: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title"),
641
+ onClick: function onClick() {
642
+ return handleNavigate("social-media");
643
+ }
644
+ }), !disableQRDownload && entity && /*#__PURE__*/jsxRuntime.jsx(Card, {
645
+ Icon: QrCode,
646
+ "data-cy": "qr-code-card",
647
+ "data-testid": "qr-code-card",
648
+ description: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description"),
649
+ title: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title"),
650
+ onClick: function onClick() {
651
+ return handleNavigate("qrcode");
652
+ }
653
+ })]
654
+ });
655
+ };
656
+
657
+ var MainPanel = function MainPanel(_ref) {
658
+ var title = _ref.title,
659
+ description = _ref.description,
660
+ qrCodeProps = _ref.qrCodeProps,
661
+ socialMediaProps = _ref.socialMediaProps,
662
+ _ref$isLoading = _ref.isLoading,
663
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
664
+ _ref$enabledOptions = _ref.enabledOptions,
665
+ enabledOptions = _ref$enabledOptions === void 0 ? {
666
+ regenerate: false,
667
+ edit: false
668
+ } : _ref$enabledOptions,
669
+ _ref$urls = _ref.urls,
670
+ urls = _ref$urls === void 0 ? [] : _ref$urls,
671
+ entity = _ref.entity,
672
+ entityName = _ref.entityName,
673
+ _ref$handleEdit = _ref.handleEdit,
674
+ handleEdit = _ref$handleEdit === void 0 ? neetoCist.noop : _ref$handleEdit,
675
+ _ref$handleRegenerate = _ref.handleRegenerate,
676
+ handleRegenerate = _ref$handleRegenerate === void 0 ? neetoCist.noop : _ref$handleRegenerate,
677
+ moreOptions = _ref.moreOptions,
678
+ _ref$disableShareSoci = _ref.disableShareSocialMedia,
679
+ disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
680
+ _ref$disableQRDownloa = _ref.disableQRDownload,
681
+ disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
682
+ _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
683
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
684
+ customTopContent = _ref.customTopContent,
685
+ customBottomContent = _ref.customBottomContent;
686
+ var _useTranslation = reactI18next.useTranslation(),
687
+ t = _useTranslation.t;
688
+ var shouldShowShareBlock = !disableQRDownload || !disableShareSocialMedia || neetoCist.isPresent(moreOptions);
689
+ return /*#__PURE__*/jsxRuntime.jsx(Container, {
690
+ className: "neeto-ui-bg-gray-100 neeto-molecule-share-landing-page",
691
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
692
+ className: "mx-auto w-full max-w-5xl py-10",
693
+ children: [customTopContent, /*#__PURE__*/jsxRuntime.jsx(Typography, {
694
+ "data-cy": "share-your-meeting-heading",
695
+ lineHeight: "tight",
696
+ style: "h2",
697
+ className: classnames({
698
+ "mb-2": neetoCist.isPresent(description),
699
+ "mb-6": !neetoCist.isPresent(description)
700
+ }),
701
+ children: title || t("neetoMolecules.shareViaLink.title", {
702
+ productName: globalProps.appName
703
+ })
704
+ }), description && /*#__PURE__*/jsxRuntime.jsx(Typography, {
705
+ className: "mb-6",
706
+ "data-cy": "share-your-meeting-heading",
707
+ lineHeight: "normal",
708
+ style: "body1",
709
+ children: description
710
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
711
+ className: "neeto-ui-rounded-lg neeto-ui-bg-white p-6 sm:p-8",
712
+ "data-testid": "share-via-link",
713
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
714
+ className: "space-y-1",
715
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
716
+ className: "inline-flex max-w-full flex-col space-y-4",
717
+ children: urls.map(function (urlOption) {
718
+ return /*#__PURE__*/React.createElement(Link, {
719
+ enabledOptions: enabledOptions,
720
+ entityName: entityName,
721
+ handleEdit: handleEdit,
722
+ handleRegenerate: handleRegenerate,
723
+ isLoading: isLoading,
724
+ editUrlProps: ramda.omit(["url"], urlOption),
725
+ key: urlOption.url,
726
+ previewUrl: urlOption.previewUrl,
727
+ url: urlOption.url
728
+ });
729
+ })
730
+ }), neetoCist.isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsxRuntime.jsx(ExpiryNotice, {
731
+ expiryConfiguration: publicLinkExpiryConfiguration
732
+ })]
733
+ }), shouldShowShareBlock && /*#__PURE__*/jsxRuntime.jsx(ShareBlock, {
734
+ disableQRDownload: disableQRDownload,
735
+ disableShareSocialMedia: disableShareSocialMedia,
736
+ entity: entity,
737
+ moreOptions: moreOptions,
738
+ qrCodeProps: qrCodeProps,
739
+ socialMediaProps: socialMediaProps,
740
+ url: urls[0].url
741
+ })]
742
+ }), customBottomContent]
743
+ })
744
+ });
745
+ };
746
+
491
747
  var __defProp = Object.defineProperty;
492
748
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
493
749
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1349,172 +1605,144 @@ var QRCode$1 = (props) => {
1349
1605
 
1350
1606
  var QRCode = function QRCode(_ref) {
1351
1607
  var entity = _ref.entity,
1352
- url = _ref.url;
1608
+ qrCodeProps = _ref.qrCodeProps,
1609
+ url = _ref.url,
1610
+ shareUrl = _ref.shareUrl;
1611
+ var _useTranslation = reactI18next.useTranslation(),
1612
+ t = _useTranslation.t;
1353
1613
  if (!entity) return null;
1354
1614
  var id = entity.id,
1355
1615
  name = entity.name;
1356
1616
  var canvasId = "qrcode-share-".concat(id);
1357
- var handleDownload = function handleDownload() {
1617
+ var handleDownloadQRCode = function handleDownloadQRCode() {
1358
1618
  var canvas = document.getElementById(canvasId);
1359
1619
  if (canvas) downloadCanvas(canvas, {
1360
1620
  name: neetoCist.slugify(name)
1361
1621
  });
1362
1622
  };
1363
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1364
- className: "neeto-ui-border-gray-200 flex flex-col justify-start space-y-2 border-t py-3 pl-8 sm:space-y-4 sm:border-l sm:py-2 sm:pl-6",
1365
- "data-cy": "qr-download-block",
1366
- "data-testid": "qr-download-block",
1367
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1368
- lineHeight: "normal",
1369
- style: "body2",
1370
- weight: "medium",
1371
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
1372
- i18nKey: "neetoMolecules.shareViaLink.socialMediaShare.qrCodeInfo",
1373
- components: {
1374
- button: /*#__PURE__*/jsxRuntime.jsx(Button, {
1375
- "data-cy": "qr-code-download-button",
1376
- "data-testid": "qr-code-download-button",
1377
- style: "link",
1378
- onClick: handleDownload
1379
- })
1380
- }
1623
+ var handleCopyQRCode = function handleCopyQRCode() {
1624
+ var canvas = document.getElementById(canvasId);
1625
+ if (canvas) copyCanvasToClipboard(canvas, handleDownloadQRCode);
1626
+ };
1627
+ var title = (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.pageTitle) || (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title");
1628
+ var description = (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.pageDescription) || (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description");
1629
+ return /*#__PURE__*/jsxRuntime.jsxs(Container, {
1630
+ className: "neeto-molecules-embed-qr-code-landing-page py-8",
1631
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
1632
+ className: "mb-4",
1633
+ "data-cy": "back-button",
1634
+ "data-testid": "back-button",
1635
+ icon: LeftArrow,
1636
+ iconPosition: "left",
1637
+ label: t("neetoMolecules.productEmbed.backToShare"),
1638
+ size: "small",
1639
+ style: "link",
1640
+ to: shareUrl
1641
+ }), /*#__PURE__*/jsxRuntime.jsx(Header$1, {
1642
+ className: "py-0",
1643
+ title: t("neetoMolecules.shareViaLink.qrCode.title")
1644
+ }), /*#__PURE__*/jsxRuntime.jsx(CardLayout, {
1645
+ description: description,
1646
+ title: title,
1647
+ actionBlock: /*#__PURE__*/jsxRuntime.jsxs("div", {
1648
+ className: "flex flex-wrap items-center gap-3",
1649
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
1650
+ "data-cy": "qr-code-download-button",
1651
+ "data-testid": "qr-code-download-button",
1652
+ label: t("neetoMolecules.shareViaLink.qrCode.download"),
1653
+ style: "primary",
1654
+ onClick: handleDownloadQRCode
1655
+ }), /*#__PURE__*/jsxRuntime.jsx(CopyToClipboardButton, {
1656
+ "data-cy": "qr-code-copy-button",
1657
+ "data-testid": "qr-code-copy-button",
1658
+ label: t("neetoMolecules.shareViaLink.qrCode.copy"),
1659
+ style: "secondary",
1660
+ onClick: handleCopyQRCode
1661
+ })]
1662
+ }),
1663
+ children: /*#__PURE__*/jsxRuntime.jsx(QRCode$1, {
1664
+ className: "mt-6 cursor-pointer",
1665
+ "data-cy": "qr-code-image",
1666
+ "data-testid": "qr-code-image",
1667
+ id: canvasId,
1668
+ size: 160,
1669
+ style: {
1670
+ width: 160,
1671
+ height: 160
1672
+ },
1673
+ value: url,
1674
+ onClick: handleDownloadQRCode
1381
1675
  })
1382
- }), /*#__PURE__*/jsxRuntime.jsx(QRCode$1, {
1383
- className: "cursor-pointer",
1384
- "data-cy": "qr-code-image",
1385
- "data-testid": canvasId,
1386
- id: canvasId,
1387
- size: 256,
1388
- style: {
1389
- width: 80,
1390
- height: 80
1391
- },
1392
- value: url,
1393
- onClick: handleDownload
1394
1676
  })]
1395
1677
  });
1396
1678
  };
1397
1679
 
1398
- var Subtitle = function Subtitle(_ref) {
1399
- var link = _ref.link,
1400
- dataCy = _ref.dataCy,
1401
- _onClick = _ref.onClick,
1402
- subtitle = _ref.subtitle;
1403
- var Component = neetoCist.isPresent(link) ? reactRouterDom.Link : "div";
1404
- return /*#__PURE__*/jsxRuntime.jsx(Component, {
1405
- "data-cy": dataCy,
1406
- to: link,
1407
- onClick: function onClick(event) {
1408
- event.preventDefault();
1409
- _onClick === null || _onClick === void 0 || _onClick(event);
1410
- },
1411
- children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
1412
- style: "body3",
1413
- weight: "medium",
1414
- className: classnames("break-words", {
1415
- "neeto-ui-text-accent-800": neetoCist.isPresent(_onClick) || neetoCist.isPresent(link)
1416
- }),
1417
- children: subtitle
1418
- })
1419
- });
1420
- };
1680
+ var css = ".neeto-molecules-share-landing__card{outline:1px solid rgb(var(--neeto-ui-white))!important;transition:all .3s!important}.neeto-molecules-share-landing__card:hover{border-color:rgb(var(--neeto-ui-primary-500))!important;outline:1px solid rgb(var(--neeto-ui-primary-500))!important}";
1681
+ injectCss.n(css,{});
1421
1682
 
1422
- 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; }
1423
- 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; }
1424
- var ShareBlock = function ShareBlock(_ref) {
1425
- var entity = _ref.entity,
1426
- postTitle = _ref.postTitle,
1683
+ var SocialMedia = function SocialMedia(_ref) {
1684
+ var socialMediaProps = _ref.socialMediaProps,
1427
1685
  url = _ref.url,
1428
- moreOptions = _ref.moreOptions,
1429
- disableShareSocialMedia = _ref.disableShareSocialMedia,
1430
- disableQRDownload = _ref.disableQRDownload;
1686
+ shareUrl = _ref.shareUrl;
1431
1687
  var _useTranslation = reactI18next.useTranslation(),
1432
1688
  t = _useTranslation.t;
1433
- var socialMediaButtonClasses = "neeto-ui-bg-gray-200 hover:neeto-ui-bg-gray-300 flex h-10 w-10 cursor-pointer items-center justify-center neeto-ui-rounded-md transition-colors duration-300 ease-in-out";
1434
- var hasMoreOptions = neetoCist.isPresent(moreOptions);
1435
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1436
- className: "flex flex-col divide-y sm:flex-row sm:gap-6 sm:divide-x sm:divide-y-0",
1437
- children: [hasMoreOptions && /*#__PURE__*/jsxRuntime.jsx("div", {
1438
- className: "max-w-md divide-y",
1439
- children: moreOptions.map(function (_ref2, index) {
1440
- var title = _ref2.title,
1441
- link = _ref2.link,
1442
- Icon = _ref2.icon,
1443
- onClick = _ref2.onClick,
1444
- dataCy = _ref2.dataCy,
1445
- subtitleProps = _ref2.subtitleProps;
1446
- var Component = neetoCist.isPresent(link) ? reactRouterDom.Link : "div";
1447
- return /*#__PURE__*/React.createElement(Component, {
1448
- onClick: onClick,
1449
- "data-cy": dataCy,
1450
- key: link,
1451
- to: link,
1452
- className: classnames("neeto-ui-border-gray-200 flex cursor-pointer items-center gap-x-2 border-t py-3", {
1453
- "border-none": index === 0
1454
- })
1455
- }, /*#__PURE__*/jsxRuntime.jsxs("div", {
1456
- className: "flex flex-row gap-2",
1457
- children: [/*#__PURE__*/jsxRuntime.jsx(Icon, {
1458
- className: "neeto-ui-text-gray-500 flex-shrink-0",
1459
- size: 24
1460
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
1461
- className: "flex flex-col gap-1",
1462
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1463
- className: "group-hover:underline",
1464
- style: "body2",
1465
- weight: "medium",
1466
- children: title
1467
- }), subtitleProps && /*#__PURE__*/jsxRuntime.jsx(Subtitle, _objectSpread({}, subtitleProps))]
1468
- })]
1469
- }));
1470
- })
1471
- }), !disableShareSocialMedia && /*#__PURE__*/jsxRuntime.jsxs("div", {
1472
- "data-cy": "social-media-block",
1473
- "data-testid": "social-media-block",
1474
- className: classnames("neeto-ui-border-gray-200 space-y-2 border-t py-3 sm:space-y-4 sm:border-l sm:py-2", {
1475
- "pl-8 sm:pl-6": hasMoreOptions
1476
- }),
1477
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
1478
- className: "neeto-ui-text-gray-800",
1479
- lineHeight: "normal",
1480
- style: "body2",
1481
- weight: "medium",
1482
- children: t("neetoMolecules.shareViaLink.socialMediaShare.title")
1483
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
1484
- className: "flex gap-4",
1485
- children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref3) {
1486
- var _ref4 = _slicedToArray(_ref3, 2),
1487
- key = _ref4[0],
1488
- _ref4$ = _ref4[1],
1489
- label = _ref4$.label,
1490
- Icon = _ref4$.icon,
1491
- generateShareUrl = _ref4$.generateShareUrl;
1492
- return /*#__PURE__*/jsxRuntime.jsx("a", {
1493
- className: socialMediaButtonClasses,
1689
+ var title = (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.pageTitle) || (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title");
1690
+ var description = (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.pageDescription) || (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description");
1691
+ return /*#__PURE__*/jsxRuntime.jsxs(Container, {
1692
+ className: "neeto-molecules-social-share-landing-page py-8",
1693
+ children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
1694
+ className: "mb-4",
1695
+ "data-cy": "back-button",
1696
+ "data-testid": "back-button",
1697
+ icon: LeftArrow,
1698
+ iconPosition: "left",
1699
+ label: t("neetoMolecules.productEmbed.backToShare"),
1700
+ size: "small",
1701
+ style: "link",
1702
+ to: shareUrl
1703
+ }), /*#__PURE__*/jsxRuntime.jsx(Header$1, {
1704
+ className: "py-0",
1705
+ title: t("neetoMolecules.shareViaLink.socialMediaShare.title")
1706
+ }), /*#__PURE__*/jsxRuntime.jsx(CardLayout, {
1707
+ description: description,
1708
+ title: title,
1709
+ actionBlock: /*#__PURE__*/jsxRuntime.jsx("div", {
1710
+ className: "flex flex-wrap items-center gap-3",
1711
+ children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref2) {
1712
+ var _ref3 = _slicedToArray(_ref2, 2),
1713
+ key = _ref3[0],
1714
+ _ref3$ = _ref3[1],
1715
+ label = _ref3$.label,
1716
+ Icon = _ref3$.icon,
1717
+ generateShareUrl = _ref3$.generateShareUrl;
1718
+ return /*#__PURE__*/React.createElement(Button, {
1719
+ label: label,
1494
1720
  "data-cy": "social-media-button-".concat(key),
1495
1721
  "data-testid": "social-media-button-".concat(key),
1496
- href: generateShareUrl({
1497
- url: url,
1498
- title: postTitle
1499
- }),
1722
+ icon: Icon,
1723
+ iconPosition: "right",
1724
+ key: key,
1500
1725
  rel: "noopener noreferrer",
1726
+ style: "tertiary",
1501
1727
  target: "_blank",
1502
- title: label,
1503
- children: /*#__PURE__*/jsxRuntime.jsx(Icon, {
1504
- size: 24
1728
+ href: generateShareUrl({
1729
+ url: url,
1730
+ title: socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.postTitle
1505
1731
  })
1506
- }, key);
1732
+ }, /*#__PURE__*/jsxRuntime.jsx(Icon, {
1733
+ size: 24
1734
+ }));
1507
1735
  })
1508
- })]
1509
- }), !disableQRDownload && /*#__PURE__*/jsxRuntime.jsx(QRCode, {
1510
- entity: entity,
1511
- url: url
1736
+ })
1512
1737
  })]
1513
1738
  });
1514
1739
  };
1515
1740
 
1741
+ /* eslint-disable @bigbinary/neeto/use-common-routes */
1516
1742
  var ShareViaLink = function ShareViaLink(_ref) {
1517
- var _ref$isLoading = _ref.isLoading,
1743
+ var title = _ref.title,
1744
+ description = _ref.description,
1745
+ _ref$isLoading = _ref.isLoading,
1518
1746
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
1519
1747
  _ref$enabledOptions = _ref.enabledOptions,
1520
1748
  enabledOptions = _ref$enabledOptions === void 0 ? {
@@ -1529,46 +1757,79 @@ var ShareViaLink = function ShareViaLink(_ref) {
1529
1757
  handleEdit = _ref$handleEdit === void 0 ? neetoCist.noop : _ref$handleEdit,
1530
1758
  _ref$handleRegenerate = _ref.handleRegenerate,
1531
1759
  handleRegenerate = _ref$handleRegenerate === void 0 ? neetoCist.noop : _ref$handleRegenerate,
1532
- socialMediaPostTitle = _ref.socialMediaPostTitle,
1533
- moreOptions = _ref.moreOptions,
1534
- _ref$isOtherShareOpti = _ref.isOtherShareOptionsEnabled,
1535
- isOtherShareOptionsEnabled = _ref$isOtherShareOpti === void 0 ? true : _ref$isOtherShareOpti,
1536
1760
  _ref$disableShareSoci = _ref.disableShareSocialMedia,
1537
1761
  disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
1538
1762
  _ref$disableQRDownloa = _ref.disableQRDownload,
1539
1763
  disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
1764
+ socialMediaProps = _ref.socialMediaProps,
1765
+ qrCodeProps = _ref.qrCodeProps,
1766
+ moreOptions = _ref.moreOptions,
1540
1767
  _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
1541
- publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry;
1542
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
1543
- className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white col-span-2 space-y-4 border p-6 sm:p-8",
1544
- "data-testid": "share-via-link",
1545
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
1546
- className: "space-y-1",
1547
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
1548
- className: "space-y-4",
1549
- children: urls.map(function (urlOption) {
1550
- return /*#__PURE__*/React.createElement(Link, {
1551
- enabledOptions: enabledOptions,
1552
- entityName: entityName,
1553
- handleEdit: handleEdit,
1554
- handleRegenerate: handleRegenerate,
1555
- isLoading: isLoading,
1556
- editUrlProps: ramda.omit(["url"], urlOption),
1557
- key: urlOption.url,
1558
- previewUrl: urlOption.previewUrl,
1559
- url: urlOption.url
1560
- });
1561
- })
1562
- }), neetoCist.isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsxRuntime.jsx(ExpiryNotice, {
1563
- expiryConfiguration: publicLinkExpiryConfiguration
1564
- })]
1565
- }), isOtherShareOptionsEnabled && /*#__PURE__*/jsxRuntime.jsx(ShareBlock, {
1566
- disableQRDownload: disableQRDownload,
1567
- disableShareSocialMedia: disableShareSocialMedia,
1568
- entity: entity,
1569
- moreOptions: moreOptions,
1570
- postTitle: socialMediaPostTitle,
1571
- url: urls[0].url
1768
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
1769
+ customTopContent = _ref.customTopContent,
1770
+ customBottomContent = _ref.customBottomContent;
1771
+ var _useRouteMatch = reactRouterDom.useRouteMatch(),
1772
+ sharePath = _useRouteMatch.path,
1773
+ shareUrl = _useRouteMatch.url;
1774
+ return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
1775
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1776
+ exact: true,
1777
+ path: sharePath,
1778
+ render: function render() {
1779
+ return /*#__PURE__*/jsxRuntime.jsx(MainPanel, {
1780
+ customBottomContent: customBottomContent,
1781
+ customTopContent: customTopContent,
1782
+ description: description,
1783
+ disableQRDownload: disableQRDownload,
1784
+ disableShareSocialMedia: disableShareSocialMedia,
1785
+ enabledOptions: enabledOptions,
1786
+ entity: entity,
1787
+ entityName: entityName,
1788
+ handleEdit: handleEdit,
1789
+ handleRegenerate: handleRegenerate,
1790
+ isLoading: isLoading,
1791
+ moreOptions: moreOptions,
1792
+ publicLinkExpiryConfiguration: publicLinkExpiryConfiguration,
1793
+ qrCodeProps: qrCodeProps,
1794
+ socialMediaProps: socialMediaProps,
1795
+ title: title,
1796
+ urls: urls
1797
+ });
1798
+ }
1799
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1800
+ exact: true,
1801
+ path: "".concat(sharePath, "/qrcode"),
1802
+ render: function render() {
1803
+ return /*#__PURE__*/jsxRuntime.jsx(QRCode, {
1804
+ entity: entity,
1805
+ qrCodeProps: qrCodeProps,
1806
+ shareUrl: shareUrl,
1807
+ url: urls[0].url
1808
+ });
1809
+ }
1810
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1811
+ exact: true,
1812
+ path: "".concat(sharePath, "/social-media"),
1813
+ render: function render() {
1814
+ return /*#__PURE__*/jsxRuntime.jsx(SocialMedia, {
1815
+ shareUrl: shareUrl,
1816
+ socialMediaProps: socialMediaProps,
1817
+ url: urls[0].url
1818
+ });
1819
+ }
1820
+ }), neetoCist.isPresent(moreOptions) && moreOptions.map(function (_ref2) {
1821
+ var link = _ref2.link,
1822
+ element = _ref2.element,
1823
+ path = _ref2.path;
1824
+ if (!link && !path) return null;
1825
+ return /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1826
+ exact: true,
1827
+ path: path || link,
1828
+ children: element
1829
+ }, link);
1830
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1831
+ component: ErrorPage,
1832
+ path: "*"
1572
1833
  })]
1573
1834
  });
1574
1835
  };