@availity/mui-spaces 0.2.6 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/index.d.mts +167 -11
- package/dist/index.d.ts +167 -11
- package/dist/index.js +1209 -10
- package/dist/index.mjs +1198 -10
- package/jest.config.js +1 -0
- package/package.json +14 -8
- package/src/index.ts +7 -0
- package/src/lib/Spaces.test.tsx +5 -4
- package/src/lib/Spaces.tsx +17 -6
- package/src/lib/SpacesGhostText.tsx +1 -1
- package/src/lib/SpacesImage.test.tsx +1 -1
- package/src/lib/SpacesLink/SpacesLink.test.tsx +605 -0
- package/src/lib/SpacesLink/SpacesLink.tsx +239 -0
- package/src/lib/SpacesLink/linkHandlers.tsx +45 -0
- package/src/lib/SpacesLink/spaces-link-types.tsx +143 -0
- package/src/lib/SpacesLink/useLink.test.tsx +280 -0
- package/src/lib/SpacesLink/useLink.tsx +111 -0
- package/src/lib/helpers.test.tsx +3 -0
- package/src/lib/helpers.tsx +26 -2
- package/src/lib/modals/DisclaimerModal.test.tsx +66 -0
- package/src/lib/modals/DisclaimerModal.tsx +34 -0
- package/src/lib/modals/ModalProvider.tsx +162 -0
- package/src/lib/modals/MultiPayerModal.test.tsx +61 -0
- package/src/lib/modals/MultiPayerModal.tsx +19 -0
- package/src/lib/modals/modal-types.tsx +91 -0
- package/src/lib/spaces-data.test.tsx +8 -3
- package/src/lib/spaces-types.tsx +16 -12
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -20,6 +22,18 @@ var __spreadValues = (a, b) => {
|
|
|
20
22
|
return a;
|
|
21
23
|
};
|
|
22
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
23
37
|
var __export = (target, all) => {
|
|
24
38
|
for (var name in all)
|
|
25
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -32,6 +46,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
32
46
|
}
|
|
33
47
|
return to;
|
|
34
48
|
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
35
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
58
|
var __async = (__this, __arguments, generator) => {
|
|
37
59
|
return new Promise((resolve, reject) => {
|
|
@@ -59,14 +81,19 @@ var src_exports = {};
|
|
|
59
81
|
__export(src_exports, {
|
|
60
82
|
INITIAL_STATE: () => INITIAL_STATE,
|
|
61
83
|
Spaces: () => Spaces,
|
|
84
|
+
SpacesAgreement: () => SpacesAgreement,
|
|
62
85
|
SpacesContext: () => SpacesContext,
|
|
86
|
+
SpacesDisclaimer: () => SpacesDisclaimer,
|
|
87
|
+
SpacesGhostText: () => SpacesGhostText,
|
|
88
|
+
SpacesImage: () => SpacesImage,
|
|
89
|
+
SpacesLink: () => SpacesLink,
|
|
63
90
|
useSpaces: () => useSpaces,
|
|
64
91
|
useSpacesContext: () => useSpacesContext
|
|
65
92
|
});
|
|
66
93
|
module.exports = __toCommonJS(src_exports);
|
|
67
94
|
|
|
68
95
|
// src/lib/Spaces.tsx
|
|
69
|
-
var
|
|
96
|
+
var import_react4 = require("react");
|
|
70
97
|
var import_react_query = require("@tanstack/react-query");
|
|
71
98
|
|
|
72
99
|
// src/lib/spaces-data.tsx
|
|
@@ -238,13 +265,371 @@ var configurationFindMany_default = `query configurationFindMany($ids: [String!]
|
|
|
238
265
|
}
|
|
239
266
|
}`;
|
|
240
267
|
|
|
241
|
-
// src/lib/
|
|
268
|
+
// src/lib/modals/ModalProvider.tsx
|
|
269
|
+
var import_react3 = require("react");
|
|
270
|
+
var import_resolve_url = require("@availity/resolve-url");
|
|
271
|
+
var import_mui_dialog3 = require("@availity/mui-dialog");
|
|
272
|
+
var import_mui_button = require("@availity/mui-button");
|
|
273
|
+
|
|
274
|
+
// src/lib/helpers.tsx
|
|
275
|
+
var import_qs = __toESM(require("qs"));
|
|
276
|
+
var updateUrl = (url, key, value) => {
|
|
277
|
+
const [uri, queryString] = url.split("?");
|
|
278
|
+
const currentParams = import_qs.default.parse(queryString);
|
|
279
|
+
const additionalParams = key && value && { [key]: value };
|
|
280
|
+
const newParams = import_qs.default.stringify(__spreadValues(__spreadValues({}, currentParams), additionalParams), { sort: (a, b) => a.localeCompare(b) });
|
|
281
|
+
return `${uri}?${newParams}`;
|
|
282
|
+
};
|
|
283
|
+
var getUrl = (url = "", loadApp, absolute) => {
|
|
284
|
+
if (absolute || !loadApp)
|
|
285
|
+
return url;
|
|
286
|
+
return `/public/apps/home/#!/loadApp?appUrl=${encodeURIComponent(url)}`;
|
|
287
|
+
};
|
|
288
|
+
var getTarget = (target) => {
|
|
289
|
+
if (target && !target.startsWith("_")) {
|
|
290
|
+
if (target === "BODY") {
|
|
291
|
+
return "_self";
|
|
292
|
+
}
|
|
293
|
+
if (target === "TAB") {
|
|
294
|
+
return "_blank";
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return target || "_self";
|
|
298
|
+
};
|
|
299
|
+
var isFunction = (children) => typeof children === "function";
|
|
300
|
+
var isReactNodeFunction = (children) => typeof children === "function";
|
|
301
|
+
|
|
302
|
+
// src/lib/topApps.tsx
|
|
303
|
+
var import_message_core = __toESM(require("@availity/message-core"));
|
|
304
|
+
var import_dayjs = __toESM(require("dayjs"));
|
|
305
|
+
var TOP_APPS = {
|
|
306
|
+
ALLOWED_TYPES: ["APPLICATION", "RESOURCE", "NAVIGATION"],
|
|
307
|
+
DISALLOWED_TYPES: ["reporting", "how_to_guide_dental_providers", "my_account_profile", "my_administrators"],
|
|
308
|
+
KEYS: {
|
|
309
|
+
VALUES: "myTopApps",
|
|
310
|
+
LAST_UPDATED: "top-apps-updated"
|
|
311
|
+
},
|
|
312
|
+
UPDATE_EVENT: "av:topApps:updated"
|
|
313
|
+
};
|
|
314
|
+
var getItemLocalStorage = (key) => {
|
|
315
|
+
try {
|
|
316
|
+
const value = window.localStorage.getItem(key);
|
|
317
|
+
if (value === null) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
return JSON.parse(value);
|
|
321
|
+
} catch (e) {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
var canTrackSpace = (spaceId, type) => TOP_APPS.ALLOWED_TYPES.some((t) => t === type) && !TOP_APPS.DISALLOWED_TYPES.some((id) => id === spaceId);
|
|
326
|
+
var getLocalStorageTopApps = (akaname) => {
|
|
327
|
+
const topAppsValues = getItemLocalStorage(`${TOP_APPS.KEYS.VALUES}-${akaname}`);
|
|
328
|
+
return topAppsValues;
|
|
329
|
+
};
|
|
330
|
+
var updateTopApps = (space, akaname) => __async(void 0, null, function* () {
|
|
331
|
+
if (!space.configurationId || !space.type)
|
|
332
|
+
return;
|
|
333
|
+
if (canTrackSpace(space.configurationId, space.type)) {
|
|
334
|
+
const today = (0, import_dayjs.default)();
|
|
335
|
+
const topApps = (yield getLocalStorageTopApps(akaname)) || {};
|
|
336
|
+
window.localStorage.setItem(`${TOP_APPS.KEYS.LAST_UPDATED}-${akaname}`, today.format());
|
|
337
|
+
const currentCount = topApps[space.configurationId] && typeof topApps[space.configurationId].count === "number" ? topApps[space.configurationId].count : 0;
|
|
338
|
+
topApps[space.configurationId] = __spreadProps(__spreadValues({}, topApps == null ? void 0 : topApps[space.configurationId]), {
|
|
339
|
+
count: currentCount + 1,
|
|
340
|
+
lastUse: today.format()
|
|
341
|
+
});
|
|
342
|
+
window.localStorage.setItem(`${TOP_APPS.KEYS.VALUES}-${akaname}`, JSON.stringify(topApps));
|
|
343
|
+
import_message_core.default.send(TOP_APPS.UPDATE_EVENT);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// src/lib/modals/DisclaimerModal.tsx
|
|
348
|
+
var import_react2 = require("react");
|
|
349
|
+
var import_api_axios2 = require("@availity/api-axios");
|
|
350
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
351
|
+
|
|
352
|
+
// ../progress/src/lib/CircularProgress.tsx
|
|
353
|
+
var import_react = require("react");
|
|
354
|
+
var import_CircularProgress = __toESM(require("@mui/material/CircularProgress"));
|
|
355
|
+
var import_Stack = __toESM(require("@mui/material/Stack"));
|
|
356
|
+
var import_mui_icon = require("@availity/mui-icon");
|
|
357
|
+
var import_mui_typography = require("@availity/mui-typography");
|
|
242
358
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
359
|
+
var StatusIcon = ({ status, size }) => {
|
|
360
|
+
const fontSize = size === "small" ? "medium" : "large";
|
|
361
|
+
switch (status) {
|
|
362
|
+
case "error":
|
|
363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon.WarningCircleIcon, { color: "error", fontSize, titleAccess: "loading error" });
|
|
364
|
+
case "success":
|
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_icon.SuccessCircleIcon, { color: "success", fontSize, titleAccess: "loading successful" });
|
|
366
|
+
default:
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
var getCaptionText = (status) => ({
|
|
371
|
+
loading: "Loading",
|
|
372
|
+
error: "Loading error",
|
|
373
|
+
success: "Loading successful"
|
|
374
|
+
})[status] || "";
|
|
375
|
+
var CircularProgress = (_a) => {
|
|
376
|
+
var _b = _a, {
|
|
377
|
+
loadingCaption = true,
|
|
378
|
+
error = false,
|
|
379
|
+
success = false,
|
|
380
|
+
size = "default"
|
|
381
|
+
} = _b, props = __objRest(_b, [
|
|
382
|
+
"loadingCaption",
|
|
383
|
+
"error",
|
|
384
|
+
"success",
|
|
385
|
+
"size"
|
|
386
|
+
]);
|
|
387
|
+
const [status, setStatus] = (0, import_react.useState)("loading");
|
|
388
|
+
(0, import_react.useEffect)(() => {
|
|
389
|
+
if (error) {
|
|
390
|
+
setStatus("error");
|
|
391
|
+
} else if (success) {
|
|
392
|
+
setStatus("success");
|
|
393
|
+
} else {
|
|
394
|
+
setStatus("loading");
|
|
395
|
+
}
|
|
396
|
+
}, [error, success]);
|
|
397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_Stack.default, { width: "fit-content", alignItems: "center", children: [
|
|
398
|
+
status === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
399
|
+
import_CircularProgress.default,
|
|
400
|
+
__spreadProps(__spreadValues({
|
|
401
|
+
"aria-label": "Loading"
|
|
402
|
+
}, props), {
|
|
403
|
+
size: size === "small" ? 24 : 40,
|
|
404
|
+
variant: "indeterminate"
|
|
405
|
+
})
|
|
406
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { status, size }),
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_typography.Typography, { marginTop: "8px", variant: "caption", children: loadingCaption || error || success ? getCaptionText(status) : null })
|
|
408
|
+
] });
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
// src/lib/modals/DisclaimerModal.tsx
|
|
412
|
+
var import_mui_dialog = require("@availity/mui-dialog");
|
|
413
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
414
|
+
var disclaimerQuery = `query disclaimerFindOne($id: ID!) {
|
|
415
|
+
configurationFindOne(id: $id) {
|
|
416
|
+
... on Text {
|
|
417
|
+
description
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}`;
|
|
421
|
+
var DisclaimerModal = ({ disclaimerId }) => {
|
|
422
|
+
const [disclaimer, setDisclaimer] = (0, import_react2.useState)("");
|
|
423
|
+
(0, import_react2.useEffect)(() => {
|
|
424
|
+
const fetchDisclaimer = () => __async(void 0, null, function* () {
|
|
425
|
+
if (disclaimerId) {
|
|
426
|
+
const result = yield import_api_axios2.avWebQLApi.create({ query: disclaimerQuery, variables: { id: disclaimerId } });
|
|
427
|
+
setDisclaimer(result.data.data.configurationFindOne.description);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
fetchDisclaimer();
|
|
431
|
+
}, [disclaimerId]);
|
|
432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_mui_dialog.DialogContent, { children: disclaimer ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_markdown.default, { children: disclaimer }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CircularProgress, {}) });
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
// src/lib/modals/MultiPayerModal.tsx
|
|
436
|
+
var import_mui_dialog2 = require("@availity/mui-dialog");
|
|
437
|
+
var import_mui_layout = require("@availity/mui-layout");
|
|
438
|
+
var import_mui_typography2 = require("@availity/mui-typography");
|
|
439
|
+
|
|
440
|
+
// src/lib/SpacesImage.tsx
|
|
441
|
+
var import_react_image = require("react-image");
|
|
442
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
443
|
+
var SpacesImage = (_a) => {
|
|
444
|
+
var _b = _a, { spaceId, payerId, imageType = "url", fallback } = _b, props = __objRest(_b, ["spaceId", "payerId", "imageType", "fallback"]);
|
|
445
|
+
var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
446
|
+
let spaces;
|
|
447
|
+
if (spaceId) {
|
|
448
|
+
spaces = useSpaces(spaceId);
|
|
449
|
+
} else if (payerId) {
|
|
450
|
+
spaces = useSpaces(payerId);
|
|
451
|
+
}
|
|
452
|
+
const { loading } = useSpacesContext();
|
|
453
|
+
const id = spaceId || payerId || (spaces == null ? void 0 : spaces[0].id) || (spaces == null ? void 0 : spaces[0].configurationId);
|
|
454
|
+
const imageMap = {
|
|
455
|
+
"images.logo": (_b2 = (_a2 = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _a2.images) == null ? void 0 : _b2.logo,
|
|
456
|
+
"images.tile": (_d = (_c = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _c.images) == null ? void 0 : _d.tile,
|
|
457
|
+
"images.billboard": (_f = (_e = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _e.images) == null ? void 0 : _f.billboard,
|
|
458
|
+
"images.promotional": (_h = (_g = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _g.images) == null ? void 0 : _h.promotional,
|
|
459
|
+
"images.promotionalHover": (_j = (_i = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _i.images) == null ? void 0 : _j.promotionalHover,
|
|
460
|
+
url: (_k = spaces == null ? void 0 : spaces[0]) == null ? void 0 : _k.url
|
|
461
|
+
};
|
|
462
|
+
let url = imageMap[imageType];
|
|
463
|
+
if (!url && loading) {
|
|
464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CircularProgress, { id: `app-${id}-loading` });
|
|
465
|
+
}
|
|
466
|
+
if (!url && !loading && fallback) {
|
|
467
|
+
url = fallback;
|
|
468
|
+
}
|
|
469
|
+
if (!url || !id)
|
|
470
|
+
return null;
|
|
471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
472
|
+
import_react_image.Img,
|
|
473
|
+
__spreadValues({
|
|
474
|
+
id: props.id || `app-img-${id}`,
|
|
475
|
+
src: url,
|
|
476
|
+
alt: `Space ${imageType}`,
|
|
477
|
+
loader: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CircularProgress, { id: `app-img-${id}-loading` })
|
|
478
|
+
}, props)
|
|
479
|
+
);
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
// src/lib/modals/MultiPayerModal.tsx
|
|
483
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
484
|
+
var MultiPayerModal = ({ parentPayerSpaces, name, state: { selectedOption }, setState }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_mui_dialog2.DialogContent, { children: [
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_typography2.Typography, { children: `Open ${name} as: ${selectedOption ? selectedOption.name || selectedOption.id : ""}` }),
|
|
486
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_layout.Grid, { direction: "row", children: parentPayerSpaces && parentPayerSpaces.map((payerSpace) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_mui_layout.Box, { onClick: () => setState({ selectedOption: payerSpace }), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SpacesImage, { spaceId: payerSpace.configurationId, imageType: "images.tile" }) })) })
|
|
487
|
+
] });
|
|
488
|
+
|
|
489
|
+
// src/lib/modals/modal-types.tsx
|
|
490
|
+
var isModalOptions = (action) => action.spaceType !== void 0;
|
|
491
|
+
var isModalState = (action) => action.selectedOption !== void 0;
|
|
492
|
+
|
|
493
|
+
// src/lib/modals/ModalProvider.tsx
|
|
494
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
495
|
+
var MODAL_INITIAL_STATE = {
|
|
496
|
+
isOpen: false,
|
|
497
|
+
modalOptions: void 0,
|
|
498
|
+
modalState: { selectedOption: { id: "", name: "" } },
|
|
499
|
+
selectedModal: {}
|
|
500
|
+
};
|
|
501
|
+
var ModalContext = (0, import_react3.createContext)(null);
|
|
502
|
+
var useModal = () => {
|
|
503
|
+
const ctx = (0, import_react3.useContext)(ModalContext);
|
|
504
|
+
if (!ctx)
|
|
505
|
+
throw new Error("ModalContext be used inside a Provider");
|
|
506
|
+
return ctx;
|
|
507
|
+
};
|
|
508
|
+
var MODAL_TYPES = {
|
|
509
|
+
DISCLAIMER: {
|
|
510
|
+
body: DisclaimerModal,
|
|
511
|
+
buttonProps: () => ({
|
|
512
|
+
children: "Accept"
|
|
513
|
+
}),
|
|
514
|
+
onSubmit: ({ link, id: spaceId }) => {
|
|
515
|
+
var _a;
|
|
516
|
+
window.open(((_a = link.url) == null ? void 0 : _a[0]) === "/" ? updateUrl(link.url, "spaceId", spaceId) : link.url, link.target);
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
MULTI_PAYER: {
|
|
520
|
+
body: MultiPayerModal,
|
|
521
|
+
buttonProps: ({ selectedOption }) => ({
|
|
522
|
+
children: "Continue",
|
|
523
|
+
disabled: selectedOption === void 0
|
|
524
|
+
}),
|
|
525
|
+
onSubmit: ({ metadata, link, id: spaceId, name }, modalState, dispatch) => {
|
|
526
|
+
if (metadata == null ? void 0 : metadata.disclaimerId) {
|
|
527
|
+
dispatch({ type: "OPEN_DISCLAIMER_MODAL", disclaimerId: metadata.disclaimerId, link, id: spaceId, name });
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const target = getTarget(link.target);
|
|
531
|
+
if (link.url) {
|
|
532
|
+
window.open(
|
|
533
|
+
!(0, import_resolve_url.isAbsoluteUrl)(link.url) ? getUrl(updateUrl(link.url, "spaceId", modalState.selectedOption.id), false, false) : link.url,
|
|
534
|
+
target
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
var modalActions = {
|
|
541
|
+
RESET: () => MODAL_INITIAL_STATE,
|
|
542
|
+
OPEN_DISCLAIMER_MODAL: (state, modalOptions) => __spreadProps(__spreadValues({}, state), {
|
|
543
|
+
isOpen: true,
|
|
544
|
+
selectedModal: MODAL_TYPES.DISCLAIMER,
|
|
545
|
+
modalOptions: __spreadProps(__spreadValues({}, modalOptions), { type: modalOptions.spaceType })
|
|
546
|
+
}),
|
|
547
|
+
OPEN_MULTI_PAYER_MODAL: (state, modalOptions) => __spreadProps(__spreadValues({}, state), {
|
|
548
|
+
isOpen: true,
|
|
549
|
+
selectedModal: MODAL_TYPES.MULTI_PAYER,
|
|
550
|
+
modalOptions: __spreadProps(__spreadValues({}, modalOptions), {
|
|
551
|
+
type: modalOptions.spaceType
|
|
552
|
+
})
|
|
553
|
+
}),
|
|
554
|
+
UPDATE_MODAL_STATE: (state, modalState) => __spreadProps(__spreadValues({}, state), {
|
|
555
|
+
modalState
|
|
556
|
+
})
|
|
557
|
+
};
|
|
558
|
+
var modalReducer = (state, _a) => {
|
|
559
|
+
var _b = _a, { type } = _b, action = __objRest(_b, ["type"]);
|
|
560
|
+
if (type === "RESET")
|
|
561
|
+
return modalActions.RESET();
|
|
562
|
+
if (isModalOptions(action)) {
|
|
563
|
+
if (type === "OPEN_MULTI_PAYER_MODAL")
|
|
564
|
+
return modalActions.OPEN_MULTI_PAYER_MODAL(state, action);
|
|
565
|
+
else if (type === "OPEN_DISCLAIMER_MODAL")
|
|
566
|
+
return modalActions.OPEN_DISCLAIMER_MODAL(state, action);
|
|
567
|
+
} else if (isModalState(action)) {
|
|
568
|
+
if (type === "UPDATE_MODAL_STATE")
|
|
569
|
+
return modalActions.UPDATE_MODAL_STATE(state, action);
|
|
570
|
+
}
|
|
571
|
+
return state;
|
|
572
|
+
};
|
|
573
|
+
var ModalProvider = ({ children }) => {
|
|
574
|
+
const [{ selectedModal, modalOptions, modalState, isOpen }, dispatch] = (0, import_react3.useReducer)(modalReducer, MODAL_INITIAL_STATE);
|
|
575
|
+
const toggle = () => dispatch({ type: "RESET" });
|
|
576
|
+
const buttonProps = (selectedModal == null ? void 0 : selectedModal.buttonProps) && (selectedModal == null ? void 0 : selectedModal.buttonProps(__spreadProps(__spreadValues({}, modalState), { modalOptions })));
|
|
577
|
+
const Body = selectedModal == null ? void 0 : selectedModal.body;
|
|
578
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
579
|
+
ModalContext.Provider,
|
|
580
|
+
{
|
|
581
|
+
value: (modalType, modalOptions2) => dispatch(__spreadValues({ type: `OPEN_${modalType}` }, modalOptions2)),
|
|
582
|
+
children: [
|
|
583
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_mui_dialog3.Dialog, { open: isOpen, children: [
|
|
584
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_dialog3.DialogTitle, { id: "disclaimer-header", children: modalOptions == null ? void 0 : modalOptions.title }),
|
|
585
|
+
Body && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
586
|
+
Body,
|
|
587
|
+
__spreadProps(__spreadValues({}, modalOptions), {
|
|
588
|
+
setState: (newState) => dispatch(__spreadValues({ type: "UPDATE_MODAL_STATE" }, newState)),
|
|
589
|
+
state: modalState
|
|
590
|
+
})
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_mui_dialog3.DialogActions, { children: [
|
|
593
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_mui_button.Button, { onClick: toggle, children: "Cancel" }),
|
|
594
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
595
|
+
import_mui_button.Button,
|
|
596
|
+
__spreadProps(__spreadValues({
|
|
597
|
+
color: "primary"
|
|
598
|
+
}, buttonProps), {
|
|
599
|
+
onClick: () => {
|
|
600
|
+
if ((selectedModal == null ? void 0 : selectedModal.onSubmit) && modalOptions && modalState) {
|
|
601
|
+
selectedModal.onSubmit(modalOptions, modalState, dispatch);
|
|
602
|
+
}
|
|
603
|
+
if (modalOptions) {
|
|
604
|
+
updateTopApps(
|
|
605
|
+
{
|
|
606
|
+
configurationId: modalOptions.id,
|
|
607
|
+
type: modalOptions.type,
|
|
608
|
+
name: modalOptions.name,
|
|
609
|
+
id: modalOptions.id
|
|
610
|
+
},
|
|
611
|
+
modalOptions.user
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
toggle();
|
|
615
|
+
}
|
|
616
|
+
})
|
|
617
|
+
)
|
|
618
|
+
] })
|
|
619
|
+
] }),
|
|
620
|
+
children
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
// src/lib/Spaces.tsx
|
|
627
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
243
628
|
var INITIAL_STATE = {
|
|
244
629
|
loading: true
|
|
245
630
|
};
|
|
246
|
-
var SpacesContext = (0,
|
|
247
|
-
var useSpacesContext = () => (0,
|
|
631
|
+
var SpacesContext = (0, import_react4.createContext)(INITIAL_STATE);
|
|
632
|
+
var useSpacesContext = () => (0, import_react4.useContext)(SpacesContext);
|
|
248
633
|
var Spaces = ({
|
|
249
634
|
query = configurationFindMany_default,
|
|
250
635
|
variables = { types: ["PAYERSPACE"] },
|
|
@@ -254,7 +639,7 @@ var Spaces = ({
|
|
|
254
639
|
spaceIds,
|
|
255
640
|
spaces: spacesFromProps
|
|
256
641
|
}) => {
|
|
257
|
-
const [{ previousSpacesMap, previousSpacesByConfigMap, previousSpacesByPayerMap, loading, error }, dispatch] = (0,
|
|
642
|
+
const [{ previousSpacesMap, previousSpacesByConfigMap, previousSpacesByPayerMap, loading, error }, dispatch] = (0, import_react4.useReducer)(spacesReducer, INITIAL_STATE);
|
|
258
643
|
const spacesMap = new Map(previousSpacesMap);
|
|
259
644
|
const configIdsMap = new Map(previousSpacesByConfigMap);
|
|
260
645
|
const payerIdsMap = new Map(previousSpacesByPayerMap);
|
|
@@ -313,7 +698,7 @@ var Spaces = ({
|
|
|
313
698
|
}
|
|
314
699
|
]
|
|
315
700
|
});
|
|
316
|
-
(0,
|
|
701
|
+
(0, import_react4.useEffect)(() => {
|
|
317
702
|
if (isErrorByPayerIds || isErrorBySpaceIds) {
|
|
318
703
|
dispatch({
|
|
319
704
|
type: "ERROR",
|
|
@@ -322,7 +707,7 @@ var Spaces = ({
|
|
|
322
707
|
});
|
|
323
708
|
}
|
|
324
709
|
}, [isErrorByPayerIds, isErrorBySpaceIds]);
|
|
325
|
-
(0,
|
|
710
|
+
(0, import_react4.useEffect)(() => {
|
|
326
711
|
dispatch({
|
|
327
712
|
type: "LOADING",
|
|
328
713
|
loading: true
|
|
@@ -384,17 +769,22 @@ var Spaces = ({
|
|
|
384
769
|
loading: false
|
|
385
770
|
});
|
|
386
771
|
}, [spacesBySpaceIds, spacesByPayerIds, payerIds, spaceIds]);
|
|
387
|
-
|
|
772
|
+
const spacesChildren = () => {
|
|
773
|
+
if (children) {
|
|
774
|
+
return isReactNodeFunction(children) ? (() => children({ spaces: [spacesMap.values()], loading, error }))() : children;
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
388
778
|
SpacesContext.Provider,
|
|
389
779
|
{
|
|
390
|
-
children,
|
|
391
780
|
value: {
|
|
392
781
|
spaces: spacesMap,
|
|
393
782
|
spacesByConfig: configIdsMap,
|
|
394
783
|
spacesByPayer: payerIdsMap,
|
|
395
784
|
loading: loading || isLoadingByPayerIds || isLoadingBySpaceIds,
|
|
396
785
|
error
|
|
397
|
-
}
|
|
786
|
+
},
|
|
787
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalProvider, { children: spacesChildren() })
|
|
398
788
|
}
|
|
399
789
|
);
|
|
400
790
|
};
|
|
@@ -420,11 +810,820 @@ var useSpaces = (...ids) => {
|
|
|
420
810
|
}
|
|
421
811
|
}, []);
|
|
422
812
|
};
|
|
813
|
+
|
|
814
|
+
// src/lib/SpacesLink/SpacesLink.tsx
|
|
815
|
+
var import_dayjs2 = __toESM(require("dayjs"));
|
|
816
|
+
|
|
817
|
+
// ../card/src/lib/Card.tsx
|
|
818
|
+
var import_Card = __toESM(require("@mui/material/Card"));
|
|
819
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
820
|
+
var Card = (_a) => {
|
|
821
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_Card.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
823
|
+
};
|
|
824
|
+
|
|
825
|
+
// ../card/src/lib/CardActionArea.tsx
|
|
826
|
+
var import_CardActionArea = __toESM(require("@mui/material/CardActionArea"));
|
|
827
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
828
|
+
|
|
829
|
+
// ../card/src/lib/CardActions.tsx
|
|
830
|
+
var import_CardActions = __toESM(require("@mui/material/CardActions"));
|
|
831
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
832
|
+
|
|
833
|
+
// ../card/src/lib/CardContent.tsx
|
|
834
|
+
var import_CardContent = __toESM(require("@mui/material/CardContent"));
|
|
835
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
836
|
+
var CardContent = (_a) => {
|
|
837
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_CardContent.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// ../card/src/lib/CardHeader.tsx
|
|
842
|
+
var import_styles = require("@mui/material/styles");
|
|
843
|
+
var import_CardHeader = __toESM(require("@mui/material/CardHeader"));
|
|
844
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
845
|
+
var CardHeader = (_a) => {
|
|
846
|
+
var _b = _a, {
|
|
847
|
+
titleTypographyProps,
|
|
848
|
+
subheaderTypographyProps
|
|
849
|
+
} = _b, rest = __objRest(_b, [
|
|
850
|
+
"titleTypographyProps",
|
|
851
|
+
"subheaderTypographyProps"
|
|
852
|
+
]);
|
|
853
|
+
var _a2, _b2, _c, _d;
|
|
854
|
+
const theme = (0, import_styles.useTheme)();
|
|
855
|
+
const titleVariant = (_d = (_c = (_b2 = (_a2 = theme.components) == null ? void 0 : _a2.MuiCardHeader) == null ? void 0 : _b2.defaultProps) == null ? void 0 : _c.titleTypographyProps) == null ? void 0 : _d.variant;
|
|
856
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
857
|
+
import_CardHeader.default,
|
|
858
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
859
|
+
titleTypographyProps: __spreadValues({
|
|
860
|
+
variant: titleVariant
|
|
861
|
+
}, titleTypographyProps),
|
|
862
|
+
subheaderTypographyProps: __spreadValues({ variant: "subtitle2" }, subheaderTypographyProps)
|
|
863
|
+
})
|
|
864
|
+
);
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
// ../card/src/lib/CardMedia.tsx
|
|
868
|
+
var import_CardMedia = __toESM(require("@mui/material/CardMedia"));
|
|
869
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
870
|
+
|
|
871
|
+
// src/lib/SpacesLink/SpacesLink.tsx
|
|
872
|
+
var import_mui_typography3 = require("@availity/mui-typography");
|
|
873
|
+
var import_mui_icon4 = require("@availity/mui-icon");
|
|
874
|
+
var import_react10 = require("react");
|
|
875
|
+
|
|
876
|
+
// ../chip/src/lib/Chip.tsx
|
|
877
|
+
var import_Chip = __toESM(require("@mui/material/Chip"));
|
|
878
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
879
|
+
var Chip = (props) => {
|
|
880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_Chip.default, __spreadProps(__spreadValues({}, props), { color: "default", size: "medium" }));
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
// ../chip/src/lib/StatusChip.tsx
|
|
884
|
+
var import_Chip2 = __toESM(require("@mui/material/Chip"));
|
|
885
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
886
|
+
var StatusChip = (_a) => {
|
|
887
|
+
var _b = _a, { color = "default" } = _b, rest = __objRest(_b, ["color"]);
|
|
888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Chip2.default, __spreadProps(__spreadValues({ color }, rest), { size: "small" }));
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
// ../link/src/lib/Link.tsx
|
|
892
|
+
var import_react5 = require("react");
|
|
893
|
+
var import_Link = __toESM(require("@mui/material/Link"));
|
|
894
|
+
var import_mui_icon2 = require("@availity/mui-icon");
|
|
895
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
896
|
+
var ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/;
|
|
897
|
+
var WINDOWS_PATH_REGEX = /^[a-zA-Z]:\\/;
|
|
898
|
+
function isAbsoluteUrl2(url) {
|
|
899
|
+
if (WINDOWS_PATH_REGEX.test(url)) {
|
|
900
|
+
return false;
|
|
901
|
+
}
|
|
902
|
+
return ABSOLUTE_URL_REGEX.test(url);
|
|
903
|
+
}
|
|
904
|
+
var getUrl2 = (url = "") => {
|
|
905
|
+
return `/public/apps/home/#!/loadApp?appUrl=${encodeURIComponent(url)}`;
|
|
906
|
+
};
|
|
907
|
+
var getLocation = (href) => {
|
|
908
|
+
const location = document.createElement("a");
|
|
909
|
+
location.href = href;
|
|
910
|
+
return location;
|
|
911
|
+
};
|
|
912
|
+
var setRel = (url, target, absolute) => {
|
|
913
|
+
if (target === "_blank" && absolute) {
|
|
914
|
+
const dest = getLocation(url);
|
|
915
|
+
if (dest.hostname !== window.location.hostname) {
|
|
916
|
+
return "noopener noreferrer";
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
return void 0;
|
|
920
|
+
};
|
|
921
|
+
var Link = (0, import_react5.forwardRef)((props, ref) => {
|
|
922
|
+
const _a = props, { href, target = "_self", children, onClick, loadApp = true, rel, iconPosition = "start" } = _a, rest = __objRest(_a, ["href", "target", "children", "onClick", "loadApp", "rel", "iconPosition"]);
|
|
923
|
+
const absolute = isAbsoluteUrl2(href);
|
|
924
|
+
const encode = !(absolute || !loadApp);
|
|
925
|
+
const url = encode ? getUrl2(href) : href;
|
|
926
|
+
const NewWindowIcon = target === "_blank" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_mui_icon2.OpenInNewIcon, {}) : null;
|
|
927
|
+
const startIcon = iconPosition === "start";
|
|
928
|
+
const endIcon = iconPosition === "end";
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
930
|
+
import_Link.default,
|
|
931
|
+
__spreadProps(__spreadValues({
|
|
932
|
+
href: url,
|
|
933
|
+
target,
|
|
934
|
+
onClick: (event) => onClick && onClick(event, url),
|
|
935
|
+
rel: rel || setRel(url, target, absolute)
|
|
936
|
+
}, rest), {
|
|
937
|
+
ref,
|
|
938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { children: [
|
|
939
|
+
startIcon && NewWindowIcon,
|
|
940
|
+
" ",
|
|
941
|
+
children,
|
|
942
|
+
" ",
|
|
943
|
+
endIcon && NewWindowIcon
|
|
944
|
+
] })
|
|
945
|
+
})
|
|
946
|
+
);
|
|
947
|
+
});
|
|
948
|
+
|
|
949
|
+
// ../favorites/src/lib/Favorites.tsx
|
|
950
|
+
var import_react6 = require("react");
|
|
951
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
952
|
+
var import_message_core3 = __toESM(require("@availity/message-core"));
|
|
953
|
+
|
|
954
|
+
// ../favorites/src/lib/utils.ts
|
|
955
|
+
var import_message_core2 = __toESM(require("@availity/message-core"));
|
|
956
|
+
var import_api_axios3 = require("@availity/api-axios");
|
|
957
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
958
|
+
|
|
959
|
+
// ../favorites/src/lib/Favorites.tsx
|
|
960
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
961
|
+
var FavoritesContext = (0, import_react6.createContext)(null);
|
|
962
|
+
var noOp = () => {
|
|
963
|
+
};
|
|
964
|
+
var useFavorites = (id) => {
|
|
965
|
+
const context = (0, import_react6.useContext)(FavoritesContext);
|
|
966
|
+
if (context === null) {
|
|
967
|
+
throw new Error("useFavorites must be used within a FavoritesProvider");
|
|
968
|
+
}
|
|
969
|
+
const { favorites, queryStatus, mutationStatus, lastClickedFavoriteId, deleteFavorite, addFavorite } = context;
|
|
970
|
+
const isLastClickedFavorite = lastClickedFavoriteId === id;
|
|
971
|
+
const isFavorited = (0, import_react6.useMemo)(() => {
|
|
972
|
+
const fav = favorites == null ? void 0 : favorites.find((f) => f.id === id);
|
|
973
|
+
return !!fav;
|
|
974
|
+
}, [favorites, id]);
|
|
975
|
+
const toggleFavorite = () => isFavorited ? deleteFavorite(id) : addFavorite(id);
|
|
976
|
+
const isDisabled = queryStatus === "loading" || queryStatus === "idle" || mutationStatus === "loading";
|
|
977
|
+
let status = "initLoading";
|
|
978
|
+
if (queryStatus === "loading")
|
|
979
|
+
status = "initLoading";
|
|
980
|
+
if (mutationStatus === "loading")
|
|
981
|
+
status = "reloading";
|
|
982
|
+
if (queryStatus === "error" || mutationStatus === "error")
|
|
983
|
+
status = "error";
|
|
984
|
+
if (queryStatus === "success" && (mutationStatus === "success" || mutationStatus === "idle"))
|
|
985
|
+
status = "success";
|
|
986
|
+
return {
|
|
987
|
+
isFavorited,
|
|
988
|
+
status,
|
|
989
|
+
isLastClickedFavorite,
|
|
990
|
+
toggleFavorite: isDisabled ? noOp : toggleFavorite
|
|
991
|
+
};
|
|
992
|
+
};
|
|
993
|
+
|
|
994
|
+
// ../tooltip/src/lib/Tooltip.tsx
|
|
995
|
+
var import_Tooltip = __toESM(require("@mui/material/Tooltip"));
|
|
996
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
997
|
+
var Tooltip = (props) => {
|
|
998
|
+
const _a = props, { children, dangerouslySetTransitionTimer } = _a, rest = __objRest(_a, ["children", "dangerouslySetTransitionTimer"]);
|
|
999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1000
|
+
import_Tooltip.default,
|
|
1001
|
+
__spreadProps(__spreadValues({}, rest), {
|
|
1002
|
+
TransitionProps: { timeout: dangerouslySetTransitionTimer !== void 0 ? dangerouslySetTransitionTimer : 100 },
|
|
1003
|
+
arrow: true,
|
|
1004
|
+
children
|
|
1005
|
+
})
|
|
1006
|
+
);
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
// ../favorites/src/lib/FavoriteHeart.tsx
|
|
1010
|
+
var import_mui_icon3 = require("@availity/mui-icon");
|
|
1011
|
+
var import_styles2 = require("@mui/material/styles");
|
|
1012
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1013
|
+
var icons = {
|
|
1014
|
+
spinner: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CircularProgress, { "aria-hidden": true, size: "small", loadingCaption: false }),
|
|
1015
|
+
unknownDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_mui_icon3.HeartIcon, { "aria-hidden": true, color: "disabled" }),
|
|
1016
|
+
favoritedDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_mui_icon3.HeartIcon, { "aria-hidden": true, color: "error", opacity: "0.6" }),
|
|
1017
|
+
unfavoritedDisabledHeart: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_mui_icon3.HeartEmptyIcon, { "aria-hidden": true, color: "disabled", opacity: "0.6" }),
|
|
1018
|
+
favoritedHeart: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_mui_icon3.HeartIcon, { "aria-hidden": true, color: "error" }),
|
|
1019
|
+
unfavoritedHeart: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_mui_icon3.HeartEmptyIcon, { "aria-hidden": true, color: "secondary" })
|
|
1020
|
+
};
|
|
1021
|
+
var FavoriteHeartContainer = (0, import_styles2.styled)("div", { name: "AvFavoriteHeart", slot: "root" })({});
|
|
1022
|
+
var FavoriteInput = (0, import_styles2.styled)("input", {
|
|
1023
|
+
name: "AvFavoriteHeart",
|
|
1024
|
+
slot: "input"
|
|
1025
|
+
})({});
|
|
1026
|
+
var FavoriteIcon = (0, import_styles2.styled)("div", {
|
|
1027
|
+
name: "AvFavoriteHeart",
|
|
1028
|
+
slot: "icon"
|
|
1029
|
+
})({});
|
|
1030
|
+
var FavoriteHeart = ({
|
|
1031
|
+
id,
|
|
1032
|
+
name,
|
|
1033
|
+
onChange,
|
|
1034
|
+
onMouseDown,
|
|
1035
|
+
disabled = false
|
|
1036
|
+
}) => {
|
|
1037
|
+
const { isFavorited, isLastClickedFavorite, status, toggleFavorite } = useFavorites(id);
|
|
1038
|
+
const handleChange = (event) => {
|
|
1039
|
+
onChange == null ? void 0 : onChange(isFavorited, event);
|
|
1040
|
+
toggleFavorite();
|
|
1041
|
+
};
|
|
1042
|
+
const handleKeyPress = (event) => {
|
|
1043
|
+
if (event.code === "Enter" || event.key === "Enter") {
|
|
1044
|
+
onChange == null ? void 0 : onChange(isFavorited, event);
|
|
1045
|
+
toggleFavorite();
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
const iconKey = (() => {
|
|
1049
|
+
if (status === "initLoading")
|
|
1050
|
+
return "unknownDisabledHeart";
|
|
1051
|
+
if (status === "reloading") {
|
|
1052
|
+
if (isLastClickedFavorite)
|
|
1053
|
+
return "spinner";
|
|
1054
|
+
return isFavorited ? "favoritedDisabledHeart" : "unfavoritedDisabledHeart";
|
|
1055
|
+
}
|
|
1056
|
+
if (disabled) {
|
|
1057
|
+
return isFavorited ? "favoritedDisabledHeart" : "unfavoritedDisabledHeart";
|
|
1058
|
+
}
|
|
1059
|
+
if (isFavorited)
|
|
1060
|
+
return "favoritedHeart";
|
|
1061
|
+
return "unfavoritedHeart";
|
|
1062
|
+
})();
|
|
1063
|
+
const cursor = disabled || !isLastClickedFavorite && (status === "initLoading" || status === "reloading") ? "not-allowed" : void 0;
|
|
1064
|
+
const tooltipContent = `${isFavorited ? "Remove from" : "Add to"} My Favorites`;
|
|
1065
|
+
const favoriteInputProps = {
|
|
1066
|
+
onKeyDown: handleKeyPress,
|
|
1067
|
+
type: "checkbox",
|
|
1068
|
+
"aria-label": `Favorite ${name}`,
|
|
1069
|
+
id: `av-favorite-heart-${id}`,
|
|
1070
|
+
disabled,
|
|
1071
|
+
checked: isFavorited,
|
|
1072
|
+
onChange: handleChange,
|
|
1073
|
+
onMouseDown,
|
|
1074
|
+
style: { cursor }
|
|
1075
|
+
};
|
|
1076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(FavoriteHeartContainer, { children: [
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FavoriteIcon, { children: icons[iconKey] }),
|
|
1078
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1079
|
+
"span",
|
|
1080
|
+
{
|
|
1081
|
+
style: {
|
|
1082
|
+
position: "absolute",
|
|
1083
|
+
width: "1px",
|
|
1084
|
+
height: "1px",
|
|
1085
|
+
padding: 0,
|
|
1086
|
+
margin: "-1px",
|
|
1087
|
+
overflow: "hidden",
|
|
1088
|
+
clip: "rect(0,0,0,0)",
|
|
1089
|
+
whiteSpace: "nowrap",
|
|
1090
|
+
border: 0
|
|
1091
|
+
},
|
|
1092
|
+
"aria-live": isLastClickedFavorite && (status === "reloading" || status === "error") ? "polite" : "off",
|
|
1093
|
+
children: isLastClickedFavorite && status === "reloading" ? "Loading..." : isLastClickedFavorite && status === "error" ? "An error has occurred. Please try again." : ""
|
|
1094
|
+
}
|
|
1095
|
+
),
|
|
1096
|
+
disabled ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FavoriteInput, __spreadValues({}, favoriteInputProps)) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Tooltip, { title: tooltipContent, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FavoriteInput, __spreadValues({}, favoriteInputProps)) })
|
|
1097
|
+
] });
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
// src/lib/SpacesLink/SpacesLink.tsx
|
|
1101
|
+
var import_mui_layout2 = require("@availity/mui-layout");
|
|
1102
|
+
|
|
1103
|
+
// ../list/src/lib/List.tsx
|
|
1104
|
+
var import_List = __toESM(require("@mui/material/List"));
|
|
1105
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1106
|
+
|
|
1107
|
+
// ../list/src/lib/ListItem.tsx
|
|
1108
|
+
var import_ListItem = __toESM(require("@mui/material/ListItem"));
|
|
1109
|
+
var import_react7 = require("react");
|
|
1110
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1111
|
+
var ListItem = (0, import_react7.forwardRef)((props, ref) => {
|
|
1112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_ListItem.default, __spreadProps(__spreadValues({}, props), { ref }));
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
// ../list/src/lib/ListItemAvatar.tsx
|
|
1116
|
+
var import_ListItemAvatar = __toESM(require("@mui/material/ListItemAvatar"));
|
|
1117
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1118
|
+
|
|
1119
|
+
// ../list/src/lib/ListItemButton.tsx
|
|
1120
|
+
var import_ListItemButton = __toESM(require("@mui/material/ListItemButton"));
|
|
1121
|
+
var import_react8 = require("react");
|
|
1122
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1123
|
+
var ListItemButton = (0, import_react8.forwardRef)((props, ref) => {
|
|
1124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_ListItemButton.default, __spreadProps(__spreadValues({}, props), { ref }));
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
// ../list/src/lib/ListItemIcon.tsx
|
|
1128
|
+
var import_ListItemIcon = __toESM(require("@mui/material/ListItemIcon"));
|
|
1129
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1130
|
+
|
|
1131
|
+
// ../list/src/lib/ListItemStatusCard.tsx
|
|
1132
|
+
var import_react9 = require("react");
|
|
1133
|
+
var import_styles3 = require("@mui/material/styles");
|
|
1134
|
+
var import_ListItem2 = __toESM(require("@mui/material/ListItem"));
|
|
1135
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1136
|
+
var ListItemStatusCardSlot = (0, import_styles3.styled)(import_ListItem2.default, {
|
|
1137
|
+
name: "AvListItemStatusCard",
|
|
1138
|
+
slot: "root",
|
|
1139
|
+
overridesResolver: (props, styles) => [styles.root, props.color && styles.color]
|
|
1140
|
+
})(({ theme, ownerState }) => __spreadValues({
|
|
1141
|
+
backgroundColor: theme.palette.background.paper,
|
|
1142
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
1143
|
+
borderRadius: "4px",
|
|
1144
|
+
marginBottom: "4px",
|
|
1145
|
+
paddingLeft: "8px",
|
|
1146
|
+
"&.MuiListItem-padding.MuiListItem-gutters": {
|
|
1147
|
+
paddingLeft: "calc(16px + 8px)"
|
|
1148
|
+
}
|
|
1149
|
+
}, ownerState.color && ownerState.color !== "default" && {
|
|
1150
|
+
".AvListItemStatusCard-statusAccent": {
|
|
1151
|
+
backgroundColor: `${theme.palette[ownerState.color].main}`
|
|
1152
|
+
}
|
|
1153
|
+
}));
|
|
1154
|
+
var StatusAccent = (0, import_styles3.styled)("div", {
|
|
1155
|
+
name: "AvListItemStatusCard",
|
|
1156
|
+
slot: "statusAccent",
|
|
1157
|
+
overridesResolver: (props, styles) => [styles.statusAccent, props.color && styles.color]
|
|
1158
|
+
})(({ theme }) => ({
|
|
1159
|
+
position: "absolute",
|
|
1160
|
+
left: 0,
|
|
1161
|
+
top: 0,
|
|
1162
|
+
height: "100%",
|
|
1163
|
+
width: "8px",
|
|
1164
|
+
backgroundColor: theme.palette.divider,
|
|
1165
|
+
backgroundClip: "border-box",
|
|
1166
|
+
borderTopLeftRadius: "3px",
|
|
1167
|
+
borderBottomLeftRadius: "3px",
|
|
1168
|
+
content: "''"
|
|
1169
|
+
}));
|
|
1170
|
+
var ListItemStatusCard = (0, import_react9.forwardRef)((props, ref) => {
|
|
1171
|
+
const _a = props, { alignItems = "flex-start", children, color } = _a, rest = __objRest(_a, ["alignItems", "children", "color"]);
|
|
1172
|
+
const themeProps = (0, import_styles3.useThemeProps)({ props, name: "AvListItemStatusCard" });
|
|
1173
|
+
const ownerState = __spreadProps(__spreadValues({}, themeProps), { color });
|
|
1174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(ListItemStatusCardSlot, __spreadProps(__spreadValues({ alignItems, divider: false, ownerState }, rest), { ref, children: [
|
|
1175
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StatusAccent, { className: "AvListItemStatusCard-statusAccent" }),
|
|
1176
|
+
children
|
|
1177
|
+
] }));
|
|
1178
|
+
});
|
|
1179
|
+
|
|
1180
|
+
// ../list/src/lib/ListItemText.tsx
|
|
1181
|
+
var import_ListItemText = __toESM(require("@mui/material/ListItemText"));
|
|
1182
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1183
|
+
var ListItemText = (_a) => {
|
|
1184
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
1185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_ListItemText.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
// ../list/src/lib/ListSubheader.tsx
|
|
1189
|
+
var import_ListSubheader = __toESM(require("@mui/material/ListSubheader"));
|
|
1190
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1191
|
+
|
|
1192
|
+
// src/lib/SpacesLink/SpacesLink.tsx
|
|
1193
|
+
var import_react_markdown2 = __toESM(require("react-markdown"));
|
|
1194
|
+
|
|
1195
|
+
// src/lib/SpacesLink/useLink.tsx
|
|
1196
|
+
var import_hooks = require("@availity/hooks");
|
|
1197
|
+
|
|
1198
|
+
// src/lib/SpacesLink/linkHandlers.tsx
|
|
1199
|
+
var import_native_form = __toESM(require("@availity/native-form"));
|
|
1200
|
+
var import_resolve_url2 = require("@availity/resolve-url");
|
|
1201
|
+
var openLink = (space, params) => __async(void 0, null, function* () {
|
|
1202
|
+
var _a, _b, _c;
|
|
1203
|
+
if (!((_a = space == null ? void 0 : space.link) == null ? void 0 : _a.url)) {
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
if (params == null ? void 0 : params.akaname)
|
|
1207
|
+
yield updateTopApps(space, params.akaname);
|
|
1208
|
+
const url = !(0, import_resolve_url2.isAbsoluteUrl)(space.link.url) ? getUrl(updateUrl(space.link.url, "spaceId", (params == null ? void 0 : params.payerSpaceId) || ((_c = (_b = space.parents) == null ? void 0 : _b[0]) == null ? void 0 : _c.id)), false, false) : space.link.url;
|
|
1209
|
+
const target = getTarget(space.link.target);
|
|
1210
|
+
window.open(url, target);
|
|
1211
|
+
});
|
|
1212
|
+
var openLinkWithSso = (_0, _1) => __async(void 0, [_0, _1], function* (space, { akaname, clientId, payerSpaceId, ssoParams }) {
|
|
1213
|
+
var _a;
|
|
1214
|
+
if (space.meta && space.meta.ssoId) {
|
|
1215
|
+
const options = ((_a = space.link) == null ? void 0 : _a.target) ? { target: getTarget(space.link.target) } : void 0;
|
|
1216
|
+
const attributes = __spreadValues({
|
|
1217
|
+
X_Client_ID: clientId,
|
|
1218
|
+
X_XSRF_TOKEN: document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, "$1"),
|
|
1219
|
+
spaceId: payerSpaceId
|
|
1220
|
+
}, ssoParams);
|
|
1221
|
+
try {
|
|
1222
|
+
if (akaname)
|
|
1223
|
+
yield updateTopApps(space, akaname);
|
|
1224
|
+
yield (0, import_native_form.default)(space.meta.ssoId, attributes, options, space.type);
|
|
1225
|
+
} catch (e) {
|
|
1226
|
+
console.warn("Something went wrong");
|
|
1227
|
+
}
|
|
1228
|
+
return false;
|
|
1229
|
+
}
|
|
1230
|
+
return false;
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
// src/lib/SpacesLink/useLink.tsx
|
|
1234
|
+
var isSsoSpace = (space) => (space == null ? void 0 : space.type) === "saml" || (space == null ? void 0 : space.type) === "openid";
|
|
1235
|
+
var useLink = (spaceOrSpaceId, options) => {
|
|
1236
|
+
var _a, _b, _c, _d;
|
|
1237
|
+
const spaceFromSpacesProvider = useSpaces(
|
|
1238
|
+
(typeof spaceOrSpaceId === "string" ? spaceOrSpaceId : spaceOrSpaceId == null ? void 0 : spaceOrSpaceId.id) || ""
|
|
1239
|
+
);
|
|
1240
|
+
const { data: user } = (0, import_hooks.useCurrentUser)();
|
|
1241
|
+
const openModal = useModal();
|
|
1242
|
+
const space = spaceFromSpacesProvider == null ? void 0 : spaceFromSpacesProvider[0];
|
|
1243
|
+
const parentPayerSpaces = (_a = space == null ? void 0 : space.parents) == null ? void 0 : _a.filter(
|
|
1244
|
+
(p) => p.type && (p.type.toLowerCase() === "space" || p.type.toLowerCase() === "payerspace")
|
|
1245
|
+
);
|
|
1246
|
+
const legacySso = () => {
|
|
1247
|
+
var _a2;
|
|
1248
|
+
if (space && ((_a2 = space.meta) == null ? void 0 : _a2.disclaimerId) && space.link) {
|
|
1249
|
+
openModal("DISCLAIMER_MODAL", {
|
|
1250
|
+
disclaimerId: space.meta.disclaimerId,
|
|
1251
|
+
name: space.name,
|
|
1252
|
+
spaceType: space.type,
|
|
1253
|
+
id: space.configurationId,
|
|
1254
|
+
title: space.name,
|
|
1255
|
+
description: space.description,
|
|
1256
|
+
link: space.link,
|
|
1257
|
+
user: user == null ? void 0 : user.akaname
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
const openMultiPayerModal = () => {
|
|
1262
|
+
if (space && space.link)
|
|
1263
|
+
openModal("MULTI_PAYER_MODAL", {
|
|
1264
|
+
title: "Open Link as Payer",
|
|
1265
|
+
name: space == null ? void 0 : space.name,
|
|
1266
|
+
parentPayerSpaces,
|
|
1267
|
+
link: space == null ? void 0 : space.link,
|
|
1268
|
+
id: space == null ? void 0 : space.configurationId,
|
|
1269
|
+
spaceType: space == null ? void 0 : space.type,
|
|
1270
|
+
metadata: space == null ? void 0 : space.meta,
|
|
1271
|
+
user: user == null ? void 0 : user.akaname
|
|
1272
|
+
});
|
|
1273
|
+
};
|
|
1274
|
+
const mediaProps = {
|
|
1275
|
+
role: "link"
|
|
1276
|
+
};
|
|
1277
|
+
if (isSsoSpace(space) && ((_b = space == null ? void 0 : space.meta) == null ? void 0 : _b.ssoId)) {
|
|
1278
|
+
if (!(options == null ? void 0 : options.clientId)) {
|
|
1279
|
+
throw new Error("clientId is required for SSO spaces");
|
|
1280
|
+
}
|
|
1281
|
+
if (!options.linkAttributes) {
|
|
1282
|
+
throw new Error("linkAttributes are required for SSO spaces");
|
|
1283
|
+
}
|
|
1284
|
+
mediaProps.onClick = (event) => {
|
|
1285
|
+
event.preventDefault();
|
|
1286
|
+
if (options.clientId && options.linkAttributes) {
|
|
1287
|
+
openLinkWithSso(space, {
|
|
1288
|
+
akaname: user == null ? void 0 : user.akaname,
|
|
1289
|
+
clientId: options.clientId,
|
|
1290
|
+
payerSpaceId: options.linkAttributes.spaceId,
|
|
1291
|
+
ssoParams: options.linkAttributes
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
mediaProps.onKeyDown = (event) => {
|
|
1296
|
+
if (event.key === "Enter") {
|
|
1297
|
+
event.preventDefault();
|
|
1298
|
+
if (options.clientId && options.linkAttributes) {
|
|
1299
|
+
openLinkWithSso(space, {
|
|
1300
|
+
akaname: user == null ? void 0 : user.akaname,
|
|
1301
|
+
clientId: options.clientId,
|
|
1302
|
+
payerSpaceId: options.linkAttributes.spaceId,
|
|
1303
|
+
ssoParams: options.linkAttributes
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
};
|
|
1308
|
+
} else if ((_c = space == null ? void 0 : space.meta) == null ? void 0 : _c.disclaimerId) {
|
|
1309
|
+
mediaProps.onClick = legacySso;
|
|
1310
|
+
mediaProps.onKeyDown = (event) => {
|
|
1311
|
+
if (event.key === "Enter")
|
|
1312
|
+
return legacySso();
|
|
1313
|
+
};
|
|
1314
|
+
} else if (parentPayerSpaces && parentPayerSpaces.length > 1 && !((_d = options == null ? void 0 : options.linkAttributes) == null ? void 0 : _d.spaceId)) {
|
|
1315
|
+
mediaProps.onClick = openMultiPayerModal;
|
|
1316
|
+
mediaProps.onKeyDown = (event) => {
|
|
1317
|
+
if (event.key === "Enter")
|
|
1318
|
+
return openMultiPayerModal();
|
|
1319
|
+
};
|
|
1320
|
+
} else {
|
|
1321
|
+
mediaProps.onClick = () => {
|
|
1322
|
+
var _a2;
|
|
1323
|
+
if (space)
|
|
1324
|
+
return openLink(space, { akaname: user == null ? void 0 : user.akaname, payerSpaceId: (_a2 = options == null ? void 0 : options.linkAttributes) == null ? void 0 : _a2.spaceId });
|
|
1325
|
+
};
|
|
1326
|
+
mediaProps.onKeyDown = (event) => {
|
|
1327
|
+
var _a2;
|
|
1328
|
+
if (event.key === "Enter" && space)
|
|
1329
|
+
return openLink(space, { akaname: user == null ? void 0 : user.akaname, payerSpaceId: (_a2 = options == null ? void 0 : options.linkAttributes) == null ? void 0 : _a2.spaceId });
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
return [space, mediaProps];
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
// src/lib/SpacesLink/SpacesLink.tsx
|
|
1336
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1337
|
+
var getDisplayDate = (date) => (0, import_dayjs2.default)(date).format("MM/DD/YYYY");
|
|
1338
|
+
var getContainerTag = (propTag, variant) => {
|
|
1339
|
+
if (variant && variant !== "default")
|
|
1340
|
+
return { card: Card, list: ListItem }[variant];
|
|
1341
|
+
return propTag || "div";
|
|
1342
|
+
};
|
|
1343
|
+
var getBodyTag = (propTag, variant) => {
|
|
1344
|
+
if (variant && variant !== "default")
|
|
1345
|
+
return { card: CardContent, list: "div" }[variant];
|
|
1346
|
+
return propTag || "div";
|
|
1347
|
+
};
|
|
1348
|
+
var getTitleTag = (propTag, variant) => {
|
|
1349
|
+
if (variant && variant !== "default")
|
|
1350
|
+
return { card: CardHeader, list: import_mui_typography3.Typography }[variant];
|
|
1351
|
+
return propTag || "div";
|
|
1352
|
+
};
|
|
1353
|
+
var getTextTag = (propTag, variant) => {
|
|
1354
|
+
if (variant && variant !== "default")
|
|
1355
|
+
return { card: import_mui_typography3.Typography, list: ListItemText }[variant];
|
|
1356
|
+
return propTag || "div";
|
|
1357
|
+
};
|
|
1358
|
+
var SpacesLink = (_a) => {
|
|
1359
|
+
var _b = _a, {
|
|
1360
|
+
spaceId,
|
|
1361
|
+
space: propSpace,
|
|
1362
|
+
className,
|
|
1363
|
+
children,
|
|
1364
|
+
favorite,
|
|
1365
|
+
icon,
|
|
1366
|
+
showName = true,
|
|
1367
|
+
showNew,
|
|
1368
|
+
showDate,
|
|
1369
|
+
stacked,
|
|
1370
|
+
body = true,
|
|
1371
|
+
description: showDescription,
|
|
1372
|
+
tag,
|
|
1373
|
+
bodyTag,
|
|
1374
|
+
titleTag,
|
|
1375
|
+
textTag,
|
|
1376
|
+
titleClassName,
|
|
1377
|
+
variant = "default",
|
|
1378
|
+
loading: propsLoading,
|
|
1379
|
+
clientId: propsClientId,
|
|
1380
|
+
maxDescriptionWidth,
|
|
1381
|
+
style,
|
|
1382
|
+
linkAttributes,
|
|
1383
|
+
role,
|
|
1384
|
+
analytics,
|
|
1385
|
+
customBadgeText,
|
|
1386
|
+
customBadgeColor,
|
|
1387
|
+
idPrefix = ""
|
|
1388
|
+
} = _b, rest = __objRest(_b, [
|
|
1389
|
+
"spaceId",
|
|
1390
|
+
"space",
|
|
1391
|
+
"className",
|
|
1392
|
+
"children",
|
|
1393
|
+
"favorite",
|
|
1394
|
+
"icon",
|
|
1395
|
+
"showName",
|
|
1396
|
+
"showNew",
|
|
1397
|
+
"showDate",
|
|
1398
|
+
"stacked",
|
|
1399
|
+
"body",
|
|
1400
|
+
"description",
|
|
1401
|
+
"tag",
|
|
1402
|
+
"bodyTag",
|
|
1403
|
+
"titleTag",
|
|
1404
|
+
"textTag",
|
|
1405
|
+
"titleClassName",
|
|
1406
|
+
"variant",
|
|
1407
|
+
"loading",
|
|
1408
|
+
"clientId",
|
|
1409
|
+
"maxDescriptionWidth",
|
|
1410
|
+
"style",
|
|
1411
|
+
"linkAttributes",
|
|
1412
|
+
"role",
|
|
1413
|
+
"analytics",
|
|
1414
|
+
"customBadgeText",
|
|
1415
|
+
"customBadgeColor",
|
|
1416
|
+
"idPrefix"
|
|
1417
|
+
]);
|
|
1418
|
+
var _a2, _b2;
|
|
1419
|
+
const { loading } = useSpacesContext();
|
|
1420
|
+
const isLoading = loading || propsLoading;
|
|
1421
|
+
const [linkSpace, props] = useLink(propSpace || spaceId, { clientId: propsClientId, linkAttributes });
|
|
1422
|
+
const showUrl = !(linkSpace == null ? void 0 : linkSpace.isGhosted) && ((_a2 = linkSpace == null ? void 0 : linkSpace.link) == null ? void 0 : _a2.url);
|
|
1423
|
+
const favoriteIcon = (0, import_react10.useMemo)(
|
|
1424
|
+
() => (linkSpace == null ? void 0 : linkSpace.configurationId) && favorite && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1425
|
+
FavoriteHeart,
|
|
1426
|
+
{
|
|
1427
|
+
id: `${idPrefix}${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1428
|
+
name: linkSpace == null ? void 0 : linkSpace.name,
|
|
1429
|
+
onChange: (_, e) => e.stopPropagation()
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
[favorite, linkSpace == null ? void 0 : linkSpace.configurationId, linkSpace == null ? void 0 : linkSpace.name, idPrefix]
|
|
1433
|
+
);
|
|
1434
|
+
const dateInfo = (0, import_react10.useMemo)(
|
|
1435
|
+
() => (showNew || showDate) && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_mui_layout2.Grid, { textAlign: stacked ? "center" : "inherit", children: [
|
|
1436
|
+
showNew && (linkSpace == null ? void 0 : linkSpace.isNew) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Chip, { id: `${idPrefix}app-new-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}`, label: "New!" }),
|
|
1437
|
+
showDate && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1438
|
+
import_mui_typography3.Typography,
|
|
1439
|
+
{
|
|
1440
|
+
id: `${idPrefix}app-date-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1441
|
+
variant: "caption",
|
|
1442
|
+
color: "textSecondary",
|
|
1443
|
+
children: getDisplayDate(linkSpace == null ? void 0 : linkSpace.activeDate)
|
|
1444
|
+
}
|
|
1445
|
+
)
|
|
1446
|
+
] }),
|
|
1447
|
+
[linkSpace == null ? void 0 : linkSpace.activeDate, linkSpace == null ? void 0 : linkSpace.isNew, showDate, showNew, stacked, linkSpace == null ? void 0 : linkSpace.configurationId, idPrefix]
|
|
1448
|
+
);
|
|
1449
|
+
const customBadgeDisplay = (0, import_react10.useMemo)(
|
|
1450
|
+
() => customBadgeText && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1451
|
+
import_mui_layout2.Box,
|
|
1452
|
+
{
|
|
1453
|
+
textAlign: stacked ? "center" : "inherit",
|
|
1454
|
+
marginRight: variant !== "card" && (showDate || showNew && (linkSpace == null ? void 0 : linkSpace.isNew)) ? 2 : void 0,
|
|
1455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1456
|
+
StatusChip,
|
|
1457
|
+
{
|
|
1458
|
+
color: customBadgeColor || "info",
|
|
1459
|
+
id: `${idPrefix}app-custom-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}-${customBadgeText}`,
|
|
1460
|
+
label: customBadgeText
|
|
1461
|
+
}
|
|
1462
|
+
)
|
|
1463
|
+
}
|
|
1464
|
+
),
|
|
1465
|
+
[
|
|
1466
|
+
customBadgeColor,
|
|
1467
|
+
customBadgeText,
|
|
1468
|
+
showDate,
|
|
1469
|
+
showNew,
|
|
1470
|
+
stacked,
|
|
1471
|
+
variant,
|
|
1472
|
+
linkSpace == null ? void 0 : linkSpace.isNew,
|
|
1473
|
+
idPrefix,
|
|
1474
|
+
linkSpace == null ? void 0 : linkSpace.configurationId
|
|
1475
|
+
]
|
|
1476
|
+
);
|
|
1477
|
+
if (isLoading) {
|
|
1478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CircularProgress, __spreadValues({ id: `${idPrefix}app-${linkSpace == null ? void 0 : linkSpace.configurationId}-loading` }, rest));
|
|
1479
|
+
}
|
|
1480
|
+
const Tag = getContainerTag(tag, variant);
|
|
1481
|
+
const BodyTag = getBodyTag(bodyTag, variant);
|
|
1482
|
+
const TitleTag = getTitleTag(titleTag, variant);
|
|
1483
|
+
const TextTag = getTextTag(textTag, variant);
|
|
1484
|
+
const renderChildren = () => {
|
|
1485
|
+
if (children) {
|
|
1486
|
+
return isFunction(children) ? (() => children(__spreadValues(__spreadValues(__spreadValues({}, linkSpace), analytics), props)))() : (0, import_react10.cloneElement)(children, __spreadValues(__spreadValues({
|
|
1487
|
+
role: "link",
|
|
1488
|
+
tabIndex: 0,
|
|
1489
|
+
style: { cursor: showUrl ? "pointer" : "not-allowed" },
|
|
1490
|
+
"aria-label": linkSpace == null ? void 0 : linkSpace.name
|
|
1491
|
+
}, analytics), props));
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1495
|
+
Tag,
|
|
1496
|
+
__spreadProps(__spreadValues({
|
|
1497
|
+
title: linkSpace == null ? void 0 : linkSpace.name,
|
|
1498
|
+
className
|
|
1499
|
+
}, rest), {
|
|
1500
|
+
style: __spreadValues({}, style),
|
|
1501
|
+
role: variant === "list" ? "listitem" : role,
|
|
1502
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(BodyTag, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_mui_layout2.Grid, { alignItems: !showDescription || stacked ? "center" : "start", direction: stacked ? "column" : "row", children: [
|
|
1503
|
+
!stacked && favoriteIcon,
|
|
1504
|
+
icon && (linkSpace == null ? void 0 : linkSpace.url) && ((_b2 = linkSpace == null ? void 0 : linkSpace.type) == null ? void 0 : _b2.toUpperCase()) === "FILE" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Link, { target: "_blank", href: linkSpace == null ? void 0 : linkSpace.url, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_mui_icon4.FileIcon, { "data-testid": "icon" }) }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_mui_icon4.NavigateTopIcon, { "data-testid": "icon" }),
|
|
1505
|
+
children ? renderChildren() : body && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_mui_layout2.Grid, { id: `${idPrefix}${linkSpace == null ? void 0 : linkSpace.type}-${linkSpace == null ? void 0 : linkSpace.configurationId}`, children: [
|
|
1506
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1507
|
+
import_mui_layout2.Box,
|
|
1508
|
+
{
|
|
1509
|
+
marginBottom: !customBadgeDisplay && (!showDescription || !(linkSpace == null ? void 0 : linkSpace.description)) ? 0 : void 0,
|
|
1510
|
+
paddingTop: stacked ? 3 : void 0,
|
|
1511
|
+
textAlign: stacked ? "center" : void 0,
|
|
1512
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1513
|
+
TitleTag,
|
|
1514
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
1515
|
+
id: `${idPrefix}app-title-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1516
|
+
className: titleClassName,
|
|
1517
|
+
tabIndex: 0,
|
|
1518
|
+
style: {
|
|
1519
|
+
cursor: showUrl ? "pointer" : "not-allowed"
|
|
1520
|
+
}
|
|
1521
|
+
}, analytics), props), {
|
|
1522
|
+
role: showUrl ? "link" : role,
|
|
1523
|
+
"aria-label": linkSpace == null ? void 0 : linkSpace.name,
|
|
1524
|
+
"aria-describedby": showNew && (linkSpace == null ? void 0 : linkSpace.isNew) ? `${idPrefix}app-new-badge-${linkSpace == null ? void 0 : linkSpace.configurationId}` : void 0,
|
|
1525
|
+
variant: variant === "list" ? "h5" : "h6",
|
|
1526
|
+
title: showName ? linkSpace == null ? void 0 : linkSpace.name : void 0,
|
|
1527
|
+
children: showName ? linkSpace == null ? void 0 : linkSpace.name : void 0
|
|
1528
|
+
})
|
|
1529
|
+
)
|
|
1530
|
+
}
|
|
1531
|
+
),
|
|
1532
|
+
stacked && dateInfo,
|
|
1533
|
+
showDescription && (linkSpace == null ? void 0 : linkSpace.description) && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1534
|
+
TextTag,
|
|
1535
|
+
{
|
|
1536
|
+
marginTop: 1,
|
|
1537
|
+
textAlign: stacked ? "center" : void 0,
|
|
1538
|
+
overflow: "hidden",
|
|
1539
|
+
whiteSpace: maxDescriptionWidth ? "nowrap" : void 0,
|
|
1540
|
+
width: maxDescriptionWidth,
|
|
1541
|
+
textOverflow: "ellipsis",
|
|
1542
|
+
id: `${idPrefix}app-description-${linkSpace == null ? void 0 : linkSpace.configurationId}`,
|
|
1543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_markdown2.default, { className: "Card-text", children: linkSpace == null ? void 0 : linkSpace.description })
|
|
1544
|
+
}
|
|
1545
|
+
),
|
|
1546
|
+
variant === "card" && customBadgeDisplay
|
|
1547
|
+
] }),
|
|
1548
|
+
variant !== "card" && customBadgeDisplay,
|
|
1549
|
+
!stacked && dateInfo
|
|
1550
|
+
] }) })
|
|
1551
|
+
})
|
|
1552
|
+
);
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
// src/lib/SpacesAgreement.tsx
|
|
1556
|
+
var import_mui_typography4 = require("@availity/mui-typography");
|
|
1557
|
+
var import_react_markdown3 = __toESM(require("react-markdown"));
|
|
1558
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1559
|
+
var SpacesAgreement = ({ spaceId, markdown = false, id: elementId }) => {
|
|
1560
|
+
const spaces = useSpaces(spaceId);
|
|
1561
|
+
if (spaces && spaces.length > 0) {
|
|
1562
|
+
const { description: agreement, id } = spaces[0];
|
|
1563
|
+
if (agreement) {
|
|
1564
|
+
const children = markdown ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_markdown3.default, { children: agreement }) : agreement;
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_mui_typography4.Typography, { variant: "agreement", id: elementId || `spaces-agreement-${spaceId || id}`, children });
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return null;
|
|
1569
|
+
};
|
|
1570
|
+
|
|
1571
|
+
// src/lib/SpacesDisclaimer.tsx
|
|
1572
|
+
var import_mui_disclaimer = require("@availity/mui-disclaimer");
|
|
1573
|
+
var import_react_markdown4 = __toESM(require("react-markdown"));
|
|
1574
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1575
|
+
var SpacesDisclaimer = (_a) => {
|
|
1576
|
+
var _b = _a, {
|
|
1577
|
+
accent = true,
|
|
1578
|
+
spaceId,
|
|
1579
|
+
markdown = false,
|
|
1580
|
+
id: elementId
|
|
1581
|
+
} = _b, props = __objRest(_b, [
|
|
1582
|
+
"accent",
|
|
1583
|
+
"spaceId",
|
|
1584
|
+
"markdown",
|
|
1585
|
+
"id"
|
|
1586
|
+
]);
|
|
1587
|
+
const spaces = useSpaces(spaceId);
|
|
1588
|
+
if (spaces && spaces.length > 0) {
|
|
1589
|
+
const { description: disclaimer, id } = spaces[0];
|
|
1590
|
+
if (disclaimer) {
|
|
1591
|
+
const children = markdown ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_markdown4.default, { children: disclaimer }) : disclaimer;
|
|
1592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1593
|
+
import_mui_disclaimer.Disclaimer,
|
|
1594
|
+
__spreadValues({
|
|
1595
|
+
accent,
|
|
1596
|
+
id: elementId || `spaces-disclaimer-${spaceId || id}`,
|
|
1597
|
+
description: children
|
|
1598
|
+
}, props)
|
|
1599
|
+
);
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
return null;
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
// src/lib/SpacesGhostText.tsx
|
|
1606
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1607
|
+
var SpacesGhostText = (_a) => {
|
|
1608
|
+
var _b = _a, { spaceId, id } = _b, props = __objRest(_b, ["spaceId", "id"]);
|
|
1609
|
+
var _a2;
|
|
1610
|
+
const spaces = useSpaces(spaceId);
|
|
1611
|
+
const space = spaces == null ? void 0 : spaces[0];
|
|
1612
|
+
if (space == null ? void 0 : space.isGhosted) {
|
|
1613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("small", __spreadProps(__spreadValues({ id: id || `app-ghost-text-${spaceId}` }, props), { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("em", { children: (_a2 = space == null ? void 0 : space.meta) == null ? void 0 : _a2.ghostText }) }));
|
|
1614
|
+
}
|
|
1615
|
+
return null;
|
|
1616
|
+
};
|
|
423
1617
|
// Annotate the CommonJS export names for ESM import in node:
|
|
424
1618
|
0 && (module.exports = {
|
|
425
1619
|
INITIAL_STATE,
|
|
426
1620
|
Spaces,
|
|
1621
|
+
SpacesAgreement,
|
|
427
1622
|
SpacesContext,
|
|
1623
|
+
SpacesDisclaimer,
|
|
1624
|
+
SpacesGhostText,
|
|
1625
|
+
SpacesImage,
|
|
1626
|
+
SpacesLink,
|
|
428
1627
|
useSpaces,
|
|
429
1628
|
useSpacesContext
|
|
430
1629
|
});
|