@nextblock-cms/ecom 0.0.10 → 0.8.1
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/actions.d.ts +2 -0
- package/currency-rest-client-CwoqdgAP.js +23 -0
- package/currency-rest-client-uolJxUkL.cjs +1 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +35 -0
- package/index.es.js +3226 -0
- package/invoice-ui-BJZfedDd.cjs +332 -0
- package/invoice-ui-GJ1ADAjn.js +5759 -0
- package/lib/CurrencyProvider.d.ts +18 -0
- package/lib/cart-store.d.ts +47 -0
- package/lib/components/AccountNavigationMenu.d.ts +14 -0
- package/lib/components/AddToCartButton.d.ts +8 -0
- package/lib/components/Cart.d.ts +1 -0
- package/lib/components/CartDrawer.d.ts +1 -0
- package/lib/components/CartIcon.d.ts +1 -0
- package/lib/components/Checkout.d.ts +6 -0
- package/lib/components/CouponForm.d.ts +8 -0
- package/lib/components/CurrencySwitcher.d.ts +1 -0
- package/lib/components/CustomerProfileForm.d.ts +21 -0
- package/lib/components/FeaturedProduct.d.ts +8 -0
- package/lib/components/InvoiceDocument.d.ts +32 -0
- package/lib/components/InvoiceViewerShell.d.ts +26 -0
- package/lib/components/ProductCard.d.ts +7 -0
- package/lib/components/ProductDetailsLayout.d.ts +7 -0
- package/lib/components/ProductGallery.d.ts +9 -0
- package/lib/components/ProductGrid.d.ts +8 -0
- package/lib/components/ShippingEstimator.d.ts +5 -0
- package/lib/components/SimpleTiptapRenderer.d.ts +7 -0
- package/lib/components/SubscriptionSelector.d.ts +7 -0
- package/lib/components/media/MediaImage.d.ts +12 -0
- package/lib/components/media/MediaPickerDialog.d.ts +16 -0
- package/lib/components/media/MediaUploadForm.d.ts +10 -0
- package/lib/components/media/UploadFolderContext.d.ts +10 -0
- package/lib/countries.d.ts +5 -0
- package/lib/coupon-server.d.ts +22 -0
- package/lib/coupon-server.test.d.ts +1 -0
- package/lib/coupons.d.ts +41 -0
- package/lib/currency-constants.d.ts +1 -0
- package/lib/currency-rest-client.d.ts +1 -0
- package/lib/currency-sale-schedule.test.d.ts +1 -0
- package/lib/currency-store.d.ts +20 -0
- package/lib/currency-sync.d.ts +19 -0
- package/lib/currency.d.ts +116 -0
- package/lib/customer-addresses.d.ts +19 -0
- package/lib/customer-orders.d.ts +23 -0
- package/lib/customer.d.ts +51 -0
- package/lib/export-helpers.d.ts +48 -0
- package/lib/factory.d.ts +2 -0
- package/lib/freemius-coupons.d.ts +58 -0
- package/lib/freemius-order-sync.d.ts +133 -0
- package/lib/freemius-order-sync.test.d.ts +1 -0
- package/lib/inventory-settings.d.ts +16 -0
- package/lib/invoice-server.d.ts +18 -0
- package/lib/invoice-ui.d.ts +29 -0
- package/lib/invoice.d.ts +75 -0
- package/lib/order-inventory.d.ts +7 -0
- package/lib/order-tax-details.d.ts +57 -0
- package/lib/pages/cms/coupons/CouponEditorForm.d.ts +23 -0
- package/lib/pages/cms/coupons/CouponsPage.d.ts +8 -0
- package/lib/pages/cms/coupons/CreateCouponDialog.d.ts +6 -0
- package/lib/pages/cms/coupons/EditCouponPage.d.ts +5 -0
- package/lib/pages/cms/coupons/ProductScopePicker.d.ts +16 -0
- package/lib/pages/cms/coupons/actions.d.ts +5 -0
- package/lib/pages/cms/coupons/index.d.ts +2 -0
- package/lib/pages/cms/coupons/product-options.d.ts +2 -0
- package/lib/pages/cms/orders/ExportReportsDialog.d.ts +2 -0
- package/lib/pages/cms/orders/MarkPaidButton.d.ts +3 -0
- package/lib/pages/cms/orders/OrderDetailPage.d.ts +5 -0
- package/lib/pages/cms/orders/OrderPrintButton.d.ts +3 -0
- package/lib/pages/cms/orders/OrderStatusForm.d.ts +4 -0
- package/lib/pages/cms/orders/OrdersPage.d.ts +6 -0
- package/lib/pages/cms/orders/actions.d.ts +7 -0
- package/lib/pages/cms/orders/export-actions.d.ts +2 -0
- package/lib/pages/cms/orders/index.d.ts +6 -0
- package/lib/pages/cms/orders/server-actions.d.ts +11 -0
- package/lib/pages/cms/orders/types.d.ts +60 -0
- package/lib/pages/cms/payments/PaymentsClient.d.ts +19 -0
- package/lib/pages/cms/payments/PaymentsPage.d.ts +1 -0
- package/lib/pages/cms/payments/actions.d.ts +4 -0
- package/lib/pages/cms/payments/index.d.ts +2 -0
- package/lib/pages/cms/payments/queries.d.ts +12 -0
- package/lib/pages/cms/products/ProductsPage.d.ts +7 -0
- package/lib/pages/cms/products/[id]/edit/EditProductPage.d.ts +12 -0
- package/lib/pages/cms/products/actions.d.ts +18201 -0
- package/lib/pages/cms/products/attributes/AttributeManagementPage.d.ts +1 -0
- package/lib/pages/cms/products/attributes/components/AttributeManager.d.ts +50 -0
- package/lib/pages/cms/products/categories/CategoryManagementPage.d.ts +1 -0
- package/lib/pages/cms/products/categories/components/CategoryManager.d.ts +47 -0
- package/lib/pages/cms/products/components/CopyProductFromLanguage.d.ts +9 -0
- package/lib/pages/cms/products/components/CurrencyPriceFields.d.ts +18 -0
- package/lib/pages/cms/products/components/DeleteProductButton.d.ts +9 -0
- package/lib/pages/cms/products/components/FreemiusPricingDashboard.d.ts +24 -0
- package/lib/pages/cms/products/components/ProductCategorySelector.d.ts +14 -0
- package/lib/pages/cms/products/components/ProductForm.d.ts +62 -0
- package/lib/pages/cms/products/components/ProductMediaManager.d.ts +17 -0
- package/lib/pages/cms/products/components/ProductsBulkTable.d.ts +32 -0
- package/lib/pages/cms/products/components/SaleScheduleFields.d.ts +16 -0
- package/lib/pages/cms/products/components/SyncFreemiusButton.d.ts +3 -0
- package/lib/pages/cms/products/components/SyncFreemiusPricingButton.d.ts +5 -0
- package/lib/pages/cms/products/components/SyncProductForm.d.ts +1 -0
- package/lib/pages/cms/products/components/VariationsEditor.d.ts +26 -0
- package/lib/pages/cms/products/index.d.ts +7 -0
- package/lib/pages/cms/products/inventory/InventoryPage.d.ts +1 -0
- package/lib/pages/cms/products/inventory/InventoryTableClient.d.ts +6 -0
- package/lib/pages/cms/products/inventory/actions.d.ts +38 -0
- package/lib/pages/cms/products/new/NewProductPage.d.ts +9 -0
- package/lib/pages/cms/products/product-price-sync.d.ts +43 -0
- package/lib/pages/cms/products/server-actions.d.ts +125 -0
- package/lib/pages/cms/shipping/ShippingPage.d.ts +6 -0
- package/lib/pages/cms/shipping/components/RateForm.d.ts +26 -0
- package/lib/pages/cms/shipping/components/ZoneForm.d.ts +13 -0
- package/lib/pages/cms/shipping/index.d.ts +2 -0
- package/lib/pages/cms/shipping/server-actions.d.ts +80 -0
- package/lib/pages/cms/taxes/TaxesPage.d.ts +5 -0
- package/lib/pages/cms/taxes/actions.d.ts +3 -0
- package/lib/pages/cms/taxes/components/TaxRateForm.d.ts +8 -0
- package/lib/pages/cms/taxes/index.d.ts +2 -0
- package/lib/product-actions.d.ts +18457 -0
- package/lib/product-context.d.ts +7 -0
- package/lib/product-schema.d.ts +73 -0
- package/lib/providers/freemius.d.ts +49 -0
- package/lib/providers/stripe.d.ts +13 -0
- package/lib/server-actions/coupon-actions.d.ts +17 -0
- package/lib/server-actions/customer-actions.d.ts +18 -0
- package/lib/server-actions/product-actions.d.ts +69 -0
- package/lib/server-actions/shipping-actions.d.ts +10 -0
- package/lib/server-actions/tax-actions.d.ts +7 -0
- package/lib/shared-inventory.d.ts +38 -0
- package/lib/shipping/resolver.d.ts +16 -0
- package/lib/shipping-rate-currency.d.ts +39 -0
- package/lib/states.d.ts +9 -0
- package/lib/stripe/checkout.d.ts +6 -0
- package/lib/stripe/client.d.ts +2 -0
- package/lib/stripe/order-sync.d.ts +18 -0
- package/lib/stripe/webhooks.d.ts +4 -0
- package/lib/tax-calculation.d.ts +23 -0
- package/lib/trials.d.ts +15 -0
- package/lib/types.d.ts +245 -0
- package/lib/use-cart.d.ts +11 -0
- package/lib/variation-utils.d.ts +72 -0
- package/lib/zod-config.d.ts +2 -0
- package/package.json +47 -2
- package/server.cjs.js +110 -0
- package/server.d.ts +31 -0
- package/server.es.js +6039 -0
- package/index.ts +0 -12
- package/tsconfig.lib.json +0 -10
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from './zod-config';
|
|
2
|
+
export declare const productSchema: z.ZodObject<{
|
|
3
|
+
product_type: z.ZodPipe<z.ZodUnion<[z.ZodEnum<{
|
|
4
|
+
physical: "physical";
|
|
5
|
+
digital: "digital";
|
|
6
|
+
}>, z.ZodLiteral<"">]> & z.ZodType<"physical" | "digital", "" | "physical" | "digital", z.core.$ZodTypeInternals<"physical" | "digital", "" | "physical" | "digital">>, z.ZodTransform<"physical" | "digital", "physical" | "digital">>;
|
|
7
|
+
payment_provider: z.ZodEnum<{
|
|
8
|
+
stripe: "stripe";
|
|
9
|
+
freemius: "freemius";
|
|
10
|
+
}>;
|
|
11
|
+
title: z.ZodString;
|
|
12
|
+
slug: z.ZodString;
|
|
13
|
+
sku: z.ZodString;
|
|
14
|
+
upc: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
15
|
+
price: z.ZodCoercedNumber<unknown>;
|
|
16
|
+
prices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodCoercedNumber<unknown>>>;
|
|
17
|
+
sale_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
18
|
+
sale_prices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodCoercedNumber<unknown>>>>;
|
|
19
|
+
sale_start_at: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>>>;
|
|
20
|
+
sale_end_at: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>>>;
|
|
21
|
+
stock: z.ZodCoercedNumber<unknown>;
|
|
22
|
+
meta_title: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
23
|
+
meta_description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
24
|
+
short_description: z.ZodOptional<z.ZodString>;
|
|
25
|
+
description_json: z.ZodOptional<z.ZodAny>;
|
|
26
|
+
freemius_plan_id: z.ZodOptional<z.ZodString>;
|
|
27
|
+
freemius_product_id: z.ZodOptional<z.ZodString>;
|
|
28
|
+
trial_period_days: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
29
|
+
trial_requires_payment_method: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
media_id: z.ZodOptional<z.ZodString>;
|
|
31
|
+
product_media: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
|
+
media_id: z.ZodString;
|
|
33
|
+
}, z.core.$strip>>>;
|
|
34
|
+
category_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
is_taxable: z.ZodBoolean;
|
|
36
|
+
status: z.ZodEnum<{
|
|
37
|
+
draft: "draft";
|
|
38
|
+
active: "active";
|
|
39
|
+
archived: "archived";
|
|
40
|
+
}>;
|
|
41
|
+
language_id: z.ZodCoercedNumber<unknown>;
|
|
42
|
+
translation_group_id: z.ZodPipe<z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>, z.ZodTransform<string | undefined, string | undefined>>;
|
|
43
|
+
explicitly_removed_media_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
variation_attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
|
+
attribute_id: z.ZodString;
|
|
46
|
+
term_ids: z.ZodArray<z.ZodString>;
|
|
47
|
+
}, z.core.$strip>>>;
|
|
48
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
combination_key: z.ZodString;
|
|
51
|
+
sku: z.ZodString;
|
|
52
|
+
upc: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
53
|
+
price: z.ZodCoercedNumber<unknown>;
|
|
54
|
+
prices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodCoercedNumber<unknown>>>;
|
|
55
|
+
sale_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
56
|
+
sale_prices: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodCoercedNumber<unknown>>>>;
|
|
57
|
+
sale_start_at: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>>>;
|
|
58
|
+
sale_end_at: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<string | null, string>>>>;
|
|
59
|
+
stock_quantity: z.ZodCoercedNumber<unknown>;
|
|
60
|
+
main_media_id: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
61
|
+
main_image_url: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
62
|
+
attribute_term_ids: z.ZodArray<z.ZodString>;
|
|
63
|
+
selected_options: z.ZodArray<z.ZodObject<{
|
|
64
|
+
attribute_id: z.ZodString;
|
|
65
|
+
attribute_name: z.ZodString;
|
|
66
|
+
term_id: z.ZodString;
|
|
67
|
+
term_value: z.ZodString;
|
|
68
|
+
term_slug: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strip>>;
|
|
70
|
+
label: z.ZodString;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export type ProductFormValues = z.infer<typeof productSchema>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PaymentProvider } from '../types';
|
|
2
|
+
import { CheckoutSessionInput } from '../customer';
|
|
3
|
+
export type FreemiusCheckoutCredentialEntry = {
|
|
4
|
+
publicKey?: string;
|
|
5
|
+
secretKey?: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function readFreemiusEnvValue(name: keyof NodeJS.ProcessEnv): string | null;
|
|
9
|
+
export declare function parseFreemiusCheckoutCredentialsMap(): Record<string, FreemiusCheckoutCredentialEntry> | null;
|
|
10
|
+
export declare function resolveFreemiusCheckoutCredentials(productId: string | number): {
|
|
11
|
+
publicKey: string;
|
|
12
|
+
secretKey: string | null;
|
|
13
|
+
apiKey: string | null;
|
|
14
|
+
source: "product-map";
|
|
15
|
+
} | {
|
|
16
|
+
publicKey: string;
|
|
17
|
+
secretKey: string | null;
|
|
18
|
+
apiKey: string | null;
|
|
19
|
+
source: "single-product-sandbox-env";
|
|
20
|
+
} | {
|
|
21
|
+
publicKey: string | null;
|
|
22
|
+
secretKey: string | null;
|
|
23
|
+
apiKey: string | null;
|
|
24
|
+
source: "single-product-env";
|
|
25
|
+
} | {
|
|
26
|
+
publicKey: string | null;
|
|
27
|
+
secretKey: string | null;
|
|
28
|
+
apiKey: string | null;
|
|
29
|
+
source: "legacy-env";
|
|
30
|
+
};
|
|
31
|
+
export declare class FreemiusProvider implements PaymentProvider {
|
|
32
|
+
getProviderName(): string;
|
|
33
|
+
createCheckoutSession({ items: cartItems, customerEmail, customerPhone, userId, billingAddress, shippingAddress, currencyCode, couponCode, couponContextItems, }: CheckoutSessionInput): Promise<{
|
|
34
|
+
url: string | null;
|
|
35
|
+
error?: string;
|
|
36
|
+
errorKey?: string;
|
|
37
|
+
errorParams?: Record<string, string | number>;
|
|
38
|
+
errorStatus?: number;
|
|
39
|
+
customProps?: any;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export declare function syncFreemiusProductsToSupabase(): Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
count: number;
|
|
45
|
+
}>;
|
|
46
|
+
export declare function syncSingleFreemiusProduct(productId: string): Promise<{
|
|
47
|
+
success: boolean;
|
|
48
|
+
count: number;
|
|
49
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CheckoutSessionInput } from '../customer';
|
|
2
|
+
import { PaymentProvider } from '../types';
|
|
3
|
+
export declare class StripeProvider implements PaymentProvider {
|
|
4
|
+
getProviderName(): string;
|
|
5
|
+
createCheckoutSession({ items: cartItems, customerEmail, customerPhone, userId, billingAddress, shippingAddress, shippingMethodId, currencyCode, locale, couponCode, couponContextItems, }: CheckoutSessionInput): Promise<{
|
|
6
|
+
url: string | null;
|
|
7
|
+
error?: string;
|
|
8
|
+
errorKey?: string;
|
|
9
|
+
errorParams?: Record<string, string | number>;
|
|
10
|
+
errorStatus?: number;
|
|
11
|
+
customProps?: any;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CartItem } from '../types';
|
|
2
|
+
export declare function getCouponQuoteAction(input: {
|
|
3
|
+
code?: string | null;
|
|
4
|
+
items: CartItem[];
|
|
5
|
+
currencyCode?: string | null;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
success: true;
|
|
8
|
+
quote: import('../coupons').CouponQuote;
|
|
9
|
+
} | {
|
|
10
|
+
success: false;
|
|
11
|
+
error: string;
|
|
12
|
+
errorKey?: string;
|
|
13
|
+
} | {
|
|
14
|
+
success: false;
|
|
15
|
+
error: any;
|
|
16
|
+
errorKey: string;
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CustomerAddressInput } from '../customer';
|
|
2
|
+
export interface ProfileUpdateData {
|
|
3
|
+
full_name?: string;
|
|
4
|
+
avatar_url?: string;
|
|
5
|
+
website?: string;
|
|
6
|
+
github_username?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
billing_address?: CustomerAddressInput | null;
|
|
9
|
+
shipping_address?: CustomerAddressInput | null;
|
|
10
|
+
use_billing_for_shipping?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function updateProfile(data: ProfileUpdateData): Promise<{
|
|
13
|
+
success: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function validateCheckoutEligibility(userId: string): Promise<{
|
|
16
|
+
ready: boolean;
|
|
17
|
+
missingFields: string[];
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export declare function getTranslatedProductsForCart(translationGroupIds: string[], languageCode: string, skus?: string[], productIds?: string[]): Promise<{
|
|
2
|
+
id: any;
|
|
3
|
+
title: any;
|
|
4
|
+
sku: any;
|
|
5
|
+
price: any;
|
|
6
|
+
prices: any;
|
|
7
|
+
sale_price: any;
|
|
8
|
+
sale_prices: any;
|
|
9
|
+
sale_start_at: any;
|
|
10
|
+
sale_end_at: any;
|
|
11
|
+
scheduled_price: any;
|
|
12
|
+
scheduled_prices: any;
|
|
13
|
+
scheduled_price_at: any;
|
|
14
|
+
stock: any;
|
|
15
|
+
slug: any;
|
|
16
|
+
language_id: any;
|
|
17
|
+
product_type: any;
|
|
18
|
+
payment_provider: any;
|
|
19
|
+
freemius_product_id: any;
|
|
20
|
+
freemius_plan_id: any;
|
|
21
|
+
trial_period_days: any;
|
|
22
|
+
trial_requires_payment_method: any;
|
|
23
|
+
is_taxable: any;
|
|
24
|
+
product_media: {
|
|
25
|
+
media: {
|
|
26
|
+
file_path: any;
|
|
27
|
+
object_key: any;
|
|
28
|
+
}[];
|
|
29
|
+
}[];
|
|
30
|
+
product_variants: {
|
|
31
|
+
id: any;
|
|
32
|
+
sku: any;
|
|
33
|
+
upc: any;
|
|
34
|
+
main_media_id: any;
|
|
35
|
+
price: any;
|
|
36
|
+
prices: any;
|
|
37
|
+
sale_price: any;
|
|
38
|
+
sale_prices: any;
|
|
39
|
+
sale_start_at: any;
|
|
40
|
+
sale_end_at: any;
|
|
41
|
+
scheduled_price: any;
|
|
42
|
+
scheduled_prices: any;
|
|
43
|
+
scheduled_price_at: any;
|
|
44
|
+
stock_quantity: any;
|
|
45
|
+
media: {
|
|
46
|
+
file_path: any;
|
|
47
|
+
object_key: any;
|
|
48
|
+
description: any;
|
|
49
|
+
}[];
|
|
50
|
+
variant_attribute_mapping: {
|
|
51
|
+
attribute_term_id: any;
|
|
52
|
+
product_attribute_terms: {
|
|
53
|
+
id: any;
|
|
54
|
+
attribute_id: any;
|
|
55
|
+
value: any;
|
|
56
|
+
slug: any;
|
|
57
|
+
sort_order: any;
|
|
58
|
+
value_translations: any;
|
|
59
|
+
product_attributes: {
|
|
60
|
+
id: any;
|
|
61
|
+
name: any;
|
|
62
|
+
slug: any;
|
|
63
|
+
name_translations: any;
|
|
64
|
+
}[];
|
|
65
|
+
}[];
|
|
66
|
+
}[];
|
|
67
|
+
}[];
|
|
68
|
+
translation_group_id: any;
|
|
69
|
+
}[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShippingDestination, ResolvedShippingMethod } from '../shipping/resolver';
|
|
2
|
+
/**
|
|
3
|
+
* Server action to fetch shipping estimates from the client components (Cart/Checkout).
|
|
4
|
+
*/
|
|
5
|
+
export declare function getShippingEstimates(cartTotal: number, destination: ShippingDestination, languageCode?: string, currencyCode?: string): Promise<{
|
|
6
|
+
success: boolean;
|
|
7
|
+
methods?: ResolvedShippingMethod[];
|
|
8
|
+
error?: string;
|
|
9
|
+
errorKey?: string;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CartItem, TaxCalculationResult } from '../types';
|
|
2
|
+
import { TaxDestinationInput } from '../tax-calculation';
|
|
3
|
+
export declare function getTaxEstimate(cartItems: CartItem[], destination?: TaxDestinationInput | null, currencyCode?: string, couponCode?: string | null, couponContextItems?: CartItem[]): Promise<{
|
|
4
|
+
success: boolean;
|
|
5
|
+
tax?: TaxCalculationResult;
|
|
6
|
+
error?: string;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { Database } from '../../../db/src/index.ts';
|
|
3
|
+
import { ProductFormValues } from './product-schema';
|
|
4
|
+
export type InventoryUsageType = 'product' | 'variant' | 'mixed';
|
|
5
|
+
export interface InventoryItem {
|
|
6
|
+
key: string;
|
|
7
|
+
sku: string;
|
|
8
|
+
stock: number;
|
|
9
|
+
usageType: InventoryUsageType;
|
|
10
|
+
productTitles: string[];
|
|
11
|
+
parentProductSkus: string[];
|
|
12
|
+
languages: string[];
|
|
13
|
+
statuses: string[];
|
|
14
|
+
productIds: string[];
|
|
15
|
+
variantIds: string[];
|
|
16
|
+
}
|
|
17
|
+
interface InventoryQuantityUpdateInput {
|
|
18
|
+
sku: string;
|
|
19
|
+
stock: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function getInventoryItems(client?: SupabaseClient<Database>): Promise<{
|
|
22
|
+
key: string;
|
|
23
|
+
sku: string;
|
|
24
|
+
stock: number;
|
|
25
|
+
usageType: InventoryUsageType;
|
|
26
|
+
productTitles: string[];
|
|
27
|
+
parentProductSkus: string[];
|
|
28
|
+
languages: string[];
|
|
29
|
+
statuses: string[];
|
|
30
|
+
productIds: string[];
|
|
31
|
+
variantIds: string[];
|
|
32
|
+
}[]>;
|
|
33
|
+
export declare function setSharedInventoryQuantity(input: InventoryQuantityUpdateInput, client?: SupabaseClient<Database>): Promise<{
|
|
34
|
+
stock: number;
|
|
35
|
+
affectedCount: number;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function syncSharedInventoryForSavedProduct(productId: string, data: Pick<ProductFormValues, 'sku' | 'stock' | 'variants'>, client?: SupabaseClient<Database>): Promise<void>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ShippingDestination {
|
|
2
|
+
country: string;
|
|
3
|
+
state?: string;
|
|
4
|
+
postal_code?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ResolvedShippingMethod {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
type: 'flat_rate' | 'free_shipping';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves available shipping methods based on destination and cart value.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveShippingOptions(cartTotal: number, destination: ShippingDestination, languageCode?: string | null, currencyCode?: string | null): Promise<ResolvedShippingMethod[]>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CurrencyRecord, PriceMap } from './currency';
|
|
2
|
+
export declare const SHIPPING_RATE_CURRENCY_MODES: readonly ["auto", "manual"];
|
|
3
|
+
export type ShippingRateCurrencyMode = (typeof SHIPPING_RATE_CURRENCY_MODES)[number];
|
|
4
|
+
export declare function normalizeShippingRateCurrencyMode(value: unknown): ShippingRateCurrencyMode;
|
|
5
|
+
export declare function sanitizeShippingRateAmountMaps(params: {
|
|
6
|
+
currencies: CurrencyRecord[];
|
|
7
|
+
mode?: unknown;
|
|
8
|
+
sourceCurrencyCode?: string | null;
|
|
9
|
+
costAmounts?: PriceMap | null;
|
|
10
|
+
minOrderAmounts?: PriceMap | null;
|
|
11
|
+
fallbackCostAmount?: number | null;
|
|
12
|
+
fallbackMinOrderAmount?: number | null;
|
|
13
|
+
}): {
|
|
14
|
+
mode: "auto";
|
|
15
|
+
sourceCurrencyCode: any;
|
|
16
|
+
costAmounts: {
|
|
17
|
+
[x: number]: number;
|
|
18
|
+
};
|
|
19
|
+
minOrderAmounts: {
|
|
20
|
+
[x: number]: number;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
mode: "manual";
|
|
24
|
+
sourceCurrencyCode: any;
|
|
25
|
+
costAmounts: {
|
|
26
|
+
[x: string]: number;
|
|
27
|
+
};
|
|
28
|
+
minOrderAmounts: {
|
|
29
|
+
[x: string]: number;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function resolveShippingRateAmountForCurrency(params: {
|
|
33
|
+
currencies: CurrencyRecord[];
|
|
34
|
+
mode?: unknown;
|
|
35
|
+
amountMap?: PriceMap | null;
|
|
36
|
+
fallbackAmount?: number | null;
|
|
37
|
+
sourceCurrencyCode?: string | null;
|
|
38
|
+
currencyCode?: string | null;
|
|
39
|
+
}): any;
|
package/lib/states.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface CountrySubdivision {
|
|
2
|
+
code: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const STATES_BY_COUNTRY: Record<string, CountrySubdivision[]>;
|
|
6
|
+
export declare function getStatesForCountry(countryCode?: string | null): CountrySubdivision[];
|
|
7
|
+
export declare function countryUsesStructuredStates(countryCode?: string | null): boolean;
|
|
8
|
+
export declare function normalizeSubdivisionCode(countryCode?: string | null, stateCodeOrName?: string | null): string | null;
|
|
9
|
+
export declare function resolveSubdivisionName(countryCode?: string | null, stateCode?: string | null): string | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CartItem } from '../types';
|
|
2
|
+
import { ShippingDestination } from '../shipping/resolver';
|
|
3
|
+
export declare const createCheckoutSession: (cartItems: CartItem[], userId?: string, destination?: ShippingDestination, currencyCode?: string) => Promise<{
|
|
4
|
+
url: string | null;
|
|
5
|
+
error?: string;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as Stripe } from 'stripe';
|
|
2
|
+
import { OrderCustomerDetails } from '../customer';
|
|
3
|
+
export declare function syncStripeOrderFromSession(session: Stripe.Checkout.Session): Promise<{
|
|
4
|
+
orderId: any;
|
|
5
|
+
alreadyPaid: boolean;
|
|
6
|
+
customerDetails: OrderCustomerDetails;
|
|
7
|
+
order: {
|
|
8
|
+
id: any;
|
|
9
|
+
invoice_number: any;
|
|
10
|
+
paid_at: any;
|
|
11
|
+
total: any;
|
|
12
|
+
currency: any;
|
|
13
|
+
subtotal: any;
|
|
14
|
+
shipping_total: any;
|
|
15
|
+
tax_total: number;
|
|
16
|
+
tax_details: import('../order-tax-details').OrderTaxDetails;
|
|
17
|
+
};
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SupabaseClient } from '@supabase/supabase-js';
|
|
2
|
+
import { CurrencyRecord } from './currency';
|
|
3
|
+
import { CartItem, TaxCalculationResult } from './types';
|
|
4
|
+
export interface CheckoutTaxableItem {
|
|
5
|
+
product_id: string;
|
|
6
|
+
quantity: number;
|
|
7
|
+
unit_amount: number;
|
|
8
|
+
discount_amount?: number;
|
|
9
|
+
is_taxable: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface TaxDestinationInput {
|
|
12
|
+
country_code?: string | null;
|
|
13
|
+
state?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export declare const STRIPE_TAX_CODE_TAXABLE_GOODS = "txcd_99999999";
|
|
16
|
+
export declare const STRIPE_TAX_CODE_NONTAXABLE = "txcd_00000000";
|
|
17
|
+
export declare const STRIPE_TAX_CODE_SHIPPING = "txcd_92010001";
|
|
18
|
+
export declare function getStripeTaxCodeForProduct(isTaxable: boolean): "txcd_99999999" | "txcd_00000000";
|
|
19
|
+
export declare function buildCheckoutTaxableItemsFromCart(supabase: SupabaseClient<any>, cartItems: CartItem[], currencyCode: string, currencies: CurrencyRecord[], lineDiscounts?: Map<string, number>): Promise<CheckoutTaxableItem[]>;
|
|
20
|
+
export declare function calculateCheckoutTaxes(supabase: SupabaseClient<any>, input: {
|
|
21
|
+
items: CheckoutTaxableItem[];
|
|
22
|
+
destination?: TaxDestinationInput | null;
|
|
23
|
+
}): Promise<TaxCalculationResult>;
|
package/lib/trials.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type FreemiusTrialMode = 'free' | 'paid';
|
|
2
|
+
type TrialCarrier = {
|
|
3
|
+
trial_period_days?: number | string | null;
|
|
4
|
+
trial_requires_payment_method?: boolean | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function getTrialPeriodDays(value: TrialCarrier | null | undefined): number;
|
|
7
|
+
export declare function getTrialCheckoutMode(value: TrialCarrier | null | undefined): FreemiusTrialMode | null;
|
|
8
|
+
export declare function getTrialLabel(value: TrialCarrier | number | null | undefined): string | null;
|
|
9
|
+
export declare function getTrialPaymentRequirementLabel(value: TrialCarrier | null | undefined): "Payment method required" | "No credit card required";
|
|
10
|
+
export declare function getTrialSummary(value: TrialCarrier | null | undefined): {
|
|
11
|
+
label: string;
|
|
12
|
+
paymentRequirementLabel: string;
|
|
13
|
+
checkoutMode: FreemiusTrialMode | null;
|
|
14
|
+
} | null;
|
|
15
|
+
export {};
|