datastake-daf 0.6.667 → 0.6.669

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.
@@ -8,12 +8,17 @@ var antd = require('antd');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
9
  var PropTypes = require('prop-types');
10
10
  var moment = require('moment');
11
+ var dayjs = require('dayjs');
12
+ var axios = require('axios');
13
+ require('lodash');
11
14
 
12
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
13
16
 
14
17
  var o__default = /*#__PURE__*/_interopDefaultLegacy(o);
15
18
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
16
19
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
20
+ var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
21
+ var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
17
22
 
18
23
  typeof localStorage.getItem('is_collapsed') === 'string' ? localStorage.getItem('is_collapsed') === 'true' ? true : false : true;
19
24
  typeof localStorage.getItem('is_nested_sidebar_collapsed') === 'string' ? localStorage.getItem('is_nested_sidebar_collapsed') === 'true' : true;
@@ -5680,7 +5685,7 @@ const MOBILE_WIDTH$1 = `max-width: ${MOBILE_W$1}px`;
5680
5685
  const TABLET_WIDTH$1 = `max-width: ${TABLET_W$1}px`;
5681
5686
 
5682
5687
  /* eslint-disable react/prop-types */
5683
- const Style$5 = dt.div`
5688
+ const Style$6 = dt.div`
5684
5689
  display: flex;
5685
5690
  cursor: pointer;
5686
5691
 
@@ -5743,7 +5748,7 @@ function UserIcon({
5743
5748
  companyLogo
5744
5749
  }) {
5745
5750
  if (companyLogo) {
5746
- return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
5751
+ return /*#__PURE__*/jsxRuntime.jsx(Style$6, {
5747
5752
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5748
5753
  className: "flex",
5749
5754
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -5761,7 +5766,7 @@ function UserIcon({
5761
5766
  })
5762
5767
  });
5763
5768
  }
5764
- return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
5769
+ return /*#__PURE__*/jsxRuntime.jsx(Style$6, {
5765
5770
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
5766
5771
  className: "flex",
5767
5772
  children: [/*#__PURE__*/jsxRuntime.jsx("div", {
@@ -5778,7 +5783,7 @@ function UserIcon({
5778
5783
  });
5779
5784
  }
5780
5785
 
5781
- const Style$4 = dt.div`
5786
+ const Style$5 = dt.div`
5782
5787
  position: fixed;
5783
5788
  background: rgba(0, 0, 0, 0.4);
5784
5789
  width: 100dvw;
@@ -5978,7 +5983,7 @@ function MobileDrawer({
5978
5983
  }
5979
5984
  });
5980
5985
  };
5981
- return /*#__PURE__*/jsxRuntime.jsx(Style$4, {
5986
+ return /*#__PURE__*/jsxRuntime.jsx(Style$5, {
5982
5987
  className: formatClassname([!drawerOpened && 'closed', isUserDropdown && 'user-dropdown']),
5983
5988
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
5984
5989
  className: "drawer",
@@ -6407,174 +6412,1356 @@ const Notification = ({
6407
6412
  });
6408
6413
  };
6409
6414
 
6410
- /* eslint-disable react/prop-types */
6411
- function NotificationHistory({
6412
- visible,
6413
- setHistoryVisible,
6414
- t = key => key
6415
+ var Style$4 = dt.div`
6416
+ .noti-list {
6417
+ height: 50vh;
6418
+ max-height: 500px;
6419
+ overflow-y: auto;
6420
+ display: flex;
6421
+ flex-direction: column;
6422
+ gap: 40px;
6423
+
6424
+ .loading-all {
6425
+ padding: 8px 0px;
6426
+ text-align: center;
6427
+ }
6428
+
6429
+ .noti-group {
6430
+ h4 {
6431
+ font-size: var(--font-size-lg);
6432
+ font-weight: 600;
6433
+ margin-bottom: var(--size);
6434
+ }
6435
+ }
6436
+
6437
+ .noti {
6438
+ padding: 8px 0px;
6439
+ border-bottom: 1px solid #EAECF0;
6440
+
6441
+ &:last-of-type {
6442
+ border-bottom: 0px;
6443
+ }
6444
+
6445
+ .noti-title {
6446
+ display: flex;
6447
+
6448
+ h5 {
6449
+ font-size: 14px;
6450
+ font-weight: 600;
6451
+ line-height: 20px;
6452
+ flex: 1;
6453
+ }
6454
+
6455
+ span {
6456
+ font-size: 14px;
6457
+ font-weight: 500;
6458
+ line-height: 20px;
6459
+ color: #667085;
6460
+ }
6461
+ }
6462
+
6463
+ p {
6464
+ margin-bottom: 0px;
6465
+ color: #667085;
6466
+ font-weight: 500;
6467
+ font-size: 14px;
6468
+ }
6469
+ }
6470
+ }
6471
+ `;
6472
+
6473
+ function Tags({
6474
+ tags = []
6415
6475
  }) {
6416
- return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
6417
- open: visible,
6418
- onCancel: () => setHistoryVisible(false),
6419
- footer: null,
6420
- title: t('Notification History'),
6421
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6476
+ const mainTags = [...tags].splice(0, 3);
6477
+ const otherTags = [...tags].splice(3, tags.length - 1);
6478
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
6479
+ className: "flex ml-3",
6480
+ children: [mainTags.map((t, i) => /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
6422
6481
  style: {
6423
- padding: '20px'
6482
+ textAlign: 'center'
6424
6483
  },
6425
- children: t('Notification history content will appear here')
6426
- })
6484
+ color: t.color || 'default',
6485
+ children: t.label
6486
+ }, `tag-${i}`)), !!otherTags.length && /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
6487
+ placement: "bottom",
6488
+ title: /*#__PURE__*/jsxRuntime.jsx("div", {
6489
+ children: otherTags.map((t, i) => /*#__PURE__*/jsxRuntime.jsxs(o__default["default"].Fragment, {
6490
+ children: [t.label, i !== otherTags.length - 1 && /*#__PURE__*/jsxRuntime.jsx("br", {})]
6491
+ }, `other-tags-p-${i}`))
6492
+ }),
6493
+ children: /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
6494
+ style: {
6495
+ textAlign: 'center'
6496
+ },
6497
+ children: ["+", otherTags.length]
6498
+ })
6499
+ })]
6427
6500
  });
6428
6501
  }
6429
6502
 
6430
- /* eslint-disable react/prop-types */
6431
- function Notifications({
6432
- mod = 'pme',
6433
- toggle = () => {},
6434
- t = key => key,
6435
- goTo = () => {},
6436
- getRedirectLink = () => {},
6437
- appName = 'app',
6438
- theme = {}
6503
+ function Buttons({
6504
+ actionButtons = [],
6505
+ extraButtons = []
6439
6506
  }) {
6440
- const [historyVisible, setHistoryVisible] = o.useState(false);
6441
- const {
6442
- loading,
6443
- _notifications,
6444
- _fetch,
6445
- total,
6446
- clearAll
6447
- } = useNotificationsContext();
6448
- const items = [{
6449
- key: "details",
6450
- icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6451
- name: "CheckDone",
6452
- width: 13,
6453
- height: 13
6454
- }),
6455
- disabled: !total,
6456
- onClick: () => {
6457
- clearAll();
6458
- toggle();
6459
- },
6460
- label: t('Clear All')
6461
- }, {
6462
- key: "publish",
6463
- icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6464
- name: "NotificationText",
6465
- width: 13,
6466
- height: 13
6467
- }),
6468
- onClick: () => {
6469
- toggle();
6470
- setHistoryVisible(true);
6471
- },
6472
- label: t('View All')
6473
- }, {
6474
- key: "dashboard",
6475
- icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6476
- name: "Settings",
6477
- width: 13,
6478
- height: 13
6479
- }),
6480
- onClick: () => {
6481
- toggle();
6482
- goTo(getRedirectLink(`/app/${mod}/view/settings?activeForm=notifications`));
6483
- },
6484
- label: t('Settings')
6485
- }];
6486
- return /*#__PURE__*/jsxRuntime.jsxs(NotificationsStyle, {
6487
- className: appName,
6488
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
6489
- className: "notis-title",
6490
- children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
6491
- children: t('Notification')
6492
- }), /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
6507
+ const [minWidth, setMinWidth] = o.useState(0);
6508
+ o.useEffect(() => {
6509
+ let _minWidth = minWidth;
6510
+ actionButtons.forEach((_, i) => {
6511
+ const _btn = document.getElementById(`header-btn-${i}`);
6512
+ const _width = parseInt(_btn.offsetWidth);
6513
+ if (_width > _minWidth) {
6514
+ _minWidth = _width;
6515
+ }
6516
+ });
6517
+ setMinWidth(_minWidth);
6518
+ }, [actionButtons]);
6519
+ const renderButtons = (b, i) => {
6520
+ const _button = /*#__PURE__*/jsxRuntime.jsx("div", {
6521
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
6522
+ title: b.tooltip,
6523
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
6524
+ type: b.type,
6525
+ id: `header-btn-${i}`,
6526
+ icon: typeof b.icon === "string" ? /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6527
+ name: b.icon,
6528
+ width: 16,
6529
+ height: 16
6530
+ }) : b.icon,
6531
+ onClick: b.onClick,
6532
+ className: formatClassname([b.noMinWidth && "no-min-width", b.className, b.squareIconButton && "squareIconButton no-min-width", b.icon && "squareIconButton no-min-width"]),
6533
+ disabled: b.disabled,
6534
+ style: {
6535
+ minWidth: b.noMinWidth ? undefined : minWidth ? minWidth : undefined,
6536
+ ...(b?.style || {})
6537
+ },
6538
+ children: b.label
6539
+ })
6540
+ })
6541
+ }, `action-btn-${i}-${b?.key}`);
6542
+ if (b.tooltip) {
6543
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
6544
+ title: b.tooltip,
6545
+ children: _button
6546
+ });
6547
+ }
6548
+ if (b.popConfirm) {
6549
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Popconfirm, {
6550
+ ...b.popConfirm,
6551
+ children: _button
6552
+ });
6553
+ }
6554
+ return _button;
6555
+ };
6556
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
6557
+ className: "buttons-cont",
6558
+ children: [actionButtons.map(renderButtons), !!extraButtons.length && /*#__PURE__*/jsxRuntime.jsx("div", {
6559
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
6493
6560
  menu: {
6494
- items
6561
+ items: extraButtons
6495
6562
  },
6496
6563
  trigger: "click",
6497
- rootClassName: formatClassname(['dark-menu', appName, theme.customHeaderColor && 'custom']),
6498
- children: /*#__PURE__*/jsxRuntime.jsx("div", {
6499
- className: "cursor-pointer",
6500
- children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6501
- name: "MoreCustom",
6502
- width: 3,
6503
- height: 13
6564
+ placement: "bottomRight",
6565
+ children: /*#__PURE__*/jsxRuntime.jsx("a", {
6566
+ onClick: e => e.preventDefault(),
6567
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
6568
+ className: "squareIconButton no-min-width",
6569
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6570
+ name: "More",
6571
+ width: 3,
6572
+ height: 13
6573
+ })
6504
6574
  })
6505
6575
  })
6506
- })]
6507
- }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6508
- className: "notis-list",
6509
- onScroll: e => {
6510
- const _t = e.target;
6511
- const canFetch = _t.scrollTop + _t.clientHeight >= _t.scrollHeight - 200;
6512
- if (canFetch) {
6513
- _fetch();
6514
- }
6515
- },
6516
- children: [!loading && !total ? /*#__PURE__*/jsxRuntime.jsx("div", {
6517
- className: "no-notis",
6518
- children: t('No new notifications')
6519
- }) : null, _notifications.map((n, i) => /*#__PURE__*/jsxRuntime.jsx(Notification, {
6520
- toggle: toggle,
6521
- n: n,
6522
- t: t,
6523
- goTo: goTo
6524
- }, `notifications-${i + 1}`)), loading && /*#__PURE__*/jsxRuntime.jsx("div", {
6525
- className: "loading-cont",
6526
- children: /*#__PURE__*/jsxRuntime.jsx(icons.LoadingOutlined, {})
6527
- })]
6528
- }), /*#__PURE__*/jsxRuntime.jsx(NotificationHistory, {
6529
- visible: historyVisible,
6530
- setHistoryVisible: setHistoryVisible,
6531
- t: t,
6532
- goTo: goTo
6576
+ })
6533
6577
  })]
6534
6578
  });
6535
6579
  }
6536
6580
 
6537
- var Style$3 = dt.div`
6538
- &.popup {
6539
- h2 {
6540
- margin-bottom: 8px;
6541
- }
6581
+ const capitalize = string => string && string.charAt(0).toUpperCase() + string.slice(1);
6582
+ const camelCaseToTitle = string => string && typeof string === 'string' ? string.split(/(?=[A-Z])/).map(word => capitalize(word)).join(' ') : string;
6542
6583
 
6543
- p {
6544
- color: #667085;
6545
- margin-bottom: 20px;
6584
+ const CustomSelect = ({
6585
+ value,
6586
+ filterSelectOptions,
6587
+ placeholder = '',
6588
+ onChange = () => {},
6589
+ disabled = false,
6590
+ options = [],
6591
+ i = 0,
6592
+ k,
6593
+ filters,
6594
+ config = {}
6595
+ }) => {
6596
+ const filteredOptions = o.useMemo(() => {
6597
+ if (typeof config.filterOptions === 'function') {
6598
+ return options.filter(option => config.filterOptions({
6599
+ option,
6600
+ filters
6601
+ }));
6546
6602
  }
6547
-
6548
- .ant-form-item-label {
6549
- padding-bottom: 6px;
6603
+ return options;
6604
+ }, [config, filters, options]);
6605
+ o.useEffect(() => {
6606
+ if (value) {
6607
+ filteredOptions.find(o => o.value === value);
6550
6608
  }
6551
-
6552
- .buttons {
6553
- margin-top: 24px;
6609
+ }, [filteredOptions]);
6610
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
6611
+ style: {
6612
+ width: '100%'
6613
+ },
6614
+ value: value,
6615
+ placeholder: placeholder,
6616
+ filterOption: filterSelectOptions,
6617
+ onChange: onChange,
6618
+ disabled: disabled,
6619
+ showSearch: true,
6620
+ allowClear: true,
6621
+ mode: config.isMulti ? 'multiple' : undefined,
6622
+ children: filteredOptions.map((o, j) => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
6623
+ value: o.value || o,
6624
+ children: o.label || camelCaseToTitle(o)
6625
+ }, `${i}-${j}-${k}`))
6626
+ });
6627
+ };
6628
+ CustomSelect.propTypes = {
6629
+ value: PropTypes__default["default"].object,
6630
+ filterSelectOptions: PropTypes__default["default"].func,
6631
+ placeholder: PropTypes__default["default"].string,
6632
+ onChange: PropTypes__default["default"].func,
6633
+ disabled: PropTypes__default["default"].bool,
6634
+ options: PropTypes__default["default"].any,
6635
+ i: PropTypes__default["default"].number,
6636
+ k: PropTypes__default["default"].string,
6637
+ filters: PropTypes__default["default"].object,
6638
+ config: PropTypes__default["default"].object
6639
+ };
6640
+
6641
+ const Timeframe = ({
6642
+ value,
6643
+ onChange = () => {},
6644
+ disabled = false,
6645
+ t = s => s
6646
+ }) => {
6647
+ const getValue = () => {
6648
+ if (value && typeof value === 'object') {
6649
+ const {
6650
+ startDate,
6651
+ endDate
6652
+ } = value;
6653
+ const _start = typeof startDate === 'string' ? dayjs__default["default"](startDate) : startDate;
6654
+ const _end = typeof endDate === 'string' ? dayjs__default["default"](endDate) : endDate;
6655
+ return {
6656
+ startDate: _start,
6657
+ endDate: _end
6658
+ };
6659
+ }
6660
+ return {};
6661
+ };
6662
+ const {
6663
+ startDate,
6664
+ endDate
6665
+ } = getValue();
6666
+ return /*#__PURE__*/jsxRuntime.jsx(antd.DatePicker.RangePicker, {
6667
+ value: [startDate, endDate],
6668
+ className: "w-100",
6669
+ separator: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
6670
+ name: "Right",
6671
+ width: 10,
6672
+ height: 10,
6673
+ color: "#D2D6DB"
6674
+ }),
6675
+ placeholder: [t('Start Date'), t('End Date')],
6676
+ disabled: disabled,
6677
+ format: "DD MM YYYY",
6678
+ onChange: val => {
6679
+ if (val) {
6680
+ const [startDate, endDate] = val;
6681
+ onChange({
6682
+ startDate,
6683
+ endDate
6684
+ });
6685
+ } else {
6686
+ onChange({});
6687
+ }
6554
6688
  }
6689
+ });
6690
+ };
6691
+ Timeframe.propTypes = {
6692
+ t: PropTypes__default["default"].func,
6693
+ value: PropTypes__default["default"].string,
6694
+ disabled: PropTypes__default["default"].bool,
6695
+ onChange: PropTypes__default["default"].func
6696
+ };
6555
6697
 
6556
- .errors-cont {
6557
- margin-top: 8px;
6698
+ /**
6699
+ * @description Manages window.storage
6700
+ * @returns storage objects
6701
+ * @class StorageManager
6702
+ */
6703
+ class StorageManager {
6704
+ /**
6705
+ * @description Set or update given value in localStorage
6706
+ * @static
6707
+ * @returns Object
6708
+ * @memberof StorageManager
6709
+ */
6710
+ static set(key, value) {
6711
+ if (key && value) {
6712
+ window.localStorage.setItem(key, value);
6713
+ return {
6714
+ success: true,
6715
+ data: "Storage has been set successfully."
6716
+ };
6558
6717
  }
6718
+ return {
6719
+ error: true,
6720
+ data: "Storage was not set. Storage key and value is required!"
6721
+ };
6559
6722
  }
6560
- `;
6561
6723
 
6562
- const Style$2 = dt.div`
6563
- .ant-btn {
6564
- border-radius: 100px 100px 100px 0;
6565
- padding: 10px;
6566
- height: fit-content;
6567
- font-size: var(--size);
6568
- line-height: var(--size-lg);
6569
- font-weight: 400;
6570
- width: 100%;
6571
-
6572
- @media (${MOBILE_WIDTH$1}) {
6573
- padding: 0.8rem 2.625rem;
6724
+ /**
6725
+ * @description Set or update given value in sessionStorage, used to not remember user after closing opened tab.
6726
+ * @static
6727
+ * @returns Object
6728
+ * @memberof StorageManager
6729
+ */
6730
+ static setToSession(key, value) {
6731
+ if (key && value) {
6732
+ window.sessionStorage.setItem(key, value);
6733
+ return {
6734
+ success: true,
6735
+ data: "Storage has been set successfully."
6736
+ };
6574
6737
  }
6738
+ return {
6739
+ error: true,
6740
+ data: "Storage was not set. Storage key and value is required!"
6741
+ };
6742
+ }
6575
6743
 
6576
- &.normal-br {
6577
- border-radius: 8px;
6744
+ /**
6745
+ * @description Fetch data from localStorage
6746
+ * @static
6747
+ * @returns Object
6748
+ * @memberof StorageManager
6749
+ */
6750
+ static get(key, defaultValue = undefined) {
6751
+ if (key) {
6752
+ const val = window.localStorage.getItem(key) || window.sessionStorage.getItem(key);
6753
+ return val || defaultValue;
6754
+ }
6755
+ return {
6756
+ error: true,
6757
+ data: "Storage key is required!"
6758
+ };
6759
+ }
6760
+
6761
+ /**
6762
+ * @description Clear only one value from localStorage
6763
+ * @static
6764
+ * @returns Object
6765
+ * @memberof StorageManager
6766
+ */
6767
+ static clearOne(key) {
6768
+ if (key === 'token') {
6769
+ localStorage.removeItem('trade-type');
6770
+ localStorage.removeItem('trade-value');
6771
+ }
6772
+ if (key) {
6773
+ window.localStorage.removeItem(key) || window.sessionStorage.removeItem(key);
6774
+ }
6775
+ return "Storage key is required!";
6776
+ }
6777
+
6778
+ /**
6779
+ * @description Clear all values from localStorage
6780
+ * @static
6781
+ * @returns Object
6782
+ * @memberof StorageManager
6783
+ */
6784
+ static clearAll() {
6785
+ window.localStorage.clear();
6786
+ window.sessionStorage.clear();
6787
+ }
6788
+ static hasKey(key) {
6789
+ return typeof this.get(key) === 'string';
6790
+ }
6791
+ static saveFilters(module, namespace, filters = {}, merge = false) {
6792
+ let savedFilters = this.get('filters');
6793
+ try {
6794
+ savedFilters = JSON.parse(savedFilters);
6795
+ } catch (e) {
6796
+ savedFilters = {};
6797
+ }
6798
+ if (!savedFilters) {
6799
+ savedFilters = {};
6800
+ }
6801
+ if (!savedFilters[module]) {
6802
+ savedFilters[module] = {};
6803
+ }
6804
+ if (!savedFilters[module][namespace]) {
6805
+ savedFilters[module][namespace] = {};
6806
+ }
6807
+ if (Object.keys(filters).length) {
6808
+ savedFilters[module][namespace] = merge ? Object.assign(savedFilters[module][namespace], filters) : filters;
6809
+ } else {
6810
+ savedFilters[module][namespace] = {};
6811
+ }
6812
+ this.set('filters', JSON.stringify(savedFilters));
6813
+ return savedFilters[module][namespace];
6814
+ }
6815
+ static getFilters(module, namespace) {
6816
+ let savedFilters = this.get('filters');
6817
+ try {
6818
+ savedFilters = JSON.parse(savedFilters);
6819
+ } catch (e) {
6820
+ savedFilters = {};
6821
+ }
6822
+ if (!savedFilters) {
6823
+ savedFilters = {};
6824
+ }
6825
+ if (!savedFilters[module]) {
6826
+ savedFilters[module] = {};
6827
+ }
6828
+ if (!savedFilters[module][namespace]) {
6829
+ savedFilters[module][namespace] = {};
6830
+ }
6831
+ return savedFilters[module][namespace];
6832
+ }
6833
+ }
6834
+
6835
+ const isProxy = () => {
6836
+ const pathname = window.location.pathname;
6837
+ if (pathname.includes('/proxy/pme') || pathname.includes('/proxy/cadd')) {
6838
+ return window.opener || !!StorageManager.get('proxy_token');
6839
+ }
6840
+ return false;
6841
+ };
6842
+ const getToken = () => isProxy() ? StorageManager.get('proxy_token') : StorageManager.get('token');
6843
+
6844
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6845
+
6846
+ function createCommonjsModule(fn, module) {
6847
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
6848
+ }
6849
+
6850
+ var customParseFormat = createCommonjsModule(function (module, exports) {
6851
+ !function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return (e=+e)+(e>68?1900:2e3)};var a=function(e){return function(t){this[e]=+t;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||(this.zone={})).offset=function(e){if(!e)return 0;if("Z"===e)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return 0===n?0:"+"===t[0]?-n:n}(e);}],h=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},u=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?"pm":"PM");return n},d={A:[i,function(e){this.afternoon=u(e,!1);}],a:[i,function(e){this.afternoon=u(e,!0);}],S:[/\d/,function(e){this.milliseconds=100*+e;}],SS:[n,function(e){this.milliseconds=10*+e;}],SSS:[/\d{3}/,function(e){this.milliseconds=+e;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(e){var t=o.ordinal,n=e.match(/\d+/);if(this.day=n[0],t)for(var r=1;r<=31;r+=1)t(r).replace(/\[|\]/g,"")===e&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(e){var t=h("months"),n=(h("monthsShort")||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(e){var t=h("months").indexOf(e)+1;if(t<1)throw new Error;this.month=t%12||t;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(e){this.year=s(e);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var o=r&&r.toUpperCase();return n||i[r]||e[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),a=s.length,f=0;f<a;f+=1){var h=s[f],u=d[h],c=u&&u[0],l=u&&u[1];s[f]=l?{regex:c,parser:l}:h.replace(/^\[|\]$/g,"");}return function(e){for(var t={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,h=e.slice(r),u=o.exec(h)[0];f.call(t,u),e=e.replace(u,"");}}return function(e){var t=e.afternoon;if(void 0!==t){var n=e.hours;t?n<12&&(e.hours+=12):12===n&&(e.hours=0),delete e.afternoon;}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,s=e.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],h=!0===s[3],u=f||h,d=s[2];h&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(e,t,n){try{if(["x","X"].indexOf(t)>-1)return new Date(("X"===t?1e3:1)*e);var r=c(t)(e),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,h=r.seconds,u=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=h||0,g=u||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(e){return new Date("")}}(t,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,e);};}}));
6852
+ });
6853
+
6854
+ var utc = createCommonjsModule(function (module, exports) {
6855
+ !function(t,i){module.exports=i();}(commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
6856
+ });
6857
+
6858
+ var localizedFormat = createCommonjsModule(function (module, exports) {
6859
+ !function(e,t){module.exports=t();}(commonjsGlobal,(function(){var e={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t){void 0===t&&(t="YYYY-MM-DDTHH:mm:ssZ");var o=this.$locale().formats,n=function(t,o){return t.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var i=r&&r.toUpperCase();return n||o[r]||e[r]||o[i].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,o){return t||o.slice(1)}))}))}(t,void 0===o?{}:o);return i.call(this,n)};}}));
6860
+ });
6861
+
6862
+ createCommonjsModule(function (module, exports) {
6863
+ !function(e,n){module.exports=n(dayjs__default["default"]);}(commonjsGlobal,(function(e){function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=n(e),i={name:"fr",weekdays:"dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),weekdaysShort:"dim._lun._mar._mer._jeu._ven._sam.".split("_"),weekdaysMin:"di_lu_ma_me_je_ve_sa".split("_"),months:"janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),monthsShort:"janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd D MMMM YYYY HH:mm"},relativeTime:{future:"dans %s",past:"il y a %s",s:"quelques secondes",m:"une minute",mm:"%d minutes",h:"une heure",hh:"%d heures",d:"un jour",dd:"%d jours",M:"un mois",MM:"%d mois",y:"un an",yy:"%d ans"},ordinal:function(e){return ""+e+(1===e?"er":"")}};return t.default.locale(i,null,!0),i}));
6864
+ });
6865
+
6866
+ createCommonjsModule(function (module, exports) {
6867
+ !function(e,o){module.exports=o(dayjs__default["default"]);}(commonjsGlobal,(function(e){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=o(e),d={name:"es",monthsShort:"ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_"),weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),weekStart:1,formats:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinal:function(e){return e+"º"}};return s.default.locale(d,null,!0),d}));
6868
+ });
6869
+
6870
+ createCommonjsModule(function (module, exports) {
6871
+ !function(e,n){module.exports=n();}(commonjsGlobal,(function(){return {name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}}));
6872
+ });
6873
+
6874
+ /* eslint-disable no-case-declarations */
6875
+ dayjs__default["default"].extend(customParseFormat);
6876
+ dayjs__default["default"].extend(utc);
6877
+ dayjs__default["default"].extend(utc);
6878
+ dayjs__default["default"].extend(localizedFormat);
6879
+
6880
+ /**
6881
+ * @function filterString
6882
+ * @description Checks if a string contains a search string ignoring accents.
6883
+ * @param {string} str1 - The string to search in.
6884
+ * @param {string} str2 - The search string.
6885
+ * @returns {boolean} - Whether the string contains the search string or not.
6886
+ * @example
6887
+ * filterString('hello', 'he') // true
6888
+ * filterString('hello', 'll') // true
6889
+ * filterString('hello', 'z') // false
6890
+ * filterString('h ll ', 'll') // true
6891
+ * filterString('h ll ', 'll') // true
6892
+ */
6893
+ const filterString = (str1, str2) => {
6894
+ str1 = typeof str1 === "string" ? str1.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") : "";
6895
+ str2 = typeof str2 === "string" ? str2.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "") : "";
6896
+ return str1.toLowerCase().indexOf(str2.toLowerCase()) >= 0;
6897
+ };
6898
+
6899
+ /**
6900
+ * @function filterSelectOptions
6901
+ * @description Checks if a select option matches an input value ignoring accents.
6902
+ * @param {string} inputValue - The input value to check.
6903
+ * @param {object} option - The select option object.
6904
+ * @property {string} [option.children] - The text content of the option.
6905
+ * @property {string} [option.label] - The label of the option.
6906
+ * @returns {boolean} - Whether the option matches the input value or not.
6907
+ * @example
6908
+ * filterSelectOptions('hello', { children: 'hello world' }) // true
6909
+ * filterSelectOptions('hello', { label: 'hello world' }) // true
6910
+ * filterSelectOptions('hello', { label: 'goodbye world' }) // false
6911
+ */
6912
+ const filterSelectOptions = (inputValue, option) => {
6913
+ return filterString(typeof option.children === "string" ? option.children : typeof option.label === "string" ? option.label : "", inputValue);
6914
+ };
6915
+
6916
+ /**
6917
+ * Formats a date string into a specified format. This function should
6918
+ * always be used when a date is formatted.
6919
+ *
6920
+ * @param {string} value - The date string to be formatted.
6921
+ * @param {string} [format='DD MMM YYYY'] - The format to output the date in.
6922
+ * @param {string} [locale = 'en'] - The langauge of the date.
6923
+ * @returns {string} - The formatted date string.
6924
+ */
6925
+
6926
+ const renderDateFormatted = (value, format = "DD MMM YYYY", locale = "en") => {
6927
+ return dayjs__default["default"].utc(value, "YYYY-MM-DD").locale(locale).format(format);
6928
+ };
6929
+
6930
+ const {
6931
+ Text
6932
+ } = antd.Typography;
6933
+ const getAjaxData = async ({
6934
+ entity,
6935
+ filterValues,
6936
+ mapper,
6937
+ method,
6938
+ setModel,
6939
+ apiUrl,
6940
+ app
6941
+ }) => {
6942
+ const noQuerryApps = ["nashiriki", "straatos"];
6943
+ const data = await axios__default["default"].post(noQuerryApps.includes(app) ? "/query" : "/query/options", {
6944
+ entity,
6945
+ method,
6946
+ mapper: mapper,
6947
+ filters: filterValues
6948
+ }, {
6949
+ baseURL: apiUrl,
6950
+ headers: {
6951
+ Authorization: `Bearer ${getToken()}`,
6952
+ Application: app
6953
+ }
6954
+ });
6955
+ setModel(data.data);
6956
+ };
6957
+ const AjaxSelect = ({
6958
+ config,
6959
+ filters = {},
6960
+ k = "",
6961
+ app,
6962
+ setValue = () => {},
6963
+ isEdit = false,
6964
+ placeholder = "",
6965
+ apiUrl
6966
+ }) => {
6967
+ const [model, setModel] = o.useState([]);
6968
+ const [initFetch, setInitFetch] = o.useState(false);
6969
+ const filterValues = o.useMemo(() => typeof config.filters === "function" ? config.filters(filters) : {}, [config, filters]);
6970
+ const [lastFilterValues, setLastFilterValues] = o.useState(filterValues);
6971
+ const isFilter = config?.isOnFilter || false;
6972
+ const disabled = o.useMemo(() => typeof config.disabled === "function" ? config.disabled(filters) : true, [config, filters]);
6973
+ const value = o.useMemo(() => filters[k] || null, [k, filters]);
6974
+ const label = o.useMemo(() => {
6975
+ const v = model.find(m => m.value === value);
6976
+ if (v) {
6977
+ return v.label;
6978
+ }
6979
+ return "";
6980
+ }, [model, value]);
6981
+ o.useEffect(() => {
6982
+ if (Object.keys(lastFilterValues) && !disabled) {
6983
+ getAjaxData({
6984
+ apiUrl: isFilter ? config.filtersConfig?.apiUrl : apiUrl,
6985
+ app: isFilter ? config.filtersConfig?.app : app,
6986
+ entity: config.entity,
6987
+ filterValues: lastFilterValues,
6988
+ mapper: config.mapper,
6989
+ method: config.method,
6990
+ setModel
6991
+ });
6992
+ setInitFetch(true);
6993
+ }
6994
+ }, [lastFilterValues]);
6995
+ o.useEffect(() => {
6996
+ if (!model.find(m => m.value === value) && initFetch) {
6997
+ setValue(undefined);
6998
+ }
6999
+ }, [model]);
7000
+ o.useEffect(() => {
7001
+ const changedPath = Object.keys(lastFilterValues).reduce((all, key) => {
7002
+ const now = filterValues[key];
7003
+ const old = lastFilterValues[key];
7004
+ if (old !== now) {
7005
+ all.push(key);
7006
+ }
7007
+ return all;
7008
+ }, []);
7009
+ if (changedPath.length) {
7010
+ setLastFilterValues(filterValues);
7011
+ }
7012
+ }, [filterValues]);
7013
+ return !isEdit ? /*#__PURE__*/jsxRuntime.jsx(Text, {
7014
+ style: config.labelStyle || {},
7015
+ ellipsis: {
7016
+ tooltip: label
7017
+ },
7018
+ children: label
7019
+ }) : /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
7020
+ autoComplete: "new-password",
7021
+ allowClear: true,
7022
+ showSearch: true,
7023
+ value: value,
7024
+ style: {
7025
+ width: "100%"
7026
+ },
7027
+ disabled: disabled,
7028
+ placeholder: placeholder,
7029
+ filterOption: filterSelectOptions,
7030
+ optionFilterProp: "label",
7031
+ options: model,
7032
+ onChange: val => {
7033
+ setValue(val);
7034
+ }
7035
+ });
7036
+ };
7037
+ AjaxSelect.propTypes = {
7038
+ config: PropTypes__default["default"].object,
7039
+ filters: PropTypes__default["default"].object,
7040
+ k: PropTypes__default["default"].string,
7041
+ setValue: PropTypes__default["default"].func,
7042
+ isEdit: PropTypes__default["default"].bool,
7043
+ placeholder: PropTypes__default["default"].string
7044
+ };
7045
+
7046
+ const SelectFilters = ({
7047
+ onApply,
7048
+ className,
7049
+ setShowFilters = () => {},
7050
+ options = {},
7051
+ filtersConfig,
7052
+ app,
7053
+ showFilters = false,
7054
+ selectedFilters = {},
7055
+ apiUrl,
7056
+ t = s => s,
7057
+ language = 'en',
7058
+ type = 'default',
7059
+ isHeader = false
7060
+ }) => {
7061
+ const [filters, setFilters] = o.useState(selectedFilters || {});
7062
+ const [initFilters, setInitFilters] = o.useState(selectedFilters || {});
7063
+ const getClearLabel = () => {
7064
+ switch (type) {
7065
+ case 'small':
7066
+ return 'Clear';
7067
+ default:
7068
+ return 'Clear Filters';
7069
+ }
7070
+ };
7071
+ const getApplyLabel = () => {
7072
+ switch (type) {
7073
+ case 'small':
7074
+ return 'Apply';
7075
+ default:
7076
+ return 'Apply Filters';
7077
+ }
7078
+ };
7079
+ const hasChanges = o.useMemo(() => {
7080
+ let _hasChanges = false;
7081
+ const activeFiltersKeys = Object.keys(filters);
7082
+ if (activeFiltersKeys.length !== Object.keys(initFilters).length) {
7083
+ return true;
7084
+ }
7085
+ activeFiltersKeys.forEach(k => {
7086
+ if (!_hasChanges && initFilters[k] !== filters[k]) {
7087
+ _hasChanges = true;
7088
+ }
7089
+ });
7090
+ return _hasChanges;
7091
+ }, [initFilters, filters]);
7092
+ const entries = Object.entries(filtersConfig).filter(([k, v]) => {
7093
+ if (!showFilters) {
7094
+ return false;
7095
+ }
7096
+ if (v.type === 'select') {
7097
+ return !!options[k];
7098
+ }
7099
+ return true;
7100
+ });
7101
+ const onChange = (val, key) => {
7102
+ setFilters(prev => {
7103
+ const o = {};
7104
+ const entries = Object.entries(prev);
7105
+ entries.forEach(([kk, vv]) => {
7106
+ o[kk] = vv;
7107
+ });
7108
+ o[key] = val;
7109
+ return o;
7110
+ });
7111
+ };
7112
+ const getPlaceholder = p => {
7113
+ if (typeof p === 'function') {
7114
+ return p(t);
7115
+ }
7116
+ if (typeof p === 'string') {
7117
+ return t(p);
7118
+ }
7119
+ return t('Filter');
7120
+ };
7121
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
7122
+ className: formatClassname([className, 'daf-select-filters', type]),
7123
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
7124
+ className: formatClassname(['filters', entries.length === 0 && 'empty', isHeader && 'px-0 pt-1']),
7125
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
7126
+ className: "filters-cont",
7127
+ children: entries.filter(([, v]) => !(typeof v.show === 'function' ? v.show(filters) : false)).map(([k, v], i) => /*#__PURE__*/jsxRuntime.jsx("div", {
7128
+ style: v.style,
7129
+ className: "cont",
7130
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
7131
+ children: [v.type === 'select' && options[k] && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
7132
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomSelect, {
7133
+ config: v,
7134
+ k: k,
7135
+ filters: filters,
7136
+ value: filters[k],
7137
+ filterSelectOptions: filterSelectOptions,
7138
+ placeholder: getPlaceholder(v.placeholder),
7139
+ onChange: e => onChange(e, k),
7140
+ disabled: typeof v.disabled === 'function' ? v.disabled(filters) : false,
7141
+ options: typeof v.getOptions === 'function' ? v.getOptions(filters) : options[k],
7142
+ i: i
7143
+ })
7144
+ }), v.type === 'timeframe' && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
7145
+ children: /*#__PURE__*/jsxRuntime.jsx(Timeframe, {
7146
+ t: t,
7147
+ value: filters[k],
7148
+ onChange: e => onChange(e, k),
7149
+ disabled: typeof v.disabled === 'function' ? v.disabled(filters) : false
7150
+ })
7151
+ }), v.type === 'ajaxSelect' && /*#__PURE__*/jsxRuntime.jsx(AjaxSelect, {
7152
+ k: k,
7153
+ filters: filters,
7154
+ config: v,
7155
+ apiUrl: apiUrl,
7156
+ setValue: v => onChange(v, k),
7157
+ allowClear: true,
7158
+ app: app,
7159
+ isEdit: showFilters,
7160
+ placeholder: getPlaceholder(v.placeholder)
7161
+ }), v.type === 'text' && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
7162
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Input, {
7163
+ type: "text",
7164
+ value: filters[k],
7165
+ placeholder: getPlaceholder(v.placeholder),
7166
+ onChange: e => onChange(e.target.value, k)
7167
+ })
7168
+ })]
7169
+ })
7170
+ }, i.toString()))
7171
+ }), showFilters && /*#__PURE__*/jsxRuntime.jsx("div", {
7172
+ className: "cont apply-cont",
7173
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
7174
+ title: t(hasChanges ? getApplyLabel() : getClearLabel()),
7175
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
7176
+ type: 'primary'
7177
+ // danger={!hasChanges}
7178
+ ,
7179
+ onClick: () => {
7180
+ if (hasChanges) {
7181
+ const obj = filters;
7182
+ Object.keys(obj).forEach(key => obj[key] === undefined && delete obj[key]);
7183
+ onApply(obj);
7184
+ setInitFilters(filters);
7185
+ if (!Object.keys(filters).length) {
7186
+ setShowFilters(false);
7187
+ }
7188
+ } else {
7189
+ setFilters({});
7190
+ onApply({});
7191
+ setInitFilters({});
7192
+ setShowFilters(false);
7193
+ }
7194
+ },
7195
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7196
+ color: 'white',
7197
+ width: 16,
7198
+ height: 16,
7199
+ name: hasChanges ? 'Check' : 'Clear'
7200
+ })
7201
+ })
7202
+ })
7203
+ })]
7204
+ })
7205
+ });
7206
+ };
7207
+ SelectFilters.propTypes = {
7208
+ t: PropTypes__default["default"].func,
7209
+ onApply: PropTypes__default["default"].func,
7210
+ options: PropTypes__default["default"].object,
7211
+ className: PropTypes__default["default"].string,
7212
+ showFilters: PropTypes__default["default"].bool,
7213
+ setShowFilters: PropTypes__default["default"].func,
7214
+ filtersConfig: PropTypes__default["default"].object,
7215
+ selectedFilters: PropTypes__default["default"].object,
7216
+ language: PropTypes__default["default"].string,
7217
+ apiUrl: PropTypes__default["default"].string
7218
+ };
7219
+
7220
+ const {
7221
+ Paragraph
7222
+ } = antd.Typography;
7223
+ const checkHasActiveFilterValues = filtersConfig => {
7224
+ if (!filtersConfig?.filtersConfig || !filtersConfig?.selectedFilters) return false;
7225
+ const filterConfigKeys = Object.keys(filtersConfig.filtersConfig);
7226
+ const selectedFilters = filtersConfig.selectedFilters;
7227
+ return filterConfigKeys.some(key => {
7228
+ const value = selectedFilters[key];
7229
+ return value !== undefined && value !== null && value !== "";
7230
+ });
7231
+ };
7232
+ const useHeader = ({
7233
+ title = "",
7234
+ tooltip = "",
7235
+ supportText = "",
7236
+ tags = [],
7237
+ actionButtons: _actionButtons = [],
7238
+ titleTooltip,
7239
+ className,
7240
+ addedHeader = null,
7241
+ addedHeaderFirst,
7242
+ extraButtons: _extraButtons = [],
7243
+ onDownload,
7244
+ downloadDisabled,
7245
+ goBackTo,
7246
+ loading,
7247
+ renderExtraComponents,
7248
+ app = "",
7249
+ isViewMode = false,
7250
+ filtersConfig = {}
7251
+ }) => {
7252
+ const hasActiveFilterValues = o.useMemo(() => checkHasActiveFilterValues(filtersConfig), [filtersConfig?.filtersConfig, filtersConfig?.selectedFilters]);
7253
+ const [showFilters, setShowFilters] = o.useState(() => checkHasActiveFilterValues(filtersConfig));
7254
+ const hasFilters = filtersConfig && Object.keys(filtersConfig).length > 0;
7255
+ o.useEffect(() => {
7256
+ if (hasActiveFilterValues) {
7257
+ setShowFilters(true);
7258
+ }
7259
+ }, [hasActiveFilterValues]);
7260
+ const downloadButtonAction = app && app === "sbg" && isViewMode ? null : {
7261
+ onClick: onDownload,
7262
+ disabled: downloadDisabled,
7263
+ label: "Download",
7264
+ key: "download"
7265
+ };
7266
+ const downloadButton = app && app === "sbg" && isViewMode ? null : {
7267
+ onClick: onDownload,
7268
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7269
+ width: 16,
7270
+ height: 16,
7271
+ color: "#6C737F",
7272
+ name: "Download"
7273
+ }),
7274
+ key: "download",
7275
+ disabled: downloadDisabled,
7276
+ noMinWidth: true,
7277
+ className: "download-btn"
7278
+ };
7279
+ const filterButton = [{
7280
+ icon: "Filter",
7281
+ key: "filters",
7282
+ noMinWidth: true,
7283
+ squareIconButton: true,
7284
+ onClick: () => {
7285
+ setShowFilters(p => !p);
7286
+ }
7287
+ }];
7288
+ const actionButtons = onDownload && _actionButtons.length < 3 ? [..._actionButtons, ...(hasFilters ? filterButton : []), downloadButton] : [..._actionButtons, ...(hasFilters ? filterButton : [])];
7289
+ const extraButtons = onDownload && _actionButtons.length >= 3 ? [..._extraButtons, downloadButtonAction] : [..._extraButtons];
7290
+ const mainCont = o.useRef();
7291
+ const buttonCont = o.useRef();
7292
+ const [mainContWidth, setMainContWidth] = o.useState(600);
7293
+ const [buttonContWidth, setButtonContWidth] = o.useState(0);
7294
+ const hasSupportText = !!supportText?.length;
7295
+ const hasTags = !!tags?.length;
7296
+ const hasButtons = o.useMemo(() => !!(actionButtons?.length || extraButtons?.length), [actionButtons, extraButtons]);
7297
+ o.useEffect(() => {
7298
+ const mainContObserver = new ResizeObserver(entries => {
7299
+ const _mainEntry = entries[0];
7300
+ if (_mainEntry) {
7301
+ const _mainWidth = _mainEntry.contentRect.width;
7302
+ setMainContWidth(_mainWidth);
7303
+ }
7304
+ });
7305
+ mainContObserver.observe(mainCont.current);
7306
+ let buttonContObserver;
7307
+ if (hasButtons) {
7308
+ buttonContObserver = new ResizeObserver(entries => {
7309
+ const _buttonEntry = entries[0];
7310
+ if (_buttonEntry) {
7311
+ const _btnWidth = _buttonEntry.contentRect.width;
7312
+ setButtonContWidth(_btnWidth);
7313
+ }
7314
+ });
7315
+ }
7316
+ if (hasButtons) {
7317
+ buttonContObserver.observe(buttonCont.current);
7318
+ }
7319
+ return () => {
7320
+ mainContObserver.disconnect();
7321
+ if (hasButtons) {
7322
+ buttonContObserver.disconnect();
7323
+ }
7324
+ };
7325
+ }, [hasButtons, buttonCont.current]);
7326
+ const maxWidth = o.useMemo(
7327
+ //? DONT CHANGE THE MAX TO AVOID NEGATIVE VALUES WHEN BUTTON CONT WIDTH IS 0
7328
+ () => mainContWidth - Math.max(0, buttonContWidth) - 24, [mainContWidth, buttonContWidth]);
7329
+ const renderMainCont = () => /*#__PURE__*/jsxRuntime.jsxs("div", {
7330
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
7331
+ className: formatClassname(["main-cont flex", className]),
7332
+ ref: mainCont,
7333
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
7334
+ className: "flex-1 flex flex-column justify-content-center",
7335
+ children: [typeof title === "string" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
7336
+ className: formatClassname(["title flex", hasSupportText && "mb-1"]),
7337
+ style: {
7338
+ maxWidth,
7339
+ alignItems: "center"
7340
+ },
7341
+ children: [goBackTo && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
7342
+ className: "flex mr-xs no-min-width",
7343
+ onClick: () => goBackTo(),
7344
+ style: {
7345
+ padding: 2,
7346
+ height: "25px",
7347
+ minWidth: "25px",
7348
+ borderRadius: "4px",
7349
+ opacity: loading ? 0 : 1
7350
+ },
7351
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7352
+ name: "Right",
7353
+ style: {
7354
+ transform: "rotate(180deg)",
7355
+ width: "12px",
7356
+ color: "var(--base-gray-70)"
7357
+ }
7358
+ })
7359
+ }), loading ? /*#__PURE__*/jsxRuntime.jsx(antd.Skeleton, {
7360
+ active: true,
7361
+ title: false,
7362
+ paragraph: {
7363
+ rows: 1
7364
+ },
7365
+ style: {
7366
+ marginTop: "10px"
7367
+ }
7368
+ }) : /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
7369
+ title: titleTooltip || title,
7370
+ children: /*#__PURE__*/jsxRuntime.jsx("h2", {
7371
+ className: formatClassname(["mb-0 mr-1", hasButtons && "limited"]),
7372
+ children: title
7373
+ })
7374
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
7375
+ className: "flex",
7376
+ children: [!!tooltip && /*#__PURE__*/jsxRuntime.jsx("div", {
7377
+ className: "flex flex-column justify-content-center",
7378
+ children: typeof tooltip === "string" ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
7379
+ title: tooltip,
7380
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.InfoCircleOutlined, {})
7381
+ }) : typeof tooltip === "object" ? /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
7382
+ rootClassName: formatClassname(["header-tooltip", tooltip.className]),
7383
+ title: tooltip.title,
7384
+ content: tooltip.content,
7385
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.InfoCircleOutlined, {})
7386
+ }) : null
7387
+ }), typeof renderExtraComponents === "function" ? renderExtraComponents() : null, hasTags && /*#__PURE__*/jsxRuntime.jsx(Tags, {
7388
+ tags: tags
7389
+ })]
7390
+ })]
7391
+ }) : typeof title === "function" ? title(maxWidth) : title, /*#__PURE__*/jsxRuntime.jsx("div", {
7392
+ style: {
7393
+ marginLeft: goBackTo ? "33px" : 0
7394
+ },
7395
+ className: "support-text",
7396
+ children: /*#__PURE__*/jsxRuntime.jsx(Paragraph, {
7397
+ ellipsis: {
7398
+ tooltip: supportText,
7399
+ rows: 1
7400
+ },
7401
+ style: {
7402
+ maxWidth: maxWidth
7403
+ },
7404
+ children: supportText
7405
+ })
7406
+ })]
7407
+ }), addedHeaderFirst ? /*#__PURE__*/jsxRuntime.jsxs("div", {
7408
+ className: "flex gap-2",
7409
+ ref: buttonCont,
7410
+ children: [addedHeader, hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
7411
+ children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
7412
+ extraButtons: extraButtons,
7413
+ actionButtons: actionButtons
7414
+ })
7415
+ })]
7416
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
7417
+ className: "flex gap-2",
7418
+ ref: buttonCont,
7419
+ children: [hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
7420
+ children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
7421
+ extraButtons: extraButtons,
7422
+ actionButtons: actionButtons
7423
+ })
7424
+ }), addedHeader]
7425
+ })]
7426
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
7427
+ style: {
7428
+ marginLeft: goBackTo ? "33px" : 0,
7429
+ width: "100%"
7430
+ },
7431
+ children: hasFilters && /*#__PURE__*/jsxRuntime.jsx(SelectFilters, {
7432
+ t: filtersConfig.t,
7433
+ apiUrl: filtersConfig.apiUrl,
7434
+ showFilters: showFilters,
7435
+ onApply: filtersConfig.onApply,
7436
+ options: filtersConfig.options,
7437
+ setShowFilters: setShowFilters,
7438
+ language: filtersConfig.language,
7439
+ type: filtersConfig.type,
7440
+ filtersConfig: filtersConfig.filtersConfig,
7441
+ selectedFilters: filtersConfig.selectedFilters,
7442
+ className: filtersConfig.className,
7443
+ isHeader: true
7444
+ })
7445
+ })]
7446
+ });
7447
+ return {
7448
+ renderMainCont,
7449
+ mainContWidth
7450
+ };
7451
+ };
7452
+
7453
+ function TabsHeader({
7454
+ tabs = [],
7455
+ onChange = () => {},
7456
+ value = '',
7457
+ className = 'mt-2',
7458
+ ...rest
7459
+ }) {
7460
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
7461
+ className: formatClassname(['daf-tabs-header pl-6 pr-6', className]),
7462
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Tabs, {
7463
+ onChange: onChange,
7464
+ defaultActiveKey: value,
7465
+ activeKey: value,
7466
+ items: tabs.map(tab => ({
7467
+ children: null,
7468
+ key: tab.value,
7469
+ label: tab.label,
7470
+ disabled: tab.disabled
7471
+ })),
7472
+ ...rest
7473
+ })
7474
+ });
7475
+ }
7476
+ TabsHeader.propTypes = {
7477
+ tabs: PropTypes__default["default"].array,
7478
+ onChange: PropTypes__default["default"].func,
7479
+ value: PropTypes__default["default"].string,
7480
+ className: PropTypes__default["default"].string
7481
+ };
7482
+
7483
+ function ModalHeader({
7484
+ title = '',
7485
+ tooltip = '',
7486
+ supportText = '',
7487
+ tags = [],
7488
+ actionButtons = [],
7489
+ extraButtons = [],
7490
+ tabsConfig
7491
+ }) {
7492
+ const hasTabs = !!tabsConfig;
7493
+ const className = hasTabs ? 'with-tabs' : undefined;
7494
+ const {
7495
+ renderMainCont
7496
+ } = useHeader({
7497
+ title,
7498
+ tooltip,
7499
+ supportText,
7500
+ tags,
7501
+ className,
7502
+ actionButtons,
7503
+ extraButtons
7504
+ });
7505
+ return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7506
+ children: [renderMainCont(), !!tabsConfig && /*#__PURE__*/jsxRuntime.jsx(TabsHeader, {
7507
+ ...tabsConfig
7508
+ })]
7509
+ });
7510
+ }
7511
+ ModalHeader.propTypes = {
7512
+ tooltip: PropTypes__default["default"].any,
7513
+ title: PropTypes__default["default"].string,
7514
+ supportText: PropTypes__default["default"].any,
7515
+ tags: PropTypes__default["default"].any,
7516
+ actionButtons: PropTypes__default["default"].array,
7517
+ extraButtons: PropTypes__default["default"].array,
7518
+ tabsConfig: PropTypes__default["default"].any
7519
+ };
7520
+
7521
+ const renderNotiBody = ({
7522
+ n
7523
+ }) => {
7524
+ switch (n.type) {
7525
+ default:
7526
+ return /*#__PURE__*/jsxRuntime.jsx("label", {
7527
+ children: n.body
7528
+ });
7529
+ }
7530
+ };
7531
+ const renderNotiTitle = ({
7532
+ n
7533
+ }) => {
7534
+ return n.title;
7535
+ };
7536
+
7537
+ /* eslint-disable react/prop-types */
7538
+ function NotificationHistory({
7539
+ visible,
7540
+ setHistoryVisible,
7541
+ t = key => key,
7542
+ useNotificationsHistoryContext = () => {}
7543
+ }) {
7544
+ const {
7545
+ loading,
7546
+ _notifications,
7547
+ _fetch,
7548
+ total
7549
+ } = useNotificationsHistoryContext();
7550
+ const groupped = o.useMemo(() => _notifications.reduce((all, item) => {
7551
+ const _key = renderDateFormatted(item.createdAt, 'MMMM YYYY');
7552
+ if (all[_key]) {
7553
+ all[_key].items.push(item);
7554
+ } else {
7555
+ all[_key] = {
7556
+ items: [item]
7557
+ };
7558
+ }
7559
+ return all;
7560
+ }, {}), [_notifications]);
7561
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Modal, {
7562
+ open: visible,
7563
+ width: 680,
7564
+ footer: null,
7565
+ onCancel: () => setHistoryVisible(false),
7566
+ title: /*#__PURE__*/jsxRuntime.jsx(ModalHeader, {
7567
+ title: t('Notification History'),
7568
+ supportText: t('Visualise all your notifications here.')
7569
+ }),
7570
+ children: /*#__PURE__*/jsxRuntime.jsx(Style$4, {
7571
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
7572
+ className: "noti-list",
7573
+ onScroll: e => {
7574
+ const _t = e.target;
7575
+ const canFetch = _t.scrollTop + _t.clientHeight >= _t.scrollHeight - 200;
7576
+ if (canFetch) {
7577
+ _fetch();
7578
+ }
7579
+ },
7580
+ children: [Object.keys(groupped).map((key, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
7581
+ className: "noti-group",
7582
+ children: [/*#__PURE__*/jsxRuntime.jsx("h4", {
7583
+ children: key
7584
+ }), groupped[key].items.map((n, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
7585
+ className: "noti",
7586
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
7587
+ className: "noti-title",
7588
+ children: [/*#__PURE__*/jsxRuntime.jsx("h5", {
7589
+ children: renderNotiTitle({
7590
+ n
7591
+ })
7592
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
7593
+ children: renderDateFormatted(n.createdAt)
7594
+ })]
7595
+ }), /*#__PURE__*/jsxRuntime.jsx("p", {
7596
+ children: renderNotiBody({
7597
+ n
7598
+ })
7599
+ })]
7600
+ }, `${i}-noti-${n.id}`))]
7601
+ }, `${key}-${i}`)), loading && /*#__PURE__*/jsxRuntime.jsx("div", {
7602
+ className: "loading-all",
7603
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.LoadingOutlined, {})
7604
+ }), !loading && !total ? /*#__PURE__*/jsxRuntime.jsx("div", {
7605
+ className: "no-notis",
7606
+ children: /*#__PURE__*/jsxRuntime.jsx("p", {
7607
+ children: t('No new notifications')
7608
+ })
7609
+ }) : null]
7610
+ })
7611
+ })
7612
+ });
7613
+ }
7614
+
7615
+ /* eslint-disable react/prop-types */
7616
+ function Notifications({
7617
+ mod = 'pme',
7618
+ toggle = () => {},
7619
+ t = key => key,
7620
+ goTo = () => {},
7621
+ getRedirectLink = () => {},
7622
+ appName = 'app',
7623
+ theme = {},
7624
+ useNotificationsHistoryContext = () => {},
7625
+ useNotificationsContext = () => {}
7626
+ }) {
7627
+ const [historyVisible, setHistoryVisible] = o.useState(false);
7628
+ const {
7629
+ loading,
7630
+ _notifications,
7631
+ _fetch,
7632
+ total,
7633
+ clearAll
7634
+ } = useNotificationsContext();
7635
+ const items = [{
7636
+ key: "details",
7637
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7638
+ name: "CheckDone",
7639
+ width: 13,
7640
+ height: 13
7641
+ }),
7642
+ disabled: !total,
7643
+ onClick: () => {
7644
+ clearAll();
7645
+ toggle();
7646
+ },
7647
+ label: t('Clear All')
7648
+ }, {
7649
+ key: "publish",
7650
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7651
+ name: "NotificationText",
7652
+ width: 13,
7653
+ height: 13
7654
+ }),
7655
+ onClick: () => {
7656
+ toggle();
7657
+ setHistoryVisible(true);
7658
+ },
7659
+ label: t('View All')
7660
+ }, {
7661
+ key: "dashboard",
7662
+ icon: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7663
+ name: "Settings",
7664
+ width: 13,
7665
+ height: 13
7666
+ }),
7667
+ onClick: () => {
7668
+ toggle();
7669
+ goTo(getRedirectLink(`/app/${mod}/view/settings?activeForm=notifications`));
7670
+ },
7671
+ label: t('Settings')
7672
+ }];
7673
+ return /*#__PURE__*/jsxRuntime.jsxs(NotificationsStyle, {
7674
+ className: appName,
7675
+ children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
7676
+ className: "notis-title",
7677
+ children: [/*#__PURE__*/jsxRuntime.jsx("h3", {
7678
+ children: t('Notification')
7679
+ }), /*#__PURE__*/jsxRuntime.jsx(antd.Dropdown, {
7680
+ menu: {
7681
+ items
7682
+ },
7683
+ trigger: "click",
7684
+ rootClassName: formatClassname(['dark-menu', appName, theme.customHeaderColor && 'custom']),
7685
+ children: /*#__PURE__*/jsxRuntime.jsx("div", {
7686
+ className: "cursor-pointer",
7687
+ children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
7688
+ name: "MoreCustom",
7689
+ width: 3,
7690
+ height: 13
7691
+ })
7692
+ })
7693
+ })]
7694
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
7695
+ className: "notis-list",
7696
+ onScroll: e => {
7697
+ const _t = e.target;
7698
+ const canFetch = _t.scrollTop + _t.clientHeight >= _t.scrollHeight - 200;
7699
+ if (canFetch) {
7700
+ _fetch();
7701
+ }
7702
+ },
7703
+ children: [!loading && !total ? /*#__PURE__*/jsxRuntime.jsx("div", {
7704
+ className: "no-notis",
7705
+ children: t('No new notifications')
7706
+ }) : null, _notifications.map((n, i) => /*#__PURE__*/jsxRuntime.jsx(Notification, {
7707
+ toggle: toggle,
7708
+ n: n,
7709
+ t: t,
7710
+ goTo: goTo
7711
+ }, `notifications-${i + 1}`)), loading && /*#__PURE__*/jsxRuntime.jsx("div", {
7712
+ className: "loading-cont",
7713
+ children: /*#__PURE__*/jsxRuntime.jsx(icons.LoadingOutlined, {})
7714
+ })]
7715
+ }), /*#__PURE__*/jsxRuntime.jsx(NotificationHistory, {
7716
+ visible: historyVisible,
7717
+ setHistoryVisible: setHistoryVisible,
7718
+ t: t,
7719
+ goTo: goTo
7720
+ })]
7721
+ });
7722
+ }
7723
+
7724
+ var Style$3 = dt.div`
7725
+ &.popup {
7726
+ h2 {
7727
+ margin-bottom: 8px;
7728
+ }
7729
+
7730
+ p {
7731
+ color: #667085;
7732
+ margin-bottom: 20px;
7733
+ }
7734
+
7735
+ .ant-form-item-label {
7736
+ padding-bottom: 6px;
7737
+ }
7738
+
7739
+ .buttons {
7740
+ margin-top: 24px;
7741
+ }
7742
+
7743
+ .errors-cont {
7744
+ margin-top: 8px;
7745
+ }
7746
+ }
7747
+ `;
7748
+
7749
+ const Style$2 = dt.div`
7750
+ .ant-btn {
7751
+ border-radius: 100px 100px 100px 0;
7752
+ padding: 10px;
7753
+ height: fit-content;
7754
+ font-size: var(--size);
7755
+ line-height: var(--size-lg);
7756
+ font-weight: 400;
7757
+ width: 100%;
7758
+
7759
+ @media (${MOBILE_WIDTH$1}) {
7760
+ padding: 0.8rem 2.625rem;
7761
+ }
7762
+
7763
+ &.normal-br {
7764
+ border-radius: 8px;
6578
7765
  }
6579
7766
 
6580
7767
  &.ant-btn-primary {
@@ -6753,143 +7940,6 @@ function LoginPopup({
6753
7940
  });
6754
7941
  }
6755
7942
 
6756
- /**
6757
- * @description Manages window.storage
6758
- * @returns storage objects
6759
- * @class StorageManager
6760
- */
6761
- class StorageManager {
6762
- /**
6763
- * @description Set or update given value in localStorage
6764
- * @static
6765
- * @returns Object
6766
- * @memberof StorageManager
6767
- */
6768
- static set(key, value) {
6769
- if (key && value) {
6770
- window.localStorage.setItem(key, value);
6771
- return {
6772
- success: true,
6773
- data: "Storage has been set successfully."
6774
- };
6775
- }
6776
- return {
6777
- error: true,
6778
- data: "Storage was not set. Storage key and value is required!"
6779
- };
6780
- }
6781
-
6782
- /**
6783
- * @description Set or update given value in sessionStorage, used to not remember user after closing opened tab.
6784
- * @static
6785
- * @returns Object
6786
- * @memberof StorageManager
6787
- */
6788
- static setToSession(key, value) {
6789
- if (key && value) {
6790
- window.sessionStorage.setItem(key, value);
6791
- return {
6792
- success: true,
6793
- data: "Storage has been set successfully."
6794
- };
6795
- }
6796
- return {
6797
- error: true,
6798
- data: "Storage was not set. Storage key and value is required!"
6799
- };
6800
- }
6801
-
6802
- /**
6803
- * @description Fetch data from localStorage
6804
- * @static
6805
- * @returns Object
6806
- * @memberof StorageManager
6807
- */
6808
- static get(key, defaultValue = undefined) {
6809
- if (key) {
6810
- const val = window.localStorage.getItem(key) || window.sessionStorage.getItem(key);
6811
- return val || defaultValue;
6812
- }
6813
- return {
6814
- error: true,
6815
- data: "Storage key is required!"
6816
- };
6817
- }
6818
-
6819
- /**
6820
- * @description Clear only one value from localStorage
6821
- * @static
6822
- * @returns Object
6823
- * @memberof StorageManager
6824
- */
6825
- static clearOne(key) {
6826
- if (key === 'token') {
6827
- localStorage.removeItem('trade-type');
6828
- localStorage.removeItem('trade-value');
6829
- }
6830
- if (key) {
6831
- window.localStorage.removeItem(key) || window.sessionStorage.removeItem(key);
6832
- }
6833
- return "Storage key is required!";
6834
- }
6835
-
6836
- /**
6837
- * @description Clear all values from localStorage
6838
- * @static
6839
- * @returns Object
6840
- * @memberof StorageManager
6841
- */
6842
- static clearAll() {
6843
- window.localStorage.clear();
6844
- window.sessionStorage.clear();
6845
- }
6846
- static hasKey(key) {
6847
- return typeof this.get(key) === 'string';
6848
- }
6849
- static saveFilters(module, namespace, filters = {}, merge = false) {
6850
- let savedFilters = this.get('filters');
6851
- try {
6852
- savedFilters = JSON.parse(savedFilters);
6853
- } catch (e) {
6854
- savedFilters = {};
6855
- }
6856
- if (!savedFilters) {
6857
- savedFilters = {};
6858
- }
6859
- if (!savedFilters[module]) {
6860
- savedFilters[module] = {};
6861
- }
6862
- if (!savedFilters[module][namespace]) {
6863
- savedFilters[module][namespace] = {};
6864
- }
6865
- if (Object.keys(filters).length) {
6866
- savedFilters[module][namespace] = merge ? Object.assign(savedFilters[module][namespace], filters) : filters;
6867
- } else {
6868
- savedFilters[module][namespace] = {};
6869
- }
6870
- this.set('filters', JSON.stringify(savedFilters));
6871
- return savedFilters[module][namespace];
6872
- }
6873
- static getFilters(module, namespace) {
6874
- let savedFilters = this.get('filters');
6875
- try {
6876
- savedFilters = JSON.parse(savedFilters);
6877
- } catch (e) {
6878
- savedFilters = {};
6879
- }
6880
- if (!savedFilters) {
6881
- savedFilters = {};
6882
- }
6883
- if (!savedFilters[module]) {
6884
- savedFilters[module] = {};
6885
- }
6886
- if (!savedFilters[module][namespace]) {
6887
- savedFilters[module][namespace] = {};
6888
- }
6889
- return savedFilters[module][namespace];
6890
- }
6891
- }
6892
-
6893
7943
  /* eslint-disable react/prop-types */
6894
7944
  const {
6895
7945
  Content
@@ -6963,6 +8013,8 @@ function AppLayout({
6963
8013
  NotificationsHistoryProvider,
6964
8014
  changeNotificationState,
6965
8015
  notificationMode,
8016
+ useNotificationsHistoryContext,
8017
+ useNotificationsContext,
6966
8018
  // Collapse
6967
8019
  isCollapsed,
6968
8020
  setIsCollapsed,
@@ -7187,7 +8239,9 @@ function AppLayout({
7187
8239
  goTo: goTo,
7188
8240
  getRedirectLink: getRedirectLink,
7189
8241
  appName: appName,
7190
- theme: theme
8242
+ theme: theme,
8243
+ useNotificationsHistoryContext: useNotificationsHistoryContext,
8244
+ useNotificationsContext: useNotificationsContext
7191
8245
  }),
7192
8246
  disabled: true
7193
8247
  }]