@schemavaults/auth-ui 0.5.55 → 0.6.19
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/components/AccountCard/account_card.d.ts +1 -0
- package/dist/components/AccountCard/account_card.js +4 -2
- package/dist/components/AccountCard/account_card.js.map +1 -1
- package/dist/components/AccountCard/index.d.ts +2 -2
- package/dist/components/AccountCard/index.js +1 -1
- package/dist/components/AccountCard/index.js.map +1 -1
- package/dist/components/ApiServersCard/api_servers_card.d.ts +3 -1
- package/dist/components/ApiServersCard/api_servers_card.js +11 -2
- package/dist/components/ApiServersCard/api_servers_card.js.map +1 -1
- package/dist/components/ApiServersCard/index.d.ts +2 -2
- package/dist/components/ApiServersCard/index.js +1 -1
- package/dist/components/ApiServersCard/index.js.map +1 -1
- package/dist/components/ApiServersTable/ApiServersTable.d.ts +1 -1
- package/dist/components/ApiServersTable/ApiServersTable.js +23 -12
- package/dist/components/ApiServersTable/ApiServersTable.js.map +1 -1
- package/dist/components/ApiServersTable/columns.d.ts +2 -2
- package/dist/components/ApiServersTable/columns.js +2 -1
- package/dist/components/ApiServersTable/columns.js.map +1 -1
- package/dist/components/ApiServersTable/index.d.ts +4 -3
- package/dist/components/ApiServersTable/index.js +2 -1
- package/dist/components/ApiServersTable/index.js.map +1 -1
- package/dist/components/ApiServersTable/useApiServersList.d.ts +2 -3
- package/dist/components/ApiServersTable/useApiServersList.js +14 -47
- package/dist/components/ApiServersTable/useApiServersList.js.map +1 -1
- package/dist/components/AppsCard/apps_card.d.ts +3 -1
- package/dist/components/AppsCard/apps_card.js +13 -5
- package/dist/components/AppsCard/apps_card.js.map +1 -1
- package/dist/components/AppsCard/index.d.ts +3 -2
- package/dist/components/AppsCard/index.js +2 -1
- package/dist/components/AppsCard/index.js.map +1 -1
- package/dist/components/AppsTable/AppDomainsList.d.ts +2 -1
- package/dist/components/AppsTable/AppDomainsList.js +11 -5
- package/dist/components/AppsTable/AppDomainsList.js.map +1 -1
- package/dist/components/AppsTable/AppsTable.js +9 -13
- package/dist/components/AppsTable/AppsTable.js.map +1 -1
- package/dist/components/AppsTable/columns.d.ts +1 -1
- package/dist/components/AppsTable/columns.js +1 -1
- package/dist/components/AppsTable/columns.js.map +1 -1
- package/dist/components/AppsTable/frontend_app_actions.js +1 -3
- package/dist/components/AppsTable/frontend_app_actions.js.map +1 -1
- package/dist/components/AppsTable/index.d.ts +4 -3
- package/dist/components/AppsTable/index.js +2 -1
- package/dist/components/AppsTable/index.js.map +1 -1
- package/dist/components/AppsTable/send-authorize-app-request.d.ts +1 -3
- package/dist/components/AppsTable/send-authorize-app-request.js +3 -33
- package/dist/components/AppsTable/send-authorize-app-request.js.map +1 -1
- package/dist/components/AppsTable/useAppDomains.js +2 -43
- package/dist/components/AppsTable/useAppDomains.js.map +1 -1
- package/dist/components/AppsTable/useAppsList.d.ts +3 -24
- package/dist/components/AppsTable/useAppsList.js +12 -46
- package/dist/components/AppsTable/useAppsList.js.map +1 -1
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.d.ts +10 -1
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.js +24 -36
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialog.js.map +1 -1
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialogOpenDispatchContext.d.ts +2 -0
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialogOpenDispatchContext.js +8 -0
- package/dist/components/ConnectAppToApiDialog/ConnectAppToApiDialogOpenDispatchContext.js.map +1 -0
- package/dist/components/ConnectAppToApiDialog/index.d.ts +3 -2
- package/dist/components/ConnectAppToApiDialog/index.js +2 -1
- package/dist/components/ConnectAppToApiDialog/index.js.map +1 -1
- package/dist/components/CreateApiServerDialog/CreateApiServerDialog.d.ts +8 -1
- package/dist/components/CreateApiServerDialog/CreateApiServerDialog.js +13 -117
- package/dist/components/CreateApiServerDialog/CreateApiServerDialog.js.map +1 -1
- package/dist/components/CreateApiServerDialog/CreateApiServerDialogOpenDispatchContext.d.ts +2 -0
- package/dist/components/CreateApiServerDialog/CreateApiServerDialogOpenDispatchContext.js +8 -0
- package/dist/components/CreateApiServerDialog/CreateApiServerDialogOpenDispatchContext.js.map +1 -0
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.d.ts +11 -0
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.js +86 -0
- package/dist/components/CreateApiServerDialog/CreateApiServerForm.js.map +1 -0
- package/dist/components/CreateApiServerDialog/index.d.ts +3 -2
- package/dist/components/CreateApiServerDialog/index.js +2 -1
- package/dist/components/CreateApiServerDialog/index.js.map +1 -1
- package/dist/components/CreateAppDialog/CreateAppDialog.d.ts +9 -2
- package/dist/components/CreateAppDialog/CreateAppDialog.js +11 -138
- package/dist/components/CreateAppDialog/CreateAppDialog.js.map +1 -1
- package/dist/components/CreateAppDialog/CreateAppDialogOpenDispatchContext.d.ts +2 -0
- package/dist/components/CreateAppDialog/CreateAppDialogOpenDispatchContext.js +8 -0
- package/dist/components/CreateAppDialog/CreateAppDialogOpenDispatchContext.js.map +1 -0
- package/dist/components/CreateAppDialog/CreateAppForm.d.ts +10 -0
- package/dist/components/CreateAppDialog/CreateAppForm.js +119 -0
- package/dist/components/CreateAppDialog/CreateAppForm.js.map +1 -0
- package/dist/components/CreateAppDialog/index.d.ts +3 -2
- package/dist/components/CreateAppDialog/index.js +2 -1
- package/dist/components/CreateAppDialog/index.js.map +1 -1
- package/dist/components/CreateAppDomainDialog/CreateAppDomainDialog.js +3 -33
- package/dist/components/CreateAppDomainDialog/CreateAppDomainDialog.js.map +1 -1
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialog.d.ts +10 -2
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialog.js +11 -121
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialog.js.map +1 -1
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialogDispatchContext.d.ts +2 -0
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialogDispatchContext.js +8 -0
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeDialogDispatchContext.js.map +1 -0
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeForm.d.ts +6 -0
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeForm.js +113 -0
- package/dist/components/CreateInviteCodeDialog/CreateInviteCodeForm.js.map +1 -0
- package/dist/components/CreateInviteCodeDialog/index.d.ts +3 -1
- package/dist/components/CreateInviteCodeDialog/index.js +2 -1
- package/dist/components/CreateInviteCodeDialog/index.js.map +1 -1
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialog.d.ts +10 -6
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialog.js +12 -113
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialog.js.map +1 -1
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialogDispatchContext.d.ts +2 -0
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialogDispatchContext.js +8 -0
- package/dist/components/CreateOrganizationDialog/CreateOrganizationDialogDispatchContext.js.map +1 -0
- package/dist/components/CreateOrganizationDialog/CreateOrganizationForm.d.ts +6 -0
- package/dist/components/CreateOrganizationDialog/CreateOrganizationForm.js +113 -0
- package/dist/components/CreateOrganizationDialog/CreateOrganizationForm.js.map +1 -0
- package/dist/components/CreateOrganizationDialog/index.d.ts +3 -2
- package/dist/components/CreateOrganizationDialog/index.js +2 -1
- package/dist/components/CreateOrganizationDialog/index.js.map +1 -1
- package/dist/components/InviteCodesCard/InviteCodesCard.d.ts +2 -2
- package/dist/components/InviteCodesCard/InviteCodesCard.js +4 -65
- package/dist/components/InviteCodesCard/InviteCodesCard.js.map +1 -1
- package/dist/components/InviteCodesTable/InviteCodesTable.d.ts +5 -5
- package/dist/components/InviteCodesTable/InviteCodesTable.js +18 -7
- package/dist/components/InviteCodesTable/InviteCodesTable.js.map +1 -1
- package/dist/components/InviteCodesTable/columns.d.ts +1 -1
- package/dist/components/InviteCodesTable/index.d.ts +2 -0
- package/dist/components/InviteCodesTable/index.js +1 -0
- package/dist/components/InviteCodesTable/index.js.map +1 -1
- package/dist/components/InviteCodesTable/useAllInviteCodes.d.ts +10 -0
- package/dist/components/InviteCodesTable/useAllInviteCodes.js +56 -0
- package/dist/components/InviteCodesTable/useAllInviteCodes.js.map +1 -0
- package/dist/components/InviteMemberDialog/InviteMemberDialog.d.ts +12 -0
- package/dist/components/InviteMemberDialog/InviteMemberDialog.js +79 -0
- package/dist/components/InviteMemberDialog/InviteMemberDialog.js.map +1 -0
- package/dist/components/InviteMemberDialog/index.d.ts +2 -0
- package/dist/components/InviteMemberDialog/index.js +2 -0
- package/dist/components/InviteMemberDialog/index.js.map +1 -0
- package/dist/components/OrganizationMembersCard/OrganizationMembersCard.d.ts +3 -0
- package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js +3 -23
- package/dist/components/OrganizationMembersCard/OrganizationMembersCard.js.map +1 -1
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.d.ts +4 -1
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js +4 -3
- package/dist/components/OrganizationMembersTable/OrganizationMembersTable.js.map +1 -1
- package/dist/components/OrganizationMembersTable/columns.d.ts +1 -1
- package/dist/components/OrganizationMembersTable/columns.js +3 -3
- package/dist/components/OrganizationMembersTable/columns.js.map +1 -1
- package/dist/components/OrganizationsCard/OrganizationsCard.d.ts +2 -2
- package/dist/components/OrganizationsCard/OrganizationsCard.js +4 -65
- package/dist/components/OrganizationsCard/OrganizationsCard.js.map +1 -1
- package/dist/components/OrganizationsTable/OrganizationsTable.d.ts +2 -3
- package/dist/components/OrganizationsTable/OrganizationsTable.js +12 -8
- package/dist/components/OrganizationsTable/OrganizationsTable.js.map +1 -1
- package/dist/components/OrganizationsTable/columns.d.ts +1 -1
- package/dist/components/OrganizationsTable/columns.js.map +1 -1
- package/dist/components/OrganizationsTable/index.d.ts +3 -1
- package/dist/components/OrganizationsTable/index.js +2 -1
- package/dist/components/OrganizationsTable/index.js.map +1 -1
- package/dist/components/OrganizationsTable/useAllOrganizationsList.d.ts +8 -0
- package/dist/components/OrganizationsTable/useAllOrganizationsList.js +58 -0
- package/dist/components/OrganizationsTable/useAllOrganizationsList.js.map +1 -0
- package/dist/components/UsersCard/UsersCard.js +1 -22
- package/dist/components/UsersCard/UsersCard.js.map +1 -1
- package/dist/components/UsersTable/columns.d.ts +1 -1
- package/dist/components/UsersTable/columns.js +1 -1
- package/dist/components/UsersTable/columns.js.map +1 -1
- package/dist/components/index.d.ts +7 -5
- package/dist/components/index.js +3 -2
- package/dist/components/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Checkbox, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Textarea, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useMemo, useTransition } from "react";
|
|
5
|
+
import { DialogDescription, DialogFooter, DialogHeader, DialogTitle, useForm, } from "@schemavaults/ui";
|
|
6
|
+
import { useAppEnvironment, useAuth } from "@schemavaults/auth-react-provider";
|
|
7
|
+
import { useSWRConfig } from "swr";
|
|
8
|
+
import { SCHEMAVAULTS_ORGANIZATION_ID, } from "@schemavaults/auth-common";
|
|
9
|
+
import { schemaVaultsAppDefinitionSchema, } from "@schemavaults/app-definitions";
|
|
10
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
11
|
+
import { AppWindow } from "lucide-react";
|
|
12
|
+
export default function CreateAppForm({ owner_organization_id, clearFrontendAppsCache, onSuccess, uuid, }) {
|
|
13
|
+
const defaultValues = useMemo(() => {
|
|
14
|
+
return {
|
|
15
|
+
app_name: "",
|
|
16
|
+
app_id: uuid(),
|
|
17
|
+
app_description: "",
|
|
18
|
+
public: false,
|
|
19
|
+
created_at: Date.now(),
|
|
20
|
+
hardcoded: false,
|
|
21
|
+
owner_organization_id,
|
|
22
|
+
};
|
|
23
|
+
}, [owner_organization_id, uuid]);
|
|
24
|
+
const form = useForm({
|
|
25
|
+
resolver: zodResolver(schemaVaultsAppDefinitionSchema),
|
|
26
|
+
defaultValues,
|
|
27
|
+
});
|
|
28
|
+
const { toast } = useToast();
|
|
29
|
+
const auth = useAuth();
|
|
30
|
+
const environment = useAppEnvironment();
|
|
31
|
+
const { mutate } = useSWRConfig();
|
|
32
|
+
const [submitting, startSubmitting] = useTransition();
|
|
33
|
+
async function onSubmit(values) {
|
|
34
|
+
if (environment === "development") {
|
|
35
|
+
console.log("Submitting frontend app creation form...");
|
|
36
|
+
toast({
|
|
37
|
+
variant: "default",
|
|
38
|
+
title: "Submitting frontend app creation form...",
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
startSubmitting(async () => {
|
|
42
|
+
const authClient = auth.ready ? auth.client.current : undefined;
|
|
43
|
+
const createAppRequestBody = {
|
|
44
|
+
...values,
|
|
45
|
+
};
|
|
46
|
+
if (typeof owner_organization_id === "string") {
|
|
47
|
+
createAppRequestBody["owner_organization_id"] = owner_organization_id;
|
|
48
|
+
}
|
|
49
|
+
else if (!owner_organization_id && authClient?.currentUser?.admin) {
|
|
50
|
+
createAppRequestBody["owner_organization_id"] =
|
|
51
|
+
SCHEMAVAULTS_ORGANIZATION_ID;
|
|
52
|
+
}
|
|
53
|
+
// if we're creating it from this form then it must be non-hardcoded/dynamic...
|
|
54
|
+
createAppRequestBody["hardcoded"] = false;
|
|
55
|
+
createAppRequestBody["created_at"] = Date.now();
|
|
56
|
+
const validatedAppRequestBody = await schemaVaultsAppDefinitionSchema.safeParseAsync(createAppRequestBody);
|
|
57
|
+
if (!validatedAppRequestBody.success) {
|
|
58
|
+
console.error("Failed to prepare application creation request:", validatedAppRequestBody.error);
|
|
59
|
+
toast({
|
|
60
|
+
variant: "destructive",
|
|
61
|
+
title: "Failed to prepare application creation request",
|
|
62
|
+
description: "See your console for the full validation error message!",
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const response = await fetch("/api/apps", {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: JSON.stringify(validatedAppRequestBody.data),
|
|
70
|
+
credentials: "include",
|
|
71
|
+
});
|
|
72
|
+
if (!response.ok || response.status !== 200) {
|
|
73
|
+
throw new Error(`Frontend app creation request has bad status: ${response.status}`);
|
|
74
|
+
}
|
|
75
|
+
const body = await response.json();
|
|
76
|
+
if (typeof body !== "object") {
|
|
77
|
+
throw new Error("Expected JSON object response from frontend app creation attempt");
|
|
78
|
+
}
|
|
79
|
+
if (!Object.hasOwn(body, "success")) {
|
|
80
|
+
throw new Error("No success field in response");
|
|
81
|
+
}
|
|
82
|
+
if (!(typeof body.success === "boolean" &&
|
|
83
|
+
body.success)) {
|
|
84
|
+
console.error(body);
|
|
85
|
+
throw new Error("Frontend app creation response has success flag set to false");
|
|
86
|
+
}
|
|
87
|
+
if (environment === "development") {
|
|
88
|
+
console.log("Received response: ", body);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
toast({
|
|
93
|
+
variant: "destructive",
|
|
94
|
+
title: "Failed to create new frontend application",
|
|
95
|
+
description: e instanceof Error ? e.message : `Failed to send network request`,
|
|
96
|
+
});
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
toast({
|
|
100
|
+
variant: "default",
|
|
101
|
+
title: "Created new frontend client application successfully",
|
|
102
|
+
});
|
|
103
|
+
clearFrontendAppsCache(mutate);
|
|
104
|
+
onSuccess();
|
|
105
|
+
form.reset();
|
|
106
|
+
return;
|
|
107
|
+
});
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
return (_jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit, (e) => {
|
|
111
|
+
console.error(e);
|
|
112
|
+
toast({
|
|
113
|
+
variant: "destructive",
|
|
114
|
+
title: "Failed to validate create app form inputs",
|
|
115
|
+
description: "See console for full error message",
|
|
116
|
+
});
|
|
117
|
+
}), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Create a new application" }), _jsx(DialogDescription, { children: "Create a new frontend/client application which can access SchemaVaults APIs." })] }), _jsx(FormField, { control: form.control, name: "app_name", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "App Name" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "My New React App", ...field, disabled: submitting }) }), _jsx(FormDescription, { children: "Give a user-friendly name to the new application." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "app_description", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Description" }), _jsx(FormControl, { children: _jsx(Textarea, { placeholder: "This app connects to my new API", ...field, disabled: submitting }) }), _jsx(FormDescription, { children: "Describe what this app does." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "public", render: ({ field }) => (_jsxs(FormItem, { className: "flex flex-row gap-2 items-center flex-wrap", children: [_jsx(FormLabel, { className: "w-full", children: "Public?" }), _jsx(FormControl, { children: _jsx(Checkbox, { checked: field.value, onCheckedChange: field.onChange, disabled: submitting, onBlur: field.onBlur }) }), _jsx(FormDescription, { className: "w-full", children: "Is this app publicly listed to end-users? I.e. can they find it without having authorized it first" }), _jsx(FormMessage, {})] })) }), _jsx(DialogFooter, { children: _jsxs(Button, { id: "submit-create-app-form-button", type: "submit", disabled: submitting, children: [_jsx(AppWindow, { className: "h-4 w-4 mr-2" }), "Create client application"] }) })] }) }));
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=CreateAppForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateAppForm.js","sourceRoot":"","sources":["../../../src/components/CreateAppDialog/CreateAppForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,QAAQ,EACR,I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KAAC,SAAS,IACR,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,iBAAiB,EACtB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,MAAC,QAAQ,eACP,KAAC,SAAS,8BAAwB,EAClC,KAAC,WAAW,cACV,KAAC,QAAQ,IACP,WAAW,EAAC,iCAAiC,KACzC,KAAK,EACT,QAAQ,EAAE,UAAU,GACpB,GACU,EACd,KAAC,eAAe,+CAA+C,EAC/D,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EACF,KAAC,SAAS,IACR,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,IAAI,EAAC,QAAQ,EACb,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CACrB,MAAC,QAAQ,IAAC,SAAS,EAAC,4CAA4C,aAC9D,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,wBAAoB,EACjD,KAAC,WAAW,cACV,KAAC,QAAQ,IACP,OAAO,EAAE,KAAK,CAAC,KAAK,EACpB,eAAe,EAAE,KAAK,CAAC,QAAQ,EAC/B,QAAQ,EAAE,UAAU,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,GACpB,GACU,EACd,KAAC,eAAe,IAAC,SAAS,EAAC,QAAQ,mHAGjB,EAClB,KAAC,WAAW,KAAG,IACN,CACZ,GACD,EACF,KAAC,YAAY,cACX,MAAC,MAAM,IACL,EAAE,EAAC,+BAA+B,EAClC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,UAAU,aAEpB,KAAC,SAAS,IAAC,SAAS,EAAC,cAAc,GAAG,iCAE/B,GACI,IACV,GACF,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { CreateAppDialog } from
|
|
2
|
-
export type * from
|
|
1
|
+
export { CreateAppDialog, CreateAppDialog as default, CreateAppDialogTrigger, } from "./CreateAppDialog";
|
|
2
|
+
export type * from "./CreateAppDialog";
|
|
3
|
+
export { CreateAppDialogOpenDispatchContext } from "./CreateAppDialogOpenDispatchContext";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { CreateAppDialog } from
|
|
1
|
+
export { CreateAppDialog, CreateAppDialog as default, CreateAppDialogTrigger, } from "./CreateAppDialog";
|
|
2
|
+
export { CreateAppDialogOpenDispatchContext } from "./CreateAppDialogOpenDispatchContext";
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateAppDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateAppDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,IAAI,OAAO,EAC1B,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, useToast, } from "@schemavaults/ui";
|
|
4
4
|
import { useMemo, useTransition } from "react";
|
|
5
5
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, RadioGroup, RadioGroupItem, Label, useForm, } from "@schemavaults/ui";
|
|
6
|
-
import { useAppEnvironment
|
|
6
|
+
import { useAppEnvironment } from "@schemavaults/auth-react-provider";
|
|
7
7
|
import { useSWRConfig } from "swr";
|
|
8
|
-
import {
|
|
8
|
+
import { schemaVaultsAppDomainRefSchema, schemaVaultsAppEnvironments, } from "@schemavaults/app-definitions";
|
|
9
9
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
10
10
|
import { EarthLock } from "lucide-react";
|
|
11
11
|
export function CreateAppDomainDialog({ clearFrontendWebAppDomainsCache, app_id, open, onOpenChange, }) {
|
|
@@ -24,7 +24,6 @@ export function CreateAppDomainDialog({ clearFrontendWebAppDomainsCache, app_id,
|
|
|
24
24
|
resolver: zodResolver(schemaVaultsAppDomainRefSchema),
|
|
25
25
|
defaultValues,
|
|
26
26
|
});
|
|
27
|
-
const auth = useAuth();
|
|
28
27
|
const { mutate } = useSWRConfig();
|
|
29
28
|
const [submitting, startSubmitting] = useTransition();
|
|
30
29
|
async function onSubmit(values) {
|
|
@@ -35,33 +34,6 @@ export function CreateAppDomainDialog({ clearFrontendWebAppDomainsCache, app_id,
|
|
|
35
34
|
title: "Submitting frontend app web domain creation form...",
|
|
36
35
|
});
|
|
37
36
|
}
|
|
38
|
-
const authClient = auth.ready ? auth.client.current : undefined;
|
|
39
|
-
if (!authClient) {
|
|
40
|
-
toast({
|
|
41
|
-
variant: "destructive",
|
|
42
|
-
title: "Auth client not ready",
|
|
43
|
-
description: `Cannot acquire an access token yet`,
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
let auth_access_jwt;
|
|
48
|
-
try {
|
|
49
|
-
const auth_jwt = await authClient.acquireAccessToken({
|
|
50
|
-
token_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
51
|
-
audience: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
52
|
-
});
|
|
53
|
-
if (!auth_jwt)
|
|
54
|
-
throw new Error("Failed to acquire auth access token");
|
|
55
|
-
auth_access_jwt = auth_jwt;
|
|
56
|
-
}
|
|
57
|
-
catch (e) {
|
|
58
|
-
toast({
|
|
59
|
-
variant: "destructive",
|
|
60
|
-
title: "Error loading authentication access token",
|
|
61
|
-
description: e instanceof Error ? e.message : `Failed to prepare network request`,
|
|
62
|
-
});
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
37
|
try {
|
|
66
38
|
const response = await fetch("/api/apps/domains/create", {
|
|
67
39
|
method: "POST",
|
|
@@ -70,9 +42,7 @@ export function CreateAppDomainDialog({ clearFrontendWebAppDomainsCache, app_id,
|
|
|
70
42
|
created_at: Date.now(),
|
|
71
43
|
app_id,
|
|
72
44
|
}),
|
|
73
|
-
|
|
74
|
-
Authorization: `Bearer ${auth_access_jwt.token}}`,
|
|
75
|
-
},
|
|
45
|
+
credentials: "include",
|
|
76
46
|
});
|
|
77
47
|
if (!response.ok || response.status !== 200) {
|
|
78
48
|
throw new Error(`Frontend app domain creation request has bad status: ${response.status}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateAppDomainDialog.js","sourceRoot":"","sources":["../../../src/components/CreateAppDomainDialog/CreateAppDomainDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"CreateAppDomainDialog.js","sourceRoot":"","sources":["../../../src/components/CreateAppDomainDialog/CreateAppDomainDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAqB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EACL,MAAM,EACN,aAAa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|
|
2
|
-
export
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
export interface CreateInviteCodeDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (val: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function CreateInviteCodeDialog({ open, onOpenChange, }: CreateInviteCodeDialogProps): ReactElement;
|
|
7
|
+
export interface CreateInviteCodeDialogTriggerProps {
|
|
8
|
+
onOpenChange: (val: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function CreateInviteCodeDialogTrigger({ onOpenChange, }: CreateInviteCodeDialogTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
3
11
|
export default CreateInviteCodeDialog;
|
|
@@ -1,127 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Button
|
|
4
|
-
import {
|
|
5
|
-
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, useForm, } from "@schemavaults/ui";
|
|
6
|
-
import { useAppEnvironment, useAuth } from "@schemavaults/auth-react-provider";
|
|
7
|
-
import { useSWRConfig } from "swr";
|
|
8
|
-
import { inviteCodeDefinitionSchema, } from "@schemavaults/auth-common";
|
|
9
|
-
import { SCHEMAVAULTS_AUTH_APP_DEFINITION, } from "@schemavaults/app-definitions";
|
|
10
|
-
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
+
import { Button } from "@schemavaults/ui";
|
|
4
|
+
import { Dialog, DialogContent } from "@schemavaults/ui";
|
|
11
5
|
import { SwatchBook } from "lucide-react";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
const auth = useAuth();
|
|
24
|
-
const { mutate } = useSWRConfig();
|
|
25
|
-
const environment = useAppEnvironment();
|
|
26
|
-
const clearInviteCodesCache = useCallback(() => {
|
|
27
|
-
mutate((key) => typeof key === "string" && key.startsWith("/api/admin/invite-codes"), undefined, { revalidate: true });
|
|
28
|
-
}, [mutate]);
|
|
29
|
-
async function onSubmit(values) {
|
|
30
|
-
if (environment === "development") {
|
|
31
|
-
console.log("Submitting invite code creation form with values: ", values);
|
|
32
|
-
toast({
|
|
33
|
-
variant: "default",
|
|
34
|
-
title: "Submitting invite code creation form...",
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const newInviteCode = {
|
|
38
|
-
...values,
|
|
39
|
-
created_at: Date.now(),
|
|
40
|
-
};
|
|
41
|
-
const authClient = auth.ready ? auth.client.current : undefined;
|
|
42
|
-
if (!authClient) {
|
|
43
|
-
toast({
|
|
44
|
-
variant: "destructive",
|
|
45
|
-
title: "Auth client not ready",
|
|
46
|
-
description: `Cannot acquire an access token yet`,
|
|
47
|
-
});
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
let auth_access_jwt;
|
|
51
|
-
try {
|
|
52
|
-
const auth_jwt = await authClient.acquireAccessToken({
|
|
53
|
-
token_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
54
|
-
audience: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
55
|
-
});
|
|
56
|
-
if (!auth_jwt)
|
|
57
|
-
throw new Error("Failed to acquire auth access token");
|
|
58
|
-
auth_access_jwt = auth_jwt;
|
|
59
|
-
}
|
|
60
|
-
catch (e) {
|
|
61
|
-
toast({
|
|
62
|
-
variant: "destructive",
|
|
63
|
-
title: "Error loading authentication access token",
|
|
64
|
-
description: e instanceof Error ? e.message : `Failed to prepare network request`,
|
|
65
|
-
});
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
const response = await fetch(`/api/admin/invite-codes`, {
|
|
70
|
-
method: "POST",
|
|
71
|
-
headers: {
|
|
72
|
-
Authorization: `Bearer ${auth_access_jwt.token}}`,
|
|
73
|
-
},
|
|
74
|
-
body: JSON.stringify(newInviteCode),
|
|
75
|
-
});
|
|
76
|
-
if (!response.ok || response.status !== 200) {
|
|
77
|
-
throw new Error(`Invite code creation request has bad status: ${response.status}`);
|
|
78
|
-
}
|
|
79
|
-
const body = await response.json();
|
|
80
|
-
if (typeof body !== "object") {
|
|
81
|
-
throw new Error("Expected JSON object response from invite code creation attempt");
|
|
82
|
-
}
|
|
83
|
-
if (!Object.hasOwn(body, "success")) {
|
|
84
|
-
throw new Error("No success field in response");
|
|
85
|
-
}
|
|
86
|
-
if (!(typeof body.success === "boolean" &&
|
|
87
|
-
body.success)) {
|
|
88
|
-
console.error(body);
|
|
89
|
-
throw new Error("Invite code creation response has success flag set to false");
|
|
90
|
-
}
|
|
91
|
-
if (environment === "development") {
|
|
92
|
-
console.log("Received response: ", body);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
catch (e) {
|
|
96
|
-
toast({
|
|
97
|
-
variant: "destructive",
|
|
98
|
-
title: "Failed to create new invite code!",
|
|
99
|
-
description: e instanceof Error ? e.message : `Failed to send network request`,
|
|
100
|
-
});
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
toast({
|
|
104
|
-
variant: "default",
|
|
105
|
-
title: "Created new invite code successfully!",
|
|
106
|
-
description: "New users should now be able to use it to register!",
|
|
107
|
-
});
|
|
108
|
-
clearInviteCodesCache();
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsxs(Button, { id: "open-create-invite-code-dialog-button", children: [_jsx(SwatchBook, { className: "h-4 w-4 mr-2" }), " Create Invite Code"] }) }), _jsx(DialogContent, { id: "create-invite-code-dialog-content", className: "sm:max-w-[425px]", children: _jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit, function onSubmitInviteCodeCreationFormError(e) {
|
|
112
|
-
console.error(e);
|
|
113
|
-
toast({
|
|
114
|
-
variant: "destructive",
|
|
115
|
-
title: "Failed to submit invite code creation form",
|
|
116
|
-
description: "Failed to parse form into a valid invite code definition object!",
|
|
117
|
-
});
|
|
118
|
-
}), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Create a new invite code" }), _jsx(DialogDescription, { children: "Create a new invite code for a new promotion or group of users." })] }), _jsx(FormField, { control: form.control, name: "invite_code", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Invite Code" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "BLAHBLAHBLAH420", ...field, name: "invite_code" }) }), _jsx(FormDescription, { children: "Enter the new invite code." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "description", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Description" }), _jsx(FormControl, { children: _jsx(Textarea, { placeholder: "e.g. Facebook Ad Campaign", ...field, name: "description" }) }), _jsx(FormDescription, { children: "Describe the promotion or group this invite code is for." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "max_uses", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Maximum # of Uses" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "99999", ...field, name: "max_uses", onChange: (e) => {
|
|
119
|
-
let asInt = e.target.valueAsNumber;
|
|
120
|
-
if (typeof asInt !== "number" || isNaN(asInt)) {
|
|
121
|
-
asInt = 1;
|
|
122
|
-
}
|
|
123
|
-
field.onChange(asInt);
|
|
124
|
-
}, type: "number", step: 1, min: 1 }) }), _jsx(FormDescription, { children: "Limit usage of this code to a certain number of registrations." }), _jsx(FormMessage, {})] })) }), _jsx(DialogFooter, { children: _jsxs(Button, { type: "submit", id: "submit-create-invite-code-form-button", children: [_jsx(SwatchBook, { className: "h-4 w-4 mr-2" }), "Create new invite code"] }) })] }) }) })] }));
|
|
6
|
+
import CreateInviteCodeForm from "./CreateInviteCodeForm";
|
|
7
|
+
export function CreateInviteCodeDialog({ open, onOpenChange, }) {
|
|
8
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { id: "create-invite-code-dialog-content", className: "sm:max-w-[425px]", children: _jsx(CreateInviteCodeForm, { onSuccess: () => onOpenChange(false) }) }) }));
|
|
9
|
+
}
|
|
10
|
+
export function CreateInviteCodeDialogTrigger({ onOpenChange, }) {
|
|
11
|
+
return (_jsxs(Button, { id: "open-create-invite-code-dialog-button", onClick: (e) => {
|
|
12
|
+
e.preventDefault();
|
|
13
|
+
onOpenChange(true);
|
|
14
|
+
}, children: [_jsx(SwatchBook, { className: "h-4 w-4 mr-2" }), " Create Invite Code"] }));
|
|
125
15
|
}
|
|
126
16
|
export default CreateInviteCodeDialog;
|
|
127
17
|
//# sourceMappingURL=CreateInviteCodeDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateInviteCodeDialog.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/CreateInviteCodeDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,
|
|
1
|
+
{"version":3,"file":"CreateInviteCodeDialog.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/CreateInviteCodeDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAO1D,MAAM,UAAU,sBAAsB,CAAC,EACrC,IAAI,EACJ,YAAY,GACgB;IAC5B,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,YAC5C,KAAC,aAAa,IACZ,EAAE,EAAC,mCAAmC,EACtC,SAAS,EAAC,kBAAkB,YAE5B,KAAC,oBAAoB,IAAC,SAAS,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,GAAI,GAChD,GACT,CACV,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,6BAA6B,CAAC,EAC5C,YAAY,GACuB;IACnC,OAAO,CACL,MAAC,MAAM,IACL,EAAE,EAAC,uCAAuC,EAC1C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,aAED,KAAC,UAAU,IAAC,SAAS,EAAC,cAAc,GAAG,2BAChC,CACV,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
export const CreateInviteCodeDialogDispatchContext = createContext((val) => {
|
|
4
|
+
void val;
|
|
5
|
+
throw new Error("Not within CreateInviteCodeDialogDispatchContext.Provider render tree!");
|
|
6
|
+
});
|
|
7
|
+
export default CreateInviteCodeDialogDispatchContext;
|
|
8
|
+
//# sourceMappingURL=CreateInviteCodeDialogDispatchContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateInviteCodeDialogDispatchContext.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/CreateInviteCodeDialogDispatchContext.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,CAAC,MAAM,qCAAqC,GAAG,aAAa,CAEhE,CAAC,GAAY,EAAE,EAAE;IACjB,KAAK,GAAG,CAAC;IACT,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Textarea, useToast, } from "@schemavaults/ui";
|
|
4
|
+
import { useCallback, useTransition } from "react";
|
|
5
|
+
import { DialogDescription, DialogFooter, DialogHeader, DialogTitle, useForm, } from "@schemavaults/ui";
|
|
6
|
+
import { useAppEnvironment } from "@schemavaults/auth-react-provider";
|
|
7
|
+
import { useSWRConfig } from "swr";
|
|
8
|
+
import { inviteCodeDefinitionSchema, } from "@schemavaults/auth-common";
|
|
9
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
10
|
+
import { SwatchBook } from "lucide-react";
|
|
11
|
+
export function CreateInviteCodeForm({ onSuccess, }) {
|
|
12
|
+
const { toast } = useToast();
|
|
13
|
+
const form = useForm({
|
|
14
|
+
resolver: zodResolver(inviteCodeDefinitionSchema),
|
|
15
|
+
defaultValues: {
|
|
16
|
+
invite_code: "",
|
|
17
|
+
description: "",
|
|
18
|
+
max_uses: 1,
|
|
19
|
+
created_at: Date.now(),
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
const { mutate } = useSWRConfig();
|
|
23
|
+
const environment = useAppEnvironment();
|
|
24
|
+
const [submitting, startSubmitting] = useTransition();
|
|
25
|
+
const clearInviteCodesCache = useCallback(() => {
|
|
26
|
+
mutate((key) => typeof key === "string" && key.startsWith("/api/admin/invite-codes"), undefined, { revalidate: true });
|
|
27
|
+
}, [mutate]);
|
|
28
|
+
async function onSubmit(values) {
|
|
29
|
+
if (environment === "development") {
|
|
30
|
+
console.log("Submitting invite code creation form with values: ", values);
|
|
31
|
+
toast({
|
|
32
|
+
variant: "default",
|
|
33
|
+
title: "Submitting invite code creation form...",
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const newInviteCode = {
|
|
37
|
+
...values,
|
|
38
|
+
created_at: Date.now(),
|
|
39
|
+
};
|
|
40
|
+
startSubmitting(async () => {
|
|
41
|
+
const parsedNewInviteCode = await inviteCodeDefinitionSchema.safeParseAsync(newInviteCode);
|
|
42
|
+
if (!parsedNewInviteCode.success) {
|
|
43
|
+
console.error("Failed to parse new invite code object: ", parsedNewInviteCode.error);
|
|
44
|
+
toast({
|
|
45
|
+
variant: "destructive",
|
|
46
|
+
title: "Failed to parse new invite code object",
|
|
47
|
+
description: "Not prepared to send creation request!",
|
|
48
|
+
});
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const response = await fetch(`/api/admin/invite-codes`, {
|
|
53
|
+
method: "POST",
|
|
54
|
+
body: JSON.stringify(newInviteCode),
|
|
55
|
+
credentials: "include",
|
|
56
|
+
});
|
|
57
|
+
if (!response.ok || response.status !== 200) {
|
|
58
|
+
throw new Error(`Invite code creation request has bad status: ${response.status}`);
|
|
59
|
+
}
|
|
60
|
+
const body = await response.json();
|
|
61
|
+
if (typeof body !== "object") {
|
|
62
|
+
throw new Error("Expected JSON object response from invite code creation attempt");
|
|
63
|
+
}
|
|
64
|
+
if (!Object.hasOwn(body, "success")) {
|
|
65
|
+
throw new Error("No success field in response");
|
|
66
|
+
}
|
|
67
|
+
if (!(typeof body.success === "boolean" &&
|
|
68
|
+
body.success)) {
|
|
69
|
+
console.error(body);
|
|
70
|
+
throw new Error("Invite code creation response has success flag set to false");
|
|
71
|
+
}
|
|
72
|
+
if (environment === "development") {
|
|
73
|
+
console.log("Received response: ", body);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
toast({
|
|
78
|
+
variant: "destructive",
|
|
79
|
+
title: "Failed to create new invite code!",
|
|
80
|
+
description: e instanceof Error ? e.message : `Failed to send network request`,
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
toast({
|
|
85
|
+
variant: "default",
|
|
86
|
+
title: "Created new invite code successfully!",
|
|
87
|
+
description: "New users should now be able to use it to register!",
|
|
88
|
+
});
|
|
89
|
+
clearInviteCodesCache();
|
|
90
|
+
onSuccess();
|
|
91
|
+
form.reset();
|
|
92
|
+
return;
|
|
93
|
+
});
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return (_jsx(Form, { ...form, children: _jsxs("form", { onSubmit: form.handleSubmit(onSubmit, function onSubmitInviteCodeCreationFormError(e) {
|
|
97
|
+
console.error(e);
|
|
98
|
+
toast({
|
|
99
|
+
variant: "destructive",
|
|
100
|
+
title: "Failed to submit invite code creation form",
|
|
101
|
+
description: "Failed to parse form into a valid invite code definition object!",
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
104
|
+
}), className: "flex flex-col justify-start gap-4", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Create a new invite code" }), _jsx(DialogDescription, { children: "Create a new invite code for a new promotion or group of users." })] }), _jsx(FormField, { control: form.control, name: "invite_code", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Invite Code" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "BLAHBLAHBLAH420", ...field, name: "invite_code", disabled: field.disabled || submitting }) }), _jsx(FormDescription, { children: "Enter the new invite code." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "description", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Description" }), _jsx(FormControl, { children: _jsx(Textarea, { placeholder: "e.g. Facebook Ad Campaign", ...field, name: "description", disabled: field.disabled || submitting }) }), _jsx(FormDescription, { children: "Describe the promotion or group this invite code is for." }), _jsx(FormMessage, {})] })) }), _jsx(FormField, { control: form.control, name: "max_uses", render: ({ field }) => (_jsxs(FormItem, { children: [_jsx(FormLabel, { children: "Maximum # of Uses" }), _jsx(FormControl, { children: _jsx(Input, { placeholder: "99999", ...field, name: "max_uses", onChange: (e) => {
|
|
105
|
+
let asInt = e.target.valueAsNumber;
|
|
106
|
+
if (typeof asInt !== "number" || isNaN(asInt)) {
|
|
107
|
+
asInt = 1;
|
|
108
|
+
}
|
|
109
|
+
field.onChange(asInt);
|
|
110
|
+
}, type: "number", step: 1, min: 1, disabled: field.disabled || submitting }) }), _jsx(FormDescription, { children: "Limit usage of this code to a certain number of registrations." }), _jsx(FormMessage, {})] })) }), _jsx(DialogFooter, { children: _jsxs(Button, { type: "submit", id: "submit-create-invite-code-form-button", children: [_jsx(SwatchBook, { className: "h-4 w-4 mr-2" }), "Create new invite code"] }) })] }) }));
|
|
111
|
+
}
|
|
112
|
+
export default CreateInviteCodeForm;
|
|
113
|
+
//# sourceMappingURL=CreateInviteCodeForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateInviteCodeForm.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/CreateInviteCodeForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,eAAe,EACf,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,OAAO,CAAC;AAEtE,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAEL,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAM1C,MAAM,UAAU,oBAAoB,CAAC,EACnC,SAAS,GACiB;IAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC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AAG,IACN,CACZ,GACD,EAEF,KAAC,YAAY,cACX,MAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAC,uCAAuC,aAC9D,KAAC,UAAU,IAAC,SAAS,EAAC,cAAc,GAAG,8BAEhC,GACI,IACV,GACF,CACR,CAAC;AACJ,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
export { CreateInviteCodeDialog, CreateInviteCodeDialog as default, } from "./CreateInviteCodeDialog";
|
|
1
|
+
export { CreateInviteCodeDialog, CreateInviteCodeDialogTrigger, CreateInviteCodeDialog as default, } from "./CreateInviteCodeDialog";
|
|
2
|
+
export type { CreateInviteCodeDialogProps, CreateInviteCodeDialogTriggerProps, } from "./CreateInviteCodeDialog";
|
|
3
|
+
export { CreateInviteCodeDialogDispatchContext } from "./CreateInviteCodeDialogDispatchContext";
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { CreateInviteCodeDialog, CreateInviteCodeDialog as default, } from "./CreateInviteCodeDialog";
|
|
1
|
+
export { CreateInviteCodeDialog, CreateInviteCodeDialogTrigger, CreateInviteCodeDialog as default, } from "./CreateInviteCodeDialog";
|
|
2
|
+
export { CreateInviteCodeDialogDispatchContext } from "./CreateInviteCodeDialogDispatchContext";
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,sBAAsB,IAAI,OAAO,GAClC,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CreateInviteCodeDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,sBAAsB,IAAI,OAAO,GAClC,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
export interface CreateOrganizationDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (val: boolean) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function CreateOrganizationDialog({
|
|
7
|
-
export {
|
|
6
|
+
export declare function CreateOrganizationDialog({ open, onOpenChange, }: CreateOrganizationDialogProps): ReactElement;
|
|
7
|
+
export interface CreateOrganizationDialogTriggerProps {
|
|
8
|
+
onOpenChange: (val: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function CreateOrganizationDialogTrigger({ onOpenChange, }: CreateOrganizationDialogTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default CreateOrganizationDialog;
|