@posiwise/dashboard-module 0.0.121 → 0.0.122

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.
@@ -609,391 +609,212 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
609
609
  }]
610
610
  }] });
611
611
 
612
+ /**
613
+ * Helper function to create menu items with default values
614
+ * @param overrides - Partial RouteInfo object with overrides
615
+ * @returns RouteInfo object with defaults applied
616
+ */
617
+ const createMenuItem = (overrides) => ({
618
+ permission: '',
619
+ path: '',
620
+ title: '',
621
+ icon: '',
622
+ class: '',
623
+ badge: '',
624
+ badgeClass: '',
625
+ isExternalLink: false,
626
+ submenu: [],
627
+ visible: true,
628
+ order: 0,
629
+ ...overrides
630
+ });
631
+ /**
632
+ * Helper function to create submenu items with default values
633
+ * @param overrides - Partial RouteInfo object with overrides
634
+ * @returns RouteInfo object with defaults applied
635
+ */
636
+ const createSubMenuItem = (overrides) => ({
637
+ permission: '',
638
+ path: '',
639
+ title: '',
640
+ icon: '',
641
+ class: '',
642
+ badge: '',
643
+ badgeClass: '',
644
+ isExternalLink: false,
645
+ submenu: [],
646
+ visible: true,
647
+ ...overrides
648
+ });
649
+ /**
650
+ * Common menu items that can be reused across modules
651
+ */
652
+ const COMMON_MENUS = {
653
+ FAQ_Menu: createMenuItem({
654
+ permission: 'Pages.Product.{permission_key}.{feature_key}.FAQ',
655
+ path: '/faq',
656
+ title: 'FAQ',
657
+ icon: 'ft-info',
658
+ order: 999
659
+ }),
660
+ ENTERPRISE_MENU: createMenuItem({
661
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Enterprise',
662
+ path: '/enterprise',
663
+ title: 'Enterprise',
664
+ icon: 'ft-package',
665
+ class: 'has-sub',
666
+ badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
667
+ order: 5,
668
+ submenu: [
669
+ createSubMenuItem({
670
+ path: ':slug/enterprise/members',
671
+ title: 'Members',
672
+ icon: 'far fa-users'
673
+ }),
674
+ createSubMenuItem({
675
+ permission: 'Pages.Alpha',
676
+ path: ':slug/enterprise/partners',
677
+ title: 'Partners',
678
+ icon: 'far fa-users'
679
+ }),
680
+ createSubMenuItem({
681
+ permission: 'Pages.Beta',
682
+ path: ':slug/enterprise/groups',
683
+ title: 'Teams',
684
+ icon: 'far fa-users-class'
685
+ }),
686
+ createSubMenuItem({
687
+ permission: 'Pages.Beta',
688
+ path: ':slug/enterprise/communications',
689
+ title: 'Communications',
690
+ icon: 'fas fa-comments'
691
+ }),
692
+ createSubMenuItem({
693
+ permission: 'Pages.Beta',
694
+ path: ':slug/enterprise/wiki',
695
+ title: 'Documentation',
696
+ icon: 'fab fa-wikipedia-w'
697
+ }),
698
+ createSubMenuItem({
699
+ permission: 'Pages.Beta',
700
+ path: ':slug/enterprise/insights',
701
+ title: 'Insights',
702
+ icon: 'far fa-tag'
703
+ })
704
+ ]
705
+ }),
706
+ CHAT_MENU: createMenuItem({
707
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Chat',
708
+ path: '/message',
709
+ title: 'Chat',
710
+ icon: 'ft-message-square',
711
+ badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
712
+ order: 2
713
+ }),
714
+ BLOG_MENU: createMenuItem({
715
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Blog || Pages.Role.MarketingManager',
716
+ path: '/posts/list',
717
+ title: 'Blog',
718
+ icon: 'far fa-blog'
719
+ })
720
+ };
721
+
722
+ // Centralized admin permissions
723
+ const ADMIN_PERMISSIONS = {
724
+ GENERIC: 'Pages.Admin',
725
+ DOMAIN_CONFIG: 'Pages.Admin.DomainConfig || Pages.Role.MarketingManager',
726
+ USERS: 'Pages.Admin.Users',
727
+ SUBSCRIPTION: 'Pages.Admin.Subscription',
728
+ PRODUCT: 'Pages.Admin.Product',
729
+ LOGIN_NOTIFICATION: 'Pages.Admin.LoginNotification || Pages.Role.MarketingManager',
730
+ NEWSLETTER: 'Pages.Admin.Newsletter || Pages.Role.MarketingManager',
731
+ MAILER: 'Pages.Admin.Mailer',
732
+ BLOG: 'Pages.Admin.Blog || Pages.Role.MarketingManager',
733
+ FAQ: 'Pages.Admin.FAQ || Pages.Role.MarketingManager',
734
+ INCIDENT: 'Pages.Admin.Incident',
735
+ CONTACT_US: 'Pages.Admin.ContactUs',
736
+ TIPS: 'Pages.Admin.Tips',
737
+ TAGS: 'Pages.Admin.Tags',
738
+ ROLES: 'Pages.Admin.Roles',
739
+ TOS: 'Pages.Admin.Tos',
740
+ CREDENTIAL: 'Pages.Admin.Credential',
741
+ TRACKING: 'Pages.Admin.Tracking',
742
+ GLOBAL_CONFIG: 'Pages.Admin.Global-Config'
743
+ };
744
+ // Centralized admin paths
745
+ const ADMIN_PATHS = {
746
+ GENERIC: '/admin/generic',
747
+ DOMAIN_CONFIG: '/admin/domain-config/list',
748
+ USERS: '/admin/users',
749
+ SUBSCRIPTION: '/admin/subscriptions',
750
+ PRODUCT: '/admin/products',
751
+ LOGIN_NOTIFICATION: '/admin/login-notifications/list',
752
+ NEWSLETTER: '/admin/newsletter',
753
+ MAILER: '/admin/mailers',
754
+ BLOG: '/admin/resources',
755
+ FAQ: '/admin/faq/list',
756
+ INCIDENT: '/admin/incident/list',
757
+ CONTACT_US: '/admin/contact-us/list',
758
+ TIPS: '/admin/tips/list',
759
+ TAGS: '/admin/tags',
760
+ ROLES: '/admin/permissions',
761
+ TOS: '/admin/tos/list',
762
+ CREDENTIAL: '/admin/credentials',
763
+ TRACKING: '/admin/tracking',
764
+ GLOBAL_CONFIG: '/admin/global-config'
765
+ };
766
+ // Centralized admin menu data
767
+ const ADMIN_MENU_DATA = [
768
+ { key: 'GENERIC', title: 'Generic', icon: 'far fa-book' },
769
+ { key: 'DOMAIN_CONFIG', title: 'Domains', icon: 'fa fa-fw fa-cog' },
770
+ { key: 'USERS', title: 'Users', icon: 'far fa-user-cog' },
771
+ { key: 'SUBSCRIPTION', title: 'Subscriptions', icon: 'ft-box' },
772
+ { key: 'PRODUCT', title: 'Products', icon: 'far fa-parking' },
773
+ { key: 'LOGIN_NOTIFICATION', title: 'Notifications', icon: 'fa fa-fw fa-bell' },
774
+ { key: 'NEWSLETTER', title: 'Newsletters', icon: 'far fa-newspaper' },
775
+ { key: 'MAILER', title: 'Mailers', icon: 'far fa-envelope' },
776
+ { key: 'BLOG', title: 'Resources', icon: 'far fa-blog' },
777
+ { key: 'FAQ', title: 'FAQs', icon: 'fa fa-question' },
778
+ { key: 'INCIDENT', title: 'Incidents', icon: 'fa fa-solid fa-triangle-exclamation' },
779
+ { key: 'CONTACT_US', title: 'Contact Us', icon: 'fa fa-address-book' },
780
+ { key: 'TIPS', title: 'Tours', icon: 'far fa-lightbulb' },
781
+ { key: 'TAGS', title: 'Tags', icon: 'far fa-tags' },
782
+ { key: 'ROLES', title: 'Permissions', icon: 'fas fa-key' },
783
+ { key: 'TOS', title: 'Privacy & TOS', icon: 'fas fa-sticky-note' },
784
+ { key: 'CREDENTIAL', title: 'Credentials', icon: 'fas fa-file-signature' },
785
+ { key: 'TRACKING', title: 'Tracking', icon: 'fa fa-map-marker' },
786
+ { key: 'GLOBAL_CONFIG', title: 'Global Configs', icon: 'fa fa-fw fa-cog' }
787
+ ];
788
+ // Helper function to create admin submenu items
789
+ const createAdminSubMenuItem = (menuKey) => createSubMenuItem({
790
+ permission: ADMIN_PERMISSIONS[menuKey],
791
+ path: ADMIN_PATHS[menuKey],
792
+ title: ADMIN_MENU_DATA.find(item => item.key === menuKey)?.title || '',
793
+ icon: ADMIN_MENU_DATA.find(item => item.key === menuKey)?.icon || ''
794
+ });
795
+ // Generate admin submenu from centralized data
796
+ const generateAdminSubmenu = () => ADMIN_MENU_DATA.map(item => createAdminSubMenuItem(item.key));
612
797
  // Sidebar menu Routes and data
613
798
  const ROUTES = [
614
- // Dashboard Home
615
- {
799
+ createMenuItem({
616
800
  permission: 'Pages.Dashboard',
617
801
  path: '/home',
618
802
  title: 'Home',
619
803
  icon: 'ft-home',
620
- class: '',
621
- badge: '',
622
- badgeClass: '',
623
- isExternalLink: false,
624
- submenu: [],
625
- visible: true,
626
804
  order: 1
627
- },
628
- // Menus for Admin page
629
- {
805
+ }),
806
+ createMenuItem({
630
807
  permission: 'Pages.Admin',
631
808
  path: null,
632
809
  title: 'Admin',
633
810
  icon: 'ft-user',
634
811
  class: 'has-sub',
635
- badge: '',
636
- badgeClass: '',
637
- isExternalLink: false,
638
- visible: true,
639
812
  order: 3,
640
- submenu: [
641
- {
642
- permission: 'Pages.Admin',
643
- path: '/admin/generic',
644
- title: 'Generic',
645
- icon: 'far fa-book',
646
- class: '',
647
- badge: '',
648
- badgeClass: '',
649
- isExternalLink: false,
650
- submenu: [],
651
- visible: true
652
- },
653
- {
654
- permission: 'Pages.Admin.DomainConfig || Pages.Role.MarketingManager',
655
- path: '/admin/domain-config/list',
656
- title: 'Domains',
657
- icon: 'fa fa-fw fa-cog',
658
- class: '',
659
- badge: '',
660
- badgeClass: '',
661
- isExternalLink: false,
662
- submenu: [],
663
- visible: true
664
- },
665
- {
666
- permission: 'Pages.Admin.Users',
667
- path: '/admin/users',
668
- title: 'Users',
669
- icon: 'far fa-user-cog',
670
- class: '',
671
- badge: '',
672
- badgeClass: '',
673
- isExternalLink: false,
674
- submenu: [],
675
- visible: true
676
- },
677
- {
678
- permission: 'Pages.Admin.Subscription',
679
- path: '/admin/subscriptions',
680
- title: 'Subscriptions',
681
- icon: 'ft-box',
682
- class: '',
683
- badge: '',
684
- badgeClass: '',
685
- isExternalLink: false,
686
- submenu: [],
687
- visible: true
688
- },
689
- {
690
- permission: 'Pages.Admin.Product',
691
- path: '/admin/products',
692
- title: 'Products',
693
- icon: 'far fa-parking',
694
- class: '',
695
- badge: '',
696
- badgeClass: '',
697
- isExternalLink: false,
698
- submenu: [],
699
- visible: true
700
- },
701
- {
702
- permission: 'Pages.Admin.LoginNotification || Pages.Role.MarketingManager',
703
- path: '/admin/login-notifications/list',
704
- title: 'Notifications',
705
- icon: 'fa fa-fw fa-bell',
706
- class: '',
707
- badge: '',
708
- badgeClass: '',
709
- isExternalLink: false,
710
- submenu: [],
711
- visible: true
712
- },
713
- {
714
- permission: 'Pages.Admin.Newsletter || Pages.Role.MarketingManager',
715
- path: '/admin/newsletter',
716
- title: 'Newsletters',
717
- icon: 'far fa-newspaper',
718
- class: '',
719
- badge: '',
720
- badgeClass: '',
721
- isExternalLink: false,
722
- submenu: [],
723
- visible: true
724
- },
725
- {
726
- permission: 'Pages.Admin.Mailer',
727
- path: '/admin/mailers',
728
- title: 'Mailers',
729
- icon: 'far fa-envelope',
730
- class: '',
731
- badge: '',
732
- badgeClass: '',
733
- isExternalLink: false,
734
- submenu: [],
735
- visible: true
736
- },
737
- {
738
- permission: 'Pages.Admin.Blog || Pages.Role.MarketingManager',
739
- path: '/admin/resources',
740
- title: 'Resources',
741
- icon: 'far fa-blog',
742
- class: '',
743
- badge: '',
744
- badgeClass: '',
745
- isExternalLink: false,
746
- submenu: [],
747
- visible: true
748
- },
749
- {
750
- permission: 'Pages.Admin.FAQ || Pages.Role.MarketingManager',
751
- path: '/admin/faq/list',
752
- title: 'FAQs',
753
- icon: 'fa fa-question',
754
- class: '',
755
- badge: '',
756
- badgeClass: '',
757
- isExternalLink: false,
758
- submenu: [],
759
- visible: true
760
- },
761
- {
762
- permission: 'Pages.Admin.Incident',
763
- path: '/admin/incident/list',
764
- title: 'Incidents',
765
- icon: 'fa fa-solid fa-triangle-exclamation',
766
- class: '',
767
- badge: '',
768
- badgeClass: '',
769
- isExternalLink: false,
770
- submenu: [],
771
- visible: true
772
- },
773
- {
774
- permission: 'Pages.Admin.ContactUs',
775
- path: '/admin/contact-us/list',
776
- title: 'Contact Us',
777
- icon: 'fa fa-address-book',
778
- class: '',
779
- badge: '',
780
- badgeClass: '',
781
- isExternalLink: false,
782
- submenu: [],
783
- visible: true
784
- },
785
- {
786
- permission: 'Pages.Admin.Tips',
787
- path: '/admin/tips/list',
788
- title: 'Tours',
789
- icon: 'far fa-lightbulb',
790
- class: '',
791
- badge: '',
792
- badgeClass: '',
793
- isExternalLink: false,
794
- submenu: [],
795
- visible: true
796
- },
797
- {
798
- permission: 'Pages.Admin.Tags',
799
- path: '/admin/tags',
800
- title: 'Tags',
801
- icon: 'far fa-tags',
802
- class: '',
803
- badge: '',
804
- badgeClass: '',
805
- isExternalLink: false,
806
- submenu: [],
807
- visible: true
808
- },
809
- {
810
- permission: 'Pages.Admin.Roles',
811
- path: '/admin/permissions',
812
- title: 'Permissions',
813
- icon: 'fas fa-key',
814
- class: '',
815
- badge: '',
816
- badgeClass: '',
817
- isExternalLink: false,
818
- submenu: [],
819
- visible: true
820
- },
821
- {
822
- permission: 'Pages.Admin.Tos',
823
- path: '/admin/tos/list',
824
- title: 'Privacy & TOS',
825
- icon: 'fas fa-sticky-note',
826
- class: '',
827
- badge: '',
828
- badgeClass: '',
829
- isExternalLink: false,
830
- submenu: [],
831
- visible: true
832
- },
833
- {
834
- permission: 'Pages.Admin.Credential',
835
- path: '/admin/credentials',
836
- title: 'Credentials',
837
- icon: 'fas fa-file-signature',
838
- class: '',
839
- badge: '',
840
- badgeClass: '',
841
- isExternalLink: false,
842
- submenu: [],
843
- visible: true
844
- },
845
- {
846
- permission: 'Pages.Admin.Tracking',
847
- path: '/admin/tracking',
848
- title: 'Tracking',
849
- icon: 'fa fa-map-marker',
850
- class: '',
851
- badge: '',
852
- badgeClass: '',
853
- isExternalLink: false,
854
- submenu: [],
855
- visible: true
856
- },
857
- {
858
- permission: 'Pages.Admin.Global-Config',
859
- path: '/admin/global-config',
860
- title: 'Global Configs',
861
- icon: 'fa fa-fw fa-cog',
862
- class: '',
863
- badge: '',
864
- badgeClass: '',
865
- isExternalLink: false,
866
- submenu: [],
867
- visible: true
868
- }
869
- ]
870
- }
813
+ submenu: generateAdminSubmenu()
814
+ })
871
815
  ];
872
- // THE FOLLOWING GOES INTO THE BOTTOM OF THE SIDEBAR
873
- const FAQ_Menu = {
874
- permission: 'Pages.Product.{permission_key}.{feature_key}.FAQ',
875
- path: '/faq',
876
- title: 'FAQ',
877
- icon: 'ft-info',
878
- class: '',
879
- badge: '',
880
- badgeClass: '',
881
- isExternalLink: false,
882
- submenu: [],
883
- visible: true,
884
- order: 999
885
- };
886
- const ENTERPRISE_MENU = {
887
- permission: 'Pages.Product.{permission_key}.{feature_key}.Enterprise',
888
- path: '/enterprise',
889
- title: 'Enterprise',
890
- icon: 'ft-package',
891
- class: 'has-sub',
892
- badge: '',
893
- badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
894
- isExternalLink: false,
895
- order: 5,
896
- submenu: [
897
- {
898
- permission: '',
899
- path: ':slug/enterprise/members',
900
- title: 'Members',
901
- icon: 'far fa-users',
902
- class: '',
903
- badge: '',
904
- badgeClass: '',
905
- isExternalLink: false,
906
- submenu: [],
907
- visible: true
908
- },
909
- {
910
- permission: 'Pages.Alpha',
911
- path: ':slug/enterprise/partners',
912
- title: 'Partners',
913
- icon: 'far fa-users',
914
- class: '',
915
- badge: '',
916
- badgeClass: '',
917
- isExternalLink: false,
918
- submenu: [],
919
- visible: true
920
- },
921
- {
922
- permission: 'Pages.Beta',
923
- path: ':slug/enterprise/groups',
924
- title: 'Teams',
925
- icon: 'far fa-users-class',
926
- class: '',
927
- badge: '',
928
- badgeClass: '',
929
- isExternalLink: false,
930
- submenu: [],
931
- visible: true
932
- },
933
- {
934
- permission: 'Pages.Beta',
935
- path: ':slug/enterprise/communications',
936
- title: 'Communications',
937
- icon: 'fas fa-comments',
938
- class: '',
939
- badge: '',
940
- badgeClass: '',
941
- isExternalLink: false,
942
- submenu: [],
943
- visible: true
944
- },
945
- {
946
- permission: 'Pages.Beta',
947
- path: ':slug/enterprise/wiki',
948
- title: 'Documentation',
949
- icon: 'fab fa-wikipedia-w',
950
- class: '',
951
- badge: '',
952
- badgeClass: '',
953
- isExternalLink: false,
954
- submenu: [],
955
- visible: true
956
- },
957
- {
958
- permission: 'Pages.Beta',
959
- path: ':slug/enterprise/insights',
960
- title: 'Insights',
961
- icon: 'far fa-tag',
962
- class: '',
963
- badge: '',
964
- badgeClass: '',
965
- isExternalLink: false,
966
- submenu: [],
967
- visible: true
968
- }
969
- ],
970
- visible: true
971
- };
972
- const CHAT_MENU = {
973
- permission: 'Pages.Product.{permission_key}.{feature_key}.Chat',
974
- path: '/message',
975
- title: 'Chat',
976
- icon: 'ft-message-square',
977
- class: '',
978
- badge: '',
979
- badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
980
- isExternalLink: false,
981
- submenu: [],
982
- order: 2,
983
- visible: true
984
- };
985
- const BLOG_MENU = {
986
- permission: 'Pages.Product.{permission_key}.{feature_key}.Blog || Pages.Role.MarketingManager',
987
- path: '/posts/list',
988
- title: 'Blog',
989
- icon: 'far fa-blog',
990
- class: '',
991
- badge: '',
992
- badgeClass: '',
993
- isExternalLink: false,
994
- submenu: [],
995
- visible: true
996
- };
816
+ // Export common menus from shared utilities
817
+ const { FAQ_Menu, ENTERPRISE_MENU, CHAT_MENU, BLOG_MENU } = COMMON_MENUS;
997
818
 
998
819
  /**
999
820
  * Generated bundle index. Do not edit.