create-nextblock 0.12.12 → 0.12.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/nextblock-template/app/checkout/success/actions.ts +3 -0
- package/templates/nextblock-template/app/checkout/success/page.tsx +5 -0
- package/templates/nextblock-template/app/profile/orders/[id]/CustomerOrderDetailPageClient.tsx +5 -0
- package/templates/nextblock-template/app/profile/orders/[id]/page.tsx +1 -0
- package/templates/nextblock-template/package.json +1 -1
- package/templates/nextblock-template/tsconfig.tsbuildinfo +1 -0
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { createClient as createSupabaseClient } from '@supabase/supabase-js';
|
|
|
4
4
|
import {
|
|
5
5
|
applyOrderInventoryDeduction,
|
|
6
6
|
assignInvoiceMetadata,
|
|
7
|
+
getFreemiusOrderLicense,
|
|
7
8
|
getInvoicePresentationData,
|
|
8
9
|
getStripeClient,
|
|
9
10
|
syncStripeOrderFromSession,
|
|
@@ -107,6 +108,7 @@ export async function fulfillOrderAction(sessionId: string) {
|
|
|
107
108
|
alreadyPaid: true,
|
|
108
109
|
status: 'paid',
|
|
109
110
|
invoice: await getInvoicePresentationData(order.id, supabase as any),
|
|
111
|
+
license: await getFreemiusOrderLicense({ orderId: order.id, client: supabase as any }),
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -116,6 +118,7 @@ export async function fulfillOrderAction(sessionId: string) {
|
|
|
116
118
|
alreadyPaid: false,
|
|
117
119
|
status: 'trial',
|
|
118
120
|
invoice: await getInvoicePresentationData(order.id, supabase as any),
|
|
121
|
+
license: await getFreemiusOrderLicense({ orderId: order.id, client: supabase as any }),
|
|
119
122
|
};
|
|
120
123
|
}
|
|
121
124
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
FreemiusLicensePanel,
|
|
5
|
+
type FreemiusOrderLicense,
|
|
4
6
|
InvoiceViewerShell,
|
|
5
7
|
type InvoicePresentationData,
|
|
6
8
|
buildInvoiceDocumentLabels,
|
|
@@ -29,6 +31,7 @@ export default function CheckoutSuccessPage() {
|
|
|
29
31
|
const searchParams = useSearchParams();
|
|
30
32
|
const sessionId = searchParams.get('session_id');
|
|
31
33
|
const [invoice, setInvoice] = useState<InvoicePresentationData | null>(null);
|
|
34
|
+
const [license, setLicense] = useState<FreemiusOrderLicense | null>(null);
|
|
32
35
|
const [syncError, setSyncError] = useState<string | null>(null);
|
|
33
36
|
const [isSyncing, setIsSyncing] = useState(false);
|
|
34
37
|
const [hasRemainingCheckoutItems, setHasRemainingCheckoutItems] = useState(false);
|
|
@@ -92,6 +95,7 @@ export default function CheckoutSuccessPage() {
|
|
|
92
95
|
if (result.invoice) {
|
|
93
96
|
const resolvedInvoice = result.invoice as InvoicePresentationData;
|
|
94
97
|
setOrderStatus((result as any).status || resolvedInvoice.order.status || null);
|
|
98
|
+
setLicense(((result as any).license as FreemiusOrderLicense | null) ?? null);
|
|
95
99
|
const purchasedKeys = new Set(
|
|
96
100
|
resolvedInvoice.order.items.map((item) =>
|
|
97
101
|
buildPurchasedItemKey(item.product_id, item.variant_id)
|
|
@@ -169,6 +173,7 @@ export default function CheckoutSuccessPage() {
|
|
|
169
173
|
</div>
|
|
170
174
|
}
|
|
171
175
|
action={action}
|
|
176
|
+
beforeInvoice={<FreemiusLicensePanel license={license} />}
|
|
172
177
|
loading={isSyncing}
|
|
173
178
|
loadingMessage={translateOrFallback(
|
|
174
179
|
t,
|
package/templates/nextblock-template/app/profile/orders/[id]/CustomerOrderDetailPageClient.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
FreemiusLicensePanel,
|
|
5
|
+
type FreemiusOrderLicense,
|
|
4
6
|
InvoiceViewerShell,
|
|
5
7
|
type InvoicePresentationData,
|
|
6
8
|
buildInvoiceDocumentLabels,
|
|
@@ -19,6 +21,7 @@ interface CustomerOrderDetailPageClientProps {
|
|
|
19
21
|
invoice_number: string | null;
|
|
20
22
|
};
|
|
21
23
|
invoice: InvoicePresentationData | null;
|
|
24
|
+
license: FreemiusOrderLicense | null;
|
|
22
25
|
profile: ProfileAccountSummary;
|
|
23
26
|
user: ProfileAccountUser;
|
|
24
27
|
}
|
|
@@ -26,6 +29,7 @@ interface CustomerOrderDetailPageClientProps {
|
|
|
26
29
|
export function CustomerOrderDetailPageClient({
|
|
27
30
|
order,
|
|
28
31
|
invoice,
|
|
32
|
+
license,
|
|
29
33
|
profile,
|
|
30
34
|
user,
|
|
31
35
|
}: CustomerOrderDetailPageClientProps) {
|
|
@@ -57,6 +61,7 @@ export function CustomerOrderDetailPageClient({
|
|
|
57
61
|
'print_invoice',
|
|
58
62
|
'Print / Save as PDF'
|
|
59
63
|
)}
|
|
64
|
+
beforeInvoice={<FreemiusLicensePanel license={license} />}
|
|
60
65
|
action={{
|
|
61
66
|
href: '/profile/orders',
|
|
62
67
|
label: translateOrFallback(
|