@omnibase/shadcn 0.4.0 → 0.4.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.
package/dist/index.cjs CHANGED
@@ -959,30 +959,33 @@ function TenantCreator({
959
959
  const [billingEmail, setBillingEmail] = (0, import_react.useState)(
960
960
  config.createForm?.billingEmail?.defaultValue || ""
961
961
  );
962
- const [token, setToken] = (0, import_react.useState)(
963
- config.joinForm?.token?.defaultValue || ""
964
- );
962
+ const [token, setToken] = (0, import_react.useState)("");
963
+ (0, import_react.useEffect)(() => {
964
+ const urlParams = new URLSearchParams(window.location.search);
965
+ const inviteToken = urlParams.get("invite_token");
966
+ if (inviteToken) {
967
+ setToken(inviteToken);
968
+ setMode("join");
969
+ }
970
+ }, []);
965
971
  const handleCreateSubmit = async (e) => {
966
972
  e.preventDefault();
967
- if (!formActions.onCreateOrganization) return;
973
+ if (!formActions.createOrganizationAction) return;
968
974
  setIsLoading(true);
969
975
  try {
970
- await formActions.onCreateOrganization({
971
- organizationName,
972
- billingEmail
973
- });
976
+ const formData = new FormData(e.target);
977
+ await formActions.createOrganizationAction(formData);
974
978
  } finally {
975
979
  setIsLoading(false);
976
980
  }
977
981
  };
978
982
  const handleJoinSubmit = async (e) => {
979
983
  e.preventDefault();
980
- if (!formActions.onJoinOrganization) return;
984
+ if (!formActions.joinOrganizationAction) return;
981
985
  setIsLoading(true);
982
986
  try {
983
- await formActions.onJoinOrganization({
984
- token
985
- });
987
+ const formData = new FormData(e.target);
988
+ await formActions.joinOrganizationAction(formData);
986
989
  } finally {
987
990
  setIsLoading(false);
988
991
  }
@@ -1052,6 +1055,7 @@ function TenantCreator({
1052
1055
  Input,
1053
1056
  {
1054
1057
  id: "organizationName",
1058
+ name: "organizationName",
1055
1059
  type: "text",
1056
1060
  placeholder: config.createForm?.organizationName?.placeholder || "Enter organization name",
1057
1061
  value: organizationName,
@@ -1067,6 +1071,7 @@ function TenantCreator({
1067
1071
  Input,
1068
1072
  {
1069
1073
  id: "billingEmail",
1074
+ name: "billingEmail",
1070
1075
  type: "email",
1071
1076
  placeholder: config.createForm?.billingEmail?.placeholder || "Enter billing email",
1072
1077
  value: billingEmail,
@@ -1085,6 +1090,7 @@ function TenantCreator({
1085
1090
  Input,
1086
1091
  {
1087
1092
  id: "token",
1093
+ name: "token",
1088
1094
  type: "text",
1089
1095
  placeholder: config.joinForm?.token?.placeholder || "Enter invitation token",
1090
1096
  value: token,
package/dist/index.d.cts CHANGED
@@ -69,18 +69,12 @@ interface TenantCreatorConfig {
69
69
  token?: {
70
70
  label?: string;
71
71
  placeholder?: string;
72
- defaultValue?: string;
73
72
  };
74
73
  };
75
74
  }
76
75
  interface TenantCreatorFormActions {
77
- onCreateOrganization?: (data: {
78
- organizationName: string;
79
- billingEmail: string;
80
- }) => void | Promise<void>;
81
- onJoinOrganization?: (data: {
82
- token: string;
83
- }) => void | Promise<void>;
76
+ createOrganizationAction?: (formData: FormData) => void | Promise<void>;
77
+ joinOrganizationAction?: (formData: FormData) => void | Promise<void>;
84
78
  }
85
79
  interface TenantCreatorProps {
86
80
  config?: TenantCreatorConfig;
package/dist/index.d.ts CHANGED
@@ -69,18 +69,12 @@ interface TenantCreatorConfig {
69
69
  token?: {
70
70
  label?: string;
71
71
  placeholder?: string;
72
- defaultValue?: string;
73
72
  };
74
73
  };
75
74
  }
76
75
  interface TenantCreatorFormActions {
77
- onCreateOrganization?: (data: {
78
- organizationName: string;
79
- billingEmail: string;
80
- }) => void | Promise<void>;
81
- onJoinOrganization?: (data: {
82
- token: string;
83
- }) => void | Promise<void>;
76
+ createOrganizationAction?: (formData: FormData) => void | Promise<void>;
77
+ joinOrganizationAction?: (formData: FormData) => void | Promise<void>;
84
78
  }
85
79
  interface TenantCreatorProps {
86
80
  config?: TenantCreatorConfig;
package/dist/index.js CHANGED
@@ -903,7 +903,7 @@ function PricingTable({
903
903
  }
904
904
 
905
905
  // src/tenant-creator/index.tsx
906
- import { useState as useState3 } from "react";
906
+ import { useState as useState3, useEffect } from "react";
907
907
  import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
908
908
  function TenantCreator({
909
909
  config = {},
@@ -920,30 +920,33 @@ function TenantCreator({
920
920
  const [billingEmail, setBillingEmail] = useState3(
921
921
  config.createForm?.billingEmail?.defaultValue || ""
922
922
  );
923
- const [token, setToken] = useState3(
924
- config.joinForm?.token?.defaultValue || ""
925
- );
923
+ const [token, setToken] = useState3("");
924
+ useEffect(() => {
925
+ const urlParams = new URLSearchParams(window.location.search);
926
+ const inviteToken = urlParams.get("invite_token");
927
+ if (inviteToken) {
928
+ setToken(inviteToken);
929
+ setMode("join");
930
+ }
931
+ }, []);
926
932
  const handleCreateSubmit = async (e) => {
927
933
  e.preventDefault();
928
- if (!formActions.onCreateOrganization) return;
934
+ if (!formActions.createOrganizationAction) return;
929
935
  setIsLoading(true);
930
936
  try {
931
- await formActions.onCreateOrganization({
932
- organizationName,
933
- billingEmail
934
- });
937
+ const formData = new FormData(e.target);
938
+ await formActions.createOrganizationAction(formData);
935
939
  } finally {
936
940
  setIsLoading(false);
937
941
  }
938
942
  };
939
943
  const handleJoinSubmit = async (e) => {
940
944
  e.preventDefault();
941
- if (!formActions.onJoinOrganization) return;
945
+ if (!formActions.joinOrganizationAction) return;
942
946
  setIsLoading(true);
943
947
  try {
944
- await formActions.onJoinOrganization({
945
- token
946
- });
948
+ const formData = new FormData(e.target);
949
+ await formActions.joinOrganizationAction(formData);
947
950
  } finally {
948
951
  setIsLoading(false);
949
952
  }
@@ -1013,6 +1016,7 @@ function TenantCreator({
1013
1016
  Input,
1014
1017
  {
1015
1018
  id: "organizationName",
1019
+ name: "organizationName",
1016
1020
  type: "text",
1017
1021
  placeholder: config.createForm?.organizationName?.placeholder || "Enter organization name",
1018
1022
  value: organizationName,
@@ -1028,6 +1032,7 @@ function TenantCreator({
1028
1032
  Input,
1029
1033
  {
1030
1034
  id: "billingEmail",
1035
+ name: "billingEmail",
1031
1036
  type: "email",
1032
1037
  placeholder: config.createForm?.billingEmail?.placeholder || "Enter billing email",
1033
1038
  value: billingEmail,
@@ -1046,6 +1051,7 @@ function TenantCreator({
1046
1051
  Input,
1047
1052
  {
1048
1053
  id: "token",
1054
+ name: "token",
1049
1055
  type: "text",
1050
1056
  placeholder: config.joinForm?.token?.placeholder || "Enter invitation token",
1051
1057
  value: token,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnibase/shadcn",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "OmniBase ShadCN UI Package",
5
5
  "type": "module",
6
6
  "exports": {