Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+9
-24
@@ -9,7 +9,7 @@ import {
|
||||
getAllSubscriptionProductsWithTenants,
|
||||
getSubscriptionProduct,
|
||||
updateSubscriptionProduct,
|
||||
} from "@toolctrl/db/subscriptions.server";
|
||||
} from "@hivegrid/db/subscriptions.server";
|
||||
import { getTranslations } from "~/locale/i18next.server";
|
||||
import { SubscriptionProductDto } from "~/application/dtos/subscriptions/SubscriptionProductDto";
|
||||
import { createPlans, deletePlan, syncPlan } from "~/utils/services/.server/pricingService";
|
||||
@@ -23,7 +23,6 @@ import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsServ
|
||||
import { useAdminData } from "~/utils/data/useAdminData";
|
||||
import InputSelect from "~/components/ui/input/InputSelect";
|
||||
import WarningBanner from "~/components/ui/banners/WarningBanner";
|
||||
import { isStripeTestMode } from "~/utils/stripe.server";
|
||||
import TableSimple from "~/components/ui/tables/TableSimple";
|
||||
import SimpleBadge from "~/components/ui/badges/SimpleBadge";
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
@@ -39,11 +38,11 @@ import BackButtonWithTitle from "~/components/ui/buttons/BackButtonWithTitle";
|
||||
import { validateCSRFToken } from "~/utils/session.server";
|
||||
import { appendCSRFToken } from "~/utils/csrf";
|
||||
import { useLocaleFormatters } from "~/locale/format";
|
||||
import { HIVEGRID_SUBSCRIPTION_PRICING_MODELS, isHiveGridSubscriptionPricingModel } from "~/application/pricing/pricingModelPolicy";
|
||||
export const meta: MetaFunction<typeof loader> = ({ data }) => [{ title: data?.title }];
|
||||
|
||||
type LoaderData = {
|
||||
title: string;
|
||||
isStripeTest: boolean;
|
||||
items: SubscriptionProductDto[];
|
||||
};
|
||||
|
||||
@@ -52,7 +51,6 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
|
||||
const { t } = await getTranslations(request);
|
||||
const data: LoaderData = {
|
||||
title: `${t("admin.pricing.title")} | ${process.env.APP_NAME}`,
|
||||
isStripeTest: isStripeTestMode(),
|
||||
items: await getAllSubscriptionProductsWithTenants(),
|
||||
};
|
||||
|
||||
@@ -79,6 +77,9 @@ export const action: ActionFunction = async ({ request }) => {
|
||||
if (action === "create-all-plans") {
|
||||
await verifyUserHasPermission(request, "admin.pricing.create");
|
||||
const model = Number(form.get("model")) as PricingModel;
|
||||
if (model !== PricingModel.ALL && !isHiveGridSubscriptionPricingModel(model)) {
|
||||
return badRequest({ error: t("shared.invalidForm") });
|
||||
}
|
||||
const items = await getAllSubscriptionProducts();
|
||||
if (items.length > 0) {
|
||||
return Response.json({
|
||||
@@ -347,26 +348,10 @@ export default function AdminPricingRoute() {
|
||||
setModel(Number(e));
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
name: t("pricing." + PricingModel[PricingModel.FLAT_RATE]),
|
||||
value: PricingModel.FLAT_RATE,
|
||||
},
|
||||
{
|
||||
name: t("pricing." + PricingModel[PricingModel.PER_SEAT]),
|
||||
value: PricingModel.PER_SEAT,
|
||||
},
|
||||
{
|
||||
name: t("pricing." + PricingModel[PricingModel.USAGE_BASED]),
|
||||
value: PricingModel.USAGE_BASED,
|
||||
},
|
||||
{
|
||||
name: t("pricing." + PricingModel[PricingModel.FLAT_RATE_USAGE_BASED]),
|
||||
value: PricingModel.FLAT_RATE_USAGE_BASED,
|
||||
},
|
||||
{
|
||||
name: t("pricing." + PricingModel[PricingModel.ONCE]),
|
||||
value: PricingModel.ONCE,
|
||||
},
|
||||
...HIVEGRID_SUBSCRIPTION_PRICING_MODELS.map((value) => ({
|
||||
name: t("pricing." + PricingModel[value]),
|
||||
value,
|
||||
})),
|
||||
{
|
||||
name: t("shared.all"),
|
||||
value: PricingModel.ALL,
|
||||
|
||||
Reference in new issue
Block a user