From 79edea797313e9ae8ffe74ab3ff6ad2ac7d1cd47 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 2 Mar 2025 16:40:10 +0000 Subject: [PATCH 1/7] :bookmark: chore(release): v1.0.0-beta.26 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [1.0.0-beta.26](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2025-03-02) ### 🐛 Bug Fixes * **icon**: Comment out unused icon collection imports ([f17bf8d](https://github.com/perfect-panel/ppanel-web/commit/f17bf8d)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb7dcf4..188dd07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog +# [1.0.0-beta.26](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.25...v1.0.0-beta.26) (2025-03-02) + + +### 🐛 Bug Fixes + +* **icon**: Comment out unused icon collection imports ([f17bf8d](https://github.com/perfect-panel/ppanel-web/commit/f17bf8d)) + # [1.0.0-beta.25](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.24...v1.0.0-beta.25) (2025-03-01) diff --git a/package.json b/package.json index 8afa2a1..98c5c80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppanel-web", - "version": "1.0.0-beta.25", + "version": "1.0.0-beta.26", "private": true, "homepage": "https://github.com/perfect-panel/ppanel-web", "bugs": { From 85fdc36c141e33f878e86d2667e1f29b71b73521 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 13 Mar 2025 04:27:12 +0000 Subject: [PATCH 2/7] :bookmark: chore(release): v1.0.0-beta.27 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13) ### ♻ Code Refactoring * **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472)) * Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6)) ### ✨ Features * **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733)) * **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57)) * **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8)) * **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f)) ### 🎫 Chores * **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016)) ### 🐛 Bug Fixes * **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9)) * **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0)) * **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1)) * **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8)) * **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079)) * **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab)) * **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38)) * **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420)) * **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49)) * **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76)) * **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3)) --- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ec8da..8182f8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,42 @@ + +# Changelog + +# [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13) + + +### ♻ Code Refactoring + +* **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472)) +* Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6)) + + +### ✨ Features + +* **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733)) +* **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57)) +* **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8)) +* **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f)) + + +### 🎫 Chores + +* **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016)) + + +### 🐛 Bug Fixes + +* **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9)) +* **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0)) +* **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1)) +* **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8)) +* **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079)) +* **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab)) +* **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38)) +* **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420)) +* **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49)) +* **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76)) +* **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3)) + # Changelog diff --git a/package.json b/package.json index 98c5c80..e364b09 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppanel-web", - "version": "1.0.0-beta.26", + "version": "1.0.0-beta.27", "private": true, "homepage": "https://github.com/perfect-panel/ppanel-web", "bugs": { From 94822d902f22598b2ffe57795eb4e9633656c44a Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Thu, 13 Mar 2025 17:32:36 +0700 Subject: [PATCH 3/7] =?UTF-8?q?=E2=9C=A8=20feat(input):=20Add=20minimum=20?= =?UTF-8?q?value=20constraint=20and=20enhance=20number=20handling=20in=20E?= =?UTF-8?q?nhancedInput?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[id]/user-profile/basic-info-form.tsx | 3 + .../src/custom-components/enhanced-input.tsx | 74 +++++++++++++++---- packages/ui/src/utils/unit-conversions.ts | 49 ++++++------ 3 files changed, 89 insertions(+), 37 deletions(-) diff --git a/apps/admin/app/dashboard/user/[id]/user-profile/basic-info-form.tsx b/apps/admin/app/dashboard/user/[id]/user-profile/basic-info-form.tsx index 752446f..76e4048 100644 --- a/apps/admin/app/dashboard/user/[id]/user-profile/basic-info-form.tsx +++ b/apps/admin/app/dashboard/user/[id]/user-profile/basic-info-form.tsx @@ -113,6 +113,7 @@ export function BasicInfoForm({ user, refetch }: { user: API.User; refetch: () = unitConversion('centsToDollars', value)} @@ -136,6 +137,7 @@ export function BasicInfoForm({ user, refetch }: { user: API.User; refetch: () = unitConversion('centsToDollars', value)} @@ -159,6 +161,7 @@ export function BasicInfoForm({ user, refetch }: { user: API.User; refetch: () = unitConversion('centsToDollars', value)} diff --git a/packages/ui/src/custom-components/enhanced-input.tsx b/packages/ui/src/custom-components/enhanced-input.tsx index cd44de2..8b8f13a 100644 --- a/packages/ui/src/custom-components/enhanced-input.tsx +++ b/packages/ui/src/custom-components/enhanced-input.tsx @@ -6,7 +6,7 @@ export interface EnhancedInputProps extends Omit, 'prefix'> { prefix?: string | ReactNode; suffix?: string | ReactNode; - formatInput?: (value: string | number) => string; + formatInput?: (value: string | number) => string | number; formatOutput?: (value: string | number) => string | number; onValueChange?: (value: string | number) => void; onValueBlur?: (value: string | number) => void; @@ -26,50 +26,94 @@ export function EnhancedInput({ ...props }: EnhancedInputProps) { const getProcessedValue = (inputValue: unknown) => { - const newValue = inputValue === '' || inputValue === 0 ? '' : String(inputValue ?? ''); + if (inputValue === '' || inputValue === 0 || inputValue === '0') return ''; + const newValue = String(inputValue ?? ''); return formatInput ? formatInput(newValue) : newValue; }; - const [value, setValue] = useState(() => getProcessedValue(initialValue)); + const [value, setValue] = useState(() => getProcessedValue(initialValue)); + // @ts-expect-error - This is a controlled component + const [internalValue, setInternalValue] = useState(initialValue ?? ''); useEffect(() => { - if (initialValue !== value) { + if (initialValue !== internalValue) { const newValue = getProcessedValue(initialValue); - if (value !== newValue) setValue(newValue); + if (value !== newValue) { + setValue(newValue); + // @ts-expect-error - This is a controlled component + setInternalValue(initialValue ?? ''); + } } // eslint-disable-next-line react-hooks/exhaustive-deps }, [initialValue, formatInput]); - const processValue = (inputValue: string) => { + const processValue = (inputValue: string | number) => { let processedValue: number | string = inputValue?.toString().trim(); + + if (processedValue === '0' && props.type === 'number') { + return 0; + } + if (processedValue && props.type === 'number') processedValue = Number(processedValue); return formatOutput ? formatOutput(processedValue) : processedValue; }; const handleChange = (e: ChangeEvent) => { let inputValue = e.target.value; - if (props.type === 'number' && inputValue) { - const numericValue = Number(inputValue); - if (!isNaN(numericValue)) { - const min = Number.isFinite(props.min) ? props.min : -Infinity; - const max = Number.isFinite(props.max) ? props.max : Infinity; - inputValue = String(Math.max(min!, Math.min(max!, numericValue))); + + if (props.type === 'number') { + if (inputValue === '0') { + setValue(''); + setInternalValue(0); + onValueChange?.(0); + return; + } + + if (/^-?\d*\.?\d*$/.test(inputValue) || inputValue === '-' || inputValue === '.') { + const numericValue = Number(inputValue); + if (!isNaN(numericValue) && inputValue !== '-' && inputValue !== '.') { + const min = Number.isFinite(props.min) ? props.min : -Infinity; + const max = Number.isFinite(props.max) ? props.max : Infinity; + const constrainedValue = Math.max(min!, Math.min(max!, numericValue)); + inputValue = String(constrainedValue); + setInternalValue(constrainedValue); + } else { + setInternalValue(inputValue); + } + setValue(inputValue === '0' ? '' : inputValue); } - setValue(inputValue === '0' ? '' : inputValue); } else { setValue(inputValue); + setInternalValue(inputValue); } + const outputValue = processValue(inputValue); - console.log(); onValueChange?.(outputValue); }; const handleBlur = () => { + if (props.type === 'number' && value) { + if (value === '-' || value === '.') { + setValue(''); + setInternalValue(''); + onValueBlur?.(''); + return; + } + + // 确保0值显示为空 + if (value === '0') { + setValue(''); + onValueBlur?.(0); + return; + } + } + const outputValue = processValue(value); if ((initialValue || '') !== outputValue) { onValueBlur?.(outputValue); } }; + const renderPrefix = () => { return typeof prefix === 'string' ? (
{prefix}
@@ -77,6 +121,7 @@ export function EnhancedInput({ prefix ); }; + const renderSuffix = () => { return typeof suffix === 'string' ? (
{suffix}
@@ -95,6 +140,7 @@ export function EnhancedInput({ > {renderPrefix()} = { + centsToDollars: { formula: 'value / 100', precision: 2 }, + dollarsToCents: { formula: 'value * 100', precision: 0 }, + bitsToMb: { formula: 'value / 1024 / 1024', precision: 2 }, + mbToBits: { formula: 'value * 1024 * 1024', precision: 0 }, + bytesToGb: { formula: 'value / 1024 / 1024 / 1024', precision: 2 }, + gbToBytes: { formula: 'value * 1024 * 1024 * 1024', precision: 0 }, +}; + +export function unitConversion(type: ConversionType, value?: number | string) { + if (!value) return 0; + + const config = conversionConfig[type]; + if (!config) throw new Error('Invalid conversion type'); + + const formula = config.formula.replace('value', `${value}`); + const result = evaluate(formula); + return Number(format(result, { notation: 'fixed', precision: config.precision })); } export function evaluateWithPrecision(expression: string) { const result = evaluate(expression); - const formatted = format(result, { notation: 'fixed', precision: 2 }); - return Number(formatted); } From d10ecc9fdfb2afbc7a43039e14e5aaf19947a932 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 13 Mar 2025 10:35:19 +0000 Subject: [PATCH 4/7] :bookmark: chore(release): v1.0.0-beta.28 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [1.0.0-beta.28](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2025-03-13) ### ✨ Features * **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8182f8f..c8be978 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog +# [1.0.0-beta.28](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2025-03-13) + + +### ✨ Features + +* **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9)) + # [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13) diff --git a/package.json b/package.json index e364b09..9ba3091 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppanel-web", - "version": "1.0.0-beta.27", + "version": "1.0.0-beta.28", "private": true, "homepage": "https://github.com/perfect-panel/ppanel-web", "bugs": { From dddc21c6863d0bc3722aa1baef95bb91ab3ddc79 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Fri, 14 Mar 2025 13:34:36 +0700 Subject: [PATCH 5/7] =?UTF-8?q?=E2=9C=A8=20feat(api):=20Add=20CheckoutOrde?= =?UTF-8?q?r=20request=20and=20response=20types,=20and=20update=20user=20p?= =?UTF-8?q?urchase=20request=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 44 +++++++++---------- apps/admin/services/admin/index.ts | 2 +- apps/admin/services/admin/typings.d.ts | 16 +++++++ apps/admin/services/common/index.ts | 2 +- apps/admin/services/common/typings.d.ts | 16 +++++++ apps/user/app/(main)/purchasing/content.tsx | 15 ++++--- .../user/app/(main)/purchasing/order/page.tsx | 5 ++- .../components/subscribe/payment-methods.tsx | 9 ++-- apps/user/services/common/index.ts | 2 +- apps/user/services/common/typings.d.ts | 16 +++++++ apps/user/services/user/index.ts | 2 +- apps/user/services/user/typings.d.ts | 6 ++- 12 files changed, 95 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8be978..97dac0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,48 +1,44 @@ + # Changelog # [1.0.0-beta.28](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.27...v1.0.0-beta.28) (2025-03-13) - ### ✨ Features -* **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9)) +- **input**: Add minimum value constraint and enhance number handling in EnhancedInput ([94822d9](https://github.com/perfect-panel/ppanel-web/commit/94822d9)) # [1.0.0-beta.27](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.26...v1.0.0-beta.27) (2025-03-13) - ### ♻ Code Refactoring -* **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472)) -* Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6)) - +- **payment**: Reconstruct the payment page ([7109472](https://github.com/perfect-panel/ppanel-web/commit/7109472)) +- Enhance user navigation dropdown ui and styling ([d2732e6](https://github.com/perfect-panel/ppanel-web/commit/d2732e6)) ### ✨ Features -* **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733)) -* **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57)) -* **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8)) -* **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f)) - +- **cdn**: Add CDN URL configuration and update related references ([0c90733](https://github.com/perfect-panel/ppanel-web/commit/0c90733)) +- **payment**: Add bank card payment ([7fa3a57](https://github.com/perfect-panel/ppanel-web/commit/7fa3a57)) +- **subscription**: Improve layout and organization of subscription detail tabs ([e4630f8](https://github.com/perfect-panel/ppanel-web/commit/e4630f8)) +- **subscription**: Refactor subscription handling and update imports for better organization ([2215c7f](https://github.com/perfect-panel/ppanel-web/commit/2215c7f)) ### 🎫 Chores -* **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016)) - +- **merge**: Bump version to 1.0.0-beta.26 and update changelog ([3222016](https://github.com/perfect-panel/ppanel-web/commit/3222016)) ### 🐛 Bug Fixes -* **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9)) -* **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0)) -* **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1)) -* **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8)) -* **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079)) -* **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab)) -* **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38)) -* **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420)) -* **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49)) -* **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76)) -* **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3)) +- **affiliate**: Update user identifier ([35f92c9](https://github.com/perfect-panel/ppanel-web/commit/35f92c9)) +- **changelog**: Update change log style ([cfa3fc0](https://github.com/perfect-panel/ppanel-web/commit/cfa3fc0)) +- **payment**: Add notification URL field to payment management interface ([5c710e1](https://github.com/perfect-panel/ppanel-web/commit/5c710e1)) +- **payment**: Fix payment related type definitions and update payment method references ([c3138a8](https://github.com/perfect-panel/ppanel-web/commit/c3138a8)) +- **payment**: Refactor purchaseCheckout usage and remove redundant code ([a5e2079](https://github.com/perfect-panel/ppanel-web/commit/a5e2079)) +- **payment**: Update checkout type from 'link' to 'url' for consistency ([136a1ab](https://github.com/perfect-panel/ppanel-web/commit/136a1ab)) +- **payment**: Update payment information ([70d6a38](https://github.com/perfect-panel/ppanel-web/commit/70d6a38)) +- **payment**: Update payment method update logic to include row data ([6752420](https://github.com/perfect-panel/ppanel-web/commit/6752420)) +- **purchasing**: Update payment type to lowercase and add optional chaining for discounts ([c06ea49](https://github.com/perfect-panel/ppanel-web/commit/c06ea49)) +- **ui**: Improve dashboard layout and enhance button functionality; open checkout URLs in a new tab ([fc0da76](https://github.com/perfect-panel/ppanel-web/commit/fc0da76)) +- **ui**: Multiple display bugs ([f5d8fd3](https://github.com/perfect-panel/ppanel-web/commit/f5d8fd3)) diff --git a/apps/admin/services/admin/index.ts b/apps/admin/services/admin/index.ts index f9e3438..37cdd29 100644 --- a/apps/admin/services/admin/index.ts +++ b/apps/admin/services/admin/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as ads from './ads'; diff --git a/apps/admin/services/admin/typings.d.ts b/apps/admin/services/admin/typings.d.ts index 286059b..d03073d 100644 --- a/apps/admin/services/admin/typings.d.ts +++ b/apps/admin/services/admin/typings.d.ts @@ -116,6 +116,17 @@ declare namespace API { ids: number[]; }; + type CheckoutOrderRequest = { + orderNo: string; + returnUrl?: string; + }; + + type CheckoutOrderResponse = { + type: string; + checkout_url?: string; + stripe?: StripePayment; + }; + type CloseOrderRequest = { orderNo: string; }; @@ -1097,6 +1108,11 @@ declare namespace API { total: number; }; + type QueryUserAffiliateListRequest = { + page: number; + size: number; + }; + type QueryUserAffiliateListResponse = { list: UserAffiliate[]; total: number; diff --git a/apps/admin/services/common/index.ts b/apps/admin/services/common/index.ts index 73b3bda..61ba129 100644 --- a/apps/admin/services/common/index.ts +++ b/apps/admin/services/common/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as auth from './auth'; diff --git a/apps/admin/services/common/typings.d.ts b/apps/admin/services/common/typings.d.ts index 9b3c09c..1958585 100644 --- a/apps/admin/services/common/typings.d.ts +++ b/apps/admin/services/common/typings.d.ts @@ -94,6 +94,17 @@ declare namespace API { enabled: boolean; }; + type CheckoutOrderRequest = { + orderNo: string; + returnUrl?: string; + }; + + type CheckoutOrderResponse = { + type: string; + checkout_url?: string; + stripe?: StripePayment; + }; + type CheckUserParams = { email: string; }; @@ -496,6 +507,11 @@ declare namespace API { total: number; }; + type QueryUserAffiliateListRequest = { + page: number; + size: number; + }; + type QueryUserAffiliateListResponse = { list: UserAffiliate[]; total: number; diff --git a/apps/user/app/(main)/purchasing/content.tsx b/apps/user/app/(main)/purchasing/content.tsx index 2f1ca78..ea865e5 100644 --- a/apps/user/app/(main)/purchasing/content.tsx +++ b/apps/user/app/(main)/purchasing/content.tsx @@ -27,7 +27,7 @@ export default function Content({ subscription }: { subscription?: API.Subscribe subscribe_id: 0, payment: -1, coupon: '', - platform: 'email', + auth_type: 'email', identifier: '', password: '', }); @@ -70,12 +70,15 @@ export default function Content({ subscription }: { subscription?: API.Subscribe startTransition(async () => { try { const { data } = await purchase(params); - console.log(data); - const { order_no, check_url, type } = data.data!; + const { order_no } = data.data!; if (order_no) { - if (type === 'link') { - window.location.href = check_url!; - } + localStorage.setItem( + order_no, + JSON.stringify({ + auth_type: params.auth_type, + identifier: params.identifier, + }), + ); router.push(`/purchasing/order?order_no=${order_no}`); } } catch (error) { diff --git a/apps/user/app/(main)/purchasing/order/page.tsx b/apps/user/app/(main)/purchasing/order/page.tsx index 50cd4bc..4b01cd4 100644 --- a/apps/user/app/(main)/purchasing/order/page.tsx +++ b/apps/user/app/(main)/purchasing/order/page.tsx @@ -37,7 +37,10 @@ export default function Page() { enabled: enabled, queryKey: ['queryPurchaseOrder', orderNo], queryFn: async () => { - const { data } = await queryPurchaseOrder({ order_no: orderNo! }); + if (!orderNo) return; + const params = localStorage.getItem(orderNo); + const authParams = params ? JSON.parse(params) : {}; + const { data } = await queryPurchaseOrder({ order_no: orderNo!, ...authParams }); if (data?.data?.status !== 1) { setEnabled(false); if (data?.data?.token) { diff --git a/apps/user/components/subscribe/payment-methods.tsx b/apps/user/components/subscribe/payment-methods.tsx index b2a5c25..840a846 100644 --- a/apps/user/components/subscribe/payment-methods.tsx +++ b/apps/user/components/subscribe/payment-methods.tsx @@ -22,10 +22,11 @@ const PaymentMethods: React.FC = ({ value, onChange, balanc queryKey: ['getAvailablePaymentMethods', { balance }], queryFn: async () => { const { data } = await getAvailablePaymentMethods(); - const methods = data.data?.list || []; - if (!value && methods[0]?.id) onChange(methods[0]?.id); - if (balance) return methods; - return methods.filter((item) => item.id !== -1); + const list = data.data?.list || []; + const methods = balance ? list : list.filter((item) => item.id !== -1); + const defaultMethod = methods.find((item) => item.id)?.id; + if (defaultMethod) onChange(defaultMethod); + return methods; }, }); return ( diff --git a/apps/user/services/common/index.ts b/apps/user/services/common/index.ts index 73b3bda..61ba129 100644 --- a/apps/user/services/common/index.ts +++ b/apps/user/services/common/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as auth from './auth'; diff --git a/apps/user/services/common/typings.d.ts b/apps/user/services/common/typings.d.ts index 9b3c09c..1958585 100644 --- a/apps/user/services/common/typings.d.ts +++ b/apps/user/services/common/typings.d.ts @@ -94,6 +94,17 @@ declare namespace API { enabled: boolean; }; + type CheckoutOrderRequest = { + orderNo: string; + returnUrl?: string; + }; + + type CheckoutOrderResponse = { + type: string; + checkout_url?: string; + stripe?: StripePayment; + }; + type CheckUserParams = { email: string; }; @@ -496,6 +507,11 @@ declare namespace API { total: number; }; + type QueryUserAffiliateListRequest = { + page: number; + size: number; + }; + type QueryUserAffiliateListResponse = { list: UserAffiliate[]; total: number; diff --git a/apps/user/services/user/index.ts b/apps/user/services/user/index.ts index f988131..12fe8d0 100644 --- a/apps/user/services/user/index.ts +++ b/apps/user/services/user/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as announcement from './announcement'; diff --git a/apps/user/services/user/typings.d.ts b/apps/user/services/user/typings.d.ts index 93a654e..fa7095a 100644 --- a/apps/user/services/user/typings.d.ts +++ b/apps/user/services/user/typings.d.ts @@ -438,8 +438,8 @@ declare namespace API { }; type PortalPurchaseRequest = { + auth_type: string; identifier: string; - platform: string; password?: string; payment: number; subscribe_id: number; @@ -572,10 +572,14 @@ declare namespace API { }; type QueryPurchaseOrderParams = { + auth_type: string; + identifier: string; order_no: string; }; type QueryPurchaseOrderRequest = { + auth_type: string; + identifier: string; order_no: string; }; From b8316bba334aaee4e5f9b9c728cc3825759be023 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Fri, 14 Mar 2025 13:40:56 +0700 Subject: [PATCH 6/7] =?UTF-8?q?=E2=9C=A8=20feat(loading):=20Replace=20load?= =?UTF-8?q?ing=20animation=20with=20a=20simpler=20spinner=20and=20loading?= =?UTF-8?q?=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/user/components/loading.tsx | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/apps/user/components/loading.tsx b/apps/user/components/loading.tsx index dd194e1..914807c 100644 --- a/apps/user/components/loading.tsx +++ b/apps/user/components/loading.tsx @@ -11,21 +11,10 @@ export default function Loading({ loading = true }: LoadingProps) { : 'pointer-events-none bg-transparent opacity-0 backdrop-blur-0' }`} > -
-
-
-
-
-
-
-
-
-
-
+
+
+
+

Loading...

From 29bc3c772240cd4ec2fb5244c85579a08c393238 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 14 Mar 2025 06:43:47 +0000 Subject: [PATCH 7/7] :bookmark: chore(release): v1.0.0-beta.29 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # [1.0.0-beta.29](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2025-03-14) ### ✨ Features * **api**: Add CheckoutOrder request and response types, and update user purchase request parameters ([dddc21c](https://github.com/perfect-panel/ppanel-web/commit/dddc21c)) * **loading**: Replace loading animation with a simpler spinner and loading text ([b8316bb](https://github.com/perfect-panel/ppanel-web/commit/b8316bb)) --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97dac0d..3cb1d02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ + +# Changelog + +# [1.0.0-beta.29](https://github.com/perfect-panel/ppanel-web/compare/v1.0.0-beta.28...v1.0.0-beta.29) (2025-03-14) + + +### ✨ Features + +* **api**: Add CheckoutOrder request and response types, and update user purchase request parameters ([dddc21c](https://github.com/perfect-panel/ppanel-web/commit/dddc21c)) +* **loading**: Replace loading animation with a simpler spinner and loading text ([b8316bb](https://github.com/perfect-panel/ppanel-web/commit/b8316bb)) + # Changelog diff --git a/package.json b/package.json index 9ba3091..f7780ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ppanel-web", - "version": "1.0.0-beta.28", + "version": "1.0.0-beta.29", "private": true, "homepage": "https://github.com/perfect-panel/ppanel-web", "bugs": {