-
Notifications
You must be signed in to change notification settings - Fork 0
Susmoycurrency #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Susmoycurrency #159
Conversation
This reverts commit 2fbe215.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR appears to localize the storefront/admin experience for Bangladesh (BDT / bn-BD / Asia-Dhaka), simplify checkout totals by removing tax from cart calculations/UI, and fix/align analytics API responses with the frontend (including adding E2E coverage).
Changes:
- Switch defaults and UI display from USD to BDT (and related locale/timezone defaults).
- Remove estimated tax from cart/store UI and cart total calculation.
- Align analytics endpoints’ response shapes and date parsing; add Playwright E2E tests.
Reviewed changes
Copilot reviewed 66 out of 83 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| test-results/.playwright-artifacts-94/27376374300dfd4c17ed0c876dbd8679.webm | Playwright artifact added (test output video). |
| test-results/.playwright-artifacts-93/b77902f0d17ca3636c320006f3f1c6bc.webm | Playwright artifact added (test output video). |
| test-results/.playwright-artifacts-93/96507b703850bd86d86c0c90ea223ce7.png | Playwright artifact added (test output screenshot). |
| test-results/.playwright-artifacts-93/53799fedc676500758b58c88b0a4d137.webm | Playwright artifact added (test output video). |
| test-results/.playwright-artifacts-0/ba17c804a0ae05557a39a7b9e7c20c62.webm | Playwright artifact added (test output video). |
| test-results/.playwright-artifacts-0/626b241b95209db735a5ffa3865cd7f2.png | Playwright artifact added (test output screenshot). |
| src/test/vitest.d.ts | Adjust eslint-disable comments for Vitest matcher typings. |
| src/lib/utils.ts | Default currency/locale switched to BDT/bn-BD; rename helper to taka + backward-compatible alias. |
| src/lib/stores/cart-store.ts | Remove tax from totals and simplify cart totals (shipping + subtotal). |
| src/lib/storefront/defaults.ts | Trust badge copy updated for ৳5,000 threshold. |
| src/lib/services/store.service.ts | Store creation defaults updated for BD/BDT/Asia-Dhaka. |
| src/lib/services/order-processing.service.ts | Increase Prisma transaction timeouts; update email total currency symbol. |
| src/lib/services/discount.service.ts | Discount min-order error message updated to ৳. |
| src/lib/services/checkout.service.ts | Update free-shipping comment for ৳5,000; domestic rules include BD. |
| src/lib/services/analytics.service.ts | Fix naming and expand customer metrics (retention, churn, LTV). |
| src/lib/prisma.ts | Guard Prisma $on('query') listener attachment to avoid duplicates in dev. |
| src/components/ui/enhanced-data-table.tsx | Remove eslint disable note for TanStack/React Compiler handling. |
| src/components/stores/store-form-dialog.tsx | Default store currency to BDT; remove taxRate field from UI/schema. |
| src/components/storefront/product-grid.tsx | Display prices using ৳ symbol. |
| src/components/storefront/discount-banner.tsx | Adjust client-side dismissal/expiry checks to avoid hydration mismatch. |
| src/components/section-cards.tsx | Demo “Total Revenue” display changed to ৳. |
| src/components/products/product-quick-view.tsx | Default currency symbol changed to ৳. |
| src/components/products/price-range-filter.tsx | Preset ranges updated for BDT scale. |
| src/components/products-table.tsx | Display prices using ৳. |
| src/components/product/variant-manager.tsx | Display variant prices using ৳. |
| src/components/price-range-filter.tsx | Default currency code switched to BDT. |
| src/components/orders/refund-dialog.tsx | Use bn-BD/BDT formatting for refund amounts. |
| src/components/orders-table.tsx | Use bn-BD/BDT formatting for amounts. |
| src/components/order-detail-client.tsx | Use bn-BD/BDT formatting; remove tax line item display. |
| src/components/notifications/notifications-list.tsx | Mock notification message updated to ৳. |
| src/components/dashboards/super-admin-dashboard.tsx | Revenue display switched to ৳. |
| src/components/dashboards/store-admin-dashboard.tsx | Revenue display switched to ৳. |
| src/components/dashboard/storefront/trust-badges-editor.tsx | Placeholder updated for ৳5,000 threshold. |
| src/components/customers/customers-list.tsx | Use bn-BD/BDT formatting for customer spend. |
| src/components/customers/customer-detail-dialog.tsx | Use bn-BD/BDT formatting for customer spend. |
| src/components/checkout/payment-method-step.tsx | Mock totals updated to ৳; remove tax line. |
| src/components/checkout/cart-review-step.tsx | Show ৳ prices; update copy to “Shipping calculated…” (no tax). |
| src/components/cart/cart-list.tsx | Remove tax from mock cart + UI; show ৳ amounts. |
| src/components/cart/cart-drawer.tsx | Default currency symbol changed to ৳; update copy to “Shipping calculated…”. |
| src/components/analytics/top-products-table.tsx | Use bn-BD/BDT formatting for revenue. |
| src/components/analytics/revenue-chart.tsx | Use bn-BD/BDT formatting for revenue. |
| src/components/analytics/customer-metrics.tsx | Use bn-BD/BDT formatting and update default display. |
| src/components/analytics/analytics-dashboard.tsx | Improve refresh behavior, abort fetches, add logging, switch to bn-BD/BDT formatting. |
| src/components/analytics-dashboard.tsx | Use bn-BD/BDT formatting. |
| src/components/admin/store-request-actions.tsx | Subscription plan pricing labels updated to ৳. |
| src/components/admin/admin-dashboard.tsx | Admin revenue display switched to ৳. |
| src/app/store/[slug]/products/[productSlug]/page.tsx | Free shipping copy updated to ৳5,000. |
| src/app/store/[slug]/components/price-display.tsx | Display prices using ৳ symbol. |
| src/app/store/[slug]/components/cart-item.tsx | Display prices using ৳ symbol. |
| src/app/store/[slug]/checkout/page.tsx | Remove tax from checkout totals and order payload; display ৳. |
| src/app/store/[slug]/cart/page.tsx | Remove estimated tax display; adjust free shipping notice to 5000; display ৳. |
| src/app/checkout/page.tsx | Mock checkout totals updated to ৳; remove tax line. |
| src/app/checkout/confirmation/page.tsx | Confirmation mock total updated to ৳. |
| src/app/api/subscriptions/subscribe/route.ts | Mock subscription amounts/currency switched to BDT. |
| src/app/api/subscriptions/status/route.ts | Mock subscription amounts/currency switched to BDT. |
| src/app/api/subscriptions/route.ts | Mock subscription amounts/currency switched to BDT. |
| src/app/api/stores/[id]/settings/route.ts | Remove taxRate from schema; defaults switched to BDT/Asia-Dhaka/bn. |
| src/app/api/store/[slug]/orders/route.ts | Default currency formatting switched to bn-BD/BDT. |
| src/app/api/shipping/rates/route.ts | Switch shipping carriers and domestic detection to BD; return BDT. |
| src/app/api/orders/[id]/invoice/route.ts | Invoice text updated to ৳. |
| src/app/api/integrations/[id]/route.ts | Integration settings currency switched to BDT. |
| src/app/api/checkout/payment-intent/route.ts | Default currency switched to bdt. |
| src/app/api/analytics/sales/route.ts | Normalize from/to date parsing to full-day boundaries. |
| src/app/api/analytics/revenue/route.ts | Normalize date parsing and wrap response in { data: ... }. |
| src/app/api/analytics/products/top/route.ts | Map sales -> unitsSold and wrap response in { data: ... }. |
| src/app/api/analytics/dashboard/route.ts | Normalize date parsing to full-day boundaries. |
| src/app/api/analytics/customers/route.ts | Support startDate/endDate params, normalize date parsing, and wrap { data: ... }. |
| src/app/admin/stores/[id]/page.tsx | Admin store detail displays amounts using ৳. |
| src/app/admin/analytics/page.tsx | Admin analytics revenue display switched to ৳. |
| prisma/seed.ts | Seed data updated for BD phone/address/currency/timezone/locale. |
| prisma/seed.mjs | Seed data updated for BD phone/address/currency/timezone/locale. |
| prisma/schema.prisma | Store defaults updated to BD/BDT/Asia-Dhaka/bn. |
| package-lock.json | Lockfile updated (peer flags, dev flags). |
| e2e/analytics.spec.ts | Add Playwright E2E tests validating analytics UI + API response shapes. |
| country: z.string().default('BD'), | ||
| currency: z.string().default('BDT'), | ||
| timezone: z.string().default('Asia/Dhaka'), | ||
| locale: z.string().default('en'), | ||
| subscriptionPlan: z.nativeEnum(SubscriptionPlan).default(SubscriptionPlan.FREE), |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CreateStoreSchema defaults locale to 'en', but Prisma Store.locale now defaults to 'bn' and the seeds also use 'bn'. Keeping 'en' here will override the DB default and create stores with an unexpected locale. Consider defaulting to 'bn' (or removing the Zod default to let Prisma defaults apply).
| // Retention: customers from previous period who also ordered in current period | ||
| let retainedCustomers = 0; | ||
| if (previousPeriodCustomerIds.length > 0) { | ||
| const retained = customerIdsInPeriod.filter(id => previousPeriodCustomerIds.includes(id)); | ||
| retainedCustomers = retained.length; | ||
| } |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retention calculation uses previousPeriodCustomerIds.includes(id) inside a filter, which is O(n²) for larger customer sets. Consider converting previousPeriodCustomerIds to a Set and doing O(1) lookups when counting retained customers.
| console.log(`[Analytics] Fetching dashboard for ${timeRange}: ${from} to ${to}`); | ||
|
|
||
| const response = await fetch(`/api/analytics/dashboard?${params}`, { | ||
| signal: abortController.signal, | ||
| cache: 'no-store', | ||
| }); | ||
| if (!response.ok) throw new Error('Failed to fetch analytics'); | ||
|
|
||
| const data = await response.json(); | ||
| console.log(`[Analytics] Received dashboard data:`, data); | ||
| setMetrics(data); |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds console.log statements that will run in production on the client and can leak data to user consoles. Prefer removing them or gating them behind a development check (e.g., process.env.NODE_ENV === 'development').
| // React Compiler note: disable the incompatible-library check for useReactTable | ||
| // eslint-disable-next-line react-hooks/incompatible-library | ||
| const table = useReactTable({ | ||
| data, |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment says we need to disable react-hooks/incompatible-library for useReactTable, but the eslint-disable was removed. This will diverge from the established pattern in src/components/data-table.tsx:368-372 and may reintroduce the React Compiler/TanStack warning. Either restore the disable for this call or remove the note if it’s no longer needed.
| test.beforeAll(async ({ browser }) => { | ||
| // Create a new context and page | ||
| const context = await browser.newContext(); | ||
| authenticatedPage = await context.newPage(); | ||
|
|
||
| // Login once | ||
| await loginWithCredentials(authenticatedPage); | ||
|
|
||
| // Navigate to analytics | ||
| await authenticatedPage.goto("/dashboard/analytics"); | ||
| await authenticatedPage.waitForLoadState("networkidle"); | ||
| }); | ||
|
|
||
| test.afterAll(async () => { | ||
| if (authenticatedPage) { | ||
| await authenticatedPage.close(); | ||
| } |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Playwright beforeAll creates a browser context but only closes the page in afterAll. This can leak resources across the test run. Store the context in a variable and close the context in afterAll (closing the context will also close its pages).
| // Add free shipping for domestic orders over ৳5,000 | ||
| if (isDomestic && cartSubtotal >= 50) { | ||
| options.push({ |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The free-shipping threshold is documented as “over ৳5,000”, but the logic still uses cartSubtotal >= 50, so free shipping will trigger at 50 (taka) instead of 5000. Update the threshold to 5000 (or read it from store settings) to match the UI copy and other BDT changes.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
No description provided.