@bigbinary/neeto-molecules 5.1.25 → 5.1.27

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.
Files changed (79) hide show
  1. package/dist/ShareViaLink.js +2 -1127
  2. package/dist/ShareViaLink.js.map +1 -1
  3. package/dist/cjs/ShareViaLink.js +2 -1127
  4. package/dist/cjs/ShareViaLink.js.map +1 -1
  5. package/dist/cjs/external-link-C7Cbtssd.js +21 -0
  6. package/dist/cjs/external-link-C7Cbtssd.js.map +1 -0
  7. package/dist/cjs/index-Dzzs5KSc.js +1132 -0
  8. package/dist/cjs/index-Dzzs5KSc.js.map +1 -0
  9. package/dist/cjs/info-CpwCcUWd.js +21 -0
  10. package/dist/cjs/info-CpwCcUWd.js.map +1 -0
  11. package/dist/cjs/v2/DndTable.js +194 -0
  12. package/dist/cjs/v2/DndTable.js.map +1 -0
  13. package/dist/cjs/v2/NavigationHeader.js +1 -0
  14. package/dist/cjs/v2/NavigationHeader.js.map +1 -1
  15. package/dist/cjs/v2/PublishBlock.js +5 -19
  16. package/dist/cjs/v2/PublishBlock.js.map +1 -1
  17. package/dist/cjs/v2/ShareViaLink.js +1041 -0
  18. package/dist/cjs/v2/ShareViaLink.js.map +1 -0
  19. package/dist/cjs/v2/SuffixedInput.js +3 -17
  20. package/dist/cjs/v2/SuffixedInput.js.map +1 -1
  21. package/dist/cjs/v2/Taxonomy.js +546 -0
  22. package/dist/cjs/v2/Taxonomy.js.map +1 -0
  23. package/dist/external-link-Bqki-W-9.js +19 -0
  24. package/dist/external-link-Bqki-W-9.js.map +1 -0
  25. package/dist/index-c-mrzXSg.js +1130 -0
  26. package/dist/index-c-mrzXSg.js.map +1 -0
  27. package/dist/info-DpOFLPLx.js +19 -0
  28. package/dist/info-DpOFLPLx.js.map +1 -0
  29. package/dist/v2/DndTable.js +189 -0
  30. package/dist/v2/DndTable.js.map +1 -0
  31. package/dist/v2/NavigationHeader.js +1 -0
  32. package/dist/v2/NavigationHeader.js.map +1 -1
  33. package/dist/v2/PublishBlock.js +3 -17
  34. package/dist/v2/PublishBlock.js.map +1 -1
  35. package/dist/v2/ShareViaLink.js +1020 -0
  36. package/dist/v2/ShareViaLink.js.map +1 -0
  37. package/dist/v2/SuffixedInput.js +2 -16
  38. package/dist/v2/SuffixedInput.js.map +1 -1
  39. package/dist/v2/Taxonomy.js +525 -0
  40. package/dist/v2/Taxonomy.js.map +1 -0
  41. package/package.json +3 -3
  42. package/src/translations/ar.json +10 -3
  43. package/src/translations/bg.json +10 -3
  44. package/src/translations/ca.json +10 -3
  45. package/src/translations/cs.json +10 -3
  46. package/src/translations/da.json +10 -3
  47. package/src/translations/de.json +10 -3
  48. package/src/translations/es-MX.json +10 -3
  49. package/src/translations/es.json +10 -3
  50. package/src/translations/et.json +10 -3
  51. package/src/translations/fi.json +10 -3
  52. package/src/translations/fil.json +10 -3
  53. package/src/translations/fr.json +10 -3
  54. package/src/translations/he.json +10 -3
  55. package/src/translations/hi.json +10 -3
  56. package/src/translations/hr.json +10 -3
  57. package/src/translations/hu.json +10 -3
  58. package/src/translations/id.json +10 -3
  59. package/src/translations/it.json +10 -3
  60. package/src/translations/ja.json +9 -2
  61. package/src/translations/ko.json +9 -2
  62. package/src/translations/nl.json +10 -3
  63. package/src/translations/pl.json +10 -3
  64. package/src/translations/pt-BR.json +10 -3
  65. package/src/translations/pt.json +10 -3
  66. package/src/translations/ro.json +10 -3
  67. package/src/translations/ru.json +10 -3
  68. package/src/translations/sk.json +10 -3
  69. package/src/translations/sl.json +10 -3
  70. package/src/translations/sv.json +10 -3
  71. package/src/translations/th.json +9 -2
  72. package/src/translations/tr.json +10 -3
  73. package/src/translations/uk.json +10 -3
  74. package/src/translations/vi.json +10 -3
  75. package/src/translations/zh-CN.json +10 -3
  76. package/src/translations/zh-TW.json +10 -3
  77. package/types/v2/DndTable.d.ts +23 -0
  78. package/types/v2/ShareViaLink.d.ts +61 -0
  79. package/types/v2/Taxonomy.d.ts +16 -0
@@ -0,0 +1,1041 @@
1
+ 'use strict';
2
+
3
+ var neetoCist = require('@bigbinary/neeto-cist');
4
+ var PrivateRoute = require('@bigbinary/neeto-commons-frontend/v2/react-utils/PrivateRoute');
5
+ var reactRouterDom = require('react-router-dom');
6
+ var neetoAtoms = require('@bigbinary/neeto-atoms');
7
+ var classnames = require('classnames');
8
+ var initializers = require('@bigbinary/neeto-commons-frontend/v2/initializers');
9
+ var ramda = require('ramda');
10
+ var reactI18next = require('react-i18next');
11
+ var jsxRuntime = require('react/jsx-runtime');
12
+ var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
13
+ var React = require('react');
14
+ var useBreakpoints = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useBreakpoints');
15
+ var formik$1 = require('@bigbinary/neeto-atoms/formik');
16
+ var formik = require('formik');
17
+ var i18next = require('i18next');
18
+ var constants = require('@bigbinary/neeto-commons-frontend/v2/constants');
19
+ var Facebook = require('@bigbinary/neeto-icons/Facebook');
20
+ var Linkedin = require('@bigbinary/neeto-icons/Linkedin');
21
+ var Twitter = require('@bigbinary/neeto-icons/Twitter');
22
+ var yup = require('yup');
23
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
24
+ var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
25
+ var general = require('@bigbinary/neeto-commons-frontend/v2/utils/general');
26
+ var utils = require('@bigbinary/neeto-commons-frontend/v2/utils');
27
+ var info = require('../info-CpwCcUWd.js');
28
+ var v2_CopyToClipboardButton = require('./CopyToClipboardButton.js');
29
+ var v2_MoreDropdown = require('./MoreDropdown.js');
30
+ var createLucideIcon = require('../createLucideIcon-DBDhE7kE.js');
31
+ var externalLink = require('../external-link-C7Cbtssd.js');
32
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
33
+ var v2_HelpPopover = require('./HelpPopover.js');
34
+ var v2_Container = require('./Container.js');
35
+ var index = require('../index-Dzzs5KSc.js');
36
+ var v2_CardLayout = require('./CardLayout.js');
37
+ var v2_Header = require('./Header.js');
38
+ var arrowLeft = require('../arrow-left-gtCwH31u.js');
39
+ var v2_ErrorPage = require('./ErrorPage.js');
40
+ require('../check-VgZf0qTr.js');
41
+ require('../copy-CerjTcLL.js');
42
+ require('@bigbinary/neeto-commons-frontend/v2/react-utils');
43
+ require('../ellipsis-BcfLTtl5.js');
44
+ require('../circle-question-mark-kxBMPyWQ.js');
45
+ require('../index-JY2zVpnv.js');
46
+ require('../_commonjsHelpers-BJu3ubxk.js');
47
+ require('./Breadcrumbs.js');
48
+ require('@bigbinary/neeto-atoms/primitives');
49
+ require('./Search.js');
50
+ require('@bigbinary/neeto-commons-frontend/v2/react-utils/useFuncDebounce');
51
+ require('@bigbinary/neeto-commons-frontend/v2/react-utils/useQueryParams');
52
+ require('@bigbinary/neeto-commons-frontend/v2/react-utils/useUpdateEffect');
53
+ require('../search-BBuFYdmG.js');
54
+ require('zustand/shallow');
55
+ require('../purify.es-D81wVm4N.js');
56
+ require('@bigbinary/neeto-commons-frontend/v2/react-utils/useDisplayErrorPage');
57
+ require('react-helmet');
58
+ require('../triangle-alert-De-qkUXK.js');
59
+ require('../chevron-left-DWN80ILn.js');
60
+ require('../house-Bx8edBjy.js');
61
+
62
+ function _interopNamespaceDefault(e) {
63
+ var n = Object.create(null);
64
+ if (e) {
65
+ Object.keys(e).forEach(function (k) {
66
+ if (k !== 'default') {
67
+ var d = Object.getOwnPropertyDescriptor(e, k);
68
+ Object.defineProperty(n, k, d.get ? d : {
69
+ enumerable: true,
70
+ get: function () { return e[k]; }
71
+ });
72
+ }
73
+ });
74
+ }
75
+ n.default = e;
76
+ return Object.freeze(n);
77
+ }
78
+
79
+ var yup__namespace = /*#__PURE__*/_interopNamespaceDefault(yup);
80
+
81
+ /**
82
+ * @license lucide-react v1.7.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */
87
+
88
+
89
+ const __iconNode$2 = [
90
+ ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
91
+ ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
92
+ ];
93
+ const Link$1 = createLucideIcon.createLucideIcon("link", __iconNode$2);
94
+
95
+ /**
96
+ * @license lucide-react v1.7.0 - ISC
97
+ *
98
+ * This source code is licensed under the ISC license.
99
+ * See the LICENSE file in the root directory of this source tree.
100
+ */
101
+
102
+
103
+ const __iconNode$1 = [
104
+ ["rect", { width: "5", height: "5", x: "3", y: "3", rx: "1", key: "1tu5fj" }],
105
+ ["rect", { width: "5", height: "5", x: "16", y: "3", rx: "1", key: "1v8r4q" }],
106
+ ["rect", { width: "5", height: "5", x: "3", y: "16", rx: "1", key: "1x03jg" }],
107
+ ["path", { d: "M21 16h-3a2 2 0 0 0-2 2v3", key: "177gqh" }],
108
+ ["path", { d: "M21 21v.01", key: "ents32" }],
109
+ ["path", { d: "M12 7v3a2 2 0 0 1-2 2H7", key: "8crl2c" }],
110
+ ["path", { d: "M3 12h.01", key: "nlz23k" }],
111
+ ["path", { d: "M12 3h.01", key: "n36tog" }],
112
+ ["path", { d: "M12 16v.01", key: "133mhm" }],
113
+ ["path", { d: "M16 12h1", key: "1slzba" }],
114
+ ["path", { d: "M21 12v.01", key: "1lwtk9" }],
115
+ ["path", { d: "M12 21v-1", key: "1880an" }]
116
+ ];
117
+ const QrCode = createLucideIcon.createLucideIcon("qr-code", __iconNode$1);
118
+
119
+ /**
120
+ * @license lucide-react v1.7.0 - ISC
121
+ *
122
+ * This source code is licensed under the ISC license.
123
+ * See the LICENSE file in the root directory of this source tree.
124
+ */
125
+
126
+
127
+ const __iconNode = [
128
+ ["circle", { cx: "18", cy: "5", r: "3", key: "gq8acd" }],
129
+ ["circle", { cx: "6", cy: "12", r: "3", key: "w7nqdw" }],
130
+ ["circle", { cx: "18", cy: "19", r: "3", key: "1xt0gg" }],
131
+ ["line", { x1: "8.59", x2: "15.42", y1: "13.51", y2: "17.49", key: "47mynk" }],
132
+ ["line", { x1: "15.41", x2: "8.59", y1: "6.51", y2: "10.49", key: "1n3mei" }]
133
+ ];
134
+ const Share2 = createLucideIcon.createLucideIcon("share-2", __iconNode);
135
+
136
+ var ExpiryNotice = function ExpiryNotice(_ref) {
137
+ var expiryConfiguration = _ref.expiryConfiguration;
138
+ var _useTranslation = reactI18next.useTranslation(),
139
+ t = _useTranslation.t;
140
+ var daysBeforeExpiry = expiryConfiguration.daysBeforeExpiry;
141
+ var notice = t("neetoMolecules.shareViaLink.expiryNotice.daysRemaining", {
142
+ count: daysBeforeExpiry
143
+ });
144
+ if (daysBeforeExpiry < 1) {
145
+ notice = t("neetoMolecules.shareViaLink.expiryNotice.expiresToday");
146
+ }
147
+ if (daysBeforeExpiry <= 0) {
148
+ notice = t("neetoMolecules.shareViaLink.expiryNotice.expired");
149
+ }
150
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
151
+ as: "span",
152
+ "data-testid": "expiry-notice",
153
+ variant: "body3",
154
+ className: classnames("ms-1", {
155
+ "text-destructive": daysBeforeExpiry <= 1,
156
+ "text-muted-foreground": daysBeforeExpiry > 1
157
+ }),
158
+ children: notice
159
+ });
160
+ };
161
+
162
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = false, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = true, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), true), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
163
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
164
+ var facebookShareLink = function facebookShareLink(_ref) {
165
+ var url = _ref.url;
166
+ return general.buildUrl("https://www.facebook.com/sharer/sharer.php", {
167
+ u: url
168
+ });
169
+ };
170
+ var linkedInShareLink = function linkedInShareLink(_ref2) {
171
+ var url = _ref2.url,
172
+ title = _ref2.title;
173
+ return general.buildUrl("https://www.linkedin.com/sharing/share-offsite", {
174
+ mini: true,
175
+ text: "".concat(title, " ").concat(url)
176
+ });
177
+ };
178
+ var twitterShareLink = function twitterShareLink(_ref3) {
179
+ var url = _ref3.url,
180
+ title = _ref3.title;
181
+ return general.buildUrl("http://twitter.com/share", {
182
+ text: title,
183
+ url: url
184
+ });
185
+ };
186
+ var downloadCanvas = function downloadCanvas(canvas) {
187
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
188
+ var _options$name = options.name,
189
+ name = _options$name === void 0 ? "image" : _options$name,
190
+ _options$extension = options.extension,
191
+ extension = _options$extension === void 0 ? "png" : _options$extension;
192
+ var canvasUrl = canvas.toDataURL("image/".concat(extension));
193
+ var element = document.createElement("a");
194
+ element.href = canvasUrl;
195
+ element.download = "".concat(name, ".").concat(extension);
196
+ element.click();
197
+ element.remove();
198
+ };
199
+ var copyCanvasToClipboard = /*#__PURE__*/function () {
200
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(canvas, handleDownloadQRCode) {
201
+ var blob, clipboardItem;
202
+ return _regenerator().w(function (_context) {
203
+ while (1) switch (_context.p = _context.n) {
204
+ case 0:
205
+ if (canvas) {
206
+ _context.n = 1;
207
+ break;
208
+ }
209
+ return _context.a(2);
210
+ case 1:
211
+ _context.p = 1;
212
+ _context.n = 2;
213
+ return new Promise(function (resolve) {
214
+ return canvas.toBlob(resolve);
215
+ });
216
+ case 2:
217
+ blob = _context.v;
218
+ if (blob) {
219
+ _context.n = 3;
220
+ break;
221
+ }
222
+ return _context.a(2);
223
+ case 3:
224
+ clipboardItem = new ClipboardItem(_defineProperty({}, blob.type, blob));
225
+ navigator.clipboard.write([clipboardItem]);
226
+ _context.n = 5;
227
+ break;
228
+ case 4:
229
+ _context.p = 4;
230
+ _context.v;
231
+ handleDownloadQRCode();
232
+ case 5:
233
+ return _context.a(2);
234
+ }
235
+ }, _callee, null, [[1, 4]]);
236
+ }));
237
+ return function copyCanvasToClipboard(_x, _x2) {
238
+ return _ref4.apply(this, arguments);
239
+ };
240
+ }();
241
+ var getPathname = function getPathname(url) {
242
+ return new URL(url).pathname.slice(1);
243
+ };
244
+ var getPrefixFromUrl = function getPrefixFromUrl(url) {
245
+ return "".concat(new URL(url).origin, "/");
246
+ };
247
+ var normalizeEditablePath = ramda.replace(/[^a-z0-9&?=._-]/gi, "");
248
+
249
+ var SOCIAL_MEDIA_OPTIONS = {
250
+ FACEBOOK: {
251
+ label: i18next.t("neetoMolecules.shareViaLink.socialMediaShare.facebook"),
252
+ icon: Facebook,
253
+ generateShareUrl: facebookShareLink
254
+ },
255
+ LINKEDIN: {
256
+ label: i18next.t("neetoMolecules.shareViaLink.socialMediaShare.linkedIn"),
257
+ icon: Linkedin,
258
+ generateShareUrl: linkedInShareLink
259
+ },
260
+ TWITTER: {
261
+ label: i18next.t("neetoMolecules.shareViaLink.socialMediaShare.twitter"),
262
+ icon: Twitter,
263
+ generateShareUrl: twitterShareLink
264
+ }
265
+ };
266
+ var PATH_VALIDATION_SCHEMA = yup__namespace.object().shape({
267
+ path: yup__namespace.string().required(i18next.t("neetoMolecules.shareViaLink.editUrl.validationError")).matches(/^[A-Za-z0-9]([\w/-])*$/, i18next.t("neetoMolecules.shareViaLink.editUrl.validationError")).test("reserved-path", i18next.t("neetoMolecules.shareViaLink.editUrl.reservedPathError"), function (value) {
268
+ return !constants.RESERVED_PATHS.includes(value === null || value === void 0 ? void 0 : value.toLowerCase());
269
+ })
270
+ });
271
+
272
+ var EditURL = function EditURL(_ref) {
273
+ var editUrlProps = _ref.editUrlProps,
274
+ isOpen = _ref.isOpen,
275
+ onClose = _ref.onClose,
276
+ url = _ref.url,
277
+ isLoading = _ref.isLoading,
278
+ handleEdit = _ref.handleEdit;
279
+ var _useTranslation = reactI18next.useTranslation(),
280
+ t = _useTranslation.t;
281
+ var focusRef = React.useRef(null);
282
+ var prevIsLoadingRef = React.useRef(isLoading);
283
+ var observerRef = React.useRef(null);
284
+ var prefixText = (editUrlProps === null || editUrlProps === void 0 ? void 0 : editUrlProps.prefix) || getPrefixFromUrl(url);
285
+ var _useState = React.useState(prefixText),
286
+ _useState2 = _slicedToArray(_useState, 2),
287
+ displayedPrefix = _useState2[0],
288
+ setDisplayedPrefix = _useState2[1];
289
+ var updateDisplayedPrefix = React.useCallback(function (inputElement) {
290
+ if (!inputElement) return;
291
+ var parentElement = inputElement.parentElement;
292
+ var _getComputedStyle = getComputedStyle(inputElement),
293
+ fontSize = _getComputedStyle.fontSize;
294
+ var averageCharWidth = parseFloat(fontSize) * 0.6;
295
+ var requiredInputWidth = inputElement.value.length * averageCharWidth;
296
+ var prefixWidth = parentElement.offsetWidth - requiredInputWidth;
297
+ var maxPrefixChars = Math.max(Math.floor(prefixWidth / averageCharWidth), 5);
298
+ setDisplayedPrefix(maxPrefixChars < prefixText.length ? "...".concat(prefixText.slice(-maxPrefixChars)) : prefixText);
299
+ }, [prefixText]);
300
+ var setInputRef = React.useCallback(function (inputElement) {
301
+ focusRef.current = inputElement;
302
+ if (observerRef.current) {
303
+ observerRef.current.disconnect();
304
+ observerRef.current = null;
305
+ }
306
+ if (inputElement) {
307
+ observerRef.current = new ResizeObserver(function () {
308
+ return requestAnimationFrame(function () {
309
+ return updateDisplayedPrefix(inputElement);
310
+ });
311
+ });
312
+ observerRef.current.observe(inputElement);
313
+ }
314
+ }, [updateDisplayedPrefix]);
315
+ React.useEffect(function () {
316
+ if (prevIsLoadingRef.current && !isLoading) onClose();
317
+ prevIsLoadingRef.current = isLoading;
318
+ }, [isLoading]);
319
+ return /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Sheet, {
320
+ isOpen: isOpen,
321
+ onClose: onClose,
322
+ "aria-describedby": undefined,
323
+ size: "large",
324
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Header, {
325
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Title, {
326
+ children: t("neetoMolecules.shareViaLink.editUrl.title")
327
+ })
328
+ }), /*#__PURE__*/jsxRuntime.jsx(formik.Formik, {
329
+ enableReinitialize: true,
330
+ initialValues: {
331
+ path: (editUrlProps === null || editUrlProps === void 0 ? void 0 : editUrlProps.editablePath) || getPathname(url)
332
+ },
333
+ validationSchema: PATH_VALIDATION_SCHEMA,
334
+ onSubmit: function onSubmit(_ref2) {
335
+ var path = _ref2.path;
336
+ return handleEdit(path);
337
+ },
338
+ children: function children() {
339
+ return /*#__PURE__*/jsxRuntime.jsxs(formik.Form, {
340
+ children: [/*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Sheet.Body, {
341
+ className: "flex flex-col gap-y-6",
342
+ children: [/*#__PURE__*/jsxRuntime.jsx(formik.Field, {
343
+ name: "path",
344
+ children: function children(_ref3) {
345
+ var field = _ref3.field,
346
+ meta = _ref3.meta,
347
+ form = _ref3.form;
348
+ return /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
349
+ "data-testid": "edit-url-input",
350
+ error: meta.touched ? meta.error : undefined,
351
+ label: t("neetoMolecules.shareViaLink.editUrl.inputLabel"),
352
+ maxLength: editUrlProps === null || editUrlProps === void 0 ? void 0 : editUrlProps.maxLength,
353
+ name: "path",
354
+ prefix: displayedPrefix,
355
+ ref: setInputRef,
356
+ value: field.value,
357
+ onBlur: field.onBlur,
358
+ onChange: function onChange(event) {
359
+ return form.setFieldValue("path", normalizeEditablePath(event.target.value));
360
+ }
361
+ });
362
+ }
363
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
364
+ variant: "body2",
365
+ children: t("neetoMolecules.shareViaLink.editUrl.description")
366
+ })]
367
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Sheet.Footer, {
368
+ className: "flex items-center gap-x-2",
369
+ children: /*#__PURE__*/jsxRuntime.jsx(formik$1.ActionBlock, {
370
+ cancelButtonProps: {
371
+ onClick: onClose,
372
+ "data-testid": "edit-url-cancel-button"
373
+ },
374
+ submitButtonProps: {
375
+ loading: isLoading,
376
+ "data-testid": "edit-url-confirm-button"
377
+ }
378
+ })
379
+ })]
380
+ });
381
+ }
382
+ })]
383
+ });
384
+ };
385
+
386
+ var RegenerateURL = function RegenerateURL(_ref) {
387
+ var _regenerateConfig$exp;
388
+ var isOpen = _ref.isOpen,
389
+ onClose = _ref.onClose,
390
+ url = _ref.url,
391
+ isLoading = _ref.isLoading,
392
+ handleRegenerate = _ref.handleRegenerate,
393
+ _ref$regenerateConfig = _ref.regenerateConfig,
394
+ regenerateConfig = _ref$regenerateConfig === void 0 ? {
395
+ expiresInOptions: [],
396
+ helpUrl: null
397
+ } : _ref$regenerateConfig;
398
+ var _useTranslation = reactI18next.useTranslation(),
399
+ t = _useTranslation.t;
400
+ var prevIsLoadingRef = React.useRef(isLoading);
401
+ var regenerateStrategy = neetoCist.isPresent(regenerateConfig === null || regenerateConfig === void 0 ? void 0 : regenerateConfig.expiresInOptions) ? "expiryBased" : "basic";
402
+ var defaultExpiresInOption = regenerateConfig === null || regenerateConfig === void 0 || (_regenerateConfig$exp = regenerateConfig.expiresInOptions) === null || _regenerateConfig$exp === void 0 || (_regenerateConfig$exp = _regenerateConfig$exp[0]) === null || _regenerateConfig$exp === void 0 ? void 0 : _regenerateConfig$exp.value;
403
+ var _useState = React.useState(defaultExpiresInOption),
404
+ _useState2 = _slicedToArray(_useState, 2),
405
+ selectedExpiresInOption = _useState2[0],
406
+ setSelectedExpiresInOption = _useState2[1];
407
+ var defaultExpiresOnDate = utils.dayjs().add(10, "day").toDate();
408
+ var _useState3 = React.useState(defaultExpiresOnDate),
409
+ _useState4 = _slicedToArray(_useState3, 2),
410
+ selectedExpiresOnDate = _useState4[0],
411
+ setSelectedExpiresOnDate = _useState4[1];
412
+ var isSelectedExpiresInOptionNever = selectedExpiresInOption === "never";
413
+ var isSelectedExpiresInOptionCustom = selectedExpiresInOption === "custom";
414
+ var isSelectedExpiresInOptionValidNumberOfDays = neetoCist.isPresent(selectedExpiresInOption) && !isSelectedExpiresInOptionCustom && !isSelectedExpiresInOptionNever;
415
+ var isValidExpiryConfig = isSelectedExpiresInOptionNever || isSelectedExpiresInOptionCustom && neetoCist.isPresent(selectedExpiresOnDate) || isSelectedExpiresInOptionValidNumberOfDays;
416
+ var expiryConfigPayload = isSelectedExpiresInOptionValidNumberOfDays ? {
417
+ expiresInDays: selectedExpiresInOption
418
+ } : {
419
+ expiresOnDate: selectedExpiresOnDate
420
+ };
421
+ var onSubmit = function onSubmit() {
422
+ return regenerateStrategy === "basic" || isSelectedExpiresInOptionNever ? handleRegenerate() : handleRegenerate({
423
+ payload: expiryConfigPayload
424
+ });
425
+ };
426
+ React.useEffect(function () {
427
+ if (prevIsLoadingRef.current && !isLoading) onClose();
428
+ prevIsLoadingRef.current = isLoading;
429
+ }, [isLoading]);
430
+ React.useEffect(function () {
431
+ if (!isOpen) return;
432
+ setSelectedExpiresInOption(defaultExpiresInOption);
433
+ setSelectedExpiresOnDate(defaultExpiresOnDate);
434
+ }, [isOpen]);
435
+ var expiresInLabel = neetoCist.isPresent(regenerateConfig === null || regenerateConfig === void 0 ? void 0 : regenerateConfig.helpUrl) ? /*#__PURE__*/jsxRuntime.jsxs("span", {
436
+ className: "inline-flex items-center gap-1",
437
+ children: [t("neetoMolecules.shareViaLink.regenerateUrl.expiresInLabel"), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
438
+ position: "top",
439
+ content: t("neetoMolecules.shareViaLink.regenerateUrl.expiresInHelpTitle"),
440
+ children: /*#__PURE__*/jsxRuntime.jsx("button", {
441
+ className: "cursor-pointer opacity-75 transition-opacity duration-300 ease-in-out hover:opacity-100",
442
+ type: "button",
443
+ onClick: function onClick() {
444
+ return window.open(regenerateConfig === null || regenerateConfig === void 0 ? void 0 : regenerateConfig.helpUrl, "_blank");
445
+ },
446
+ children: /*#__PURE__*/jsxRuntime.jsx(info.Info, {
447
+ size: 14
448
+ })
449
+ })
450
+ })]
451
+ }) : t("neetoMolecules.shareViaLink.regenerateUrl.expiresInLabel");
452
+ return /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Dialog, {
453
+ isOpen: isOpen,
454
+ onClose: onClose,
455
+ "aria-describedby": undefined,
456
+ size: regenerateStrategy === "basic" ? "medium" : "large",
457
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Dialog.Header, {
458
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Dialog.Title, {
459
+ children: regenerateStrategy === "expiryBased" ? t("neetoMolecules.shareViaLink.regenerateUrl.titleForExpiryBasedRegeneration") : t("neetoMolecules.shareViaLink.regenerateUrl.title")
460
+ })
461
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Dialog.Body, {
462
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
463
+ className: "flex w-full flex-col gap-y-6",
464
+ children: [regenerateStrategy === "basic" && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
465
+ disabled: true,
466
+ label: t("neetoMolecules.shareViaLink.regenerateUrl.inputLabel"),
467
+ value: url
468
+ }), regenerateStrategy === "expiryBased" && /*#__PURE__*/jsxRuntime.jsxs("div", {
469
+ className: "flex flex-row gap-2",
470
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Select, {
471
+ dataTestId: "expires-in-select",
472
+ label: expiresInLabel,
473
+ options: regenerateConfig.expiresInOptions,
474
+ value: selectedExpiresInOption,
475
+ className: classnames({
476
+ "w-1/2": isSelectedExpiresInOptionCustom,
477
+ "w-full": !isSelectedExpiresInOptionCustom
478
+ }),
479
+ onChange: setSelectedExpiresInOption
480
+ }), isSelectedExpiresInOptionCustom && /*#__PURE__*/jsxRuntime.jsx("div", {
481
+ className: "w-1/2",
482
+ "data-testid": "expires-on-date-picker",
483
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DatePicker, {
484
+ disabledDate: function disabledDate(d) {
485
+ return !d || utils.dayjs(d).isBefore(utils.dayjs());
486
+ },
487
+ value: selectedExpiresOnDate,
488
+ label: t("neetoMolecules.shareViaLink.regenerateUrl.expiresOnLabel"),
489
+ onChange: setSelectedExpiresOnDate
490
+ })
491
+ })]
492
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
493
+ variant: "body2",
494
+ children: t("neetoMolecules.shareViaLink.regenerateUrl.description")
495
+ })]
496
+ })
497
+ }), /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Dialog.Footer, {
498
+ className: "flex items-center gap-x-2",
499
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
500
+ "data-testid": "regenerate-url-confirm-button",
501
+ loading: isLoading,
502
+ disabled: regenerateStrategy === "expiryBased" && !isValidExpiryConfig,
503
+ label: t("neetoMolecules.shareViaLink.regenerateUrl.submitButtonLabel"),
504
+ onClick: onSubmit
505
+ }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
506
+ "data-testid": "regenerate-url-cancel-button",
507
+ variant: "ghost",
508
+ label: t("neetoMolecules.shareViaLink.regenerateUrl.cancelButtonLabel"),
509
+ onClick: onClose
510
+ })]
511
+ })]
512
+ });
513
+ };
514
+
515
+ var Link = function Link(_ref) {
516
+ var editUrlProps = _ref.editUrlProps,
517
+ enabledOptions = _ref.enabledOptions,
518
+ entityName = _ref.entityName,
519
+ handleEdit = _ref.handleEdit,
520
+ handleRegenerate = _ref.handleRegenerate,
521
+ isLoading = _ref.isLoading,
522
+ previewUrl = _ref.previewUrl,
523
+ url = _ref.url;
524
+ var _useState = React.useState(false),
525
+ _useState2 = _slicedToArray(_useState, 2),
526
+ isRegenerateURLModalOpen = _useState2[0],
527
+ setIsRegenerateURLModalOpen = _useState2[1];
528
+ var _useState3 = React.useState(false),
529
+ _useState4 = _slicedToArray(_useState3, 2),
530
+ isEditURLModalOpen = _useState4[0],
531
+ setIsEditURLModalOpen = _useState4[1];
532
+ var _useTranslation = reactI18next.useTranslation(),
533
+ t = _useTranslation.t;
534
+ var _useBreakpoints = useBreakpoints(),
535
+ isSize = _useBreakpoints.isSize;
536
+ var isMobile = isSize("mobile");
537
+ var isDropdownEnabled = enabledOptions.regenerate || enabledOptions.edit;
538
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
539
+ className: "flex flex-col gap-y-4",
540
+ "data-testid": "link-block",
541
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
542
+ className: "flex items-center gap-1 sm:gap-2",
543
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
544
+ className: "relative flex min-w-0 flex-grow items-stretch truncate leading-none",
545
+ "data-testid": "nui-input-field",
546
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
547
+ className: "border-border bg-muted relative flex min-w-0 flex-grow items-center truncate rounded-l-md rounded-r-none border leading-none rtl:rounded-l-none rtl:rounded-r-md",
548
+ children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
549
+ className: "relative min-w-0 flex-grow flex-row justify-start truncate px-2 py-1 leading-none",
550
+ href: url,
551
+ icon: Link$1,
552
+ iconPosition: "left",
553
+ label: url,
554
+ target: "_blank",
555
+ variant: "link"
556
+ })
557
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_CopyToClipboardButton, {
558
+ className: "rounded-l-none rtl:rounded-l-md rtl:rounded-r-none",
559
+ "data-testid": "link-copy-button",
560
+ label: !isMobile ? t("neetoMolecules.shareViaLink.copyLink") : null,
561
+ value: url
562
+ })]
563
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
564
+ className: "flex flex-shrink-0 items-center gap-1 sm:gap-2",
565
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
566
+ "data-testid": "preview-button",
567
+ href: previewUrl || url,
568
+ icon: externalLink.ExternalLink,
569
+ target: "_blank",
570
+ variant: "outline",
571
+ tooltipProps: {
572
+ content: t("neetoMolecules.shareViaLink.view", {
573
+ entity: entityName
574
+ }),
575
+ position: "top",
576
+ touch: ["hold", 500]
577
+ }
578
+ }), isDropdownEnabled && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
579
+ children: [/*#__PURE__*/jsxRuntime.jsx(v2_MoreDropdown, {
580
+ menuItems: [{
581
+ isVisible: enabledOptions.regenerate || neetoCist.isPresent(enabledOptions.regenerate),
582
+ "data-testid": "regenerate-url-button",
583
+ onClick: function onClick() {
584
+ return setIsRegenerateURLModalOpen(true);
585
+ },
586
+ label: t("neetoMolecules.shareViaLink.regenerateUrl.title"),
587
+ key: "regenerate-url-option"
588
+ }, {
589
+ isVisible: enabledOptions.edit,
590
+ "data-testid": "edit-url-button",
591
+ onClick: function onClick() {
592
+ return setIsEditURLModalOpen(true);
593
+ },
594
+ label: t("neetoMolecules.shareViaLink.editUrl.title"),
595
+ key: "edit-url-option"
596
+ }]
597
+ }), /*#__PURE__*/jsxRuntime.jsx(RegenerateURL, {
598
+ handleRegenerate: handleRegenerate,
599
+ isLoading: isLoading,
600
+ url: url,
601
+ isOpen: isRegenerateURLModalOpen,
602
+ regenerateConfig: enabledOptions.regenerate,
603
+ onClose: function onClose() {
604
+ return setIsRegenerateURLModalOpen(false);
605
+ }
606
+ }), /*#__PURE__*/jsxRuntime.jsx(EditURL, {
607
+ editUrlProps: editUrlProps,
608
+ handleEdit: handleEdit,
609
+ isLoading: isLoading,
610
+ url: url,
611
+ isOpen: isEditURLModalOpen,
612
+ onClose: function onClose() {
613
+ return setIsEditURLModalOpen(false);
614
+ }
615
+ })]
616
+ })]
617
+ })]
618
+ })
619
+ });
620
+ };
621
+
622
+ var _excluded = ["title", "link", "description", "Icon", "onClick", "helpPopoverProps"];
623
+ 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; }
624
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
625
+ var Card = function Card(_ref) {
626
+ var title = _ref.title,
627
+ link = _ref.link,
628
+ description = _ref.description,
629
+ Icon = _ref.Icon,
630
+ _ref$onClick = _ref.onClick,
631
+ onClick = _ref$onClick === void 0 ? neetoCist.noop : _ref$onClick,
632
+ helpPopoverProps = _ref.helpPopoverProps,
633
+ otherProps = _objectWithoutProperties(_ref, _excluded);
634
+ var Component = neetoCist.isPresent(link) ? reactRouterDom.Link : "div";
635
+ return /*#__PURE__*/jsxRuntime.jsxs(Component, _objectSpread(_objectSpread({
636
+ onClick: onClick,
637
+ className: "border-border hover:border-primary flex cursor-pointer flex-col gap-3 rounded-lg border p-3 transition-all duration-300",
638
+ to: link
639
+ }, otherProps), {}, {
640
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
641
+ className: "flex items-center gap-2",
642
+ children: [Icon && /*#__PURE__*/jsxRuntime.jsx(Icon, {
643
+ className: "text-muted-foreground flex-shrink-0",
644
+ size: 24
645
+ }), /*#__PURE__*/jsxRuntime.jsxs(neetoAtoms.Typography, {
646
+ className: "min-w-0 flex-grow break-words",
647
+ "data-testid": "share-card-title",
648
+ variant: "h4",
649
+ children: [title, helpPopoverProps && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
650
+ children: [" ", /*#__PURE__*/jsxRuntime.jsx(v2_HelpPopover, _objectSpread({}, helpPopoverProps))]
651
+ })]
652
+ })]
653
+ }), description && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
654
+ className: "break-words",
655
+ "data-testid": "share-card-description",
656
+ variant: "body2",
657
+ children: description
658
+ })]
659
+ }));
660
+ };
661
+
662
+ var ShareBlock = function ShareBlock(_ref) {
663
+ var moreOptions = _ref.moreOptions,
664
+ disableShareSocialMedia = _ref.disableShareSocialMedia,
665
+ disableQRDownload = _ref.disableQRDownload,
666
+ socialMediaProps = _ref.socialMediaProps,
667
+ qrCodeProps = _ref.qrCodeProps,
668
+ entity = _ref.entity,
669
+ urls = _ref.urls;
670
+ var location = reactRouterDom.useLocation();
671
+ var history = reactRouterDom.useHistory();
672
+ var _useTranslation = reactI18next.useTranslation(),
673
+ t = _useTranslation.t;
674
+ var handleNavigate = function handleNavigate(subPath) {
675
+ // eslint-disable-next-line @bigbinary/neeto/use-common-routes
676
+ history.push("".concat(location.pathname, "/").concat(subPath));
677
+ };
678
+ var hasMoreOptions = neetoCist.isPresent(moreOptions);
679
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
680
+ className: classnames("grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3", {
681
+ "border-border mt-8 border-t pt-8": neetoCist.isNotEmpty(urls)
682
+ }),
683
+ children: [hasMoreOptions && moreOptions.filter(function (_ref2) {
684
+ var permissions = _ref2.permissions;
685
+ return neetoCist.isNotPresent(permissions) || initializers.globalProps.permissions.some(ramda.includes(ramda.__, permissions));
686
+ }).map(function (_ref3) {
687
+ var title = _ref3.title,
688
+ link = _ref3.link,
689
+ Icon = _ref3.icon,
690
+ onClick = _ref3.onClick,
691
+ dataTestid = _ref3.dataTestid,
692
+ description = _ref3.description,
693
+ helpPopoverProps = _ref3.helpPopoverProps;
694
+ return /*#__PURE__*/React.createElement(Card, {
695
+ Icon: Icon,
696
+ description: description,
697
+ helpPopoverProps: helpPopoverProps,
698
+ link: link,
699
+ onClick: onClick,
700
+ title: title,
701
+ "data-testid": dataTestid,
702
+ key: link
703
+ });
704
+ }), !disableShareSocialMedia && /*#__PURE__*/jsxRuntime.jsx(Card, {
705
+ Icon: Share2,
706
+ "data-testid": "social-share-card",
707
+ description: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description"),
708
+ title: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title"),
709
+ onClick: function onClick() {
710
+ return handleNavigate("social-media");
711
+ }
712
+ }), !disableQRDownload && entity && /*#__PURE__*/jsxRuntime.jsx(Card, {
713
+ Icon: QrCode,
714
+ "data-testid": "qr-code-card",
715
+ description: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description"),
716
+ title: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title"),
717
+ onClick: function onClick() {
718
+ return handleNavigate("qrcode");
719
+ }
720
+ })]
721
+ });
722
+ };
723
+
724
+ var MainPanel = function MainPanel(_ref) {
725
+ var _urls$;
726
+ var title = _ref.title,
727
+ description = _ref.description,
728
+ qrCodeProps = _ref.qrCodeProps,
729
+ socialMediaProps = _ref.socialMediaProps,
730
+ _ref$isLoading = _ref.isLoading,
731
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
732
+ _ref$enabledOptions = _ref.enabledOptions,
733
+ enabledOptions = _ref$enabledOptions === void 0 ? {
734
+ regenerate: false,
735
+ edit: false
736
+ } : _ref$enabledOptions,
737
+ _ref$urls = _ref.urls,
738
+ urls = _ref$urls === void 0 ? [] : _ref$urls,
739
+ entity = _ref.entity,
740
+ entityName = _ref.entityName,
741
+ _ref$handleEdit = _ref.handleEdit,
742
+ handleEdit = _ref$handleEdit === void 0 ? neetoCist.noop : _ref$handleEdit,
743
+ _ref$handleRegenerate = _ref.handleRegenerate,
744
+ handleRegenerate = _ref$handleRegenerate === void 0 ? neetoCist.noop : _ref$handleRegenerate,
745
+ moreOptions = _ref.moreOptions,
746
+ _ref$disableShareSoci = _ref.disableShareSocialMedia,
747
+ disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
748
+ _ref$disableQRDownloa = _ref.disableQRDownload,
749
+ disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
750
+ _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
751
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
752
+ customTopContent = _ref.customTopContent,
753
+ customBottomContent = _ref.customBottomContent;
754
+ var _useTranslation = reactI18next.useTranslation(),
755
+ t = _useTranslation.t;
756
+ var shouldShowShareBlock = !disableQRDownload || !disableShareSocialMedia || neetoCist.isPresent(moreOptions);
757
+ return /*#__PURE__*/jsxRuntime.jsx(v2_Container, {
758
+ className: "bg-muted",
759
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
760
+ className: "mx-auto w-full max-w-5xl py-10",
761
+ children: [customTopContent, /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
762
+ "data-testid": "share-your-meeting-heading",
763
+ variant: "h2",
764
+ className: classnames({
765
+ "mb-2": neetoCist.isPresent(description),
766
+ "mb-6": !neetoCist.isPresent(description)
767
+ }),
768
+ children: title || t("neetoMolecules.shareViaLink.title", {
769
+ productName: initializers.globalProps.appName
770
+ })
771
+ }), description && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
772
+ className: "mb-6",
773
+ "data-testid": "share-your-meeting-heading",
774
+ variant: "body1",
775
+ children: description
776
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
777
+ className: "bg-background rounded-lg p-6 sm:p-8",
778
+ "data-testid": "share-via-link",
779
+ children: [neetoCist.isNotEmpty(urls) && /*#__PURE__*/jsxRuntime.jsxs("div", {
780
+ className: "flex flex-col gap-y-1",
781
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
782
+ className: "inline-flex max-w-full flex-col gap-y-4",
783
+ children: urls === null || urls === void 0 ? void 0 : urls.map(function (urlOption) {
784
+ return /*#__PURE__*/React.createElement(Link, {
785
+ enabledOptions: enabledOptions,
786
+ entityName: entityName,
787
+ handleEdit: handleEdit,
788
+ handleRegenerate: handleRegenerate,
789
+ isLoading: isLoading,
790
+ editUrlProps: ramda.omit(["url"], urlOption),
791
+ key: urlOption.url,
792
+ previewUrl: urlOption.previewUrl,
793
+ url: urlOption.url
794
+ });
795
+ })
796
+ }), neetoCist.isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsxRuntime.jsx(ExpiryNotice, {
797
+ expiryConfiguration: publicLinkExpiryConfiguration
798
+ })]
799
+ }), shouldShowShareBlock && /*#__PURE__*/jsxRuntime.jsx(ShareBlock, {
800
+ disableQRDownload: disableQRDownload,
801
+ disableShareSocialMedia: disableShareSocialMedia,
802
+ entity: entity,
803
+ moreOptions: moreOptions,
804
+ qrCodeProps: qrCodeProps,
805
+ socialMediaProps: socialMediaProps,
806
+ urls: urls,
807
+ url: (_urls$ = urls[0]) === null || _urls$ === void 0 ? void 0 : _urls$.url
808
+ })]
809
+ }), customBottomContent]
810
+ })
811
+ });
812
+ };
813
+
814
+ var QRCode = function QRCode(_ref) {
815
+ var entity = _ref.entity,
816
+ qrCodeProps = _ref.qrCodeProps,
817
+ url = _ref.url,
818
+ shareUrl = _ref.shareUrl;
819
+ var _useTranslation = reactI18next.useTranslation(),
820
+ t = _useTranslation.t;
821
+ if (!entity) return null;
822
+ var id = entity.id,
823
+ name = entity.name;
824
+ var canvasId = "qrcode-share-".concat(id);
825
+ var handleDownloadQRCode = function handleDownloadQRCode() {
826
+ var canvas = document.getElementById(canvasId);
827
+ if (canvas) downloadCanvas(canvas, {
828
+ name: neetoCist.slugify(name)
829
+ });
830
+ };
831
+ var handleCopyQRCode = function handleCopyQRCode() {
832
+ var canvas = document.getElementById(canvasId);
833
+ if (canvas) copyCanvasToClipboard(canvas, handleDownloadQRCode);
834
+ };
835
+ 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");
836
+ 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");
837
+ return /*#__PURE__*/jsxRuntime.jsxs(v2_Container, {
838
+ className: "py-8",
839
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
840
+ className: "mb-4",
841
+ "data-testid": "back-button",
842
+ icon: arrowLeft.ArrowLeft,
843
+ iconPosition: "left",
844
+ label: t("neetoMolecules.productEmbed.backToShare"),
845
+ size: "sm",
846
+ to: shareUrl,
847
+ variant: "link"
848
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_Header, {
849
+ className: "py-0",
850
+ title: t("neetoMolecules.shareViaLink.qrCode.title")
851
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_CardLayout, {
852
+ description: description,
853
+ title: title,
854
+ actionBlock: /*#__PURE__*/jsxRuntime.jsxs("div", {
855
+ className: "flex flex-wrap items-center gap-3",
856
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
857
+ "data-testid": "qr-code-download-button",
858
+ label: t("neetoMolecules.shareViaLink.qrCode.download"),
859
+ onClick: handleDownloadQRCode
860
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_CopyToClipboardButton, {
861
+ "data-testid": "qr-code-copy-button",
862
+ label: t("neetoMolecules.shareViaLink.qrCode.copy"),
863
+ variant: "outline",
864
+ onClick: handleCopyQRCode
865
+ })]
866
+ }),
867
+ children: /*#__PURE__*/jsxRuntime.jsx(index.QRCodeCanvas, {
868
+ className: "mt-6 cursor-pointer",
869
+ "data-testid": "qr-code-image",
870
+ id: canvasId,
871
+ size: 160,
872
+ style: {
873
+ width: 160,
874
+ height: 160
875
+ },
876
+ value: url,
877
+ onClick: handleDownloadQRCode
878
+ })
879
+ })]
880
+ });
881
+ };
882
+
883
+ var SocialMedia = function SocialMedia(_ref) {
884
+ var socialMediaProps = _ref.socialMediaProps,
885
+ url = _ref.url,
886
+ shareUrl = _ref.shareUrl;
887
+ var _useTranslation = reactI18next.useTranslation(),
888
+ t = _useTranslation.t;
889
+ 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");
890
+ 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");
891
+ return /*#__PURE__*/jsxRuntime.jsxs(v2_Container, {
892
+ className: "py-8",
893
+ children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
894
+ className: "mb-4",
895
+ "data-testid": "back-button",
896
+ icon: arrowLeft.ArrowLeft,
897
+ iconPosition: "left",
898
+ label: t("neetoMolecules.productEmbed.backToShare"),
899
+ size: "sm",
900
+ to: shareUrl,
901
+ variant: "link"
902
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_Header, {
903
+ className: "py-0",
904
+ title: t("neetoMolecules.shareViaLink.socialMediaShare.title")
905
+ }), /*#__PURE__*/jsxRuntime.jsx(v2_CardLayout, {
906
+ description: description,
907
+ title: title,
908
+ actionBlock: /*#__PURE__*/jsxRuntime.jsx("div", {
909
+ className: "flex flex-wrap items-center gap-3",
910
+ children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref2) {
911
+ var _ref3 = _slicedToArray(_ref2, 2),
912
+ key = _ref3[0],
913
+ _ref3$ = _ref3[1],
914
+ label = _ref3$.label,
915
+ Icon = _ref3$.icon,
916
+ generateShareUrl = _ref3$.generateShareUrl;
917
+ return /*#__PURE__*/React.createElement(neetoAtoms.Button, {
918
+ label: label,
919
+ "data-testid": "social-media-button-".concat(key),
920
+ icon: Icon,
921
+ iconPosition: "right",
922
+ key: key,
923
+ rel: "noopener noreferrer",
924
+ target: "_blank",
925
+ variant: "outline",
926
+ href: generateShareUrl({
927
+ url: url,
928
+ title: socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.postTitle
929
+ })
930
+ });
931
+ })
932
+ })
933
+ })]
934
+ });
935
+ };
936
+
937
+ /* eslint-disable @bigbinary/neeto/use-common-routes */
938
+ var ShareViaLink = function ShareViaLink(_ref) {
939
+ var title = _ref.title,
940
+ description = _ref.description,
941
+ _ref$isLoading = _ref.isLoading,
942
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
943
+ _ref$enabledOptions = _ref.enabledOptions,
944
+ enabledOptions = _ref$enabledOptions === void 0 ? {
945
+ regenerate: false,
946
+ edit: false
947
+ } : _ref$enabledOptions,
948
+ _ref$urls = _ref.urls,
949
+ urls = _ref$urls === void 0 ? [] : _ref$urls,
950
+ entity = _ref.entity,
951
+ entityName = _ref.entityName,
952
+ _ref$handleEdit = _ref.handleEdit,
953
+ handleEdit = _ref$handleEdit === void 0 ? neetoCist.noop : _ref$handleEdit,
954
+ _ref$handleRegenerate = _ref.handleRegenerate,
955
+ handleRegenerate = _ref$handleRegenerate === void 0 ? neetoCist.noop : _ref$handleRegenerate,
956
+ _ref$disableShareSoci = _ref.disableShareSocialMedia,
957
+ disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
958
+ _ref$disableQRDownloa = _ref.disableQRDownload,
959
+ disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
960
+ socialMediaProps = _ref.socialMediaProps,
961
+ qrCodeProps = _ref.qrCodeProps,
962
+ moreOptions = _ref.moreOptions,
963
+ _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
964
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
965
+ customTopContent = _ref.customTopContent,
966
+ customBottomContent = _ref.customBottomContent;
967
+ var _useRouteMatch = reactRouterDom.useRouteMatch(),
968
+ sharePath = _useRouteMatch.path,
969
+ shareUrl = _useRouteMatch.url;
970
+ return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
971
+ children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
972
+ exact: true,
973
+ path: sharePath,
974
+ render: function render() {
975
+ return /*#__PURE__*/jsxRuntime.jsx(MainPanel, {
976
+ customBottomContent: customBottomContent,
977
+ customTopContent: customTopContent,
978
+ description: description,
979
+ disableQRDownload: disableQRDownload,
980
+ disableShareSocialMedia: disableShareSocialMedia,
981
+ enabledOptions: enabledOptions,
982
+ entity: entity,
983
+ entityName: entityName,
984
+ handleEdit: handleEdit,
985
+ handleRegenerate: handleRegenerate,
986
+ isLoading: isLoading,
987
+ moreOptions: moreOptions,
988
+ publicLinkExpiryConfiguration: publicLinkExpiryConfiguration,
989
+ qrCodeProps: qrCodeProps,
990
+ socialMediaProps: socialMediaProps,
991
+ title: title,
992
+ urls: urls
993
+ });
994
+ }
995
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
996
+ exact: true,
997
+ path: "".concat(sharePath, "/qrcode"),
998
+ render: function render() {
999
+ var _urls$;
1000
+ return /*#__PURE__*/jsxRuntime.jsx(QRCode, {
1001
+ entity: entity,
1002
+ qrCodeProps: qrCodeProps,
1003
+ shareUrl: shareUrl,
1004
+ url: (_urls$ = urls[0]) === null || _urls$ === void 0 ? void 0 : _urls$.url
1005
+ });
1006
+ }
1007
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1008
+ exact: true,
1009
+ path: "".concat(sharePath, "/social-media"),
1010
+ render: function render() {
1011
+ var _urls$2;
1012
+ return /*#__PURE__*/jsxRuntime.jsx(SocialMedia, {
1013
+ shareUrl: shareUrl,
1014
+ socialMediaProps: socialMediaProps,
1015
+ url: (_urls$2 = urls[0]) === null || _urls$2 === void 0 ? void 0 : _urls$2.url
1016
+ });
1017
+ }
1018
+ }), neetoCist.isPresent(moreOptions) && moreOptions.map(function (_ref2) {
1019
+ var link = _ref2.link,
1020
+ element = _ref2.element,
1021
+ path = _ref2.path,
1022
+ permissions = _ref2.permissions;
1023
+ if (!link && !path) return null;
1024
+ return /*#__PURE__*/React.createElement(PrivateRoute, {
1025
+ permissions: permissions,
1026
+ exact: true,
1027
+ key: link,
1028
+ path: path || link,
1029
+ render: function render() {
1030
+ return element;
1031
+ }
1032
+ });
1033
+ }), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
1034
+ component: v2_ErrorPage,
1035
+ path: "*"
1036
+ })]
1037
+ });
1038
+ };
1039
+
1040
+ module.exports = ShareViaLink;
1041
+ //# sourceMappingURL=ShareViaLink.js.map