@mantajs/core 0.1.1 → 0.1.2

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.
@@ -9,16 +9,6 @@ const Medusa = require("@medusajs/js-sdk");
9
9
  const _interopDefault = (e2) => e2 && e2.__esModule ? e2 : { default: e2 };
10
10
  const React__default = /* @__PURE__ */ _interopDefault(React);
11
11
  const Medusa__default = /* @__PURE__ */ _interopDefault(Medusa);
12
- const EmployeesPage = () => {
13
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4", children: [
14
- /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Employees" }),
15
- /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Manage employees and their company assignments." })
16
- ] }) });
17
- };
18
- adminSdk.defineRouteConfig({
19
- label: "Employees",
20
- nested: "/companies"
21
- });
22
12
  var isCheckBoxInput = (element) => element.type === "checkbox";
23
13
  var isDateObject = (value) => value instanceof Date;
24
14
  var isNullOrUndefined = (value) => value == null;
@@ -5330,16 +5320,26 @@ const config = adminSdk.defineRouteConfig({
5330
5320
  label: "Companies",
5331
5321
  icon: icons.BuildingStorefront
5332
5322
  });
5323
+ const EmployeesPage = () => {
5324
+ return /* @__PURE__ */ jsxRuntime.jsx(ui.Container, { className: "divide-y p-0", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-4", children: [
5325
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { level: "h1", children: "Employees" }),
5326
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { className: "text-ui-fg-subtle", children: "Manage employees and their company assignments." })
5327
+ ] }) });
5328
+ };
5329
+ adminSdk.defineRouteConfig({
5330
+ label: "Employees",
5331
+ nested: "/companies"
5332
+ });
5333
5333
  const widgetModule = { widgets: [] };
5334
5334
  const routeModule = {
5335
5335
  routes: [
5336
- {
5337
- Component: EmployeesPage,
5338
- path: "/employees"
5339
- },
5340
5336
  {
5341
5337
  Component: CompaniesPage,
5342
5338
  path: "/companies"
5339
+ },
5340
+ {
5341
+ Component: EmployeesPage,
5342
+ path: "/employees"
5343
5343
  }
5344
5344
  ]
5345
5345
  };
@@ -1,20 +1,10 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { defineRouteConfig } from "@medusajs/admin-sdk";
3
- import { Container, Heading, Text, toast, Button, Table, FocusModal, Label, Input } from "@medusajs/ui";
3
+ import { toast, Container, Heading, Text, Button, Table, FocusModal, Label, Input } from "@medusajs/ui";
4
4
  import { BuildingStorefront, Plus, Spinner } from "@medusajs/icons";
5
5
  import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
6
6
  import React, { useState } from "react";
7
7
  import Medusa from "@medusajs/js-sdk";
8
- const EmployeesPage = () => {
9
- return /* @__PURE__ */ jsx(Container, { className: "divide-y p-0", children: /* @__PURE__ */ jsxs("div", { className: "px-6 py-4", children: [
10
- /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Employees" }),
11
- /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", children: "Manage employees and their company assignments." })
12
- ] }) });
13
- };
14
- defineRouteConfig({
15
- label: "Employees",
16
- nested: "/companies"
17
- });
18
8
  var isCheckBoxInput = (element) => element.type === "checkbox";
19
9
  var isDateObject = (value) => value instanceof Date;
20
10
  var isNullOrUndefined = (value) => value == null;
@@ -5326,16 +5316,26 @@ const config = defineRouteConfig({
5326
5316
  label: "Companies",
5327
5317
  icon: BuildingStorefront
5328
5318
  });
5319
+ const EmployeesPage = () => {
5320
+ return /* @__PURE__ */ jsx(Container, { className: "divide-y p-0", children: /* @__PURE__ */ jsxs("div", { className: "px-6 py-4", children: [
5321
+ /* @__PURE__ */ jsx(Heading, { level: "h1", children: "Employees" }),
5322
+ /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", children: "Manage employees and their company assignments." })
5323
+ ] }) });
5324
+ };
5325
+ defineRouteConfig({
5326
+ label: "Employees",
5327
+ nested: "/companies"
5328
+ });
5329
5329
  const widgetModule = { widgets: [] };
5330
5330
  const routeModule = {
5331
5331
  routes: [
5332
- {
5333
- Component: EmployeesPage,
5334
- path: "/employees"
5335
- },
5336
5332
  {
5337
5333
  Component: CompaniesPage,
5338
5334
  path: "/companies"
5335
+ },
5336
+ {
5337
+ Component: EmployeesPage,
5338
+ path: "/employees"
5339
5339
  }
5340
5340
  ]
5341
5341
  };
@@ -9,7 +9,12 @@ class Migration20260126141741 extends migrations_1.Migration {
9
9
  this.addSql(`create table if not exists "employee" ("id" text not null, "spending_limit" integer not null default 0, "is_admin" boolean not null default false, "company_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "employee_pkey" primary key ("id"));`);
10
10
  this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_employee_company_id" ON "employee" ("company_id") WHERE deleted_at IS NULL;`);
11
11
  this.addSql(`CREATE INDEX IF NOT EXISTS "IDX_employee_deleted_at" ON "employee" ("deleted_at") WHERE deleted_at IS NULL;`);
12
- this.addSql(`alter table if exists "employee" add constraint "employee_company_id_foreign" foreign key ("company_id") references "company" ("id") on update cascade;`);
12
+ this.addSql(`DO $$ BEGIN
13
+ IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'employee_company_id_foreign') THEN
14
+ ALTER TABLE "employee" ADD CONSTRAINT "employee_company_id_foreign"
15
+ FOREIGN KEY ("company_id") REFERENCES "company" ("id") ON UPDATE CASCADE;
16
+ END IF;
17
+ END $$;`);
13
18
  }
14
19
  async down() {
15
20
  this.addSql(`alter table if exists "employee" drop constraint if exists "employee_company_id_foreign";`);
@@ -18,4 +23,4 @@ class Migration20260126141741 extends migrations_1.Migration {
18
23
  }
19
24
  }
20
25
  exports.Migration20260126141741 = Migration20260126141741;
21
- //#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6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbW9kdWxlcy9jb21wYW55L21pZ3JhdGlvbnMvTWlncmF0aW9uMjAyNjAxMjYxNDE3NDEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEseUVBQXFFO0FBRXJFLE1BQWEsdUJBQXdCLFNBQVEsc0JBQVM7SUFFM0MsS0FBSyxDQUFDLEVBQUU7UUFDZixJQUFJLENBQUMsTUFBTSxDQUFDLHdiQUF3YixDQUFDLENBQUM7UUFDdGMsSUFBSSxDQUFDLE1BQU0sQ0FBQywyR0FBMkcsQ0FBQyxDQUFDO1FBRXpILElBQUksQ0FBQyxNQUFNLENBQUMsaVdBQWlXLENBQUMsQ0FBQztRQUMvVyxJQUFJLENBQUMsTUFBTSxDQUFDLDZHQUE2RyxDQUFDLENBQUM7UUFDM0gsSUFBSSxDQUFDLE1BQU0sQ0FBQyw2R0FBNkcsQ0FBQyxDQUFDO1FBRTNILElBQUksQ0FBQyxNQUFNLENBQUM7Ozs7O1FBS1IsQ0FBQyxDQUFDO0lBQ1IsQ0FBQztJQUVRLEtBQUssQ0FBQyxJQUFJO1FBQ2pCLElBQUksQ0FBQyxNQUFNLENBQUMsMkZBQTJGLENBQUMsQ0FBQztRQUV6RyxJQUFJLENBQUMsTUFBTSxDQUFDLHlDQUF5QyxDQUFDLENBQUM7UUFFdkQsSUFBSSxDQUFDLE1BQU0sQ0FBQywwQ0FBMEMsQ0FBQyxDQUFDO0lBQzFELENBQUM7Q0FFRjtBQTFCRCwwREEwQkMifQ==
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mantajs/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "B2B plugin for Medusa with Company and Employee management",
5
5
  "author": "MANTAJS",
6
6
  "license": "MIT",