@atomic-solutions/schemas 0.1.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/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/common/index.cjs +105 -0
- package/dist/common/index.cjs.map +1 -0
- package/dist/common/index.d.cts +57 -0
- package/dist/common/index.d.ts +57 -0
- package/dist/common/index.js +97 -0
- package/dist/common/index.js.map +1 -0
- package/dist/index.cjs +1189 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1118 -0
- package/dist/index.js.map +1 -0
- package/dist/money.schema-BeHADrsV.d.cts +250 -0
- package/dist/money.schema-BeHADrsV.d.ts +250 -0
- package/dist/payment.schema-CjccuGNs.d.cts +4837 -0
- package/dist/payment.schema-CjccuGNs.d.ts +4837 -0
- package/dist/woocommerce/index.cjs +865 -0
- package/dist/woocommerce/index.cjs.map +1 -0
- package/dist/woocommerce/index.d.cts +54 -0
- package/dist/woocommerce/index.d.ts +54 -0
- package/dist/woocommerce/index.js +825 -0
- package/dist/woocommerce/index.js.map +1 -0
- package/dist/wordpress/index.cjs +325 -0
- package/dist/wordpress/index.cjs.map +1 -0
- package/dist/wordpress/index.d.cts +11883 -0
- package/dist/wordpress/index.d.ts +11883 -0
- package/dist/wordpress/index.js +293 -0
- package/dist/wordpress/index.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base address schema for WooCommerce addresses
|
|
5
|
+
*
|
|
6
|
+
* Used for both billing and shipping addresses in checkout
|
|
7
|
+
*/
|
|
8
|
+
declare const addressSchema: z.ZodObject<{
|
|
9
|
+
/** First name */
|
|
10
|
+
first_name: z.ZodString;
|
|
11
|
+
/** Last name */
|
|
12
|
+
last_name: z.ZodString;
|
|
13
|
+
/** Company name (optional) */
|
|
14
|
+
company: z.ZodString;
|
|
15
|
+
/** Address line 1 */
|
|
16
|
+
address_1: z.ZodString;
|
|
17
|
+
/** Address line 2 (optional) */
|
|
18
|
+
address_2: z.ZodString;
|
|
19
|
+
/** City */
|
|
20
|
+
city: z.ZodString;
|
|
21
|
+
/** State/Province/Region */
|
|
22
|
+
state: z.ZodString;
|
|
23
|
+
/** Postal code */
|
|
24
|
+
postcode: z.ZodString;
|
|
25
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
26
|
+
country: z.ZodString;
|
|
27
|
+
/** Phone number */
|
|
28
|
+
phone: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
first_name: string;
|
|
31
|
+
last_name: string;
|
|
32
|
+
company: string;
|
|
33
|
+
address_1: string;
|
|
34
|
+
address_2: string;
|
|
35
|
+
city: string;
|
|
36
|
+
state: string;
|
|
37
|
+
postcode: string;
|
|
38
|
+
country: string;
|
|
39
|
+
phone: string;
|
|
40
|
+
}, {
|
|
41
|
+
first_name: string;
|
|
42
|
+
last_name: string;
|
|
43
|
+
company: string;
|
|
44
|
+
address_1: string;
|
|
45
|
+
address_2: string;
|
|
46
|
+
city: string;
|
|
47
|
+
state: string;
|
|
48
|
+
postcode: string;
|
|
49
|
+
country: string;
|
|
50
|
+
phone: string;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Non-mandatory address schema for API responses
|
|
54
|
+
*
|
|
55
|
+
* Used for parsing cart shipping/billing addresses from API responses.
|
|
56
|
+
* No validation constraints - accepts whatever the API returns.
|
|
57
|
+
*/
|
|
58
|
+
declare const addressSchemaNonMandatory: z.ZodObject<{
|
|
59
|
+
/** First name */
|
|
60
|
+
first_name: z.ZodString;
|
|
61
|
+
/** Last name */
|
|
62
|
+
last_name: z.ZodString;
|
|
63
|
+
/** Company name (optional) */
|
|
64
|
+
company: z.ZodString;
|
|
65
|
+
/** Address line 1 */
|
|
66
|
+
address_1: z.ZodString;
|
|
67
|
+
/** Address line 2 (optional) */
|
|
68
|
+
address_2: z.ZodString;
|
|
69
|
+
/** City */
|
|
70
|
+
city: z.ZodString;
|
|
71
|
+
/** State/Province/Region */
|
|
72
|
+
state: z.ZodString;
|
|
73
|
+
/** Postal code */
|
|
74
|
+
postcode: z.ZodString;
|
|
75
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
76
|
+
country: z.ZodString;
|
|
77
|
+
/** Phone number */
|
|
78
|
+
phone: z.ZodString;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
first_name: string;
|
|
81
|
+
last_name: string;
|
|
82
|
+
company: string;
|
|
83
|
+
address_1: string;
|
|
84
|
+
address_2: string;
|
|
85
|
+
city: string;
|
|
86
|
+
state: string;
|
|
87
|
+
postcode: string;
|
|
88
|
+
country: string;
|
|
89
|
+
phone: string;
|
|
90
|
+
}, {
|
|
91
|
+
first_name: string;
|
|
92
|
+
last_name: string;
|
|
93
|
+
company: string;
|
|
94
|
+
address_1: string;
|
|
95
|
+
address_2: string;
|
|
96
|
+
city: string;
|
|
97
|
+
state: string;
|
|
98
|
+
postcode: string;
|
|
99
|
+
country: string;
|
|
100
|
+
phone: string;
|
|
101
|
+
}>;
|
|
102
|
+
/**
|
|
103
|
+
* Billing address schema
|
|
104
|
+
*
|
|
105
|
+
* Extends base address with email field (required for billing)
|
|
106
|
+
*/
|
|
107
|
+
declare const billingAddressSchemaMandatory: z.ZodObject<{
|
|
108
|
+
/** First name */
|
|
109
|
+
first_name: z.ZodString;
|
|
110
|
+
/** Last name */
|
|
111
|
+
last_name: z.ZodString;
|
|
112
|
+
/** Company name (optional) */
|
|
113
|
+
company: z.ZodString;
|
|
114
|
+
/** Address line 1 */
|
|
115
|
+
address_1: z.ZodString;
|
|
116
|
+
/** Address line 2 (optional) */
|
|
117
|
+
address_2: z.ZodString;
|
|
118
|
+
/** City */
|
|
119
|
+
city: z.ZodString;
|
|
120
|
+
/** State/Province/Region */
|
|
121
|
+
state: z.ZodString;
|
|
122
|
+
/** Postal code */
|
|
123
|
+
postcode: z.ZodString;
|
|
124
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
125
|
+
country: z.ZodString;
|
|
126
|
+
/** Phone number */
|
|
127
|
+
phone: z.ZodString;
|
|
128
|
+
} & {
|
|
129
|
+
/** Email address (required for billing) */
|
|
130
|
+
email: z.ZodString;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
first_name: string;
|
|
133
|
+
last_name: string;
|
|
134
|
+
company: string;
|
|
135
|
+
address_1: string;
|
|
136
|
+
address_2: string;
|
|
137
|
+
city: string;
|
|
138
|
+
state: string;
|
|
139
|
+
postcode: string;
|
|
140
|
+
country: string;
|
|
141
|
+
phone: string;
|
|
142
|
+
email: string;
|
|
143
|
+
}, {
|
|
144
|
+
first_name: string;
|
|
145
|
+
last_name: string;
|
|
146
|
+
company: string;
|
|
147
|
+
address_1: string;
|
|
148
|
+
address_2: string;
|
|
149
|
+
city: string;
|
|
150
|
+
state: string;
|
|
151
|
+
postcode: string;
|
|
152
|
+
country: string;
|
|
153
|
+
phone: string;
|
|
154
|
+
email: string;
|
|
155
|
+
}>;
|
|
156
|
+
declare const billingAddressSchemaNonMandatory: z.ZodObject<{
|
|
157
|
+
/** First name */
|
|
158
|
+
first_name: z.ZodString;
|
|
159
|
+
/** Last name */
|
|
160
|
+
last_name: z.ZodString;
|
|
161
|
+
/** Company name (optional) */
|
|
162
|
+
company: z.ZodString;
|
|
163
|
+
/** Address line 1 */
|
|
164
|
+
address_1: z.ZodString;
|
|
165
|
+
/** Address line 2 (optional) */
|
|
166
|
+
address_2: z.ZodString;
|
|
167
|
+
/** City */
|
|
168
|
+
city: z.ZodString;
|
|
169
|
+
/** State/Province/Region */
|
|
170
|
+
state: z.ZodString;
|
|
171
|
+
/** Postal code */
|
|
172
|
+
postcode: z.ZodString;
|
|
173
|
+
/** Country code (ISO 3166-1 alpha-2) */
|
|
174
|
+
country: z.ZodString;
|
|
175
|
+
/** Phone number */
|
|
176
|
+
phone: z.ZodString;
|
|
177
|
+
} & {
|
|
178
|
+
/** Email address (can be null for guest carts) */
|
|
179
|
+
email: z.ZodNullable<z.ZodString>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
first_name: string;
|
|
182
|
+
last_name: string;
|
|
183
|
+
company: string;
|
|
184
|
+
address_1: string;
|
|
185
|
+
address_2: string;
|
|
186
|
+
city: string;
|
|
187
|
+
state: string;
|
|
188
|
+
postcode: string;
|
|
189
|
+
country: string;
|
|
190
|
+
phone: string;
|
|
191
|
+
email: string | null;
|
|
192
|
+
}, {
|
|
193
|
+
first_name: string;
|
|
194
|
+
last_name: string;
|
|
195
|
+
company: string;
|
|
196
|
+
address_1: string;
|
|
197
|
+
address_2: string;
|
|
198
|
+
city: string;
|
|
199
|
+
state: string;
|
|
200
|
+
postcode: string;
|
|
201
|
+
country: string;
|
|
202
|
+
phone: string;
|
|
203
|
+
email: string | null;
|
|
204
|
+
}>;
|
|
205
|
+
type Address = z.infer<typeof addressSchema>;
|
|
206
|
+
type BillingAddress = z.infer<typeof billingAddressSchemaMandatory>;
|
|
207
|
+
type AddressNonOptional = z.infer<typeof addressSchemaNonMandatory>;
|
|
208
|
+
type BillingAddressNonOptional = z.infer<typeof billingAddressSchemaNonMandatory>;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* WooCommerce money/currency formatting schema
|
|
212
|
+
*
|
|
213
|
+
* Contains currency information and formatting rules used throughout
|
|
214
|
+
* WooCommerce responses for prices, totals, and monetary values.
|
|
215
|
+
*/
|
|
216
|
+
declare const moneySchema: z.ZodObject<{
|
|
217
|
+
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
218
|
+
currency_code: z.ZodString;
|
|
219
|
+
/** Currency symbol (e.g., '$', '€', 'KM') */
|
|
220
|
+
currency_symbol: z.ZodString;
|
|
221
|
+
/** Number of decimal places (e.g., 2 for dollars/euros) */
|
|
222
|
+
currency_minor_unit: z.ZodNumber;
|
|
223
|
+
/** Decimal separator character (e.g., '.', ',') */
|
|
224
|
+
currency_decimal_separator: z.ZodString;
|
|
225
|
+
/** Thousands separator character (e.g., ',', '.') */
|
|
226
|
+
currency_thousand_separator: z.ZodString;
|
|
227
|
+
/** Currency symbol prefix (empty if symbol is suffix) */
|
|
228
|
+
currency_prefix: z.ZodString;
|
|
229
|
+
/** Currency symbol suffix (empty if symbol is prefix) */
|
|
230
|
+
currency_suffix: z.ZodString;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
currency_code: string;
|
|
233
|
+
currency_symbol: string;
|
|
234
|
+
currency_minor_unit: number;
|
|
235
|
+
currency_decimal_separator: string;
|
|
236
|
+
currency_thousand_separator: string;
|
|
237
|
+
currency_prefix: string;
|
|
238
|
+
currency_suffix: string;
|
|
239
|
+
}, {
|
|
240
|
+
currency_code: string;
|
|
241
|
+
currency_symbol: string;
|
|
242
|
+
currency_minor_unit: number;
|
|
243
|
+
currency_decimal_separator: string;
|
|
244
|
+
currency_thousand_separator: string;
|
|
245
|
+
currency_prefix: string;
|
|
246
|
+
currency_suffix: string;
|
|
247
|
+
}>;
|
|
248
|
+
type Money = z.infer<typeof moneySchema>;
|
|
249
|
+
|
|
250
|
+
export { type Address as A, type BillingAddress as B, type Money as M, addressSchema as a, addressSchemaNonMandatory as b, billingAddressSchemaMandatory as c, billingAddressSchemaNonMandatory as d, type AddressNonOptional as e, type BillingAddressNonOptional as f, moneySchema as m };
|