warqadui 0.0.74 → 0.0.75

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.d.mts CHANGED
@@ -1169,11 +1169,14 @@ declare const useApp: () => {
1169
1169
  declare const linkUserSchema: z$1.ZodObject<{
1170
1170
  email: z$1.ZodEffects<z$1.ZodEffects<z$1.ZodString, string, string>, string, string>;
1171
1171
  name: z$1.ZodString;
1172
+ role: z$1.ZodEnum<["admin"]>;
1172
1173
  }, "strip", z$1.ZodTypeAny, {
1173
1174
  name: string;
1175
+ role: "admin";
1174
1176
  email: string;
1175
1177
  }, {
1176
1178
  name: string;
1179
+ role: "admin";
1177
1180
  email: string;
1178
1181
  }>;
1179
1182
  declare const verifyUserEmailSchema: z$1.ZodObject<{
package/dist/index.d.ts CHANGED
@@ -1169,11 +1169,14 @@ declare const useApp: () => {
1169
1169
  declare const linkUserSchema: z$1.ZodObject<{
1170
1170
  email: z$1.ZodEffects<z$1.ZodEffects<z$1.ZodString, string, string>, string, string>;
1171
1171
  name: z$1.ZodString;
1172
+ role: z$1.ZodEnum<["admin"]>;
1172
1173
  }, "strip", z$1.ZodTypeAny, {
1173
1174
  name: string;
1175
+ role: "admin";
1174
1176
  email: string;
1175
1177
  }, {
1176
1178
  name: string;
1179
+ role: "admin";
1177
1180
  email: string;
1178
1181
  }>;
1179
1182
  declare const verifyUserEmailSchema: z$1.ZodObject<{
package/dist/index.js CHANGED
@@ -8313,7 +8313,8 @@ var linkUserSchema = import_zod4.z.object({
8313
8313
  email: import_zod4.z.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
8314
8314
  message: "Please enter a valid email address"
8315
8315
  }).transform((val) => val?.toLowerCase()),
8316
- name: import_zod4.z.string().min(2, { message: "Name must be at least 2 characters" })
8316
+ name: import_zod4.z.string().min(2, { message: "Name must be at least 2 characters" }),
8317
+ role: import_zod4.z.enum(["admin"])
8317
8318
  });
8318
8319
  var verifyUserEmailSchema = import_zod4.z.object({
8319
8320
  email: import_zod4.z.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
@@ -8356,7 +8357,8 @@ function LinkUser({ type: initialType = "employee" }) {
8356
8357
  resolver: (0, import_zod5.zodResolver)(linkUserSchema),
8357
8358
  defaultValues: {
8358
8359
  email: "",
8359
- name: ""
8360
+ name: "",
8361
+ role: "admin"
8360
8362
  },
8361
8363
  shouldUnregister: false
8362
8364
  });
@@ -8440,6 +8442,16 @@ function LinkUser({ type: initialType = "employee" }) {
8440
8442
  placeholder: "e.g maoo@exapmle.com",
8441
8443
  required: true
8442
8444
  }
8445
+ ),
8446
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
8447
+ Fields_default.Select,
8448
+ {
8449
+ label: "Role",
8450
+ form: methods,
8451
+ name: "role",
8452
+ options: [{ label: "Admin", value: "admin" }],
8453
+ required: true
8454
+ }
8443
8455
  )
8444
8456
  ] }),
8445
8457
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -8490,7 +8502,7 @@ function VerifyEmailForm({
8490
8502
  );
8491
8503
  }, [data]);
8492
8504
  const email = data?.emailVerification?.email;
8493
- const oldEmail = data?.emailVerification?.email !== data?.email ? data?.emailVerification?.email : null;
8505
+ const oldEmail = data?.email;
8494
8506
  const methods = (0, import_react_hook_form10.useForm)({
8495
8507
  resolver: (0, import_zod6.zodResolver)(verifyUserEmailSchema),
8496
8508
  defaultValues: {
@@ -8617,8 +8629,7 @@ var import_jsx_runtime46 = require("react/jsx-runtime");
8617
8629
  function UpdateEmailForm({
8618
8630
  data,
8619
8631
  close,
8620
- reload,
8621
- app = ""
8632
+ reload
8622
8633
  }) {
8623
8634
  const { put, isLoading } = useApis_default();
8624
8635
  const currentEmail = data?.email;
@@ -8633,7 +8644,7 @@ function UpdateEmailForm({
8633
8644
  const onSubmit = async (formData) => {
8634
8645
  try {
8635
8646
  await put({
8636
- url: `${app}/users/change_email/${data._id}`,
8647
+ url: `/users/change_email/${data._id}`,
8637
8648
  body: {
8638
8649
  email: formData.newEmail
8639
8650
  }
@@ -8706,8 +8717,7 @@ var { Countdown: Countdown2 } = import_antd11.Statistic;
8706
8717
  function ResetPasswordForm({
8707
8718
  data,
8708
8719
  close,
8709
- reload,
8710
- app = ""
8720
+ reload
8711
8721
  }) {
8712
8722
  const { put, isLoading } = useApis_default();
8713
8723
  const [datas, setDatas] = (0, import_react37.useState)(data);
@@ -8741,7 +8751,7 @@ function ResetPasswordForm({
8741
8751
  const resendToken = async () => {
8742
8752
  try {
8743
8753
  const res = await put({
8744
- url: `${app}/users/reset_password/${data._id}`,
8754
+ url: `/users/reset_password/${data._id}`,
8745
8755
  body: {
8746
8756
  email: userEmail
8747
8757
  }
@@ -8812,7 +8822,7 @@ var ResetPasswordForm_default = ResetPasswordForm;
8812
8822
  var import_antd12 = require("antd");
8813
8823
  var import_react38 = require("react");
8814
8824
  var import_jsx_runtime48 = require("react/jsx-runtime");
8815
- var ActivateUser = ({ data, app = "" }) => {
8825
+ var ActivateUser = ({ data }) => {
8816
8826
  const [checked, setChecked] = (0, import_react38.useState)(data?.isActive);
8817
8827
  const { put, isLoading } = useApis_default();
8818
8828
  return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
@@ -8821,7 +8831,7 @@ var ActivateUser = ({ data, app = "" }) => {
8821
8831
  onChange: async (e) => {
8822
8832
  try {
8823
8833
  const res = await put({
8824
- url: `${app}/users/activate/${data?._id}`,
8834
+ url: `/users/activate/${data?._id}`,
8825
8835
  v: 1,
8826
8836
  body: { isActive: e }
8827
8837
  });
@@ -8845,11 +8855,9 @@ var Activate_default = ActivateUser;
8845
8855
  var import_react_router_dom7 = require("react-router-dom");
8846
8856
  var import_jsx_runtime49 = require("react/jsx-runtime");
8847
8857
  function Users() {
8848
- const { appId } = (0, import_react_router_dom7.useParams)();
8849
- const app = appId ? `/${appId}` : "";
8850
8858
  const navigate = (0, import_react_router_dom7.useNavigate)();
8851
8859
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8852
- url: `${app}/users/get`,
8860
+ url: "/users/get",
8853
8861
  v: 1,
8854
8862
  dateFilter: false
8855
8863
  });
@@ -8865,7 +8873,6 @@ function Users() {
8865
8873
  ResetPasswordForm_default,
8866
8874
  {
8867
8875
  data: data2,
8868
- app,
8869
8876
  close: () => close(),
8870
8877
  reload: () => reload()
8871
8878
  }
@@ -8884,8 +8891,7 @@ function Users() {
8884
8891
  {
8885
8892
  data: data2,
8886
8893
  close: () => close(),
8887
- reload: () => reload(),
8888
- app
8894
+ reload: () => reload()
8889
8895
  }
8890
8896
  ),
8891
8897
  width: 600
@@ -8960,7 +8966,7 @@ function Users() {
8960
8966
  header: "Status",
8961
8967
  cell: ({ row }) => {
8962
8968
  const data2 = row.original;
8963
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2, app });
8969
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2 });
8964
8970
  }
8965
8971
  },
8966
8972
  {
@@ -9006,11 +9012,8 @@ var users_default = Users;
9006
9012
  var import_react_hook_form13 = require("react-hook-form");
9007
9013
  var import_zod8 = require("@hookform/resolvers/zod");
9008
9014
  var import_antd13 = require("antd");
9009
- var import_react_router_dom8 = require("react-router-dom");
9010
9015
  var import_jsx_runtime50 = require("react/jsx-runtime");
9011
9016
  function UserForm() {
9012
- const { appId } = (0, import_react_router_dom8.useParams)();
9013
- const app = appId ? `/${appId}` : "";
9014
9017
  const { navigate } = useApp_default();
9015
9018
  const { post, isLoading } = useApis_default();
9016
9019
  const methods = (0, import_react_hook_form13.useForm)({
@@ -9025,7 +9028,7 @@ function UserForm() {
9025
9028
  const onSubmit = async (data) => {
9026
9029
  try {
9027
9030
  await post({
9028
- url: `${app}/users/create`,
9031
+ url: `/users/create`,
9029
9032
  body: data
9030
9033
  });
9031
9034
  import_antd13.message.success("User created successfully");
@@ -9089,7 +9092,7 @@ var UserForm_default = UserForm;
9089
9092
 
9090
9093
  // src/components/users/ResetPasswordPage.tsx
9091
9094
  var import_react40 = require("react");
9092
- var import_react_router_dom9 = require("react-router-dom");
9095
+ var import_react_router_dom8 = require("react-router-dom");
9093
9096
  var import_lucide_react21 = require("lucide-react");
9094
9097
  var import_react_hook_form14 = require("react-hook-form");
9095
9098
  var import_zod9 = require("@hookform/resolvers/zod");
@@ -9104,8 +9107,8 @@ var resetPageSchema = z4.object({
9104
9107
  path: ["confirmPassword"]
9105
9108
  });
9106
9109
  function ResetPasswordPage() {
9107
- const [searchParams] = (0, import_react_router_dom9.useSearchParams)();
9108
- const navigate = (0, import_react_router_dom9.useNavigate)();
9110
+ const [searchParams] = (0, import_react_router_dom8.useSearchParams)();
9111
+ const navigate = (0, import_react_router_dom8.useNavigate)();
9109
9112
  const { put, isLoading } = useApis_default();
9110
9113
  const [isVerified, setIsVerified] = (0, import_react40.useState)(false);
9111
9114
  const [verifying, setVerifying] = (0, import_react40.useState)(true);
@@ -9277,7 +9280,7 @@ var ResetPasswordPage_default = ResetPasswordPage;
9277
9280
 
9278
9281
  // src/components/users/UserProfile.tsx
9279
9282
  var import_lucide_react22 = require("lucide-react");
9280
- var import_react_router_dom10 = require("react-router-dom");
9283
+ var import_react_router_dom9 = require("react-router-dom");
9281
9284
  var import_antd15 = require("antd");
9282
9285
  var import_jsx_runtime52 = require("react/jsx-runtime");
9283
9286
  var UserProfile = ({
@@ -9290,7 +9293,7 @@ var UserProfile = ({
9290
9293
  }) => {
9291
9294
  const { post } = useApis_default();
9292
9295
  const { user, logout: authLogout, account } = useAuth_default();
9293
- const navigate = (0, import_react_router_dom10.useNavigate)();
9296
+ const navigate = (0, import_react_router_dom9.useNavigate)();
9294
9297
  const logout = async () => {
9295
9298
  if (onLogout) {
9296
9299
  onLogout();
@@ -9342,11 +9345,11 @@ var UserProfile = ({
9342
9345
  var UserProfile_default = UserProfile;
9343
9346
 
9344
9347
  // src/components/users/ProfilePage.tsx
9345
- var import_react_router_dom11 = require("react-router-dom");
9348
+ var import_react_router_dom10 = require("react-router-dom");
9346
9349
  var import_lucide_react23 = require("lucide-react");
9347
9350
  var import_jsx_runtime53 = require("react/jsx-runtime");
9348
9351
  var ProfilePage = () => {
9349
- const navigate = (0, import_react_router_dom11.useNavigate)();
9352
+ const navigate = (0, import_react_router_dom10.useNavigate)();
9350
9353
  const { user, account } = useAuth();
9351
9354
  if (!user) {
9352
9355
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h1", { children: "Please login to view your profile" }) });
package/dist/index.mjs CHANGED
@@ -8280,7 +8280,8 @@ var linkUserSchema = z3.object({
8280
8280
  email: z3.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
8281
8281
  message: "Please enter a valid email address"
8282
8282
  }).transform((val) => val?.toLowerCase()),
8283
- name: z3.string().min(2, { message: "Name must be at least 2 characters" })
8283
+ name: z3.string().min(2, { message: "Name must be at least 2 characters" }),
8284
+ role: z3.enum(["admin"])
8284
8285
  });
8285
8286
  var verifyUserEmailSchema = z3.object({
8286
8287
  email: z3.string().refine((val) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
@@ -8323,7 +8324,8 @@ function LinkUser({ type: initialType = "employee" }) {
8323
8324
  resolver: zodResolver3(linkUserSchema),
8324
8325
  defaultValues: {
8325
8326
  email: "",
8326
- name: ""
8327
+ name: "",
8328
+ role: "admin"
8327
8329
  },
8328
8330
  shouldUnregister: false
8329
8331
  });
@@ -8407,6 +8409,16 @@ function LinkUser({ type: initialType = "employee" }) {
8407
8409
  placeholder: "e.g maoo@exapmle.com",
8408
8410
  required: true
8409
8411
  }
8412
+ ),
8413
+ /* @__PURE__ */ jsx44(
8414
+ Fields_default.Select,
8415
+ {
8416
+ label: "Role",
8417
+ form: methods,
8418
+ name: "role",
8419
+ options: [{ label: "Admin", value: "admin" }],
8420
+ required: true
8421
+ }
8410
8422
  )
8411
8423
  ] }),
8412
8424
  /* @__PURE__ */ jsx44("footer", { className: "flex justify-end mt-4", children: /* @__PURE__ */ jsx44(
@@ -8457,7 +8469,7 @@ function VerifyEmailForm({
8457
8469
  );
8458
8470
  }, [data]);
8459
8471
  const email = data?.emailVerification?.email;
8460
- const oldEmail = data?.emailVerification?.email !== data?.email ? data?.emailVerification?.email : null;
8472
+ const oldEmail = data?.email;
8461
8473
  const methods = useForm4({
8462
8474
  resolver: zodResolver4(verifyUserEmailSchema),
8463
8475
  defaultValues: {
@@ -8584,8 +8596,7 @@ import { jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
8584
8596
  function UpdateEmailForm({
8585
8597
  data,
8586
8598
  close,
8587
- reload,
8588
- app = ""
8599
+ reload
8589
8600
  }) {
8590
8601
  const { put, isLoading } = useApis_default();
8591
8602
  const currentEmail = data?.email;
@@ -8600,7 +8611,7 @@ function UpdateEmailForm({
8600
8611
  const onSubmit = async (formData) => {
8601
8612
  try {
8602
8613
  await put({
8603
- url: `${app}/users/change_email/${data._id}`,
8614
+ url: `/users/change_email/${data._id}`,
8604
8615
  body: {
8605
8616
  email: formData.newEmail
8606
8617
  }
@@ -8673,8 +8684,7 @@ var { Countdown: Countdown2 } = Statistic2;
8673
8684
  function ResetPasswordForm({
8674
8685
  data,
8675
8686
  close,
8676
- reload,
8677
- app = ""
8687
+ reload
8678
8688
  }) {
8679
8689
  const { put, isLoading } = useApis_default();
8680
8690
  const [datas, setDatas] = useState27(data);
@@ -8708,7 +8718,7 @@ function ResetPasswordForm({
8708
8718
  const resendToken = async () => {
8709
8719
  try {
8710
8720
  const res = await put({
8711
- url: `${app}/users/reset_password/${data._id}`,
8721
+ url: `/users/reset_password/${data._id}`,
8712
8722
  body: {
8713
8723
  email: userEmail
8714
8724
  }
@@ -8779,7 +8789,7 @@ var ResetPasswordForm_default = ResetPasswordForm;
8779
8789
  import { message as message10, Switch } from "antd";
8780
8790
  import { useState as useState28 } from "react";
8781
8791
  import { Fragment as Fragment10, jsx as jsx48 } from "react/jsx-runtime";
8782
- var ActivateUser = ({ data, app = "" }) => {
8792
+ var ActivateUser = ({ data }) => {
8783
8793
  const [checked, setChecked] = useState28(data?.isActive);
8784
8794
  const { put, isLoading } = useApis_default();
8785
8795
  return /* @__PURE__ */ jsx48(Fragment10, { children: /* @__PURE__ */ jsx48(
@@ -8788,7 +8798,7 @@ var ActivateUser = ({ data, app = "" }) => {
8788
8798
  onChange: async (e) => {
8789
8799
  try {
8790
8800
  const res = await put({
8791
- url: `${app}/users/activate/${data?._id}`,
8801
+ url: `/users/activate/${data?._id}`,
8792
8802
  v: 1,
8793
8803
  body: { isActive: e }
8794
8804
  });
@@ -8809,14 +8819,12 @@ var ActivateUser = ({ data, app = "" }) => {
8809
8819
  var Activate_default = ActivateUser;
8810
8820
 
8811
8821
  // src/components/users/users.tsx
8812
- import { useNavigate as useNavigate6, useParams as useParams3 } from "react-router-dom";
8822
+ import { useNavigate as useNavigate6 } from "react-router-dom";
8813
8823
  import { Fragment as Fragment11, jsx as jsx49, jsxs as jsxs38 } from "react/jsx-runtime";
8814
8824
  function Users() {
8815
- const { appId } = useParams3();
8816
- const app = appId ? `/${appId}` : "";
8817
8825
  const navigate = useNavigate6();
8818
8826
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8819
- url: `${app}/users/get`,
8827
+ url: "/users/get",
8820
8828
  v: 1,
8821
8829
  dateFilter: false
8822
8830
  });
@@ -8832,7 +8840,6 @@ function Users() {
8832
8840
  ResetPasswordForm_default,
8833
8841
  {
8834
8842
  data: data2,
8835
- app,
8836
8843
  close: () => close(),
8837
8844
  reload: () => reload()
8838
8845
  }
@@ -8851,8 +8858,7 @@ function Users() {
8851
8858
  {
8852
8859
  data: data2,
8853
8860
  close: () => close(),
8854
- reload: () => reload(),
8855
- app
8861
+ reload: () => reload()
8856
8862
  }
8857
8863
  ),
8858
8864
  width: 600
@@ -8927,7 +8933,7 @@ function Users() {
8927
8933
  header: "Status",
8928
8934
  cell: ({ row }) => {
8929
8935
  const data2 = row.original;
8930
- return /* @__PURE__ */ jsx49(Activate_default, { data: data2, app });
8936
+ return /* @__PURE__ */ jsx49(Activate_default, { data: data2 });
8931
8937
  }
8932
8938
  },
8933
8939
  {
@@ -8973,11 +8979,8 @@ var users_default = Users;
8973
8979
  import { useForm as useForm7 } from "react-hook-form";
8974
8980
  import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
8975
8981
  import { message as message11 } from "antd";
8976
- import { useParams as useParams4 } from "react-router-dom";
8977
8982
  import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
8978
8983
  function UserForm() {
8979
- const { appId } = useParams4();
8980
- const app = appId ? `/${appId}` : "";
8981
8984
  const { navigate } = useApp_default();
8982
8985
  const { post, isLoading } = useApis_default();
8983
8986
  const methods = useForm7({
@@ -8992,7 +8995,7 @@ function UserForm() {
8992
8995
  const onSubmit = async (data) => {
8993
8996
  try {
8994
8997
  await post({
8995
- url: `${app}/users/create`,
8998
+ url: `/users/create`,
8996
8999
  body: data
8997
9000
  });
8998
9001
  message11.success("User created successfully");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.74",
3
+ "version": "0.0.75",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",