@marianmeres/collection-types 1.31.0 β 1.32.0
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/dist/country.d.ts +24 -0
- package/dist/country.js +7 -0
- package/dist/customer.d.ts +16 -3
- package/dist/mod.d.ts +1 -0
- package/dist/mod.js +2 -0
- package/dist/order.d.ts +17 -0
- package/dist/project.d.ts +30 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Country type definitions for geographic reference data.
|
|
3
|
+
*
|
|
4
|
+
* Countries are stored in the project domain and referenced
|
|
5
|
+
* via weak relations from customer addresses.
|
|
6
|
+
*/
|
|
7
|
+
import type { MaybeLocalized } from "./utils.js";
|
|
8
|
+
/** Country data field schema */
|
|
9
|
+
export interface CountryData {
|
|
10
|
+
/** ISO 3166-1 alpha-2 code (e.g., "US", "GB") - used as path for uniqueness */
|
|
11
|
+
code: string;
|
|
12
|
+
/** Display name - can be a plain string or localized object (e.g., { en: "United States", de: "Vereinigte Staaten" }) */
|
|
13
|
+
name: MaybeLocalized<string>;
|
|
14
|
+
/** Phone prefix with + (e.g., "+1", "+44") */
|
|
15
|
+
phone_prefix?: string;
|
|
16
|
+
/** Flag emoji (e.g., "πΊπΈ") */
|
|
17
|
+
flag?: string;
|
|
18
|
+
/** Extensible metadata for future fields */
|
|
19
|
+
custom?: Record<string, unknown>;
|
|
20
|
+
/** Index signature for Model<T> compatibility */
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}
|
|
23
|
+
/** Country type identifier */
|
|
24
|
+
export type CountryType = "default";
|
package/dist/country.js
ADDED
package/dist/customer.d.ts
CHANGED
|
@@ -13,14 +13,25 @@
|
|
|
13
13
|
export interface CustomerData {
|
|
14
14
|
/** Customer email */
|
|
15
15
|
email: string;
|
|
16
|
-
/** Customer
|
|
17
|
-
|
|
16
|
+
/** Customer first name */
|
|
17
|
+
first_name: string;
|
|
18
|
+
/** Customer last name */
|
|
19
|
+
last_name: string;
|
|
18
20
|
/** Phone number */
|
|
19
21
|
phone?: string;
|
|
20
22
|
/** True if customer has no linked account */
|
|
21
23
|
guest: boolean;
|
|
22
24
|
/** Marketing consent */
|
|
23
25
|
accepts_marketing: boolean;
|
|
26
|
+
/** Company name for B2B customers */
|
|
27
|
+
company_name?: string;
|
|
28
|
+
/** Tax identification number */
|
|
29
|
+
tax_id?: string;
|
|
30
|
+
/** VAT number for EU businesses */
|
|
31
|
+
vat_number?: string;
|
|
32
|
+
/** Project-specific customer preferences */
|
|
33
|
+
custom?: Record<string, unknown>;
|
|
34
|
+
addresses?: never;
|
|
24
35
|
/** Index signature for compatibility with UserData */
|
|
25
36
|
[key: string]: unknown;
|
|
26
37
|
}
|
|
@@ -36,12 +47,14 @@ export interface AddressData {
|
|
|
36
47
|
city: string;
|
|
37
48
|
/** Postal/ZIP code */
|
|
38
49
|
postal_code: string;
|
|
39
|
-
/** Country code or name */
|
|
50
|
+
/** Country code or name (legacy/fallback) */
|
|
40
51
|
country: string;
|
|
41
52
|
/** Contact phone */
|
|
42
53
|
phone?: string;
|
|
43
54
|
/** Whether this is the default address for its type */
|
|
44
55
|
is_default: boolean;
|
|
56
|
+
/** Country relation (UI-only, stored in relations table) */
|
|
57
|
+
country_rel?: never;
|
|
45
58
|
/** Index signature for compatibility with UserData */
|
|
46
59
|
[key: string]: unknown;
|
|
47
60
|
}
|
package/dist/mod.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export * from "./external-domain.js";
|
|
|
43
43
|
export * from "./account.js";
|
|
44
44
|
export * from "./product.js";
|
|
45
45
|
export * from "./project.js";
|
|
46
|
+
export * from "./country.js";
|
|
46
47
|
export * from "./template.js";
|
|
47
48
|
export * from "./email.js";
|
|
48
49
|
export * from "./example.js";
|
package/dist/mod.js
CHANGED
|
@@ -55,6 +55,8 @@ export * from "./account.js";
|
|
|
55
55
|
export * from "./product.js";
|
|
56
56
|
// Project/config domain types
|
|
57
57
|
export * from "./project.js";
|
|
58
|
+
// Country domain types (geographic reference data)
|
|
59
|
+
export * from "./country.js";
|
|
58
60
|
// Template domain types
|
|
59
61
|
export * from "./template.js";
|
|
60
62
|
// Email domain types
|
package/dist/order.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ import type { AddressData } from "./customer.js";
|
|
|
13
13
|
import type { UUID } from "./utils.js";
|
|
14
14
|
/** Order status progression */
|
|
15
15
|
export type OrderStatus = "pending" | "paid" | "processing" | "shipped" | "delivered" | "cancelled";
|
|
16
|
+
/** Checkout stages for tracking progress */
|
|
17
|
+
export type CheckoutStage = "cart" | "addresses" | "delivery" | "confirm" | "payment" | "complete";
|
|
16
18
|
/** Single order line item (snapshot at purchase time) */
|
|
17
19
|
export interface OrderLineItem {
|
|
18
20
|
/** Product model_id for reference */
|
|
@@ -39,6 +41,13 @@ export interface OrderTotals {
|
|
|
39
41
|
/** Final total */
|
|
40
42
|
total: number;
|
|
41
43
|
}
|
|
44
|
+
/** Delivery option snapshot at checkout time */
|
|
45
|
+
export interface DeliveryOptionSnapshot {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
price: number;
|
|
49
|
+
estimated_time?: string;
|
|
50
|
+
}
|
|
42
51
|
/** Order data field schema */
|
|
43
52
|
export interface OrderData {
|
|
44
53
|
/** Current order status */
|
|
@@ -55,6 +64,14 @@ export interface OrderData {
|
|
|
55
64
|
billing_address: AddressData;
|
|
56
65
|
/** Order notes */
|
|
57
66
|
notes?: string;
|
|
67
|
+
/** Selected delivery option ID */
|
|
68
|
+
delivery_option_id?: string;
|
|
69
|
+
/** Delivery option snapshot at checkout time */
|
|
70
|
+
delivery_option?: DeliveryOptionSnapshot;
|
|
71
|
+
/** Customer email (for tracking, especially guest checkout) */
|
|
72
|
+
customer_email?: string;
|
|
73
|
+
/** Current checkout stage */
|
|
74
|
+
checkout_stage?: CheckoutStage;
|
|
58
75
|
/** Index signature for compatibility with UserData */
|
|
59
76
|
[key: string]: unknown;
|
|
60
77
|
}
|
package/dist/project.d.ts
CHANGED
|
@@ -37,3 +37,33 @@ export interface ConfigDataRbac extends ConfigDataDefault {
|
|
|
37
37
|
}
|
|
38
38
|
/** Union of all config data types */
|
|
39
39
|
export type ConfigData = ConfigDataDefault | ConfigDataRbac;
|
|
40
|
+
/** Single delivery option */
|
|
41
|
+
export interface DeliveryOption {
|
|
42
|
+
/** Unique identifier */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Display name */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Description shown to customer */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Base price in cents */
|
|
49
|
+
price: number;
|
|
50
|
+
/** Estimated delivery time (e.g., "2-3 business days") */
|
|
51
|
+
estimated_time?: string;
|
|
52
|
+
/** Whether this option is currently available */
|
|
53
|
+
is_active: boolean;
|
|
54
|
+
/** Sort order for display */
|
|
55
|
+
sort_order: number;
|
|
56
|
+
/** Optional: minimum order amount for this option (in cents) */
|
|
57
|
+
min_order_amount?: number;
|
|
58
|
+
/** Optional: free shipping threshold (in cents) */
|
|
59
|
+
free_above?: number;
|
|
60
|
+
}
|
|
61
|
+
/** Delivery options configuration (stored in project config) */
|
|
62
|
+
export interface DeliveryOptionsConfig {
|
|
63
|
+
/** Default currency for prices */
|
|
64
|
+
currency: string;
|
|
65
|
+
/** Available delivery options */
|
|
66
|
+
options: DeliveryOption[];
|
|
67
|
+
/** Default option ID when none selected */
|
|
68
|
+
default_option_id?: string;
|
|
69
|
+
}
|