warqadui 0.0.73 → 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,10 +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: app = "" } = (0, import_react_router_dom7.useParams)();
8849
8858
  const navigate = (0, import_react_router_dom7.useNavigate)();
8850
8859
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8851
- url: `${app}/users/get`,
8860
+ url: "/users/get",
8852
8861
  v: 1,
8853
8862
  dateFilter: false
8854
8863
  });
@@ -8864,7 +8873,6 @@ function Users() {
8864
8873
  ResetPasswordForm_default,
8865
8874
  {
8866
8875
  data: data2,
8867
- app,
8868
8876
  close: () => close(),
8869
8877
  reload: () => reload()
8870
8878
  }
@@ -8883,8 +8891,7 @@ function Users() {
8883
8891
  {
8884
8892
  data: data2,
8885
8893
  close: () => close(),
8886
- reload: () => reload(),
8887
- app
8894
+ reload: () => reload()
8888
8895
  }
8889
8896
  ),
8890
8897
  width: 600
@@ -8959,7 +8966,7 @@ function Users() {
8959
8966
  header: "Status",
8960
8967
  cell: ({ row }) => {
8961
8968
  const data2 = row.original;
8962
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2, app });
8969
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Activate_default, { data: data2 });
8963
8970
  }
8964
8971
  },
8965
8972
  {
@@ -9005,10 +9012,8 @@ var users_default = Users;
9005
9012
  var import_react_hook_form13 = require("react-hook-form");
9006
9013
  var import_zod8 = require("@hookform/resolvers/zod");
9007
9014
  var import_antd13 = require("antd");
9008
- var import_react_router_dom8 = require("react-router-dom");
9009
9015
  var import_jsx_runtime50 = require("react/jsx-runtime");
9010
9016
  function UserForm() {
9011
- const { appId: app = "" } = (0, import_react_router_dom8.useParams)();
9012
9017
  const { navigate } = useApp_default();
9013
9018
  const { post, isLoading } = useApis_default();
9014
9019
  const methods = (0, import_react_hook_form13.useForm)({
@@ -9023,7 +9028,7 @@ function UserForm() {
9023
9028
  const onSubmit = async (data) => {
9024
9029
  try {
9025
9030
  await post({
9026
- url: `${app}/users/create`,
9031
+ url: `/users/create`,
9027
9032
  body: data
9028
9033
  });
9029
9034
  import_antd13.message.success("User created successfully");
@@ -9087,7 +9092,7 @@ var UserForm_default = UserForm;
9087
9092
 
9088
9093
  // src/components/users/ResetPasswordPage.tsx
9089
9094
  var import_react40 = require("react");
9090
- var import_react_router_dom9 = require("react-router-dom");
9095
+ var import_react_router_dom8 = require("react-router-dom");
9091
9096
  var import_lucide_react21 = require("lucide-react");
9092
9097
  var import_react_hook_form14 = require("react-hook-form");
9093
9098
  var import_zod9 = require("@hookform/resolvers/zod");
@@ -9102,8 +9107,8 @@ var resetPageSchema = z4.object({
9102
9107
  path: ["confirmPassword"]
9103
9108
  });
9104
9109
  function ResetPasswordPage() {
9105
- const [searchParams] = (0, import_react_router_dom9.useSearchParams)();
9106
- 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)();
9107
9112
  const { put, isLoading } = useApis_default();
9108
9113
  const [isVerified, setIsVerified] = (0, import_react40.useState)(false);
9109
9114
  const [verifying, setVerifying] = (0, import_react40.useState)(true);
@@ -9275,7 +9280,7 @@ var ResetPasswordPage_default = ResetPasswordPage;
9275
9280
 
9276
9281
  // src/components/users/UserProfile.tsx
9277
9282
  var import_lucide_react22 = require("lucide-react");
9278
- var import_react_router_dom10 = require("react-router-dom");
9283
+ var import_react_router_dom9 = require("react-router-dom");
9279
9284
  var import_antd15 = require("antd");
9280
9285
  var import_jsx_runtime52 = require("react/jsx-runtime");
9281
9286
  var UserProfile = ({
@@ -9288,7 +9293,7 @@ var UserProfile = ({
9288
9293
  }) => {
9289
9294
  const { post } = useApis_default();
9290
9295
  const { user, logout: authLogout, account } = useAuth_default();
9291
- const navigate = (0, import_react_router_dom10.useNavigate)();
9296
+ const navigate = (0, import_react_router_dom9.useNavigate)();
9292
9297
  const logout = async () => {
9293
9298
  if (onLogout) {
9294
9299
  onLogout();
@@ -9340,11 +9345,11 @@ var UserProfile = ({
9340
9345
  var UserProfile_default = UserProfile;
9341
9346
 
9342
9347
  // src/components/users/ProfilePage.tsx
9343
- var import_react_router_dom11 = require("react-router-dom");
9348
+ var import_react_router_dom10 = require("react-router-dom");
9344
9349
  var import_lucide_react23 = require("lucide-react");
9345
9350
  var import_jsx_runtime53 = require("react/jsx-runtime");
9346
9351
  var ProfilePage = () => {
9347
- const navigate = (0, import_react_router_dom11.useNavigate)();
9352
+ const navigate = (0, import_react_router_dom10.useNavigate)();
9348
9353
  const { user, account } = useAuth();
9349
9354
  if (!user) {
9350
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,13 +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: app = "" } = useParams3();
8816
8825
  const navigate = useNavigate6();
8817
8826
  const { data, TransactionViewComponent, reload } = useTransaction_default({
8818
- url: `${app}/users/get`,
8827
+ url: "/users/get",
8819
8828
  v: 1,
8820
8829
  dateFilter: false
8821
8830
  });
@@ -8831,7 +8840,6 @@ function Users() {
8831
8840
  ResetPasswordForm_default,
8832
8841
  {
8833
8842
  data: data2,
8834
- app,
8835
8843
  close: () => close(),
8836
8844
  reload: () => reload()
8837
8845
  }
@@ -8850,8 +8858,7 @@ function Users() {
8850
8858
  {
8851
8859
  data: data2,
8852
8860
  close: () => close(),
8853
- reload: () => reload(),
8854
- app
8861
+ reload: () => reload()
8855
8862
  }
8856
8863
  ),
8857
8864
  width: 600
@@ -8926,7 +8933,7 @@ function Users() {
8926
8933
  header: "Status",
8927
8934
  cell: ({ row }) => {
8928
8935
  const data2 = row.original;
8929
- return /* @__PURE__ */ jsx49(Activate_default, { data: data2, app });
8936
+ return /* @__PURE__ */ jsx49(Activate_default, { data: data2 });
8930
8937
  }
8931
8938
  },
8932
8939
  {
@@ -8972,10 +8979,8 @@ var users_default = Users;
8972
8979
  import { useForm as useForm7 } from "react-hook-form";
8973
8980
  import { zodResolver as zodResolver6 } from "@hookform/resolvers/zod";
8974
8981
  import { message as message11 } from "antd";
8975
- import { useParams as useParams4 } from "react-router-dom";
8976
8982
  import { jsx as jsx50, jsxs as jsxs39 } from "react/jsx-runtime";
8977
8983
  function UserForm() {
8978
- const { appId: app = "" } = useParams4();
8979
8984
  const { navigate } = useApp_default();
8980
8985
  const { post, isLoading } = useApis_default();
8981
8986
  const methods = useForm7({
@@ -8990,7 +8995,7 @@ function UserForm() {
8990
8995
  const onSubmit = async (data) => {
8991
8996
  try {
8992
8997
  await post({
8993
- url: `${app}/users/create`,
8998
+ url: `/users/create`,
8994
8999
  body: data
8995
9000
  });
8996
9001
  message11.success("User created successfully");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warqadui",
3
- "version": "0.0.73",
3
+ "version": "0.0.75",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",