@kizlo/woocommerce 0.16.0 → 0.18.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/README.md +39 -3
- package/dist/checkout-validation.d.ts +1 -1
- package/dist/index.d.ts +316 -86
- package/dist/index.js +105 -54
- package/dist/{schema-CWDJjtW7.d.ts → schema-ScTHhVY4.d.ts} +3 -3
- package/dist/test.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,23 +65,59 @@ const commerce = woocommerce({ allowGuest: false })
|
|
|
65
65
|
|
|
66
66
|
`allowGuest` defaults to `true`, permitting logged-out checkout subject to WooCommerce's own guest-checkout settings and validation. Customer APIs such as `customers.get` always require login. Guest carts, product/storefront reads, and order ownership/key checks (including guest receipts) keep their existing behavior. After installing a release containing this option, replace your application checkout-auth wrapper with `woocommerce({ allowGuest: false })`; procedure inputs, outputs, and hooks stay the same.
|
|
67
67
|
|
|
68
|
+
## Read a customer before loading a cart
|
|
69
|
+
|
|
70
|
+
`customers.get()` resolves the signed-in user's email and creates a missing WooCommerce customer on demand. Account and address pages can call it directly after signup. Existing accounts and saved details are preserved; customer and cart requests share the same identity and creation lock.
|
|
71
|
+
|
|
72
|
+
Install the matching companion plugin and regenerate your WordPress contract before upgrading the SDK. The contract must include `woocommerce.kizlo.customers.retrieve`. Provisioning or lock failures return `SERVICE_UNAVAILABLE` (503), which you can retry; they do not return an empty customer or require checkout first.
|
|
73
|
+
|
|
74
|
+
## Submit partial checkout addresses
|
|
75
|
+
|
|
76
|
+
Confirm and retry accept optional core address fields, including billing email. Send only the fields you collect. The billing address object is required; shipping is optional. Each supplied address must include `additionalFields`, with any registered required answers (or `{}` when none are required).
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const billingAddress = {
|
|
80
|
+
firstName: "Ada", lastName: "Lovelace",
|
|
81
|
+
address1: "1 Store Street", city: "London", postcode: "SW1A 1AA", country: "GB",
|
|
82
|
+
email: "ada@example.com", additionalFields: {},
|
|
83
|
+
}
|
|
84
|
+
await kizlo.woocommerce.checkout.confirm.call({ body: { billingAddress, paymentMethod: "bacs" } })
|
|
85
|
+
// For an existing unpaid order:
|
|
86
|
+
await kizlo.woocommerce.checkout.retry.call({
|
|
87
|
+
params: { orderId },
|
|
88
|
+
body: { key: orderKey, billingAddress, paymentMethod: "bacs" },
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Omitted fields produce no wire keys; explicit empty strings request clearing where WooCommerce permits it. WooCommerce validates the resulting address against its live rules through the existing checkout errors. Full-address callers remain valid. See [Billing Tax IDs](#billing-tax-ids) for Tax ID omission and [additional checkout fields](https://kizlo.io/docs/concepts/additional-checkout-fields) for registered answer contracts and native billing-to-shipping mirroring.
|
|
93
|
+
|
|
94
|
+
## Order history
|
|
95
|
+
|
|
96
|
+
`client.woocommerce.orders.list({ query: { page: 1, perPage: 10 } })` returns `{ items: Order[], meta: ListMetadata }` for the signed-in customer. Both query inputs are optional positive integers; `perPage` is capped at 100. Orders are newest first, with descending ID breaking ties. Metadata includes `page`, `totalItems`, `totalPages`, `nextPage`, `prevPage`, `hasNextPage`, and `hasPrevPage`. Empty history and pages beyond the last page succeed with an empty `items` array.
|
|
97
|
+
|
|
98
|
+
List items use the same normalized `Order` as `orders.get`, including items, additional fields, currency and totals. Both expose `number`, preserving the store's custom order numbering, and `createdAt`, the order's UTC creation time as Unix milliseconds (`0` when unavailable). Raw `status` values preserve custom statuses. Use the backend's `isPaid` and `needsPayment` flags for payment behavior; status labels do not define whether an order is paid.
|
|
99
|
+
|
|
100
|
+
History always requires login, including when `allowGuest` is enabled. The server derives the customer from the authenticated session; caller-selected email/customer IDs cannot change ownership. Internal checkout drafts and trash are excluded. Anonymous calls return `UNAUTHORIZED`, backend access denial returns `FORBIDDEN`, and other backend failures remain errors rather than empty history. History HTTP responses use `Cache-Control: private, no-store`. The existing order-key/email checks still apply to guest `orders.get` receipts.
|
|
101
|
+
|
|
102
|
+
Update the Kizlo WooCommerce plugin and run `kizlo generate` before using this API so your generated contract includes `woocommerce.kizlo.orders.list` and the shared order metadata.
|
|
103
|
+
|
|
68
104
|
## Billing Tax IDs
|
|
69
105
|
|
|
70
106
|
Billing addresses expose `taxId` on customers, carts, checkout responses, and orders. The field is always a string on output and defaults to `""` when it has not been set. Billing address inputs accept an optional `taxId`; shipping addresses have no native `taxId`, and Kizlo discards managed shipping copies independently of the hidden UI rule.
|
|
71
107
|
|
|
72
108
|
```ts
|
|
73
|
-
await kizlo.woocommerce.cart.
|
|
109
|
+
await kizlo.woocommerce.cart.updateAddress.call({
|
|
74
110
|
body: { billingAddress: { taxId: "GB123456789" } },
|
|
75
111
|
})
|
|
76
112
|
```
|
|
77
113
|
|
|
78
114
|
Store administrators can make the field mandatory from **WooCommerce → Settings → Accounts & Privacy → Checkout → Require Tax ID at checkout**. It remains optional by default.
|
|
79
115
|
|
|
80
|
-
The native value maps to the official registered `kizlo/tax-id` address field. For example, `{ billingAddress: { taxId: "GB123" } }` becomes `{ billing_address: { "kizlo/tax-id": "GB123" } }` on the Store API wire.
|
|
116
|
+
The native value maps to the official registered `kizlo/tax-id` address field. For example, `{ billingAddress: { taxId: "GB123" } }` becomes `{ billing_address: { "kizlo/tax-id": "GB123" } }` on the Store API wire. Cart/customer-address updates and checkout confirm/retry omit the key when `taxId` is omitted, preserving the saved value. Send `taxId: ""` to clear it explicitly. WooCommerce owns sanitization and contextual requiredness.
|
|
81
117
|
|
|
82
118
|
Raw introspection preserves `kizlo/tax-id` in both address schemas. Normalized billing `additionalFields` omits it from types and values: use the native property. Raw billing inputs using that key are rejected even when a duplicate equals `taxId`; there is no raw-only compatibility alias. Other registered and compatible unknown response extras retain their usual buckets.
|
|
83
119
|
|
|
84
|
-
Registered billing extras retain their named enum and scalar types in reads, partial cart updates, and
|
|
120
|
+
Registered billing extras retain their named enum and scalar types in reads, partial cart updates, and confirmation/retry inputs, including registrations with a scalar string index. Confirmation and retry require the registered answers and reject values outside their enums; partial cart updates allow omitted answers. These are compile-time guarantees from the consumer's registered contract. WooCommerce continues to validate against its live registry at runtime.
|
|
85
121
|
|
|
86
122
|
Customer reads use the grouped `billing.additional_fields` adapter backed by public CheckoutFields helpers. Orders read their own snapshot, never the current profile. Storage remains `_wc_billing/kizlo/tax-id`, so existing saved values need no migration. Order admin edits set/replace/clear the order alone; profile edits affect later cart hydration. The retry validation/persistence bridge and shipping cleanup remain required on WooCommerce 11.0.1.
|
|
87
123
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { f as CheckoutRegisteredFieldReference, m as CheckoutValidationIssue, o as StorefrontField, p as CheckoutValidationData } from "./schema-
|
|
1
|
+
import { f as CheckoutRegisteredFieldReference, m as CheckoutValidationIssue, o as StorefrontField, p as CheckoutValidationData } from "./schema-ScTHhVY4.js";
|
|
2
2
|
export { CheckoutRegisteredFieldReference, CheckoutValidationData, CheckoutValidationIssue, type StorefrontField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as StorefrontCountry, c as StorefrontFieldOverride, d as StorefrontPricing, f as CheckoutRegisteredFieldReference, i as StorefrontCheckout, l as StorefrontFieldRule, m as CheckoutValidationIssue, n as StorefrontAddress, o as StorefrontField, p as CheckoutValidationData, r as StorefrontCatalog, s as StorefrontFieldOption, t as Storefront, u as StorefrontFieldSchema } from "./schema-
|
|
1
|
+
import { a as StorefrontCountry, c as StorefrontFieldOverride, d as StorefrontPricing, f as CheckoutRegisteredFieldReference, i as StorefrontCheckout, l as StorefrontFieldRule, m as CheckoutValidationIssue, n as StorefrontAddress, o as StorefrontField, p as CheckoutValidationData, r as StorefrontCatalog, s as StorefrontFieldOption, t as Storefront, u as StorefrontFieldSchema } from "./schema-ScTHhVY4.js";
|
|
2
2
|
import * as kizlo0 from "kizlo";
|
|
3
3
|
import { WP_CustomFields, WP_Schema } from "kizlo";
|
|
4
4
|
import * as _kizlo_shared0 from "@kizlo/shared";
|
|
@@ -5178,7 +5178,7 @@ declare const SelectCartShippingRateInput: z$1.ZodObject<{
|
|
|
5178
5178
|
packageId: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodUnion<readonly [z$1.ZodNumber, z$1.ZodString]>>>;
|
|
5179
5179
|
}, z$1.core.$strip>;
|
|
5180
5180
|
type SelectCartShippingRateInput = z$1.infer<typeof SelectCartShippingRateInput>;
|
|
5181
|
-
declare const
|
|
5181
|
+
declare const UpdateCartAddressInput: z$1.ZodObject<{
|
|
5182
5182
|
shippingAddress: z$1.ZodOptional<z$1.ZodObject<{
|
|
5183
5183
|
firstName: z$1.ZodOptional<z$1.ZodString>;
|
|
5184
5184
|
lastName: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -5222,7 +5222,7 @@ type CartBillingAddressInput = Omit<z$1.input<typeof CartBillingAddress>, "addit
|
|
|
5222
5222
|
type CartShippingAddressInput = Omit<z$1.input<typeof CartShippingAddress>, "additionalFields"> & {
|
|
5223
5223
|
additionalFields: AddressAdditionalFieldsSubmission;
|
|
5224
5224
|
};
|
|
5225
|
-
type
|
|
5225
|
+
type UpdateCartAddressInput = {
|
|
5226
5226
|
billingAddress?: Partial<Omit<CartBillingAddressInput, "additionalFields">> & {
|
|
5227
5227
|
additionalFields?: BillingAdditionalFieldsInput;
|
|
5228
5228
|
};
|
|
@@ -5337,33 +5337,75 @@ declare const UpdateCheckoutInput: z$2.ZodObject<{
|
|
|
5337
5337
|
type UpdateCheckoutInput = Omit<z$2.input<typeof UpdateCheckoutInput>, "additionalFields"> & {
|
|
5338
5338
|
additionalFields?: CheckoutAdditionalFieldsInput;
|
|
5339
5339
|
};
|
|
5340
|
+
declare const CheckoutBillingAddressInput: z$2.ZodObject<{
|
|
5341
|
+
email: z$2.ZodOptional<z$2.ZodString>;
|
|
5342
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5343
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5344
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5345
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5346
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5347
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5348
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5349
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5350
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5351
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5352
|
+
additionalFields: z$2.ZodType<BillingAdditionalFields, BillingAdditionalFieldsSubmission, z$2.core.$ZodTypeInternals<BillingAdditionalFields, BillingAdditionalFieldsSubmission>>;
|
|
5353
|
+
taxId: z$2.ZodOptional<z$2.ZodString>;
|
|
5354
|
+
}, z$2.core.$strip>;
|
|
5355
|
+
type CheckoutBillingAddressInput = Omit<z$2.input<typeof CheckoutBillingAddressInput>, "additionalFields"> & {
|
|
5356
|
+
additionalFields: BillingAdditionalFieldsSubmission;
|
|
5357
|
+
};
|
|
5358
|
+
declare const CheckoutShippingAddressInput: z$2.ZodObject<{
|
|
5359
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5360
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5361
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5362
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5363
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5364
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5365
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5366
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5367
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5368
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5369
|
+
additionalFields: z$2.ZodType<{
|
|
5370
|
+
[x: string]: string | boolean | undefined;
|
|
5371
|
+
}, {
|
|
5372
|
+
[x: string]: string | boolean | undefined;
|
|
5373
|
+
}, z$2.core.$ZodTypeInternals<{
|
|
5374
|
+
[x: string]: string | boolean | undefined;
|
|
5375
|
+
}, {
|
|
5376
|
+
[x: string]: string | boolean | undefined;
|
|
5377
|
+
}>>;
|
|
5378
|
+
}, z$2.core.$strip>;
|
|
5379
|
+
type CheckoutShippingAddressInput = Omit<z$2.input<typeof CheckoutShippingAddressInput>, "additionalFields"> & {
|
|
5380
|
+
additionalFields: AddressAdditionalFieldsSubmission;
|
|
5381
|
+
};
|
|
5340
5382
|
declare const ConfirmCheckoutInput: z$2.ZodObject<{
|
|
5341
5383
|
billingAddress: z$2.ZodObject<{
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
phone: z$2.ZodString;
|
|
5384
|
+
email: z$2.ZodOptional<z$2.ZodString>;
|
|
5385
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5386
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5387
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5388
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5389
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5390
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5391
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5392
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5393
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5394
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5354
5395
|
additionalFields: z$2.ZodType<BillingAdditionalFields, BillingAdditionalFieldsSubmission, z$2.core.$ZodTypeInternals<BillingAdditionalFields, BillingAdditionalFieldsSubmission>>;
|
|
5396
|
+
taxId: z$2.ZodOptional<z$2.ZodString>;
|
|
5355
5397
|
}, z$2.core.$strip>;
|
|
5356
5398
|
shippingAddress: z$2.ZodOptional<z$2.ZodObject<{
|
|
5357
|
-
firstName: z$2.ZodString
|
|
5358
|
-
lastName: z$2.ZodString
|
|
5359
|
-
company: z$2.ZodString
|
|
5360
|
-
address1: z$2.ZodString
|
|
5361
|
-
address2: z$2.ZodString
|
|
5362
|
-
city: z$2.ZodString
|
|
5363
|
-
state: z$2.ZodString
|
|
5364
|
-
postcode: z$2.ZodString
|
|
5365
|
-
country: z$2.ZodString
|
|
5366
|
-
phone: z$2.ZodString
|
|
5399
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5400
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5401
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5402
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5403
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5404
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5405
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5406
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5407
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5408
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5367
5409
|
additionalFields: z$2.ZodType<{
|
|
5368
5410
|
[x: string]: string | boolean | undefined;
|
|
5369
5411
|
}, {
|
|
@@ -5398,8 +5440,8 @@ declare const ConfirmCheckoutInput: z$2.ZodObject<{
|
|
|
5398
5440
|
}, z$2.core.$strip>;
|
|
5399
5441
|
type ConfirmCheckoutInput = Omit<z$2.input<typeof ConfirmCheckoutInput>, "additionalFields" | "billingAddress" | "shippingAddress"> & {
|
|
5400
5442
|
additionalFields?: CheckoutAdditionalFieldsSubmission;
|
|
5401
|
-
billingAddress:
|
|
5402
|
-
shippingAddress?:
|
|
5443
|
+
billingAddress: CheckoutBillingAddressInput;
|
|
5444
|
+
shippingAddress?: CheckoutShippingAddressInput;
|
|
5403
5445
|
};
|
|
5404
5446
|
declare const RetryCheckoutInput: z$2.ZodObject<{
|
|
5405
5447
|
key: z$2.ZodString;
|
|
@@ -5407,35 +5449,35 @@ declare const RetryCheckoutInput: z$2.ZodObject<{
|
|
|
5407
5449
|
paymentMethod: z$2.ZodString;
|
|
5408
5450
|
billingEmail: z$2.ZodOptional<z$2.ZodEmail>;
|
|
5409
5451
|
billingAddress: z$2.ZodObject<{
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
phone: z$2.ZodString;
|
|
5452
|
+
email: z$2.ZodOptional<z$2.ZodString>;
|
|
5453
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5454
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5455
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5456
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5457
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5458
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5459
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5460
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5461
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5462
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5422
5463
|
additionalFields: z$2.ZodType<BillingAdditionalFields, BillingAdditionalFieldsSubmission, z$2.core.$ZodTypeInternals<BillingAdditionalFields, BillingAdditionalFieldsSubmission>>;
|
|
5464
|
+
taxId: z$2.ZodOptional<z$2.ZodString>;
|
|
5423
5465
|
}, z$2.core.$strip>;
|
|
5424
5466
|
paymentData: z$2.ZodOptional<z$2.ZodArray<z$2.ZodObject<{
|
|
5425
5467
|
key: z$2.ZodString;
|
|
5426
5468
|
value: z$2.ZodUnion<readonly [z$2.ZodString, z$2.ZodBoolean]>;
|
|
5427
5469
|
}, z$2.core.$strip>>>;
|
|
5428
5470
|
shippingAddress: z$2.ZodOptional<z$2.ZodObject<{
|
|
5429
|
-
firstName: z$2.ZodString
|
|
5430
|
-
lastName: z$2.ZodString
|
|
5431
|
-
company: z$2.ZodString
|
|
5432
|
-
address1: z$2.ZodString
|
|
5433
|
-
address2: z$2.ZodString
|
|
5434
|
-
city: z$2.ZodString
|
|
5435
|
-
state: z$2.ZodString
|
|
5436
|
-
postcode: z$2.ZodString
|
|
5437
|
-
country: z$2.ZodString
|
|
5438
|
-
phone: z$2.ZodString
|
|
5471
|
+
firstName: z$2.ZodOptional<z$2.ZodString>;
|
|
5472
|
+
lastName: z$2.ZodOptional<z$2.ZodString>;
|
|
5473
|
+
company: z$2.ZodOptional<z$2.ZodString>;
|
|
5474
|
+
address1: z$2.ZodOptional<z$2.ZodString>;
|
|
5475
|
+
address2: z$2.ZodOptional<z$2.ZodString>;
|
|
5476
|
+
city: z$2.ZodOptional<z$2.ZodString>;
|
|
5477
|
+
state: z$2.ZodOptional<z$2.ZodString>;
|
|
5478
|
+
postcode: z$2.ZodOptional<z$2.ZodString>;
|
|
5479
|
+
country: z$2.ZodOptional<z$2.ZodString>;
|
|
5480
|
+
phone: z$2.ZodOptional<z$2.ZodString>;
|
|
5439
5481
|
additionalFields: z$2.ZodType<{
|
|
5440
5482
|
[x: string]: string | boolean | undefined;
|
|
5441
5483
|
}, {
|
|
@@ -5462,8 +5504,8 @@ declare const RetryCheckoutInput: z$2.ZodObject<{
|
|
|
5462
5504
|
}, z$2.core.$strip>;
|
|
5463
5505
|
type RetryCheckoutInput = Omit<z$2.input<typeof RetryCheckoutInput>, "additionalFields" | "billingAddress" | "shippingAddress"> & {
|
|
5464
5506
|
additionalFields?: CheckoutAdditionalFieldsSubmission;
|
|
5465
|
-
billingAddress:
|
|
5466
|
-
shippingAddress?:
|
|
5507
|
+
billingAddress: CheckoutBillingAddressInput;
|
|
5508
|
+
shippingAddress?: CheckoutShippingAddressInput;
|
|
5467
5509
|
};
|
|
5468
5510
|
//#endregion
|
|
5469
5511
|
//#region src/order/schema.d.ts
|
|
@@ -5605,6 +5647,8 @@ declare const Order: z.ZodObject<{
|
|
|
5605
5647
|
}>>>;
|
|
5606
5648
|
id: z.ZodNumber;
|
|
5607
5649
|
status: z.ZodString;
|
|
5650
|
+
number: z.ZodString;
|
|
5651
|
+
createdAt: z.ZodNumber;
|
|
5608
5652
|
isPaid: z.ZodBoolean;
|
|
5609
5653
|
items: z.ZodArray<z.ZodObject<{
|
|
5610
5654
|
id: z.ZodNumber;
|
|
@@ -5764,6 +5808,186 @@ declare const GetOrderInput: z.ZodObject<{
|
|
|
5764
5808
|
billingEmail: z.ZodOptional<z.ZodEmail>;
|
|
5765
5809
|
}, z.core.$strip>;
|
|
5766
5810
|
type GetOrderInput = z.input<typeof GetOrderInput>;
|
|
5811
|
+
declare const ListOrderInput: z.ZodObject<{
|
|
5812
|
+
page: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodInt>>;
|
|
5813
|
+
perPage: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodInt>>;
|
|
5814
|
+
}, z.core.$strip>;
|
|
5815
|
+
type ListOrderInput = z.input<typeof ListOrderInput>;
|
|
5816
|
+
declare const OrderList: z.ZodObject<{
|
|
5817
|
+
items: z.ZodArray<z.ZodObject<{
|
|
5818
|
+
additionalFields: z.ZodType<{
|
|
5819
|
+
[x: string]: string | boolean | undefined;
|
|
5820
|
+
}, Partial<{
|
|
5821
|
+
[x: string]: string | boolean | undefined;
|
|
5822
|
+
}>, z.core.$ZodTypeInternals<{
|
|
5823
|
+
[x: string]: string | boolean | undefined;
|
|
5824
|
+
}, Partial<{
|
|
5825
|
+
[x: string]: string | boolean | undefined;
|
|
5826
|
+
}>>>;
|
|
5827
|
+
id: z.ZodNumber;
|
|
5828
|
+
status: z.ZodString;
|
|
5829
|
+
number: z.ZodString;
|
|
5830
|
+
createdAt: z.ZodNumber;
|
|
5831
|
+
isPaid: z.ZodBoolean;
|
|
5832
|
+
items: z.ZodArray<z.ZodObject<{
|
|
5833
|
+
id: z.ZodNumber;
|
|
5834
|
+
productId: z.ZodNullable<z.ZodNumber>;
|
|
5835
|
+
variationId: z.ZodNullable<z.ZodNumber>;
|
|
5836
|
+
hsCode: z.ZodNullable<z.ZodString>;
|
|
5837
|
+
name: z.ZodString;
|
|
5838
|
+
quantity: z.ZodNumber;
|
|
5839
|
+
selectedAttributes: z.ZodArray<z.ZodObject<{
|
|
5840
|
+
name: z.ZodString;
|
|
5841
|
+
attribute: z.ZodString;
|
|
5842
|
+
value: z.ZodString;
|
|
5843
|
+
}, z.core.$strip>>;
|
|
5844
|
+
itemData: z.ZodArray<z.ZodObject<{
|
|
5845
|
+
name: z.ZodString;
|
|
5846
|
+
value: z.ZodString;
|
|
5847
|
+
display: z.ZodNullable<z.ZodString>;
|
|
5848
|
+
}, z.core.$strip>>;
|
|
5849
|
+
totals: z.ZodObject<{
|
|
5850
|
+
subtotal: z.ZodNumber;
|
|
5851
|
+
subtotalTax: z.ZodNumber;
|
|
5852
|
+
total: z.ZodNumber;
|
|
5853
|
+
totalTax: z.ZodNumber;
|
|
5854
|
+
}, z.core.$strip>;
|
|
5855
|
+
product: z.ZodNullable<z.ZodObject<{
|
|
5856
|
+
sku: z.ZodNullable<z.ZodString>;
|
|
5857
|
+
slug: z.ZodString;
|
|
5858
|
+
url: z.ZodNullable<z.ZodString>;
|
|
5859
|
+
shortDescription: z.ZodString;
|
|
5860
|
+
description: z.ZodString;
|
|
5861
|
+
images: z.ZodArray<z.ZodObject<{
|
|
5862
|
+
id: z.ZodNumber;
|
|
5863
|
+
name: z.ZodString;
|
|
5864
|
+
src: z.ZodString;
|
|
5865
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
5866
|
+
type: z.ZodLiteral<"image">;
|
|
5867
|
+
alt: z.ZodString;
|
|
5868
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
5869
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
5870
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
5871
|
+
src: z.ZodString;
|
|
5872
|
+
width: z.ZodNumber;
|
|
5873
|
+
height: z.ZodNumber;
|
|
5874
|
+
}, z.core.$strict>>>;
|
|
5875
|
+
srcset: z.ZodOptional<z.ZodString>;
|
|
5876
|
+
}, z.core.$strict>>;
|
|
5877
|
+
prices: z.ZodObject<{
|
|
5878
|
+
price: z.ZodNumber;
|
|
5879
|
+
regularPrice: z.ZodNumber;
|
|
5880
|
+
salePrice: z.ZodNullable<z.ZodNumber>;
|
|
5881
|
+
priceRange: z.ZodNullable<z.ZodObject<{
|
|
5882
|
+
minAmount: z.ZodNumber;
|
|
5883
|
+
maxAmount: z.ZodNumber;
|
|
5884
|
+
}, z.core.$strip>>;
|
|
5885
|
+
}, z.core.$strip>;
|
|
5886
|
+
custom: z.ZodType<Record<string, unknown>, Record<string, unknown>, z.core.$ZodTypeInternals<Record<string, unknown>, Record<string, unknown>>>;
|
|
5887
|
+
}, z.core.$strip>>;
|
|
5888
|
+
extensions: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
5889
|
+
}, z.core.$strip>>;
|
|
5890
|
+
coupons: z.ZodArray<z.ZodObject<{
|
|
5891
|
+
code: z.ZodString;
|
|
5892
|
+
discountType: z.ZodString;
|
|
5893
|
+
totals: z.ZodObject<{
|
|
5894
|
+
discount: z.ZodNumber;
|
|
5895
|
+
discountTax: z.ZodNumber;
|
|
5896
|
+
}, z.core.$strip>;
|
|
5897
|
+
}, z.core.$strip>>;
|
|
5898
|
+
fees: z.ZodArray<z.ZodObject<{
|
|
5899
|
+
id: z.ZodNumber;
|
|
5900
|
+
name: z.ZodString;
|
|
5901
|
+
totals: z.ZodObject<{
|
|
5902
|
+
total: z.ZodNumber;
|
|
5903
|
+
tax: z.ZodNumber;
|
|
5904
|
+
}, z.core.$strip>;
|
|
5905
|
+
}, z.core.$strip>>;
|
|
5906
|
+
billingAddress: z.ZodObject<{
|
|
5907
|
+
additionalFields: z.ZodType<BillingAdditionalFields, BillingAdditionalFieldsInput, z.core.$ZodTypeInternals<BillingAdditionalFields, BillingAdditionalFieldsInput>>;
|
|
5908
|
+
taxId: z.ZodDefault<z.ZodString>;
|
|
5909
|
+
email: z.ZodString;
|
|
5910
|
+
firstName: z.ZodString;
|
|
5911
|
+
lastName: z.ZodString;
|
|
5912
|
+
company: z.ZodString;
|
|
5913
|
+
address1: z.ZodString;
|
|
5914
|
+
address2: z.ZodString;
|
|
5915
|
+
city: z.ZodString;
|
|
5916
|
+
state: z.ZodString;
|
|
5917
|
+
postcode: z.ZodString;
|
|
5918
|
+
country: z.ZodString;
|
|
5919
|
+
phone: z.ZodString;
|
|
5920
|
+
}, z.core.$strip>;
|
|
5921
|
+
shippingAddress: z.ZodObject<{
|
|
5922
|
+
firstName: z.ZodString;
|
|
5923
|
+
lastName: z.ZodString;
|
|
5924
|
+
company: z.ZodString;
|
|
5925
|
+
address1: z.ZodString;
|
|
5926
|
+
address2: z.ZodString;
|
|
5927
|
+
city: z.ZodString;
|
|
5928
|
+
state: z.ZodString;
|
|
5929
|
+
postcode: z.ZodString;
|
|
5930
|
+
country: z.ZodString;
|
|
5931
|
+
phone: z.ZodString;
|
|
5932
|
+
additionalFields: z.ZodType<{
|
|
5933
|
+
[x: string]: string | boolean | undefined;
|
|
5934
|
+
}, Partial<{
|
|
5935
|
+
[x: string]: string | boolean | undefined;
|
|
5936
|
+
}>, z.core.$ZodTypeInternals<{
|
|
5937
|
+
[x: string]: string | boolean | undefined;
|
|
5938
|
+
}, Partial<{
|
|
5939
|
+
[x: string]: string | boolean | undefined;
|
|
5940
|
+
}>>>;
|
|
5941
|
+
}, z.core.$strip>;
|
|
5942
|
+
needsPayment: z.ZodBoolean;
|
|
5943
|
+
needsShipping: z.ZodBoolean;
|
|
5944
|
+
paymentRequirements: z.ZodArray<z.ZodString>;
|
|
5945
|
+
errors: z.ZodArray<z.ZodObject<{
|
|
5946
|
+
code: z.ZodString;
|
|
5947
|
+
message: z.ZodString;
|
|
5948
|
+
}, z.core.$strip>>;
|
|
5949
|
+
totals: z.ZodObject<{
|
|
5950
|
+
subtotal: z.ZodNumber;
|
|
5951
|
+
itemsTotal: z.ZodNumber;
|
|
5952
|
+
itemsTaxTotal: z.ZodNumber;
|
|
5953
|
+
feesTotal: z.ZodNumber;
|
|
5954
|
+
feesTaxTotal: z.ZodNumber;
|
|
5955
|
+
discountTotal: z.ZodNumber;
|
|
5956
|
+
discountTaxTotal: z.ZodNumber;
|
|
5957
|
+
shippingTotal: z.ZodNullable<z.ZodNumber>;
|
|
5958
|
+
shippingTaxTotal: z.ZodNullable<z.ZodNumber>;
|
|
5959
|
+
taxTotal: z.ZodNumber;
|
|
5960
|
+
refundTotal: z.ZodNumber;
|
|
5961
|
+
total: z.ZodNumber;
|
|
5962
|
+
taxLines: z.ZodArray<z.ZodObject<{
|
|
5963
|
+
name: z.ZodString;
|
|
5964
|
+
price: z.ZodNumber;
|
|
5965
|
+
rate: z.ZodString;
|
|
5966
|
+
}, z.core.$strip>>;
|
|
5967
|
+
}, z.core.$strip>;
|
|
5968
|
+
currencyFormat: z.ZodObject<{
|
|
5969
|
+
currencyCode: z.ZodString;
|
|
5970
|
+
currencySymbol: z.ZodString;
|
|
5971
|
+
currencyPrefix: z.ZodString;
|
|
5972
|
+
currencySuffix: z.ZodString;
|
|
5973
|
+
currencyMinorUnit: z.ZodNumber;
|
|
5974
|
+
currencyDecimalSeparator: z.ZodString;
|
|
5975
|
+
currencyThousandSeparator: z.ZodString;
|
|
5976
|
+
}, z.core.$strip>;
|
|
5977
|
+
}, z.core.$strip>>;
|
|
5978
|
+
meta: z.ZodObject<{
|
|
5979
|
+
page: z.ZodNumber;
|
|
5980
|
+
totalItems: z.ZodNumber;
|
|
5981
|
+
totalPages: z.ZodNumber;
|
|
5982
|
+
nextPage: z.ZodNullable<z.ZodNumber>;
|
|
5983
|
+
prevPage: z.ZodNullable<z.ZodNumber>;
|
|
5984
|
+
hasNextPage: z.ZodBoolean;
|
|
5985
|
+
hasPrevPage: z.ZodBoolean;
|
|
5986
|
+
}, z.core.$strip>;
|
|
5987
|
+
}, z.core.$strip>;
|
|
5988
|
+
type OrderList = Omit<z.infer<typeof OrderList>, "items"> & {
|
|
5989
|
+
items: Order[];
|
|
5990
|
+
};
|
|
5767
5991
|
//#endregion
|
|
5768
5992
|
//#region src/product/schema.d.ts
|
|
5769
5993
|
declare const SWATCH_TYPES: readonly ["text", "color", "image"];
|
|
@@ -5775,9 +5999,9 @@ declare const SwatchType: z.ZodEnum<{
|
|
|
5775
5999
|
type SwatchType = z.infer<typeof SwatchType>;
|
|
5776
6000
|
declare const PRODUCT_TYPES: readonly ["simple", "grouped", "external", "variable", "variation"];
|
|
5777
6001
|
declare const ProductType: z.ZodEnum<{
|
|
6002
|
+
external: "external";
|
|
5778
6003
|
simple: "simple";
|
|
5779
6004
|
grouped: "grouped";
|
|
5780
|
-
external: "external";
|
|
5781
6005
|
variable: "variable";
|
|
5782
6006
|
variation: "variation";
|
|
5783
6007
|
}>;
|
|
@@ -7339,11 +7563,11 @@ declare const RetrieveProductInput: z.ZodObject<{
|
|
|
7339
7563
|
}, z.core.$strip>;
|
|
7340
7564
|
type RetrieveProductInput = z.input<typeof RetrieveProductInput>;
|
|
7341
7565
|
declare const ProductOrderBy: z.ZodEnum<{
|
|
7566
|
+
slug: "slug";
|
|
7342
7567
|
date: "date";
|
|
7568
|
+
price: "price";
|
|
7343
7569
|
id: "id";
|
|
7344
7570
|
title: "title";
|
|
7345
|
-
slug: "slug";
|
|
7346
|
-
price: "price";
|
|
7347
7571
|
modified: "modified";
|
|
7348
7572
|
include: "include";
|
|
7349
7573
|
popularity: "popularity";
|
|
@@ -7355,8 +7579,8 @@ type ProductOrderBy = z.infer<typeof ProductOrderBy>;
|
|
|
7355
7579
|
declare const PRODUCT_DATE_COLUMNS: readonly ["date", "date_gmt", "modified", "modified_gmt"];
|
|
7356
7580
|
declare const ProductDateColumn: z.ZodEnum<{
|
|
7357
7581
|
date: "date";
|
|
7358
|
-
modified: "modified";
|
|
7359
7582
|
date_gmt: "date_gmt";
|
|
7583
|
+
modified: "modified";
|
|
7360
7584
|
modified_gmt: "modified_gmt";
|
|
7361
7585
|
}>;
|
|
7362
7586
|
type ProductDateColumn = z.infer<typeof ProductDateColumn>;
|
|
@@ -7381,11 +7605,11 @@ declare const ProductStockStatus: z.ZodEnum<{
|
|
|
7381
7605
|
type ProductStockStatus = z.infer<typeof ProductStockStatus>;
|
|
7382
7606
|
declare const PRODUCT_CATALOG_VISIBILITIES: readonly ["any", "visible", "catalog", "search", "hidden"];
|
|
7383
7607
|
declare const ProductCatalogVisibility: z.ZodEnum<{
|
|
7384
|
-
search: "search";
|
|
7385
7608
|
any: "any";
|
|
7386
|
-
|
|
7387
|
-
catalog: "catalog";
|
|
7609
|
+
search: "search";
|
|
7388
7610
|
visible: "visible";
|
|
7611
|
+
catalog: "catalog";
|
|
7612
|
+
hidden: "hidden";
|
|
7389
7613
|
}>;
|
|
7390
7614
|
type ProductCatalogVisibility = z.infer<typeof ProductCatalogVisibility>;
|
|
7391
7615
|
declare const PRODUCT_RATINGS: readonly [1, 2, 3, 4, 5];
|
|
@@ -7423,8 +7647,8 @@ declare const ListProductInput: z.ZodObject<{
|
|
|
7423
7647
|
before: z.ZodOptional<z.ZodString>;
|
|
7424
7648
|
dateColumn: z.ZodOptional<z.ZodEnum<{
|
|
7425
7649
|
date: "date";
|
|
7426
|
-
modified: "modified";
|
|
7427
7650
|
date_gmt: "date_gmt";
|
|
7651
|
+
modified: "modified";
|
|
7428
7652
|
modified_gmt: "modified_gmt";
|
|
7429
7653
|
}>>;
|
|
7430
7654
|
exclude: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
@@ -7435,11 +7659,11 @@ declare const ListProductInput: z.ZodObject<{
|
|
|
7435
7659
|
desc: "desc";
|
|
7436
7660
|
}>>;
|
|
7437
7661
|
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
7662
|
+
slug: "slug";
|
|
7438
7663
|
date: "date";
|
|
7664
|
+
price: "price";
|
|
7439
7665
|
id: "id";
|
|
7440
7666
|
title: "title";
|
|
7441
|
-
slug: "slug";
|
|
7442
|
-
price: "price";
|
|
7443
7667
|
modified: "modified";
|
|
7444
7668
|
include: "include";
|
|
7445
7669
|
popularity: "popularity";
|
|
@@ -7497,11 +7721,11 @@ declare const ListProductInput: z.ZodObject<{
|
|
|
7497
7721
|
and: "and";
|
|
7498
7722
|
}>>;
|
|
7499
7723
|
catalogVisibility: z.ZodOptional<z.ZodEnum<{
|
|
7500
|
-
search: "search";
|
|
7501
7724
|
any: "any";
|
|
7502
|
-
|
|
7503
|
-
catalog: "catalog";
|
|
7725
|
+
search: "search";
|
|
7504
7726
|
visible: "visible";
|
|
7727
|
+
catalog: "catalog";
|
|
7728
|
+
hidden: "hidden";
|
|
7505
7729
|
}>>;
|
|
7506
7730
|
rating: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>, z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>>]>>;
|
|
7507
7731
|
related: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
@@ -7666,10 +7890,15 @@ declare const ProductAttributeCount: z.ZodObject<{
|
|
|
7666
7890
|
}, z.core.$strip>;
|
|
7667
7891
|
type ProductAttributeCount = z.input<typeof ProductAttributeCount>;
|
|
7668
7892
|
declare const RetrieveProductFiltersInput: z.ZodObject<{
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7893
|
+
type: z.ZodOptional<z.ZodString>;
|
|
7894
|
+
sku: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7895
|
+
slug: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
7896
|
+
catalogVisibility: z.ZodOptional<z.ZodEnum<{
|
|
7897
|
+
any: "any";
|
|
7898
|
+
search: "search";
|
|
7899
|
+
visible: "visible";
|
|
7900
|
+
catalog: "catalog";
|
|
7901
|
+
hidden: "hidden";
|
|
7673
7902
|
}>>;
|
|
7674
7903
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7675
7904
|
taxonomy: z.ZodString;
|
|
@@ -7681,30 +7910,33 @@ declare const RetrieveProductFiltersInput: z.ZodObject<{
|
|
|
7681
7910
|
and: "and";
|
|
7682
7911
|
}>>;
|
|
7683
7912
|
}, z.core.$strip>>>;
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7913
|
+
order: z.ZodOptional<z.ZodEnum<{
|
|
7914
|
+
asc: "asc";
|
|
7915
|
+
desc: "desc";
|
|
7916
|
+
}>>;
|
|
7917
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7687
7918
|
related: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
7688
|
-
|
|
7689
|
-
rating: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>, z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>>]>>;
|
|
7919
|
+
parent: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
7690
7920
|
page: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
7691
7921
|
perPage: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
7692
7922
|
after: z.ZodOptional<z.ZodString>;
|
|
7693
7923
|
before: z.ZodOptional<z.ZodString>;
|
|
7694
7924
|
dateColumn: z.ZodOptional<z.ZodEnum<{
|
|
7695
7925
|
date: "date";
|
|
7696
|
-
modified: "modified";
|
|
7697
7926
|
date_gmt: "date_gmt";
|
|
7927
|
+
modified: "modified";
|
|
7698
7928
|
modified_gmt: "modified_gmt";
|
|
7699
7929
|
}>>;
|
|
7700
7930
|
exclude: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
7931
|
+
include: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
7701
7932
|
offset: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>;
|
|
7933
|
+
rating: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>, z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>>]>>;
|
|
7702
7934
|
orderBy: z.ZodOptional<z.ZodEnum<{
|
|
7935
|
+
slug: "slug";
|
|
7703
7936
|
date: "date";
|
|
7937
|
+
price: "price";
|
|
7704
7938
|
id: "id";
|
|
7705
7939
|
title: "title";
|
|
7706
|
-
slug: "slug";
|
|
7707
|
-
price: "price";
|
|
7708
7940
|
modified: "modified";
|
|
7709
7941
|
include: "include";
|
|
7710
7942
|
popularity: "popularity";
|
|
@@ -7712,7 +7944,6 @@ declare const RetrieveProductFiltersInput: z.ZodObject<{
|
|
|
7712
7944
|
menu_order: "menu_order";
|
|
7713
7945
|
comment_count: "comment_count";
|
|
7714
7946
|
}>>;
|
|
7715
|
-
parent: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
7716
7947
|
parentExclude: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
7717
7948
|
featured: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCodec<z.ZodString, z.ZodBoolean>]>>;
|
|
7718
7949
|
category: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodString]>, z.ZodArray<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodString]>>]>>;
|
|
@@ -7749,13 +7980,6 @@ declare const RetrieveProductFiltersInput: z.ZodObject<{
|
|
|
7749
7980
|
in: "in";
|
|
7750
7981
|
and: "and";
|
|
7751
7982
|
}>>;
|
|
7752
|
-
catalogVisibility: z.ZodOptional<z.ZodEnum<{
|
|
7753
|
-
search: "search";
|
|
7754
|
-
any: "any";
|
|
7755
|
-
hidden: "hidden";
|
|
7756
|
-
catalog: "catalog";
|
|
7757
|
-
visible: "visible";
|
|
7758
|
-
}>>;
|
|
7759
7983
|
taxonomies: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
7760
7984
|
taxonomy: z.ZodString;
|
|
7761
7985
|
termIds: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>, z.ZodArray<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodCoercedNumber<string | number>>>]>>;
|
|
@@ -7788,7 +8012,7 @@ interface WooCommerceOptions {
|
|
|
7788
8012
|
declare function woocommerce(options?: WooCommerceOptions): kizlo0.Integration<"woocommerce", {
|
|
7789
8013
|
cart: {
|
|
7790
8014
|
get: kizlo0.Procedure<"api", {}, Cart, {}>;
|
|
7791
|
-
|
|
8015
|
+
updateAddress: kizlo0.Procedure<"api", {
|
|
7792
8016
|
body: {
|
|
7793
8017
|
billingAddress?: (Partial<Omit<CartBillingAddressInput, "additionalFields">> & {
|
|
7794
8018
|
additionalFields?: BillingAdditionalFieldsInput;
|
|
@@ -8129,6 +8353,12 @@ declare function woocommerce(options?: WooCommerceOptions): kizlo0.Integration<"
|
|
|
8129
8353
|
get: kizlo0.Procedure<"api", {}, Customer, kizlo0.DefinedErrorMapLike>;
|
|
8130
8354
|
};
|
|
8131
8355
|
orders: {
|
|
8356
|
+
list: kizlo0.Procedure<"api", {
|
|
8357
|
+
query?: {
|
|
8358
|
+
page?: string | number | undefined;
|
|
8359
|
+
perPage?: string | number | undefined;
|
|
8360
|
+
} | undefined;
|
|
8361
|
+
}, OrderList, kizlo0.DefinedErrorMapLike>;
|
|
8132
8362
|
get: kizlo0.Procedure<"api", {
|
|
8133
8363
|
params: {
|
|
8134
8364
|
orderId: string | number;
|
|
@@ -8250,4 +8480,4 @@ declare function woocommerce(options?: WooCommerceOptions): kizlo0.Integration<"
|
|
|
8250
8480
|
};
|
|
8251
8481
|
}>;
|
|
8252
8482
|
//#endregion
|
|
8253
|
-
export { AddCartItemInput, type AddressAdditionalFields, type AddressAdditionalFieldsInput, ApplyCouponInput, type BillingAdditionalFields, type BillingAdditionalFieldsInput, BillingFieldProjections, Cart, CartAdditionalFields, CartBillingAddress, CartBillingAddressInput, CartBillingAddressSubmission, CartCoupon, CartCouponTotals, CartError, CartFee, CartFeeTotals, CartItem, CartItemData, CartItemQuantityLimits, CartItemTotals, CartPaymentMethod, CartSelectedAttribute, CartShippingAddress, CartShippingAddressInput, CartShippingAddressSubmission, CartShippingDestination, CartShippingItem, CartShippingPackage, CartShippingRate, CartShippingRateMetadata, CartTaxLine, CartTotals, Checkout, CheckoutAdditionalFields, type CheckoutAdditionalFieldsInput, CheckoutExtensions, CheckoutPaymentData, CheckoutPaymentResult, CheckoutRegisteredFieldReference, CheckoutValidationData, CheckoutValidationIssue, ConfirmCheckoutInput, type ContactAdditionalFields, GetOrderInput, ListProductInput, ListProductInputOut, Order, OrderFee, OrderItem, OrderItemProduct, OrderTotals, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, type RegisteredFieldGroup, type RegisteredFieldLocations, type RegisteredFieldTarget, RemoveCartItemInput, RemoveCouponInput, RetrieveProductFiltersInput, RetrieveProductFiltersInputOut, RetrieveProductInput, RetryCheckoutInput, SWATCH_TYPES, SelectCartShippingRateInput, Storefront, StorefrontAddress, StorefrontCatalog, StorefrontCheckout, StorefrontCountry, StorefrontField, StorefrontFieldOption, StorefrontFieldOverride, StorefrontFieldRule, StorefrontFieldSchema, StorefrontPricing, SwatchType,
|
|
8483
|
+
export { AddCartItemInput, type AddressAdditionalFields, type AddressAdditionalFieldsInput, ApplyCouponInput, type BillingAdditionalFields, type BillingAdditionalFieldsInput, BillingFieldProjections, Cart, CartAdditionalFields, CartBillingAddress, CartBillingAddressInput, CartBillingAddressSubmission, CartCoupon, CartCouponTotals, CartError, CartFee, CartFeeTotals, CartItem, CartItemData, CartItemQuantityLimits, CartItemTotals, CartPaymentMethod, CartSelectedAttribute, CartShippingAddress, CartShippingAddressInput, CartShippingAddressSubmission, CartShippingDestination, CartShippingItem, CartShippingPackage, CartShippingRate, CartShippingRateMetadata, CartTaxLine, CartTotals, Checkout, CheckoutAdditionalFields, type CheckoutAdditionalFieldsInput, CheckoutBillingAddressInput, CheckoutExtensions, CheckoutPaymentData, CheckoutPaymentResult, CheckoutRegisteredFieldReference, CheckoutShippingAddressInput, CheckoutValidationData, CheckoutValidationIssue, ConfirmCheckoutInput, type ContactAdditionalFields, GetOrderInput, ListOrderInput, ListProductInput, ListProductInputOut, Order, OrderFee, OrderItem, OrderItemProduct, OrderList, OrderTotals, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, type RegisteredFieldGroup, type RegisteredFieldLocations, type RegisteredFieldTarget, RemoveCartItemInput, RemoveCouponInput, RetrieveProductFiltersInput, RetrieveProductFiltersInputOut, RetrieveProductInput, RetryCheckoutInput, SWATCH_TYPES, SelectCartShippingRateInput, Storefront, StorefrontAddress, StorefrontCatalog, StorefrontCheckout, StorefrontCountry, StorefrontField, StorefrontFieldOption, StorefrontFieldOverride, StorefrontFieldRule, StorefrontFieldSchema, StorefrontPricing, SwatchType, UpdateCartAddressInput, UpdateCartItemInput, UpdateCheckoutInput, WooCommerceOptions, resolveRegisteredFieldTarget, woocommerce };
|
package/dist/index.js
CHANGED
|
@@ -100,7 +100,7 @@ function sessionMiddleware(options) {
|
|
|
100
100
|
//#endregion
|
|
101
101
|
//#region src/cart/error.ts
|
|
102
102
|
const GET_CART_ERROR_MAP = defineErrorMap({});
|
|
103
|
-
const
|
|
103
|
+
const UPDATE_CART_ADDRESS_ERROR_MAP = defineErrorMap({ CART_ADDRESS_INVALID: {
|
|
104
104
|
status: 400,
|
|
105
105
|
message: "The cart address is invalid."
|
|
106
106
|
} });
|
|
@@ -710,7 +710,7 @@ const SelectCartShippingRateInput = z$1.object({
|
|
|
710
710
|
});
|
|
711
711
|
const CartShippingAddressInput = z$1.object(CartAddressFields).partial();
|
|
712
712
|
const CartBillingAddressInput = CartBillingAddress.partial().extend(BillingNativeInputFields);
|
|
713
|
-
const
|
|
713
|
+
const UpdateCartAddressInput = z$1.object({
|
|
714
714
|
shippingAddress: CartShippingAddressInput.optional(),
|
|
715
715
|
billingAddress: CartBillingAddressInput.optional()
|
|
716
716
|
});
|
|
@@ -1171,7 +1171,7 @@ const BILLING_ADDRESS_KEYS = new Set([...SHIPPING_ADDRESS_KEYS, "email"]);
|
|
|
1171
1171
|
function additionalAddressFields(address, standardKeys) {
|
|
1172
1172
|
return additionalFieldValues(Object.fromEntries(Object.entries(address).filter((entry) => !standardKeys.has(entry[0]) && (typeof entry[1] === "string" || typeof entry[1] === "boolean"))));
|
|
1173
1173
|
}
|
|
1174
|
-
function
|
|
1174
|
+
function serializeCartAddressInput(input) {
|
|
1175
1175
|
return {
|
|
1176
1176
|
...input.billingAddress !== void 0 && { billing_address: serializeCartBillingAddress(input.billingAddress) },
|
|
1177
1177
|
...input.shippingAddress !== void 0 && { shipping_address: serializeCartShippingAddress(input.shippingAddress) }
|
|
@@ -1216,16 +1216,16 @@ const CART_PROCEDURES = {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
return deserializeCart(response.data);
|
|
1218
1218
|
}),
|
|
1219
|
-
|
|
1219
|
+
updateAddress: createProcedure({
|
|
1220
1220
|
scope: "api",
|
|
1221
1221
|
method: "PUT",
|
|
1222
1222
|
path: "/cart",
|
|
1223
1223
|
output: schemaType(Cart),
|
|
1224
|
-
body: schemaType(
|
|
1225
|
-
errors:
|
|
1224
|
+
body: schemaType(UpdateCartAddressInput),
|
|
1225
|
+
errors: UPDATE_CART_ADDRESS_ERROR_MAP,
|
|
1226
1226
|
middlewares: [sessionMiddleware({ transitionGuestCart: true })]
|
|
1227
1227
|
}, async ({ context, input: { body: input }, errors }) => {
|
|
1228
|
-
const response = await context.wordpress.woocommerce.store.cart.updateCustomer.create({ body:
|
|
1228
|
+
const response = await context.wordpress.woocommerce.store.cart.updateCustomer.create({ body: serializeCartAddressInput(input) }, { headers: context.sessionHeaders });
|
|
1229
1229
|
if (response.error) switch (response.error.code) {
|
|
1230
1230
|
case "rest_invalid_param":
|
|
1231
1231
|
case "woocommerce_rest_invalid_address":
|
|
@@ -1618,9 +1618,14 @@ const UpdateCheckoutInput = z$2.object({
|
|
|
1618
1618
|
additionalFields: CheckoutAdditionalFields.optional(),
|
|
1619
1619
|
extensions: CheckoutExtensions.optional()
|
|
1620
1620
|
});
|
|
1621
|
+
const CheckoutBillingAddressInput = CartBillingAddressSubmission.partial().extend({
|
|
1622
|
+
...BillingNativeInputFields,
|
|
1623
|
+
additionalFields: CartBillingAddressSubmission.shape.additionalFields
|
|
1624
|
+
});
|
|
1625
|
+
const CheckoutShippingAddressInput = CartShippingAddressSubmission.partial().extend({ additionalFields: CartShippingAddressSubmission.shape.additionalFields });
|
|
1621
1626
|
const ConfirmCheckoutInput = z$2.object({
|
|
1622
|
-
billingAddress:
|
|
1623
|
-
shippingAddress:
|
|
1627
|
+
billingAddress: CheckoutBillingAddressInput,
|
|
1628
|
+
shippingAddress: CheckoutShippingAddressInput.optional(),
|
|
1624
1629
|
paymentMethod: z$2.string(),
|
|
1625
1630
|
expectedTotal: z$2.string().regex(/^[0-9]+$/).optional(),
|
|
1626
1631
|
customerNote: z$2.string().optional(),
|
|
@@ -1637,9 +1642,9 @@ const RetryCheckoutInput = z$2.object({
|
|
|
1637
1642
|
orderId: NumberLike,
|
|
1638
1643
|
paymentMethod: z$2.string(),
|
|
1639
1644
|
billingEmail: z$2.email().optional(),
|
|
1640
|
-
billingAddress:
|
|
1645
|
+
billingAddress: CheckoutBillingAddressInput,
|
|
1641
1646
|
paymentData: CheckoutPaymentData.optional(),
|
|
1642
|
-
shippingAddress:
|
|
1647
|
+
shippingAddress: CheckoutShippingAddressInput.optional(),
|
|
1643
1648
|
customerNote: z$2.string().optional(),
|
|
1644
1649
|
additionalFields: CheckoutAdditionalFieldsSubmissionSchema.optional(),
|
|
1645
1650
|
extensions: CheckoutExtensions.optional(),
|
|
@@ -2077,12 +2082,11 @@ const CUSTOMER_PROCEDURES = { get: createProcedure({
|
|
|
2077
2082
|
}, async ({ context, errors }) => {
|
|
2078
2083
|
const session = await context.getSession();
|
|
2079
2084
|
if (!session) throw errors.FORBIDDEN();
|
|
2080
|
-
const response = await context.wordpress.woocommerce.customers.
|
|
2081
|
-
email: session.email,
|
|
2082
|
-
role: "all"
|
|
2083
|
-
} });
|
|
2085
|
+
const response = await context.wordpress.woocommerce.kizlo.customers.retrieve(void 0, { headers: { "X-Kizlo-User-Email": session.email } });
|
|
2084
2086
|
if (response.error) switch (response.error.code) {
|
|
2085
|
-
case "
|
|
2087
|
+
case "kizlo_invalid_identity": throw errors.UNAUTHORIZED({ message: response.error.message });
|
|
2088
|
+
case "kizlo_forbidden_identity": throw errors.FORBIDDEN({ message: response.error.message });
|
|
2089
|
+
case "kizlo_customer_unavailable": throw errors.SERVICE_UNAVAILABLE({ message: response.error.message });
|
|
2086
2090
|
default:
|
|
2087
2091
|
context.logger.error("Get customer unhandled error", response.error, {
|
|
2088
2092
|
email: session.email,
|
|
@@ -2090,9 +2094,7 @@ const CUSTOMER_PROCEDURES = { get: createProcedure({
|
|
|
2090
2094
|
});
|
|
2091
2095
|
throw errors.INTERNAL_SERVER_ERROR();
|
|
2092
2096
|
}
|
|
2093
|
-
|
|
2094
|
-
if (!customer) throw errors.NOT_FOUND();
|
|
2095
|
-
return deserializeCustomer(customer);
|
|
2097
|
+
return deserializeCustomer(response.data);
|
|
2096
2098
|
}) };
|
|
2097
2099
|
|
|
2098
2100
|
//#endregion
|
|
@@ -2160,6 +2162,8 @@ const Order = z.object({
|
|
|
2160
2162
|
additionalFields: CheckoutAdditionalFieldsSchema,
|
|
2161
2163
|
id: z.number(),
|
|
2162
2164
|
status: z.string(),
|
|
2165
|
+
number: z.string(),
|
|
2166
|
+
createdAt: z.number(),
|
|
2163
2167
|
isPaid: z.boolean(),
|
|
2164
2168
|
items: z.array(OrderItem),
|
|
2165
2169
|
coupons: z.array(CartCoupon),
|
|
@@ -2178,6 +2182,14 @@ const GetOrderInput = z.object({
|
|
|
2178
2182
|
key: z.string().optional(),
|
|
2179
2183
|
billingEmail: z.email().optional()
|
|
2180
2184
|
});
|
|
2185
|
+
const ListOrderInput = z.object({
|
|
2186
|
+
page: NumberLike.pipe(z.int().min(1)).optional(),
|
|
2187
|
+
perPage: NumberLike.pipe(z.int().min(1).max(100)).optional()
|
|
2188
|
+
});
|
|
2189
|
+
const OrderList = z.object({
|
|
2190
|
+
items: z.array(Order),
|
|
2191
|
+
meta: ListMetadata
|
|
2192
|
+
});
|
|
2181
2193
|
|
|
2182
2194
|
//#endregion
|
|
2183
2195
|
//#region src/order/utils.ts
|
|
@@ -2204,6 +2216,8 @@ function deserializeOrder(data) {
|
|
|
2204
2216
|
additionalFields: additionalFieldValues(data.additional_fields),
|
|
2205
2217
|
id: data.id,
|
|
2206
2218
|
status: data.status,
|
|
2219
|
+
number: typeof kizlo.number === "string" ? kizlo.number : String(data.id),
|
|
2220
|
+
createdAt: timestampFromWpGmt(typeof kizlo.date_created_gmt === "string" ? kizlo.date_created_gmt : null) ?? 0,
|
|
2207
2221
|
isPaid: kizlo.is_paid === true,
|
|
2208
2222
|
items: data.items.map(deserializeOrderItem),
|
|
2209
2223
|
coupons: data.coupons.map((coupon) => ({
|
|
@@ -2317,41 +2331,76 @@ function nullableMoney(value) {
|
|
|
2317
2331
|
|
|
2318
2332
|
//#endregion
|
|
2319
2333
|
//#region src/order/index.ts
|
|
2320
|
-
const ORDER_PROCEDURES = {
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
if (response.status === 404) throw errors.ORDER_NOT_FOUND({ message: response.error.message });
|
|
2343
|
-
throw errors.ORDER_FORBIDDEN({ message: response.error.message });
|
|
2344
|
-
case "woocommerce_rest_invalid_billing_email":
|
|
2345
|
-
case "woocommerce_rest_invalid_user": throw errors.ORDER_FORBIDDEN({ message: response.error.message });
|
|
2346
|
-
default:
|
|
2347
|
-
context.logger.error("Get order unhandled error", response.error, {
|
|
2348
|
-
orderId: input.params.orderId,
|
|
2349
|
-
code: response.error.code
|
|
2350
|
-
});
|
|
2334
|
+
const ORDER_PROCEDURES = {
|
|
2335
|
+
list: createProcedure({
|
|
2336
|
+
scope: "api",
|
|
2337
|
+
method: "GET",
|
|
2338
|
+
path: "/orders",
|
|
2339
|
+
query: ListOrderInput.optional(),
|
|
2340
|
+
output: schemaType(OrderList),
|
|
2341
|
+
middlewares: [createMiddleware(async ({ context, next }) => {
|
|
2342
|
+
context.headers?.set("Cache-Control", "private, no-store");
|
|
2343
|
+
return next();
|
|
2344
|
+
}), sessionMiddleware({ allowGuest: false })]
|
|
2345
|
+
}, async ({ context, input, errors }) => {
|
|
2346
|
+
const query = {
|
|
2347
|
+
page: input.query?.page ?? 1,
|
|
2348
|
+
per_page: input.query?.perPage ?? 10
|
|
2349
|
+
};
|
|
2350
|
+
const response = await context.wordpress.woocommerce.kizlo.orders.list({ query }, { headers: context.sessionHeaders });
|
|
2351
|
+
if (response.error) {
|
|
2352
|
+
if (response.status === 401) throw errors.UNAUTHORIZED();
|
|
2353
|
+
if (response.status === 403) throw errors.FORBIDDEN();
|
|
2354
|
+
if (response.status === 400) throw errors.BAD_REQUEST({ message: response.error.message });
|
|
2355
|
+
context.logger.error("List orders unhandled error", response.error, { code: response.error.code });
|
|
2351
2356
|
throw errors.INTERNAL_SERVER_ERROR();
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2357
|
+
}
|
|
2358
|
+
const list = context.wordpress.resolveList({
|
|
2359
|
+
data: response.data,
|
|
2360
|
+
headers: response.headers,
|
|
2361
|
+
searchParams: query
|
|
2362
|
+
});
|
|
2363
|
+
return {
|
|
2364
|
+
items: list.items.map(deserializeOrder),
|
|
2365
|
+
meta: deserializeListMetadata(list.meta)
|
|
2366
|
+
};
|
|
2367
|
+
}),
|
|
2368
|
+
get: createProcedure({
|
|
2369
|
+
scope: "api",
|
|
2370
|
+
method: "GET",
|
|
2371
|
+
path: "/orders/{orderId}",
|
|
2372
|
+
params: GetOrderInput.pick({ orderId: true }),
|
|
2373
|
+
query: GetOrderInput.pick({
|
|
2374
|
+
key: true,
|
|
2375
|
+
billingEmail: true
|
|
2376
|
+
}).optional(),
|
|
2377
|
+
output: schemaType(Order),
|
|
2378
|
+
errors: GET_ORDER_ERROR_MAP,
|
|
2379
|
+
middlewares: [sessionMiddleware()]
|
|
2380
|
+
}, async ({ context, input, errors }) => {
|
|
2381
|
+
const response = await context.wordpress.woocommerce.store.order.retrieve({
|
|
2382
|
+
params: { id: String(input.params.orderId) },
|
|
2383
|
+
query: {
|
|
2384
|
+
key: input.query?.key,
|
|
2385
|
+
billing_email: input.query?.billingEmail
|
|
2386
|
+
}
|
|
2387
|
+
}, { headers: context.sessionHeaders });
|
|
2388
|
+
if (response.error) switch (response.error.code) {
|
|
2389
|
+
case "woocommerce_rest_invalid_order":
|
|
2390
|
+
if (response.status === 404) throw errors.ORDER_NOT_FOUND({ message: response.error.message });
|
|
2391
|
+
throw errors.ORDER_FORBIDDEN({ message: response.error.message });
|
|
2392
|
+
case "woocommerce_rest_invalid_billing_email":
|
|
2393
|
+
case "woocommerce_rest_invalid_user": throw errors.ORDER_FORBIDDEN({ message: response.error.message });
|
|
2394
|
+
default:
|
|
2395
|
+
context.logger.error("Get order unhandled error", response.error, {
|
|
2396
|
+
orderId: input.params.orderId,
|
|
2397
|
+
code: response.error.code
|
|
2398
|
+
});
|
|
2399
|
+
throw errors.INTERNAL_SERVER_ERROR();
|
|
2400
|
+
}
|
|
2401
|
+
return deserializeOrder(response.data);
|
|
2402
|
+
})
|
|
2403
|
+
};
|
|
2355
2404
|
|
|
2356
2405
|
//#endregion
|
|
2357
2406
|
//#region src/product/error.ts
|
|
@@ -2696,6 +2745,8 @@ function woocommerce(options = {}) {
|
|
|
2696
2745
|
}],
|
|
2697
2746
|
endpoints: [
|
|
2698
2747
|
"woocommerce.customers",
|
|
2748
|
+
"woocommerce.kizlo.customers",
|
|
2749
|
+
"woocommerce.kizlo.orders.list",
|
|
2699
2750
|
"woocommerce.kizlo.storefront",
|
|
2700
2751
|
"woocommerce.products",
|
|
2701
2752
|
"woocommerce.store.cart",
|
|
@@ -2716,4 +2767,4 @@ function woocommerce(options = {}) {
|
|
|
2716
2767
|
}
|
|
2717
2768
|
|
|
2718
2769
|
//#endregion
|
|
2719
|
-
export { AddCartItemInput, ApplyCouponInput, BillingFieldProjections, Cart, CartAdditionalFields, CartBillingAddress, CartBillingAddressSubmission, CartCoupon, CartCouponTotals, CartError, CartFee, CartFeeTotals, CartItem, CartItemData, CartItemQuantityLimits, CartItemTotals, CartPaymentMethod, CartSelectedAttribute, CartShippingAddress, CartShippingAddressSubmission, CartShippingDestination, CartShippingItem, CartShippingPackage, CartShippingRate, CartShippingRateMetadata, CartTaxLine, CartTotals, Checkout, CheckoutAdditionalFields, CheckoutExtensions, CheckoutPaymentData, CheckoutPaymentResult, CheckoutRegisteredFieldReference, CheckoutValidationData, CheckoutValidationIssue, ConfirmCheckoutInput, GetOrderInput, ListProductInput, Order, OrderFee, OrderItem, OrderItemProduct, OrderTotals, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RemoveCartItemInput, RemoveCouponInput, RetrieveProductFiltersInput, RetrieveProductInput, RetryCheckoutInput, SWATCH_TYPES, SelectCartShippingRateInput, Storefront, StorefrontAddress, StorefrontCatalog, StorefrontCheckout, StorefrontCountry, StorefrontField, StorefrontFieldOption, StorefrontFieldOverride, StorefrontFieldRule, StorefrontFieldSchema, StorefrontPricing, SwatchType,
|
|
2770
|
+
export { AddCartItemInput, ApplyCouponInput, BillingFieldProjections, Cart, CartAdditionalFields, CartBillingAddress, CartBillingAddressSubmission, CartCoupon, CartCouponTotals, CartError, CartFee, CartFeeTotals, CartItem, CartItemData, CartItemQuantityLimits, CartItemTotals, CartPaymentMethod, CartSelectedAttribute, CartShippingAddress, CartShippingAddressSubmission, CartShippingDestination, CartShippingItem, CartShippingPackage, CartShippingRate, CartShippingRateMetadata, CartTaxLine, CartTotals, Checkout, CheckoutAdditionalFields, CheckoutBillingAddressInput, CheckoutExtensions, CheckoutPaymentData, CheckoutPaymentResult, CheckoutRegisteredFieldReference, CheckoutShippingAddressInput, CheckoutValidationData, CheckoutValidationIssue, ConfirmCheckoutInput, GetOrderInput, ListOrderInput, ListProductInput, Order, OrderFee, OrderItem, OrderItemProduct, OrderList, OrderTotals, PRODUCT_ATTRIBUTE_RELATIONS, PRODUCT_CATALOG_VISIBILITIES, PRODUCT_DATE_COLUMNS, PRODUCT_RATINGS, PRODUCT_STOCK_STATUSES, PRODUCT_TYPES, Product, ProductAddToCart, ProductAttributeCount, ProductAttributeFilter, ProductAttributeRelation, ProductAttributeSummary, ProductAttributeTermSummary, ProductBrandSummary, ProductCatalogVisibility, ProductCategorySummary, ProductCustomFieldsSchema, ProductDateColumn, ProductDimensions, ProductExtensions, ProductFilters, ProductFiltersAttributeTerm, ProductFiltersPriceRange, ProductFiltersRatingCount, ProductFiltersStockStatus, ProductFiltersTaxonomyTerm, ProductFiltersTerm, ProductList, ProductOrderBy, ProductPriceRange, ProductPrices, ProductRating, ProductRecommendations, ProductStockAvailability, ProductStockStatus, ProductSummary, ProductTagSummary, ProductTaxonomyFilter, ProductTaxonomyOperator, ProductTermSummary, ProductType, ProductVariationAttributeSummary, ProductVariationSummary, RemoveCartItemInput, RemoveCouponInput, RetrieveProductFiltersInput, RetrieveProductInput, RetryCheckoutInput, SWATCH_TYPES, SelectCartShippingRateInput, Storefront, StorefrontAddress, StorefrontCatalog, StorefrontCheckout, StorefrontCountry, StorefrontField, StorefrontFieldOption, StorefrontFieldOverride, StorefrontFieldRule, StorefrontFieldSchema, StorefrontPricing, SwatchType, UpdateCartAddressInput, UpdateCartItemInput, UpdateCheckoutInput, resolveRegisteredFieldTarget, woocommerce };
|
|
@@ -127,8 +127,8 @@ declare const StorefrontField: z$2.ZodObject<{
|
|
|
127
127
|
id: z$2.ZodString;
|
|
128
128
|
location: z$2.ZodEnum<{
|
|
129
129
|
address: "address";
|
|
130
|
-
contact: "contact";
|
|
131
130
|
order: "order";
|
|
131
|
+
contact: "contact";
|
|
132
132
|
}>;
|
|
133
133
|
attributes: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
134
134
|
schema: z$2.ZodUnion<readonly [z$2.ZodBoolean, z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>]>;
|
|
@@ -200,8 +200,8 @@ declare const StorefrontAddress: z$2.ZodObject<{
|
|
|
200
200
|
id: z$2.ZodString;
|
|
201
201
|
location: z$2.ZodEnum<{
|
|
202
202
|
address: "address";
|
|
203
|
-
contact: "contact";
|
|
204
203
|
order: "order";
|
|
204
|
+
contact: "contact";
|
|
205
205
|
}>;
|
|
206
206
|
attributes: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
207
207
|
schema: z$2.ZodUnion<readonly [z$2.ZodBoolean, z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>]>;
|
|
@@ -295,8 +295,8 @@ declare const Storefront: z$2.ZodObject<{
|
|
|
295
295
|
id: z$2.ZodString;
|
|
296
296
|
location: z$2.ZodEnum<{
|
|
297
297
|
address: "address";
|
|
298
|
-
contact: "contact";
|
|
299
298
|
order: "order";
|
|
299
|
+
contact: "contact";
|
|
300
300
|
}>;
|
|
301
301
|
attributes: z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>;
|
|
302
302
|
schema: z$2.ZodUnion<readonly [z$2.ZodBoolean, z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>]>;
|
package/dist/test.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as kizlo23 from "kizlo";
|
|
2
2
|
import { DevPluginSource } from "kizlo/test";
|
|
3
3
|
|
|
4
4
|
//#region src/test/index.d.ts
|
|
@@ -20,6 +20,6 @@ declare const BANK_TRANSFER_DESCRIPTION = "Pay by transferring to our test bank
|
|
|
20
20
|
*/
|
|
21
21
|
declare function woocommerce(opts?: {
|
|
22
22
|
plugins?: DevPluginSource[];
|
|
23
|
-
}):
|
|
23
|
+
}): kizlo23.Fixture;
|
|
24
24
|
//#endregion
|
|
25
25
|
export { BANK_TRANSFER_DESCRIPTION, BANK_TRANSFER_TITLE, woocommerce };
|