Merge branch 'develop' into add-mail-invoice-receipt-schema

This commit is contained in:
Ahmed Bouhuolia
2024-11-10 14:37:11 +02:00
36 changed files with 4860 additions and 177 deletions

View File

@@ -1,3 +1,4 @@
import { Meta } from '@storybook/react';
import { StoryFn } from '@storybook/react';
import {
@@ -15,22 +16,3 @@ export default meta;
const Template: StoryFn<typeof InvoicePaymentEmail> = (
args: InvoicePaymentEmailProps
) => <InvoicePaymentEmail {...args} />;
export const PreviewInvoicePaymentMail = Template.bind({});
PreviewInvoicePaymentMail.args = {
preview: 'Preview text',
companyName: 'ABC Company',
companyLogoUri: 'https://example.com/logo.png',
invoiceAmount: '100.00',
dueDate: '2022-12-31',
invoiceMessage: 'Thank you for your purchase!',
invoiceNumber: 'INV-001',
dueAmount: '100.00',
total: '100.00',
viewInvoiceButtonUrl: 'https://example.com/invoice',
items: [
{ label: 'Item 1', quantity: '1', rate: '50.00' },
{ label: 'Item 2', quantity: '2', rate: '25.00' },
],
};

View File

@@ -4,7 +4,6 @@
"scripts": {
"build": "webpack --config webpack.config.js",
"lint": "eslint .",
"preview": "vite preview",
"storybook:dev": "storybook dev -p 6006",
"storybook:build": "storybook build"
},

View File

@@ -71,10 +71,12 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps {
totalLabel?: string;
total?: string;
// Discount
showDiscount?: boolean;
discountLabel?: string;
discount?: string;
// Subtotal
showSubtotal?: boolean;
subtotalLabel?: string;
subtotal?: string;
@@ -85,10 +87,10 @@ export interface InvoicePaperTemplateProps extends PaperTemplateProps {
showTaxes?: boolean;
// Due Amount
showDueAmount?: boolean;
showBalanceDue?: boolean;
balanceDueLabel?: string;
balanceDue?: string;
dueAmountLabel?: string;
dueAmount?: string;
// Footer
termsConditionsLabel?: string;
@@ -144,7 +146,7 @@ export function InvoicePaperTemplate({
subtotalLabel = 'Subtotal',
discountLabel = 'Discount',
paymentMadeLabel = 'Payment Made',
balanceDueLabel = 'Balance Due',
dueAmountLabel = 'Balance Due',
// Totals
showTotal = true,
@@ -153,13 +155,12 @@ export function InvoicePaperTemplate({
showTaxes = true,
showPaymentMade = true,
showDueAmount = true,
showBalanceDue = true,
total = '$662.75',
subtotal = '630.00',
discount = '0.00',
paymentMade = '100.00',
balanceDue = '$562.75',
dueAmount = '$562.75',
// Footer paragraphs.
termsConditionsLabel = 'Terms & Conditions',
@@ -297,10 +298,10 @@ export function InvoicePaperTemplate({
amount={paymentMade}
/>
)}
{showBalanceDue && (
{showDueAmount && (
<PaperTemplate.TotalLine
label={balanceDueLabel}
amount={balanceDue}
label={dueAmountLabel}
amount={dueAmount}
border={PaperTemplateTotalBorder.Dark}
style={{ fontWeight: 500 }}
/>

View File

@@ -19,7 +19,6 @@
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"target": "ESNext",
"types": ["vitest/globals"],
"resolveJsonModule": true,
"outDir": "dist",
},

View File

@@ -1,61 +0,0 @@
import react from '@vitejs/plugin-react';
import path from 'node:path';
import { defineConfig } from 'vitest/config';
import dts from 'vite-plugin-dts';
import tailwindcss from 'tailwindcss';
import { UserConfigExport } from 'vite';
import { name } from './package.json';
const app = async (): Promise<UserConfigExport> => {
/**
* Removes everything before the last
* @octocat/library-repo -> library-repo
* vite-component-library-template -> vite-component-library-template
*/
const formattedName = name.match(/[^/]+$/)?.[0] ?? name;
return defineConfig({
define: {
isBrowser: 'false', // This will replace isBrowser with false in the bundled code
},
ssr: {
noExternal: true,
},
plugins: [
react(),
dts({
insertTypesEntry: true,
}),
],
css: {
postcss: {
plugins: [tailwindcss],
},
},
build: {
lib: {
entry: path.resolve(__dirname, 'src/lib/main.ts'),
name: formattedName,
formats: ['es', 'umd'],
fileName: (format: string) => `${formattedName}.${format}.js`,
},
rollupOptions: {
// external: ['react', 'react/jsx-runtime', 'react-dom', 'tailwindcss'],
// output: {
// globals: {
// react: 'React',
// 'react/jsx-runtime': 'react/jsx-runtime',
// 'react-dom': 'ReactDOM',
// tailwindcss: 'tailwindcss',
// },
// },
},
},
test: {
globals: true,
environment: 'jsdom',
},
});
};
// https://vitejs.dev/config/
export default app;