This commit replaces the use of Logger with getLogger in various parts of the code to handle logging. The Logger has been replaced with getLogger, which assists in getting logs in an asynchronous manner. In addition to this, it updates the next version in pnpm-lock.yaml from next@14.2.0-canary.61 to next@14.2.0-canary.62 and various other dependencies. Also made minor annotations and comments to the function 'isBrowser' and 'formatCurrency' in the 'utils.ts' file.
28 lines
688 B
TypeScript
28 lines
688 B
TypeScript
import 'server-only';
|
|
|
|
import { getLogger } from '@kit/shared/logger';
|
|
|
|
import { getLemonSqueezyEnv } from '../schema/lemon-squeezy-server-env.schema';
|
|
|
|
/**
|
|
* @description Initialize the Lemon Squeezy client
|
|
*/
|
|
export async function initializeLemonSqueezyClient() {
|
|
const { lemonSqueezySetup } = await import('@lemonsqueezy/lemonsqueezy.js');
|
|
const env = getLemonSqueezyEnv();
|
|
const logger = await getLogger();
|
|
|
|
lemonSqueezySetup({
|
|
apiKey: env.secretKey,
|
|
onError(error) {
|
|
logger.error(
|
|
{
|
|
name: `billing.lemon-squeezy`,
|
|
error: error.message,
|
|
},
|
|
'Encountered an error using the Lemon Squeezy SDK',
|
|
);
|
|
},
|
|
});
|
|
}
|