✨ feat(subscribe): Add subscription credits
This commit is contained in:
@@ -17,6 +17,7 @@ import * as React from 'react';
|
||||
export type Option<T = string> = {
|
||||
value: T;
|
||||
label: string;
|
||||
children?: React.ReactNode;
|
||||
};
|
||||
|
||||
// Conditional types to determine the value type for onChange
|
||||
@@ -98,11 +99,11 @@ export function Combobox<T, M extends boolean = false>({
|
||||
<CommandList>
|
||||
{options.map((option) => (
|
||||
<CommandItem
|
||||
key={String(option.label)}
|
||||
key={String(option.label + option.value)}
|
||||
value={option.label}
|
||||
onSelect={() => handleSelect(option.value)}
|
||||
>
|
||||
{option.label}
|
||||
{option.children || option.label}
|
||||
<CheckIcon
|
||||
className={cn(
|
||||
'ml-auto h-4 w-4',
|
||||
|
||||
@@ -1,32 +1,9 @@
|
||||
import { startOfMonth } from 'date-fns';
|
||||
|
||||
export * from '@workspace/ui/utils/countries';
|
||||
export * from '@workspace/ui/utils/formatting';
|
||||
export * from '@workspace/ui/utils/unit-conversions';
|
||||
|
||||
export const isBrowser = () => typeof window !== 'undefined';
|
||||
|
||||
export function getNextResetDate(startDate: Date | number) {
|
||||
const time = new Date(startDate);
|
||||
const resetDay = time.getDate();
|
||||
const currentDate = new Date();
|
||||
if (isNaN(time.getTime())) {
|
||||
throw new Error('Invalid start date');
|
||||
}
|
||||
if (currentDate.getDate() >= resetDay) {
|
||||
const startOfMonthNextReset = startOfMonth(currentDate);
|
||||
startOfMonthNextReset.setMonth(startOfMonthNextReset.getMonth() + 1);
|
||||
startOfMonthNextReset.setDate(resetDay);
|
||||
startOfMonthNextReset.setHours(time.getHours());
|
||||
startOfMonthNextReset.setMinutes(time.getMinutes());
|
||||
startOfMonthNextReset.setSeconds(time.getSeconds());
|
||||
return startOfMonthNextReset;
|
||||
} else {
|
||||
time.setMonth(currentDate.getMonth());
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the full domain or root domain from a URL.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user