chore: bump package version to 0.1.12

This commit is contained in:
2025-09-30 21:04:56 +02:00
parent f7d6066d9a
commit 552ec700c2
3 changed files with 8 additions and 8 deletions

View File

@@ -55,6 +55,6 @@ export interface BillingPluginConfig {
customerInfoExtractor?: CustomerInfoExtractor // Callback to extract customer info from relationship
customerRelationSlug?: string // Customer collection slug for relationship
disabled?: boolean
providers?: PaymentProvider[]
providers?: (PaymentProvider | undefined | null)[]
}

View File

@@ -28,8 +28,8 @@ export const billingPlugin = (pluginConfig: BillingPluginConfig = {}) => (config
];
(pluginConfig.providers || [])
.filter(provider => provider.onConfig)
.forEach(provider => provider.onConfig!(config, pluginConfig))
.filter(provider => provider?.onConfig)
.forEach(provider => provider?.onConfig!(config, pluginConfig))
const incomingOnInit = config.onInit
config.onInit = async (payload) => {
@@ -38,17 +38,17 @@ export const billingPlugin = (pluginConfig: BillingPluginConfig = {}) => (config
}
singleton.set(payload, {
config: pluginConfig,
providerConfig: (pluginConfig.providers || []).reduce(
providerConfig: (pluginConfig.providers || []).filter(Boolean).reduce(
(record, provider) => {
record[provider.key] = provider
record[provider!.key] = provider as PaymentProvider
return record
},
{} as Record<string, PaymentProvider>
)
} satisfies BillingPlugin)
await Promise.all((pluginConfig.providers || [])
.filter(provider => provider.onInit)
.map(provider => provider.onInit!(payload)))
.filter(provider => provider?.onInit)
.map(provider => provider?.onInit!(payload)))
}
return config