@eintrek/erp-shell 0.1.50 → 0.1.51

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/dist/index.esm.js CHANGED
@@ -958,18 +958,35 @@ const PLAN_FEATURES = {
958
958
  MODULE_INVENTORY: "module.inventory",
959
959
  MODULE_PROJECT: "module.project",
960
960
  MODULE_SECRETARIAT: "module.secretariat",
961
+ /** AI pack (paid or trial): AI calls on AntNiti's key while credits remain. */
962
+ AI: "ai",
961
963
  };
962
- /** True when plan features include key (with legacy basic_accounting_hr alias). */
964
+ /** Keys the Accounx add-on carries with it (same alias as org_effective_features). */
965
+ const ACCOUNTING_SUB_KEYS = [
966
+ PLAN_FEATURES.MODULE_SALES,
967
+ PLAN_FEATURES.MODULE_PURCHASING,
968
+ PLAN_FEATURES.MODULE_SECRETARIAT,
969
+ ];
970
+ /**
971
+ * True when plan features include key. Aliases, mirroring the backend:
972
+ * legacy basic_accounting_hr → module.hr + module.accounting (+ its sub-keys);
973
+ * module.accounting → module.sales, module.purchasing, module.secretariat.
974
+ */
963
975
  function hasPlanFeature(features, feature) {
964
976
  if (!features?.length)
965
977
  return false;
966
978
  if (features.includes(feature))
967
979
  return true;
968
980
  if ((feature === PLAN_FEATURES.MODULE_HR ||
969
- feature === PLAN_FEATURES.MODULE_ACCOUNTING) &&
981
+ feature === PLAN_FEATURES.MODULE_ACCOUNTING ||
982
+ ACCOUNTING_SUB_KEYS.includes(feature)) &&
970
983
  features.includes(PLAN_FEATURES.BASIC_ACCOUNTING_HR)) {
971
984
  return true;
972
985
  }
986
+ if (ACCOUNTING_SUB_KEYS.includes(feature) &&
987
+ features.includes(PLAN_FEATURES.MODULE_ACCOUNTING)) {
988
+ return true;
989
+ }
973
990
  if (feature === PLAN_FEATURES.BASIC_ACCOUNTING_HR &&
974
991
  features.includes(PLAN_FEATURES.MODULE_HR) &&
975
992
  features.includes(PLAN_FEATURES.MODULE_ACCOUNTING)) {
@@ -993,35 +1010,36 @@ const APPS = [
993
1010
  id: "platform",
994
1011
  label: "แพลตฟอร์ม",
995
1012
  icon: jsx(Building2, { className: "h-4 w-4 shrink-0" }),
996
- feature: null,
1013
+ features: null,
997
1014
  baseUrl: () => normaliseBase(process.env.NEXT_PUBLIC_PLATFORM_URL, "https://platform.antniti.com"),
998
1015
  },
999
1016
  {
1000
1017
  id: "accounx",
1001
1018
  label: "Accounx",
1002
1019
  icon: jsx(Calculator, { className: "h-4 w-4 shrink-0" }),
1003
- feature: PLAN_FEATURES.MODULE_ACCOUNTING,
1020
+ features: [PLAN_FEATURES.MODULE_ACCOUNTING],
1004
1021
  baseUrl: () => normaliseBase(process.env.NEXT_PUBLIC_ACCOUNTING_URL, "https://accounx.antniti.com"),
1005
1022
  },
1006
1023
  {
1007
1024
  id: "invenx",
1008
1025
  label: "Invenx",
1009
1026
  icon: jsx(Warehouse, { className: "h-4 w-4 shrink-0" }),
1010
- feature: PLAN_FEATURES.MODULE_INVENTORY,
1027
+ features: [PLAN_FEATURES.MODULE_INVENTORY],
1011
1028
  baseUrl: () => normaliseBase(process.env.NEXT_PUBLIC_INVENX_URL, "https://invenx.antniti.com"),
1012
1029
  },
1013
1030
  {
1014
1031
  id: "plannex",
1015
1032
  label: "Plannex",
1016
1033
  icon: jsx(FolderKanban, { className: "h-4 w-4 shrink-0" }),
1017
- feature: PLAN_FEATURES.MODULE_PROJECT,
1034
+ // Tasks, day-logs and work records are free with HR; projects need the add-on.
1035
+ features: [PLAN_FEATURES.MODULE_HR, PLAN_FEATURES.MODULE_PROJECT],
1018
1036
  baseUrl: () => normaliseBase(process.env.NEXT_PUBLIC_PLANNEX_URL, "https://plannex.antniti.com"),
1019
1037
  },
1020
1038
  {
1021
1039
  id: "peoplx",
1022
1040
  label: "Peoplx",
1023
1041
  icon: jsx(Users, { className: "h-4 w-4 shrink-0" }),
1024
- feature: PLAN_FEATURES.MODULE_HR,
1042
+ features: [PLAN_FEATURES.MODULE_HR],
1025
1043
  baseUrl: () => normaliseBase(process.env.NEXT_PUBLIC_HR_URL, "https://peoplx.antniti.com"),
1026
1044
  },
1027
1045
  ];
@@ -1036,8 +1054,8 @@ function buildSystemLinks({ orgCode, activeApp, features, }) {
1036
1054
  if (!orgCode)
1037
1055
  return [];
1038
1056
  return APPS.filter(app => app.id === activeApp ||
1039
- app.feature === null ||
1040
- hasPlanFeature(features, app.feature)).map(app => ({
1057
+ app.features === null ||
1058
+ app.features.some(key => hasPlanFeature(features, key))).map(app => ({
1041
1059
  label: app.label,
1042
1060
  icon: app.icon,
1043
1061
  // Same-app link stays relative so it never leaves the current origin.