@atomic-solutions/woocommerce-api-client 0.1.0 → 0.1.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/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +19 -709
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs +5 -695
- package/dist/client/index.mjs.map +1 -1
- package/dist/http/index.d.mts +3 -3
- package/dist/http/index.d.ts +3 -3
- package/dist/http/index.js +4 -3
- package/dist/http/index.js.map +1 -1
- package/dist/http/index.mjs +4 -3
- package/dist/http/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +148 -1370
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1346
- package/dist/index.mjs.map +1 -1
- package/dist/{types-qKWtrw7A.d.ts → types-DuA0wOpm.d.mts} +1 -1
- package/dist/{types-B-zy1xrP.d.mts → types-DuA0wOpm.d.ts} +1 -1
- package/dist/utils/index.d.mts +3 -3
- package/dist/utils/index.d.ts +3 -3
- package/package.json +4 -19
- package/dist/pagination.schema-CdjWGZJr.d.mts +0 -190
- package/dist/pagination.schema-CdjWGZJr.d.ts +0 -190
- package/dist/products-Cxl54crz.d.mts +0 -3412
- package/dist/products-Cxl54crz.d.ts +0 -3412
- package/dist/schemas/admin-api/index.d.mts +0 -5340
- package/dist/schemas/admin-api/index.d.ts +0 -5340
- package/dist/schemas/admin-api/index.js +0 -584
- package/dist/schemas/admin-api/index.js.map +0 -1
- package/dist/schemas/admin-api/index.mjs +0 -545
- package/dist/schemas/admin-api/index.mjs.map +0 -1
- package/dist/schemas/index.d.mts +0 -4
- package/dist/schemas/index.d.ts +0 -4
- package/dist/schemas/index.js +0 -887
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/index.mjs +0 -844
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/schemas/store-api/index.d.mts +0 -1076
- package/dist/schemas/store-api/index.d.ts +0 -1076
- package/dist/schemas/store-api/index.js +0 -887
- package/dist/schemas/store-api/index.js.map +0 -1
- package/dist/schemas/store-api/index.mjs +0 -844
- package/dist/schemas/store-api/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
+
var storeApi = require('@atomic-solutions/schemas/woocommerce/store-api');
|
|
4
5
|
var zod = require('zod');
|
|
6
|
+
var adminApi = require('@atomic-solutions/schemas/woocommerce/admin-api');
|
|
5
7
|
|
|
6
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
9
|
|
|
@@ -449,9 +451,9 @@ var setupRequestInterceptor = (axiosInstance, config, client) => {
|
|
|
449
451
|
axiosInstance.interceptors.request.use(
|
|
450
452
|
async (requestConfig) => {
|
|
451
453
|
const url = requestConfig.url;
|
|
452
|
-
if (
|
|
454
|
+
if (config.jwtToken) {
|
|
453
455
|
const token = await config.jwtToken.get();
|
|
454
|
-
if (token) {
|
|
456
|
+
if (token && (requiresAuth(url) || requiresCartAuth(url))) {
|
|
455
457
|
requestConfig.headers.Authorization = `Bearer ${token}`;
|
|
456
458
|
if (config.debug) {
|
|
457
459
|
debug("Injected JWT token for", url);
|
|
@@ -460,10 +462,11 @@ var setupRequestInterceptor = (axiosInstance, config, client) => {
|
|
|
460
462
|
}
|
|
461
463
|
if (requiresCartAuth(url)) {
|
|
462
464
|
const headers = await config.cartHeaders.get();
|
|
465
|
+
const isAuthenticated = !!await config.jwtToken?.get();
|
|
463
466
|
if (headers.nonce) {
|
|
464
467
|
requestConfig.headers.Nonce = headers.nonce;
|
|
465
468
|
}
|
|
466
|
-
if (headers.cartToken) {
|
|
469
|
+
if (headers.cartToken && !isAuthenticated) {
|
|
467
470
|
requestConfig.headers["Cart-Token"] = headers.cartToken;
|
|
468
471
|
}
|
|
469
472
|
requestConfig.headers["Cache-Control"] = "no-cache, no-store, must-revalidate";
|
|
@@ -631,861 +634,50 @@ var setupErrorInterceptor = (axiosInstance, config, client) => {
|
|
|
631
634
|
}
|
|
632
635
|
);
|
|
633
636
|
};
|
|
634
|
-
var addressSchema = zod.z.object({
|
|
635
|
-
/** First name */
|
|
636
|
-
first_name: zod.z.string().min(1, "First name is required"),
|
|
637
|
-
/** Last name */
|
|
638
|
-
last_name: zod.z.string().min(1, "Last name is required"),
|
|
639
|
-
/** Company name (optional) */
|
|
640
|
-
company: zod.z.string(),
|
|
641
|
-
/** Address line 1 */
|
|
642
|
-
address_1: zod.z.string().min(1, "Address is required"),
|
|
643
|
-
/** Address line 2 (optional) */
|
|
644
|
-
address_2: zod.z.string(),
|
|
645
|
-
/** City */
|
|
646
|
-
city: zod.z.string().min(1, "City is required"),
|
|
647
|
-
/** State/Province/Region */
|
|
648
|
-
state: zod.z.string(),
|
|
649
|
-
/** Postal code */
|
|
650
|
-
postcode: zod.z.string().min(1, "Postal code is required"),
|
|
651
|
-
/** Country code (ISO 3166-1 alpha-2) */
|
|
652
|
-
country: zod.z.string(),
|
|
653
|
-
/** Phone number */
|
|
654
|
-
phone: zod.z.string().min(1, "Phone number is required")
|
|
655
|
-
});
|
|
656
|
-
var addressSchemaNonMandatory = zod.z.object({
|
|
657
|
-
/** First name */
|
|
658
|
-
first_name: zod.z.string(),
|
|
659
|
-
/** Last name */
|
|
660
|
-
last_name: zod.z.string(),
|
|
661
|
-
/** Company name (optional) */
|
|
662
|
-
company: zod.z.string(),
|
|
663
|
-
/** Address line 1 */
|
|
664
|
-
address_1: zod.z.string(),
|
|
665
|
-
/** Address line 2 (optional) */
|
|
666
|
-
address_2: zod.z.string(),
|
|
667
|
-
/** City */
|
|
668
|
-
city: zod.z.string(),
|
|
669
|
-
/** State/Province/Region */
|
|
670
|
-
state: zod.z.string(),
|
|
671
|
-
/** Postal code */
|
|
672
|
-
postcode: zod.z.string(),
|
|
673
|
-
/** Country code (ISO 3166-1 alpha-2) */
|
|
674
|
-
country: zod.z.string(),
|
|
675
|
-
/** Phone number */
|
|
676
|
-
phone: zod.z.string()
|
|
677
|
-
});
|
|
678
|
-
var billingAddressSchemaMandatory = addressSchema.extend({
|
|
679
|
-
/** Email address (required for billing) */
|
|
680
|
-
email: zod.z.string().email("Valid email is required")
|
|
681
|
-
});
|
|
682
|
-
var billingAddressSchemaNonMandatory = addressSchemaNonMandatory.extend({
|
|
683
|
-
/** Email address (can be null for guest carts) */
|
|
684
|
-
email: zod.z.string().nullable()
|
|
685
|
-
});
|
|
686
|
-
var moneySchema = zod.z.object({
|
|
687
|
-
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
688
|
-
currency_code: zod.z.string(),
|
|
689
|
-
/** Currency symbol (e.g., '$', '€', 'KM') */
|
|
690
|
-
currency_symbol: zod.z.string(),
|
|
691
|
-
/** Number of decimal places (e.g., 2 for dollars/euros) */
|
|
692
|
-
currency_minor_unit: zod.z.number(),
|
|
693
|
-
/** Decimal separator character (e.g., '.', ',') */
|
|
694
|
-
currency_decimal_separator: zod.z.string(),
|
|
695
|
-
/** Thousands separator character (e.g., ',', '.') */
|
|
696
|
-
currency_thousand_separator: zod.z.string(),
|
|
697
|
-
/** Currency symbol prefix (empty if symbol is suffix) */
|
|
698
|
-
currency_prefix: zod.z.string(),
|
|
699
|
-
/** Currency symbol suffix (empty if symbol is prefix) */
|
|
700
|
-
currency_suffix: zod.z.string()
|
|
701
|
-
});
|
|
702
|
-
var paginationParamsSchema = zod.z.object({
|
|
703
|
-
/** Current page number */
|
|
704
|
-
page: zod.z.number().int().positive().optional(),
|
|
705
|
-
/** Items per page */
|
|
706
|
-
per_page: zod.z.number().int().positive().max(100).optional(),
|
|
707
|
-
/** Offset for pagination */
|
|
708
|
-
offset: zod.z.number().int().nonnegative().optional(),
|
|
709
|
-
/** Sort order */
|
|
710
|
-
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
711
|
-
/** Field to sort by */
|
|
712
|
-
orderby: zod.z.string().optional()
|
|
713
|
-
});
|
|
714
|
-
var paginationMetaSchema = zod.z.object({
|
|
715
|
-
/** Total number of items */
|
|
716
|
-
total: zod.z.number(),
|
|
717
|
-
/** Total number of pages */
|
|
718
|
-
totalPages: zod.z.number(),
|
|
719
|
-
/** Current page */
|
|
720
|
-
currentPage: zod.z.number(),
|
|
721
|
-
/** Items per page */
|
|
722
|
-
perPage: zod.z.number()
|
|
723
|
-
});
|
|
724
|
-
var productImageSchema = zod.z.object({
|
|
725
|
-
/** Alternative text for the image */
|
|
726
|
-
alt: zod.z.string(),
|
|
727
|
-
/** Image unique identifier */
|
|
728
|
-
id: zod.z.number(),
|
|
729
|
-
/** Image filename */
|
|
730
|
-
name: zod.z.string(),
|
|
731
|
-
/** Available image sizes in JSON format */
|
|
732
|
-
sizes: zod.z.string(),
|
|
733
|
-
/** Full-size image URL */
|
|
734
|
-
src: zod.z.string().url(),
|
|
735
|
-
/** Srcset attribute for responsive images */
|
|
736
|
-
srcset: zod.z.string(),
|
|
737
|
-
/** Thumbnail image URL */
|
|
738
|
-
thumbnail: zod.z.string().url()
|
|
739
|
-
});
|
|
740
|
-
var cartItemImageSchema = zod.z.object({
|
|
741
|
-
/** Image ID */
|
|
742
|
-
id: zod.z.number(),
|
|
743
|
-
/** Full image URL */
|
|
744
|
-
src: zod.z.string(),
|
|
745
|
-
/** Thumbnail URL */
|
|
746
|
-
thumbnail: zod.z.string(),
|
|
747
|
-
/** Responsive image srcset */
|
|
748
|
-
srcset: zod.z.string(),
|
|
749
|
-
/** Responsive image sizes */
|
|
750
|
-
sizes: zod.z.string(),
|
|
751
|
-
/** Image name */
|
|
752
|
-
name: zod.z.string(),
|
|
753
|
-
/** Image alt text */
|
|
754
|
-
alt: zod.z.string()
|
|
755
|
-
});
|
|
756
|
-
var pricesSchema = zod.z.object({
|
|
757
|
-
/** Current active price (sale price if on sale, otherwise regular) */
|
|
758
|
-
price: zod.z.string(),
|
|
759
|
-
/** Regular price (before any discounts) */
|
|
760
|
-
regular_price: zod.z.string(),
|
|
761
|
-
/** Sale price (empty string if not on sale) */
|
|
762
|
-
sale_price: zod.z.string(),
|
|
763
|
-
/** Price range for variable products (null for simple products) */
|
|
764
|
-
price_range: zod.z.object({
|
|
765
|
-
min_amount: zod.z.string(),
|
|
766
|
-
max_amount: zod.z.string()
|
|
767
|
-
}).nullable(),
|
|
768
|
-
/** Raw price data without formatting */
|
|
769
|
-
raw_prices: zod.z.object({
|
|
770
|
-
/** Decimal precision */
|
|
771
|
-
precision: zod.z.number(),
|
|
772
|
-
/** Raw price value */
|
|
773
|
-
price: zod.z.string(),
|
|
774
|
-
/** Raw regular price value */
|
|
775
|
-
regular_price: zod.z.string(),
|
|
776
|
-
/** Raw sale price value */
|
|
777
|
-
sale_price: zod.z.string()
|
|
778
|
-
}).optional()
|
|
779
|
-
}).merge(moneySchema);
|
|
780
|
-
|
|
781
|
-
// src/schemas/store-api/cart-item.schema.ts
|
|
782
|
-
var itemTotalsSchema = zod.z.object({
|
|
783
|
-
/** Subtotal before taxes */
|
|
784
|
-
line_subtotal: zod.z.string(),
|
|
785
|
-
/** Tax amount on subtotal */
|
|
786
|
-
line_subtotal_tax: zod.z.string(),
|
|
787
|
-
/** Total after discounts, before taxes */
|
|
788
|
-
line_total: zod.z.string(),
|
|
789
|
-
/** Tax amount on total */
|
|
790
|
-
line_total_tax: zod.z.string()
|
|
791
|
-
}).merge(moneySchema);
|
|
792
|
-
var cartItemSchema = zod.z.object({
|
|
793
|
-
/** Unique cart item key (use this for update/remove operations) */
|
|
794
|
-
key: zod.z.string(),
|
|
795
|
-
/** Product ID */
|
|
796
|
-
id: zod.z.number(),
|
|
797
|
-
/** Quantity of this item in cart */
|
|
798
|
-
quantity: zod.z.number(),
|
|
799
|
-
/** Quantity limits for this product */
|
|
800
|
-
quantity_limits: zod.z.object({
|
|
801
|
-
/** Minimum quantity allowed */
|
|
802
|
-
minimum: zod.z.number(),
|
|
803
|
-
/** Maximum quantity allowed */
|
|
804
|
-
maximum: zod.z.number(),
|
|
805
|
-
/** Quantity must be multiple of this value */
|
|
806
|
-
multiple_of: zod.z.number(),
|
|
807
|
-
/** Whether quantity can be changed */
|
|
808
|
-
editable: zod.z.boolean()
|
|
809
|
-
}),
|
|
810
|
-
/** Product name */
|
|
811
|
-
name: zod.z.string(),
|
|
812
|
-
/** Short product description */
|
|
813
|
-
short_description: zod.z.string(),
|
|
814
|
-
/** Full product description */
|
|
815
|
-
description: zod.z.string(),
|
|
816
|
-
/** Product SKU */
|
|
817
|
-
sku: zod.z.string(),
|
|
818
|
-
/** Remaining stock count if low (null if not low or unlimited) */
|
|
819
|
-
low_stock_remaining: zod.z.number().nullable(),
|
|
820
|
-
/** Whether backorders are allowed */
|
|
821
|
-
backorders_allowed: zod.z.boolean(),
|
|
822
|
-
/** Whether to show backorder badge */
|
|
823
|
-
show_backorder_badge: zod.z.boolean(),
|
|
824
|
-
/** Whether product can only be purchased individually */
|
|
825
|
-
sold_individually: zod.z.boolean(),
|
|
826
|
-
/** Product permalink URL */
|
|
827
|
-
permalink: zod.z.string(),
|
|
828
|
-
/** Product images */
|
|
829
|
-
images: zod.z.array(cartItemImageSchema),
|
|
830
|
-
/** Variation attributes (for variable products) */
|
|
831
|
-
variation: zod.z.array(
|
|
832
|
-
zod.z.object({
|
|
833
|
-
/** Attribute name (e.g., 'Color', 'Size') */
|
|
834
|
-
attribute: zod.z.string(),
|
|
835
|
-
/** Selected value (e.g., 'Red', 'Large') */
|
|
836
|
-
value: zod.z.string()
|
|
837
|
-
})
|
|
838
|
-
),
|
|
839
|
-
/** Additional item data/metadata */
|
|
840
|
-
item_data: zod.z.array(
|
|
841
|
-
zod.z.object({
|
|
842
|
-
key: zod.z.string(),
|
|
843
|
-
value: zod.z.string()
|
|
844
|
-
})
|
|
845
|
-
),
|
|
846
|
-
/** Product pricing information */
|
|
847
|
-
prices: pricesSchema,
|
|
848
|
-
/** Line item totals */
|
|
849
|
-
totals: itemTotalsSchema,
|
|
850
|
-
/** Catalog visibility setting */
|
|
851
|
-
catalog_visibility: zod.z.string(),
|
|
852
|
-
/** Product type */
|
|
853
|
-
type: zod.z.enum(["simple", "variable", "grouped", "external"]),
|
|
854
|
-
/** Extension data from plugins */
|
|
855
|
-
extensions: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
856
|
-
});
|
|
857
|
-
var cartTotalsSchema = zod.z.object({
|
|
858
|
-
/** Total of all cart items (before discounts and taxes) */
|
|
859
|
-
total_items: zod.z.string(),
|
|
860
|
-
/** Tax on cart items */
|
|
861
|
-
total_items_tax: zod.z.string(),
|
|
862
|
-
/** Total fees */
|
|
863
|
-
total_fees: zod.z.string(),
|
|
864
|
-
/** Tax on fees */
|
|
865
|
-
total_fees_tax: zod.z.string(),
|
|
866
|
-
/** Total discount amount from coupons */
|
|
867
|
-
total_discount: zod.z.string(),
|
|
868
|
-
/** Tax on discounts */
|
|
869
|
-
total_discount_tax: zod.z.string(),
|
|
870
|
-
/** Shipping cost (null if not calculated yet) */
|
|
871
|
-
total_shipping: zod.z.string().nullable(),
|
|
872
|
-
/** Shipping tax (null if not calculated yet) */
|
|
873
|
-
total_shipping_tax: zod.z.string().nullable(),
|
|
874
|
-
/** Final total price (includes all taxes and fees) */
|
|
875
|
-
total_price: zod.z.string(),
|
|
876
|
-
/** Total tax amount */
|
|
877
|
-
total_tax: zod.z.string(),
|
|
878
|
-
/** Tax breakdown by rate */
|
|
879
|
-
tax_lines: zod.z.array(
|
|
880
|
-
zod.z.object({
|
|
881
|
-
/** Tax rate name */
|
|
882
|
-
name: zod.z.string(),
|
|
883
|
-
/** Tax amount */
|
|
884
|
-
price: zod.z.string(),
|
|
885
|
-
/** Tax rate percentage */
|
|
886
|
-
rate: zod.z.string()
|
|
887
|
-
})
|
|
888
|
-
)
|
|
889
|
-
}).merge(moneySchema);
|
|
890
|
-
var cartCouponSchema = zod.z.object({
|
|
891
|
-
/** Coupon code */
|
|
892
|
-
code: zod.z.string(),
|
|
893
|
-
/** Discount totals for this coupon */
|
|
894
|
-
totals: zod.z.object({
|
|
895
|
-
/** Total discount amount (before tax) */
|
|
896
|
-
total_discount: zod.z.string(),
|
|
897
|
-
/** Tax amount on discount */
|
|
898
|
-
total_discount_tax: zod.z.string()
|
|
899
|
-
}).merge(moneySchema)
|
|
900
|
-
});
|
|
901
|
-
var shippingRateSchema = zod.z.object({
|
|
902
|
-
/** Unique rate identifier (format: instance_id:method_id) */
|
|
903
|
-
rate_id: zod.z.string(),
|
|
904
|
-
/** Shipping method name */
|
|
905
|
-
name: zod.z.string(),
|
|
906
|
-
/** Shipping method description */
|
|
907
|
-
description: zod.z.string(),
|
|
908
|
-
/** Estimated delivery time */
|
|
909
|
-
delivery_time: zod.z.string(),
|
|
910
|
-
/** Shipping cost */
|
|
911
|
-
price: zod.z.string(),
|
|
912
|
-
/** Shipping instance ID */
|
|
913
|
-
instance_id: zod.z.number(),
|
|
914
|
-
/** Shipping method ID */
|
|
915
|
-
method_id: zod.z.string(),
|
|
916
|
-
/** Additional metadata for this shipping method */
|
|
917
|
-
meta_data: zod.z.array(
|
|
918
|
-
zod.z.object({
|
|
919
|
-
key: zod.z.string(),
|
|
920
|
-
value: zod.z.string()
|
|
921
|
-
})
|
|
922
|
-
),
|
|
923
|
-
/** Whether this rate is currently selected */
|
|
924
|
-
selected: zod.z.boolean(),
|
|
925
|
-
/** Currency code for the price */
|
|
926
|
-
currency_code: zod.z.string(),
|
|
927
|
-
/** Currency symbol for the price */
|
|
928
|
-
currency_symbol: zod.z.string()
|
|
929
|
-
});
|
|
930
|
-
var shippingPackageSchema = zod.z.object({
|
|
931
|
-
/** Package identifier (0-indexed) */
|
|
932
|
-
package_id: zod.z.number(),
|
|
933
|
-
/** Package name/label */
|
|
934
|
-
name: zod.z.string(),
|
|
935
|
-
/** Shipping destination address */
|
|
936
|
-
destination: zod.z.object({
|
|
937
|
-
address_1: zod.z.string(),
|
|
938
|
-
address_2: zod.z.string().optional(),
|
|
939
|
-
city: zod.z.string(),
|
|
940
|
-
state: zod.z.string(),
|
|
941
|
-
postcode: zod.z.string(),
|
|
942
|
-
country: zod.z.string()
|
|
943
|
-
}),
|
|
944
|
-
/** Items included in this package */
|
|
945
|
-
items: zod.z.array(
|
|
946
|
-
zod.z.object({
|
|
947
|
-
/** Cart item key */
|
|
948
|
-
key: zod.z.string(),
|
|
949
|
-
/** Product name */
|
|
950
|
-
name: zod.z.string(),
|
|
951
|
-
/** Quantity in package */
|
|
952
|
-
quantity: zod.z.number()
|
|
953
|
-
})
|
|
954
|
-
),
|
|
955
|
-
/** Available shipping rates for this package */
|
|
956
|
-
shipping_rates: zod.z.array(shippingRateSchema)
|
|
957
|
-
});
|
|
958
|
-
|
|
959
|
-
// src/schemas/store-api/cart.ts
|
|
960
|
-
var cartSchema = zod.z.object({
|
|
961
|
-
items: zod.z.array(cartItemSchema),
|
|
962
|
-
items_count: zod.z.number(),
|
|
963
|
-
items_weight: zod.z.number(),
|
|
964
|
-
needs_payment: zod.z.boolean(),
|
|
965
|
-
needs_shipping: zod.z.boolean(),
|
|
966
|
-
payment_methods: zod.z.array(zod.z.enum(["cod", "monri"])),
|
|
967
|
-
payment_requirements: zod.z.array(zod.z.string()),
|
|
968
|
-
has_calculated_shipping: zod.z.boolean(),
|
|
969
|
-
shipping_address: addressSchemaNonMandatory,
|
|
970
|
-
billing_address: billingAddressSchemaNonMandatory,
|
|
971
|
-
shipping_rates: zod.z.array(shippingPackageSchema),
|
|
972
|
-
coupons: zod.z.array(cartCouponSchema),
|
|
973
|
-
totals: cartTotalsSchema,
|
|
974
|
-
errors: zod.z.array(
|
|
975
|
-
zod.z.object({
|
|
976
|
-
code: zod.z.string(),
|
|
977
|
-
message: zod.z.string()
|
|
978
|
-
})
|
|
979
|
-
),
|
|
980
|
-
extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional(),
|
|
981
|
-
cross_sells: zod.z.array(zod.z.unknown()),
|
|
982
|
-
fees: zod.z.array(zod.z.unknown())
|
|
983
|
-
});
|
|
984
|
-
var addToCartInputSchema = zod.z.object({
|
|
985
|
-
id: zod.z.number(),
|
|
986
|
-
quantity: zod.z.number().int().positive(),
|
|
987
|
-
variation: zod.z.array(
|
|
988
|
-
zod.z.object({
|
|
989
|
-
attribute: zod.z.string(),
|
|
990
|
-
value: zod.z.string()
|
|
991
|
-
})
|
|
992
|
-
).optional()
|
|
993
|
-
});
|
|
994
|
-
var updateCartItemInputSchema = zod.z.object({
|
|
995
|
-
key: zod.z.string(),
|
|
996
|
-
quantity: zod.z.number().int().positive()
|
|
997
|
-
});
|
|
998
|
-
var removeCartItemInputSchema = zod.z.object({
|
|
999
|
-
key: zod.z.string()
|
|
1000
|
-
});
|
|
1001
|
-
var couponInputSchema = zod.z.object({
|
|
1002
|
-
code: zod.z.string().min(1)
|
|
1003
|
-
});
|
|
1004
|
-
var updateCustomerInputSchema = zod.z.object({
|
|
1005
|
-
billing_address: billingAddressSchemaMandatory.partial(),
|
|
1006
|
-
shipping_address: addressSchema.partial()
|
|
1007
|
-
}).partial();
|
|
1008
|
-
var selectShippingRateInputSchema = zod.z.object({
|
|
1009
|
-
package_id: zod.z.union([zod.z.number(), zod.z.string()]).default(0),
|
|
1010
|
-
rate_id: zod.z.string()
|
|
1011
|
-
});
|
|
1012
|
-
var orderItemImageSchema = zod.z.object({
|
|
1013
|
-
/** Image ID */
|
|
1014
|
-
id: zod.z.number(),
|
|
1015
|
-
/** Full image URL */
|
|
1016
|
-
src: zod.z.string().url(),
|
|
1017
|
-
/** Thumbnail URL */
|
|
1018
|
-
thumbnail: zod.z.string().url(),
|
|
1019
|
-
/** Responsive image srcset */
|
|
1020
|
-
srcset: zod.z.string(),
|
|
1021
|
-
/** Responsive image sizes attribute */
|
|
1022
|
-
sizes: zod.z.string(),
|
|
1023
|
-
/** Image name */
|
|
1024
|
-
name: zod.z.string(),
|
|
1025
|
-
/** Image alt text */
|
|
1026
|
-
alt: zod.z.string()
|
|
1027
|
-
});
|
|
1028
|
-
var orderItemPricesSchema = zod.z.object({
|
|
1029
|
-
/** Formatted price (current price) */
|
|
1030
|
-
price: zod.z.string(),
|
|
1031
|
-
/** Formatted regular price */
|
|
1032
|
-
regular_price: zod.z.string(),
|
|
1033
|
-
/** Formatted sale price */
|
|
1034
|
-
sale_price: zod.z.string(),
|
|
1035
|
-
/** Price range (null for simple products) */
|
|
1036
|
-
price_range: zod.z.null(),
|
|
1037
|
-
/** Currency code (e.g., 'USD', 'EUR') */
|
|
1038
|
-
currency_code: zod.z.string(),
|
|
1039
|
-
/** Currency symbol (e.g., '$', '€') */
|
|
1040
|
-
currency_symbol: zod.z.string(),
|
|
1041
|
-
/** Number of decimal places for currency */
|
|
1042
|
-
currency_minor_unit: zod.z.number(),
|
|
1043
|
-
/** Decimal separator (e.g., '.', ',') */
|
|
1044
|
-
currency_decimal_separator: zod.z.string(),
|
|
1045
|
-
/** Thousand separator (e.g., ',', '.') */
|
|
1046
|
-
currency_thousand_separator: zod.z.string(),
|
|
1047
|
-
/** Currency prefix (e.g., '$') */
|
|
1048
|
-
currency_prefix: zod.z.string(),
|
|
1049
|
-
/** Currency suffix (e.g., 'USD') */
|
|
1050
|
-
currency_suffix: zod.z.string(),
|
|
1051
|
-
/** Raw price values for calculations */
|
|
1052
|
-
raw_prices: zod.z.object({
|
|
1053
|
-
/** Precision for price calculations */
|
|
1054
|
-
precision: zod.z.number(),
|
|
1055
|
-
/** Raw price (in minor units) */
|
|
1056
|
-
price: zod.z.string(),
|
|
1057
|
-
/** Raw regular price (in minor units) */
|
|
1058
|
-
regular_price: zod.z.string(),
|
|
1059
|
-
/** Raw sale price (in minor units) */
|
|
1060
|
-
sale_price: zod.z.string()
|
|
1061
|
-
})
|
|
1062
|
-
});
|
|
1063
|
-
var orderItemTotalsSchema = zod.z.object({
|
|
1064
|
-
/** Line subtotal (before discounts) */
|
|
1065
|
-
line_subtotal: zod.z.string(),
|
|
1066
|
-
/** Line subtotal tax */
|
|
1067
|
-
line_subtotal_tax: zod.z.string(),
|
|
1068
|
-
/** Line total (after discounts) */
|
|
1069
|
-
line_total: zod.z.string(),
|
|
1070
|
-
/** Line total tax */
|
|
1071
|
-
line_total_tax: zod.z.string(),
|
|
1072
|
-
/** Currency code */
|
|
1073
|
-
currency_code: zod.z.string(),
|
|
1074
|
-
/** Currency symbol */
|
|
1075
|
-
currency_symbol: zod.z.string(),
|
|
1076
|
-
/** Currency minor unit */
|
|
1077
|
-
currency_minor_unit: zod.z.number(),
|
|
1078
|
-
/** Decimal separator */
|
|
1079
|
-
currency_decimal_separator: zod.z.string(),
|
|
1080
|
-
/** Thousand separator */
|
|
1081
|
-
currency_thousand_separator: zod.z.string(),
|
|
1082
|
-
/** Currency prefix */
|
|
1083
|
-
currency_prefix: zod.z.string(),
|
|
1084
|
-
/** Currency suffix */
|
|
1085
|
-
currency_suffix: zod.z.string()
|
|
1086
|
-
});
|
|
1087
|
-
var quantityLimitsSchema = zod.z.object({
|
|
1088
|
-
/** Minimum quantity allowed */
|
|
1089
|
-
minimum: zod.z.number(),
|
|
1090
|
-
/** Maximum quantity allowed */
|
|
1091
|
-
maximum: zod.z.number(),
|
|
1092
|
-
/** Quantity must be multiple of this value */
|
|
1093
|
-
multiple_of: zod.z.number(),
|
|
1094
|
-
/** Whether quantity is editable */
|
|
1095
|
-
editable: zod.z.boolean()
|
|
1096
|
-
});
|
|
1097
|
-
var orderItemSchema = zod.z.object({
|
|
1098
|
-
/** Unique cart/order item key */
|
|
1099
|
-
key: zod.z.string(),
|
|
1100
|
-
/** Product ID */
|
|
1101
|
-
id: zod.z.number(),
|
|
1102
|
-
/** Quantity ordered */
|
|
1103
|
-
quantity: zod.z.number(),
|
|
1104
|
-
/** Quantity limits for this product */
|
|
1105
|
-
quantity_limits: quantityLimitsSchema,
|
|
1106
|
-
/** Product name */
|
|
1107
|
-
name: zod.z.string(),
|
|
1108
|
-
/** Short description */
|
|
1109
|
-
short_description: zod.z.string(),
|
|
1110
|
-
/** Full description */
|
|
1111
|
-
description: zod.z.string(),
|
|
1112
|
-
/** Product SKU */
|
|
1113
|
-
sku: zod.z.string(),
|
|
1114
|
-
/** Low stock warning (null if not low) */
|
|
1115
|
-
low_stock_remaining: zod.z.null(),
|
|
1116
|
-
/** Whether backorders are allowed */
|
|
1117
|
-
backorders_allowed: zod.z.boolean(),
|
|
1118
|
-
/** Whether to show backorder badge */
|
|
1119
|
-
show_backorder_badge: zod.z.boolean(),
|
|
1120
|
-
/** Whether product can only be purchased individually */
|
|
1121
|
-
sold_individually: zod.z.boolean(),
|
|
1122
|
-
/** Product permalink URL */
|
|
1123
|
-
permalink: zod.z.string().url(),
|
|
1124
|
-
/** Product images */
|
|
1125
|
-
images: zod.z.array(orderItemImageSchema),
|
|
1126
|
-
/** Variation attributes (empty for simple products) */
|
|
1127
|
-
variation: zod.z.array(zod.z.unknown()),
|
|
1128
|
-
/** Custom item data/metadata */
|
|
1129
|
-
item_data: zod.z.array(zod.z.unknown()),
|
|
1130
|
-
/** Price information */
|
|
1131
|
-
prices: orderItemPricesSchema,
|
|
1132
|
-
/** Totals for this line item */
|
|
1133
|
-
totals: orderItemTotalsSchema,
|
|
1134
|
-
/** Catalog visibility setting */
|
|
1135
|
-
catalog_visibility: zod.z.string()
|
|
1136
|
-
});
|
|
1137
|
-
var orderTotalsSchema = zod.z.object({
|
|
1138
|
-
/** Subtotal (before discounts and fees) */
|
|
1139
|
-
subtotal: zod.z.string(),
|
|
1140
|
-
/** Total discount amount */
|
|
1141
|
-
total_discount: zod.z.string(),
|
|
1142
|
-
/** Total shipping cost */
|
|
1143
|
-
total_shipping: zod.z.string(),
|
|
1144
|
-
/** Total fees */
|
|
1145
|
-
total_fees: zod.z.string(),
|
|
1146
|
-
/** Total tax */
|
|
1147
|
-
total_tax: zod.z.string(),
|
|
1148
|
-
/** Total refund amount */
|
|
1149
|
-
total_refund: zod.z.string(),
|
|
1150
|
-
/** Final total price */
|
|
1151
|
-
total_price: zod.z.string(),
|
|
1152
|
-
/** Total items cost (subtotal after item-level discounts) */
|
|
1153
|
-
total_items: zod.z.string(),
|
|
1154
|
-
/** Tax on items */
|
|
1155
|
-
total_items_tax: zod.z.string(),
|
|
1156
|
-
/** Tax on fees */
|
|
1157
|
-
total_fees_tax: zod.z.string(),
|
|
1158
|
-
/** Tax on discounts */
|
|
1159
|
-
total_discount_tax: zod.z.string(),
|
|
1160
|
-
/** Tax on shipping */
|
|
1161
|
-
total_shipping_tax: zod.z.string(),
|
|
1162
|
-
/** Tax line items breakdown */
|
|
1163
|
-
tax_lines: zod.z.array(zod.z.unknown()),
|
|
1164
|
-
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
1165
|
-
currency_code: zod.z.string(),
|
|
1166
|
-
/** Currency symbol (e.g., '$', '€', 'KM') */
|
|
1167
|
-
currency_symbol: zod.z.string(),
|
|
1168
|
-
/** Number of decimal places for currency */
|
|
1169
|
-
currency_minor_unit: zod.z.number(),
|
|
1170
|
-
/** Decimal separator (e.g., '.', ',') */
|
|
1171
|
-
currency_decimal_separator: zod.z.string(),
|
|
1172
|
-
/** Thousand separator (e.g., ',', '.') */
|
|
1173
|
-
currency_thousand_separator: zod.z.string(),
|
|
1174
|
-
/** Currency prefix (e.g., '$') */
|
|
1175
|
-
currency_prefix: zod.z.string(),
|
|
1176
|
-
/** Currency suffix (e.g., 'USD') */
|
|
1177
|
-
currency_suffix: zod.z.string()
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
|
-
// src/schemas/store-api/order.schema.ts
|
|
1181
|
-
var orderStatusEnum = zod.z.enum([
|
|
1182
|
-
"pending",
|
|
1183
|
-
// Order received, awaiting payment
|
|
1184
|
-
"processing",
|
|
1185
|
-
// Payment received, order is being processed
|
|
1186
|
-
"on-hold",
|
|
1187
|
-
// Order on hold, awaiting confirmation
|
|
1188
|
-
"completed",
|
|
1189
|
-
// Order fulfilled and complete
|
|
1190
|
-
"cancelled",
|
|
1191
|
-
// Order cancelled by customer or admin
|
|
1192
|
-
"refunded",
|
|
1193
|
-
// Order refunded
|
|
1194
|
-
"failed"
|
|
1195
|
-
// Payment failed or order declined
|
|
1196
|
-
]);
|
|
1197
|
-
var storeApiOrderSchema = zod.z.object({
|
|
1198
|
-
/** Order ID */
|
|
1199
|
-
id: zod.z.number(),
|
|
1200
|
-
/** Order status */
|
|
1201
|
-
status: orderStatusEnum,
|
|
1202
|
-
/** Order line items (products purchased) */
|
|
1203
|
-
items: zod.z.array(orderItemSchema),
|
|
1204
|
-
/** Applied coupons */
|
|
1205
|
-
coupons: zod.z.array(zod.z.unknown()),
|
|
1206
|
-
/** Order fees */
|
|
1207
|
-
fees: zod.z.array(zod.z.unknown()),
|
|
1208
|
-
/** Order totals breakdown */
|
|
1209
|
-
totals: orderTotalsSchema,
|
|
1210
|
-
/** Shipping address */
|
|
1211
|
-
shipping_address: addressSchema,
|
|
1212
|
-
/** Billing address (includes email) */
|
|
1213
|
-
billing_address: billingAddressSchemaMandatory,
|
|
1214
|
-
/** Whether order still needs payment */
|
|
1215
|
-
needs_payment: zod.z.boolean(),
|
|
1216
|
-
/** Whether order needs shipping */
|
|
1217
|
-
needs_shipping: zod.z.boolean(),
|
|
1218
|
-
/** Payment method requirements */
|
|
1219
|
-
payment_requirements: zod.z.array(zod.z.string()),
|
|
1220
|
-
/** Order errors (if any) */
|
|
1221
|
-
errors: zod.z.array(zod.z.unknown()),
|
|
1222
|
-
/** Payment method (optional - returned from checkout) */
|
|
1223
|
-
payment_method: zod.z.string().optional(),
|
|
1224
|
-
/** Payment method title (optional - returned from checkout) */
|
|
1225
|
-
payment_method_title: zod.z.string().optional()
|
|
1226
|
-
});
|
|
1227
|
-
var checkoutSchema = zod.z.object({
|
|
1228
|
-
order_id: zod.z.number(),
|
|
1229
|
-
status: zod.z.string(),
|
|
1230
|
-
order_key: zod.z.string(),
|
|
1231
|
-
customer_note: zod.z.string(),
|
|
1232
|
-
customer_id: zod.z.number(),
|
|
1233
|
-
billing_address: billingAddressSchemaNonMandatory,
|
|
1234
|
-
shipping_address: addressSchemaNonMandatory,
|
|
1235
|
-
payment_method: zod.z.string(),
|
|
1236
|
-
payment_result: zod.z.object({
|
|
1237
|
-
payment_status: zod.z.string(),
|
|
1238
|
-
payment_details: zod.z.array(zod.z.unknown()),
|
|
1239
|
-
redirect_url: zod.z.string()
|
|
1240
|
-
})
|
|
1241
|
-
});
|
|
1242
|
-
var checkoutInputSchema = zod.z.object({
|
|
1243
|
-
payment_method: zod.z.string(),
|
|
1244
|
-
payment_data: zod.z.array(
|
|
1245
|
-
zod.z.object({
|
|
1246
|
-
key: zod.z.string(),
|
|
1247
|
-
value: zod.z.union([zod.z.string(), zod.z.boolean()])
|
|
1248
|
-
})
|
|
1249
|
-
).optional(),
|
|
1250
|
-
billing_address: billingAddressSchemaMandatory.optional(),
|
|
1251
|
-
shipping_address: addressSchema.optional(),
|
|
1252
|
-
customer_note: zod.z.string().optional(),
|
|
1253
|
-
create_account: zod.z.boolean().optional(),
|
|
1254
|
-
extensions: zod.z.record(zod.z.string(), zod.z.unknown()).optional()
|
|
1255
|
-
});
|
|
1256
|
-
var addToCartSchema = zod.z.object({
|
|
1257
|
-
/** Description for add to cart action */
|
|
1258
|
-
description: zod.z.string(),
|
|
1259
|
-
/** Maximum quantity that can be added */
|
|
1260
|
-
maximum: zod.z.number(),
|
|
1261
|
-
/** Minimum quantity that can be added */
|
|
1262
|
-
minimum: zod.z.number(),
|
|
1263
|
-
/** Quantity must be a multiple of this number */
|
|
1264
|
-
multiple_of: zod.z.number(),
|
|
1265
|
-
/** Text for add to cart button */
|
|
1266
|
-
text: zod.z.string(),
|
|
1267
|
-
/** URL for add to cart action */
|
|
1268
|
-
url: zod.z.string()
|
|
1269
|
-
});
|
|
1270
|
-
var embeddedCategorySchema = zod.z.object({
|
|
1271
|
-
/** Category unique identifier */
|
|
1272
|
-
id: zod.z.number(),
|
|
1273
|
-
/** Category display name */
|
|
1274
|
-
name: zod.z.string(),
|
|
1275
|
-
/** URL-friendly category identifier */
|
|
1276
|
-
slug: zod.z.string(),
|
|
1277
|
-
/** Link to category page */
|
|
1278
|
-
link: zod.z.string(),
|
|
1279
|
-
/** Parent category ID (0 for root categories) - optional in embedded */
|
|
1280
|
-
parent: zod.z.number().optional(),
|
|
1281
|
-
/** Category description - optional in embedded */
|
|
1282
|
-
description: zod.z.string().optional(),
|
|
1283
|
-
/** Display type - optional in embedded */
|
|
1284
|
-
display: zod.z.string().optional(),
|
|
1285
|
-
/** Category image - optional in embedded */
|
|
1286
|
-
image: productImageSchema.nullable().optional(),
|
|
1287
|
-
/** Menu order for sorting - optional in embedded */
|
|
1288
|
-
menu_order: zod.z.number().optional(),
|
|
1289
|
-
/** Number of products in this category - optional in embedded */
|
|
1290
|
-
count: zod.z.number().optional()
|
|
1291
|
-
});
|
|
1292
|
-
var productCategorySchema = zod.z.object({
|
|
1293
|
-
/** Category unique identifier */
|
|
1294
|
-
id: zod.z.number(),
|
|
1295
|
-
/** Category display name */
|
|
1296
|
-
name: zod.z.string(),
|
|
1297
|
-
/** URL-friendly category identifier */
|
|
1298
|
-
slug: zod.z.string(),
|
|
1299
|
-
/** Parent category ID (0 for root categories) */
|
|
1300
|
-
parent: zod.z.number(),
|
|
1301
|
-
/** Category description */
|
|
1302
|
-
description: zod.z.string(),
|
|
1303
|
-
/** Category image */
|
|
1304
|
-
image: productImageSchema.nullable(),
|
|
1305
|
-
/** Menu order for sorting */
|
|
1306
|
-
menu_order: zod.z.number().optional(),
|
|
1307
|
-
/** Number of products in this category */
|
|
1308
|
-
count: zod.z.number()
|
|
1309
|
-
});
|
|
1310
|
-
var storeProductsSearchParamsSchema = zod.z.object({
|
|
1311
|
-
// Pagination
|
|
1312
|
-
/** Current page number */
|
|
1313
|
-
page: zod.z.number(),
|
|
1314
|
-
/** Number of products per page (1-100) */
|
|
1315
|
-
per_page: zod.z.number().min(1).max(100).default(10),
|
|
1316
|
-
// Ordering
|
|
1317
|
-
/** Field to order results by */
|
|
1318
|
-
orderby: zod.z.enum([
|
|
1319
|
-
"date",
|
|
1320
|
-
"id",
|
|
1321
|
-
"include",
|
|
1322
|
-
"title",
|
|
1323
|
-
"slug",
|
|
1324
|
-
"price",
|
|
1325
|
-
"popularity",
|
|
1326
|
-
"rating",
|
|
1327
|
-
"menu_order",
|
|
1328
|
-
"date_modified"
|
|
1329
|
-
]).optional(),
|
|
1330
|
-
/** Sort order (ascending or descending) */
|
|
1331
|
-
order: zod.z.enum(["asc", "desc"]).optional(),
|
|
1332
|
-
// Filtering
|
|
1333
|
-
/** Search query string */
|
|
1334
|
-
search: zod.z.string().optional(),
|
|
1335
|
-
/** Exact slug match */
|
|
1336
|
-
slug: zod.z.string().optional(),
|
|
1337
|
-
// Date filtering
|
|
1338
|
-
/** Filter products published after this date */
|
|
1339
|
-
after: zod.z.string().datetime().optional(),
|
|
1340
|
-
/** Filter products published before this date */
|
|
1341
|
-
before: zod.z.string().datetime().optional(),
|
|
1342
|
-
/** Filter products modified after this date */
|
|
1343
|
-
modified_after: zod.z.string().datetime().optional(),
|
|
1344
|
-
/** Filter products modified before this date */
|
|
1345
|
-
modified_before: zod.z.string().datetime().optional(),
|
|
1346
|
-
// ID filtering
|
|
1347
|
-
/** Include specific product IDs */
|
|
1348
|
-
include: zod.z.array(zod.z.number()).optional(),
|
|
1349
|
-
/** Exclude specific product IDs */
|
|
1350
|
-
exclude: zod.z.array(zod.z.number()).optional(),
|
|
1351
|
-
// Parent/Child
|
|
1352
|
-
/** Filter by parent product IDs */
|
|
1353
|
-
parent: zod.z.array(zod.z.number()).optional(),
|
|
1354
|
-
/** Exclude products with these parent IDs */
|
|
1355
|
-
parent_exclude: zod.z.array(zod.z.number()).optional(),
|
|
1356
|
-
// Type & Status
|
|
1357
|
-
/** Filter by product type */
|
|
1358
|
-
type: zod.z.enum(["simple", "grouped", "external", "variable", "variation"]).optional(),
|
|
1359
|
-
/** Filter by product status */
|
|
1360
|
-
status: zod.z.enum(["any", "draft", "pending", "private", "publish"]).optional(),
|
|
1361
|
-
// Featured
|
|
1362
|
-
/** Filter featured products */
|
|
1363
|
-
featured: zod.z.boolean().optional(),
|
|
1364
|
-
// Visibility
|
|
1365
|
-
/** Filter by catalog visibility */
|
|
1366
|
-
catalog_visibility: zod.z.enum(["any", "visible", "catalog", "search", "hidden"]).optional(),
|
|
1367
|
-
// Stock
|
|
1368
|
-
/** Filter by stock status */
|
|
1369
|
-
stock_status: zod.z.array(zod.z.enum(["instock", "outofstock", "onbackorder"])).optional(),
|
|
1370
|
-
// Category & Tag filtering
|
|
1371
|
-
/** Filter by category slug or ID */
|
|
1372
|
-
category: zod.z.string().optional(),
|
|
1373
|
-
/** Category filter operator */
|
|
1374
|
-
category_operator: zod.z.enum(["in", "not_in", "and"]).optional(),
|
|
1375
|
-
/** Filter by tag slug or ID */
|
|
1376
|
-
tag: zod.z.string().optional(),
|
|
1377
|
-
/** Tag filter operator */
|
|
1378
|
-
tag_operator: zod.z.enum(["in", "not_in", "and"]).optional(),
|
|
1379
|
-
// Attribute filtering
|
|
1380
|
-
/** Filter by product attributes */
|
|
1381
|
-
attributes: zod.z.array(
|
|
1382
|
-
zod.z.object({
|
|
1383
|
-
/** Attribute name */
|
|
1384
|
-
attribute: zod.z.string(),
|
|
1385
|
-
/** Filter by attribute term IDs */
|
|
1386
|
-
term_id: zod.z.array(zod.z.number()).optional(),
|
|
1387
|
-
/** Filter by attribute term slugs */
|
|
1388
|
-
slug: zod.z.array(zod.z.string()).optional(),
|
|
1389
|
-
/** Attribute filter operator */
|
|
1390
|
-
operator: zod.z.enum(["in", "not_in", "and"]).optional()
|
|
1391
|
-
})
|
|
1392
|
-
).optional(),
|
|
1393
|
-
/** Relationship between attribute filters */
|
|
1394
|
-
attribute_relation: zod.z.enum(["in", "and"]).optional(),
|
|
1395
|
-
// Price filtering
|
|
1396
|
-
/** Minimum price filter */
|
|
1397
|
-
min_price: zod.z.string().optional(),
|
|
1398
|
-
/** Maximum price filter */
|
|
1399
|
-
max_price: zod.z.string().optional(),
|
|
1400
|
-
// Sale status
|
|
1401
|
-
/** Filter products on sale */
|
|
1402
|
-
on_sale: zod.z.boolean().optional(),
|
|
1403
|
-
// Rating filter
|
|
1404
|
-
/** Filter by product rating (1-5 stars) */
|
|
1405
|
-
rating: zod.z.array(zod.z.number().min(1).max(5)).optional()
|
|
1406
|
-
});
|
|
1407
|
-
|
|
1408
|
-
// src/schemas/store-api/products.ts
|
|
1409
|
-
var productSchema = zod.z.object({
|
|
1410
|
-
id: zod.z.number(),
|
|
1411
|
-
name: zod.z.string(),
|
|
1412
|
-
slug: zod.z.string(),
|
|
1413
|
-
type: zod.z.string(),
|
|
1414
|
-
variation: zod.z.string(),
|
|
1415
|
-
permalink: zod.z.string().url(),
|
|
1416
|
-
sku: zod.z.string(),
|
|
1417
|
-
short_description: zod.z.string(),
|
|
1418
|
-
description: zod.z.string(),
|
|
1419
|
-
is_purchasable: zod.z.boolean(),
|
|
1420
|
-
is_in_stock: zod.z.boolean(),
|
|
1421
|
-
is_on_backorder: zod.z.boolean(),
|
|
1422
|
-
low_stock_remaining: zod.z.number().nullable(),
|
|
1423
|
-
sold_individually: zod.z.boolean(),
|
|
1424
|
-
add_to_cart: addToCartSchema,
|
|
1425
|
-
has_options: zod.z.boolean(),
|
|
1426
|
-
on_sale: zod.z.boolean(),
|
|
1427
|
-
parent: zod.z.number(),
|
|
1428
|
-
attributes: zod.z.array(zod.z.unknown()),
|
|
1429
|
-
categories: zod.z.array(embeddedCategorySchema),
|
|
1430
|
-
tags: zod.z.array(zod.z.unknown()),
|
|
1431
|
-
images: zod.z.array(productImageSchema),
|
|
1432
|
-
variations: zod.z.array(zod.z.unknown()),
|
|
1433
|
-
price_html: zod.z.string(),
|
|
1434
|
-
prices: pricesSchema,
|
|
1435
|
-
average_rating: zod.z.string(),
|
|
1436
|
-
review_count: zod.z.number(),
|
|
1437
|
-
extensions: zod.z.record(zod.z.string(), zod.z.unknown())
|
|
1438
|
-
});
|
|
1439
|
-
|
|
1440
|
-
// src/api/cart.ts
|
|
1441
637
|
var createCartAPI = (client, endpoints, options) => ({
|
|
1442
638
|
get: async () => {
|
|
1443
639
|
const response = await client.get(endpoints.cart);
|
|
1444
|
-
return handleApiResponse(response, cartSchema, options);
|
|
640
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1445
641
|
},
|
|
1446
642
|
addItem: async (input) => {
|
|
1447
643
|
const response = await client.post(endpoints.addItem, input);
|
|
1448
|
-
return handleApiResponse(response, cartSchema, options);
|
|
644
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1449
645
|
},
|
|
1450
646
|
updateItem: async (input) => {
|
|
1451
647
|
const response = await client.post(endpoints.updateItem, input);
|
|
1452
|
-
return handleApiResponse(response, cartSchema, options);
|
|
648
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1453
649
|
},
|
|
1454
650
|
removeItem: async (input) => {
|
|
1455
651
|
const response = await client.post(endpoints.removeItem, input);
|
|
1456
|
-
return handleApiResponse(response, cartSchema, options);
|
|
652
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1457
653
|
},
|
|
1458
654
|
applyCoupon: async (input) => {
|
|
1459
655
|
const response = await client.post(endpoints.applyCoupon, input);
|
|
1460
|
-
return handleApiResponse(response, cartSchema, options);
|
|
656
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1461
657
|
},
|
|
1462
658
|
removeCoupon: async (input) => {
|
|
1463
659
|
const response = await client.post(endpoints.removeCoupon, input);
|
|
1464
|
-
return handleApiResponse(response, cartSchema, options);
|
|
660
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1465
661
|
},
|
|
1466
662
|
updateCustomer: async (input) => {
|
|
1467
663
|
const response = await client.post(endpoints.updateCustomer, input);
|
|
1468
|
-
return handleApiResponse(response, cartSchema, options);
|
|
664
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1469
665
|
},
|
|
1470
666
|
selectShippingRate: async (input) => {
|
|
1471
667
|
const response = await client.post(endpoints.selectShippingRate, input);
|
|
1472
|
-
return handleApiResponse(response, cartSchema, options);
|
|
668
|
+
return handleApiResponse(response, storeApi.cartSchema, options);
|
|
1473
669
|
}
|
|
1474
670
|
});
|
|
1475
|
-
|
|
1476
|
-
// src/api/checkout.ts
|
|
1477
671
|
var createCheckoutAPI = (client, endpoints, options) => ({
|
|
1478
672
|
get: async () => {
|
|
1479
673
|
const response = await client.get(endpoints.checkout);
|
|
1480
|
-
return handleApiResponse(response, checkoutSchema, options);
|
|
674
|
+
return handleApiResponse(response, storeApi.checkoutSchema, options);
|
|
1481
675
|
},
|
|
1482
676
|
process: async (input) => {
|
|
1483
677
|
const response = await client.post(endpoints.checkout, input);
|
|
1484
|
-
return handleApiResponse(response, checkoutSchema, options);
|
|
678
|
+
return handleApiResponse(response, storeApi.checkoutSchema, options);
|
|
1485
679
|
}
|
|
1486
680
|
});
|
|
1487
|
-
|
|
1488
|
-
// src/api/orders.ts
|
|
1489
681
|
var createOrdersAPI = (client, endpoints, options) => ({
|
|
1490
682
|
/**
|
|
1491
683
|
* Get a single order by ID
|
|
@@ -1495,21 +687,21 @@ var createOrdersAPI = (client, endpoints, options) => ({
|
|
|
1495
687
|
const { id, billing_email, key } = input;
|
|
1496
688
|
const params = billing_email && key ? { billing_email, key } : void 0;
|
|
1497
689
|
const response = await client.get(`${endpoints.order}/${id}`, { params });
|
|
1498
|
-
return handleApiResponse(response, storeApiOrderSchema, options);
|
|
690
|
+
return handleApiResponse(response, storeApi.storeApiOrderSchema, options);
|
|
1499
691
|
}
|
|
1500
692
|
});
|
|
1501
693
|
var createProductsAPI = (client, endpoints, options) => ({
|
|
1502
694
|
list: async (params) => {
|
|
1503
695
|
const response = await client.get(endpoints.products, { params });
|
|
1504
|
-
return handlePaginatedApiResponse(response, zod.z.array(productSchema), params, options);
|
|
696
|
+
return handlePaginatedApiResponse(response, zod.z.array(storeApi.productSchema), params, options);
|
|
1505
697
|
},
|
|
1506
698
|
get: async (id) => {
|
|
1507
699
|
const response = await client.get(`${endpoints.products}/${id}`);
|
|
1508
|
-
return handleApiResponse(response, productSchema, options);
|
|
700
|
+
return handleApiResponse(response, storeApi.productSchema, options);
|
|
1509
701
|
},
|
|
1510
702
|
categories: async () => {
|
|
1511
703
|
const response = await client.get(endpoints.categories);
|
|
1512
|
-
return handleApiResponse(response, zod.z.array(productCategorySchema), options);
|
|
704
|
+
return handleApiResponse(response, zod.z.array(storeApi.productCategorySchema), options);
|
|
1513
705
|
}
|
|
1514
706
|
});
|
|
1515
707
|
|
|
@@ -1575,578 +767,164 @@ var createClient = (config) => {
|
|
|
1575
767
|
return client;
|
|
1576
768
|
};
|
|
1577
769
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
"completed",
|
|
1582
|
-
"pending",
|
|
1583
|
-
"processing",
|
|
1584
|
-
"on-hold",
|
|
1585
|
-
"auto-draft",
|
|
1586
|
-
"trash",
|
|
1587
|
-
"refunded",
|
|
1588
|
-
"failed",
|
|
1589
|
-
"checkout-draft"
|
|
1590
|
-
];
|
|
1591
|
-
var PAYMENT_METHODS = ["cod", "monri", "pikpay", "bacs", "cheque"];
|
|
1592
|
-
var PRODUCT_TYPES = ["simple", "grouped", "external", "variable"];
|
|
1593
|
-
var PRODUCT_STATUS = [
|
|
1594
|
-
"any",
|
|
1595
|
-
"future",
|
|
1596
|
-
"trash",
|
|
1597
|
-
"draft",
|
|
1598
|
-
"pending",
|
|
1599
|
-
"private",
|
|
1600
|
-
"publish"
|
|
1601
|
-
];
|
|
1602
|
-
var STOCK_STATUS = ["instock", "outofstock", "onbackorder"];
|
|
1603
|
-
var USER_ROLES = [
|
|
1604
|
-
"all",
|
|
1605
|
-
"administrator",
|
|
1606
|
-
"editor",
|
|
1607
|
-
"author",
|
|
1608
|
-
"contributor",
|
|
1609
|
-
"subscriber",
|
|
1610
|
-
"customer",
|
|
1611
|
-
"shop_manager",
|
|
1612
|
-
"dc_pending_vendor",
|
|
1613
|
-
"dc_rejected_vendor",
|
|
1614
|
-
"dc_vendor",
|
|
1615
|
-
"translator"
|
|
1616
|
-
];
|
|
1617
|
-
var REVIEW_STATUS = ["all", "hold", "approved", "spam", "trash"];
|
|
1618
|
-
var SORT_ORDER = ["asc", "desc"];
|
|
1619
|
-
var COUPONS_ORDER_BY = ["date", "id", "include", "title", "slug", "modified"];
|
|
1620
|
-
var PRODUCT_SORT_FIELDS = [
|
|
1621
|
-
"date",
|
|
1622
|
-
"id",
|
|
1623
|
-
"include",
|
|
1624
|
-
"title",
|
|
1625
|
-
"slug",
|
|
1626
|
-
"modified",
|
|
1627
|
-
"popularity",
|
|
1628
|
-
"rating",
|
|
1629
|
-
"menu_order",
|
|
1630
|
-
"price"
|
|
1631
|
-
];
|
|
1632
|
-
var CATEGORY_SORT_FIELDS = [
|
|
1633
|
-
"id",
|
|
1634
|
-
"include",
|
|
1635
|
-
"name",
|
|
1636
|
-
"slug",
|
|
1637
|
-
"term_group",
|
|
1638
|
-
"description",
|
|
1639
|
-
"count"
|
|
1640
|
-
];
|
|
1641
|
-
var ORDER_SORT_FIELDS = ["date", "id", "include", "title", "slug", "modified"];
|
|
1642
|
-
var ERROR_CODES = ["registration-error-email-exists", "rest_no_route"];
|
|
1643
|
-
var CATALOG_VISIBILITY = ["visible", "catalog", "search", "hidden"];
|
|
1644
|
-
var CUSTOMER_ROLE = [
|
|
1645
|
-
"all",
|
|
1646
|
-
"administrator",
|
|
1647
|
-
"editor",
|
|
1648
|
-
"author",
|
|
1649
|
-
"contributor",
|
|
1650
|
-
"subscriber",
|
|
1651
|
-
"customer",
|
|
1652
|
-
"shop_manager"
|
|
1653
|
-
];
|
|
1654
|
-
var CUSTOMER_SORT_FIELDS = ["id", "include", "name", "registered_date"];
|
|
1655
|
-
var PRODUCT_REVIEWS_SORT_FIELDS = ["date", "date_gmt", "id", "include", "product"];
|
|
1656
|
-
var ENUM_RAW = {
|
|
1657
|
-
ORDER: {
|
|
1658
|
-
STATUS: ORDER_STATUS,
|
|
1659
|
-
SORT_FIELDS: ORDER_SORT_FIELDS
|
|
1660
|
-
},
|
|
1661
|
-
PAYMENT: {
|
|
1662
|
-
METHODS: PAYMENT_METHODS
|
|
1663
|
-
},
|
|
1664
|
-
PRODUCT: {
|
|
1665
|
-
TYPES: PRODUCT_TYPES,
|
|
1666
|
-
STATUS: PRODUCT_STATUS,
|
|
1667
|
-
STOCK_STATUS,
|
|
1668
|
-
CATALOG_VISIBILITY,
|
|
1669
|
-
SORT_FIELDS: PRODUCT_SORT_FIELDS
|
|
1670
|
-
},
|
|
1671
|
-
USER: {
|
|
1672
|
-
ROLES: USER_ROLES
|
|
1673
|
-
},
|
|
1674
|
-
REVIEW: {
|
|
1675
|
-
STATUS: REVIEW_STATUS,
|
|
1676
|
-
SORT_FIELDS: PRODUCT_REVIEWS_SORT_FIELDS
|
|
1677
|
-
},
|
|
1678
|
-
CATEGORY: {
|
|
1679
|
-
SORT_FIELDS: CATEGORY_SORT_FIELDS
|
|
1680
|
-
},
|
|
1681
|
-
COMMON: {
|
|
1682
|
-
SORT_ORDER,
|
|
1683
|
-
ERROR_CODES},
|
|
1684
|
-
CUSTOMER: {
|
|
1685
|
-
ROLE: CUSTOMER_ROLE,
|
|
1686
|
-
SORT_FIELDS: CUSTOMER_SORT_FIELDS
|
|
1687
|
-
},
|
|
1688
|
-
COUPONS: {
|
|
1689
|
-
ORDER_BY: COUPONS_ORDER_BY
|
|
1690
|
-
}
|
|
1691
|
-
};
|
|
1692
|
-
|
|
1693
|
-
// src/schemas/admin-api/enums/enums.ts
|
|
1694
|
-
var APP_ENUMS = {
|
|
1695
|
-
PRODUCT_TYPES: {
|
|
1696
|
-
RAW: ENUM_RAW.PRODUCT.TYPES,
|
|
1697
|
-
ZOD: zod.z.enum(ENUM_RAW.PRODUCT.TYPES)
|
|
1698
|
-
},
|
|
1699
|
-
PRODUCT_STATUS: {
|
|
1700
|
-
RAW: ENUM_RAW.PRODUCT.STATUS,
|
|
1701
|
-
ZOD: zod.z.enum(ENUM_RAW.PRODUCT.STATUS)
|
|
1702
|
-
},
|
|
1703
|
-
PRODUCT_STOCK_STATUS: {
|
|
1704
|
-
RAW: ENUM_RAW.PRODUCT.STOCK_STATUS,
|
|
1705
|
-
ZOD: zod.z.enum(ENUM_RAW.PRODUCT.STOCK_STATUS)
|
|
1706
|
-
},
|
|
1707
|
-
PRODUCT_CATALOG_VISIBILITY: {
|
|
1708
|
-
RAW: ENUM_RAW.PRODUCT.CATALOG_VISIBILITY,
|
|
1709
|
-
ZOD: zod.z.enum(ENUM_RAW.PRODUCT.CATALOG_VISIBILITY)
|
|
1710
|
-
},
|
|
1711
|
-
PRODUCT_SORT_FIELDS: {
|
|
1712
|
-
RAW: ENUM_RAW.PRODUCT.SORT_FIELDS,
|
|
1713
|
-
ZOD: zod.z.enum(ENUM_RAW.PRODUCT.SORT_FIELDS)
|
|
1714
|
-
},
|
|
1715
|
-
ORDER_STATUS: {
|
|
1716
|
-
RAW: ENUM_RAW.ORDER.STATUS,
|
|
1717
|
-
ZOD: zod.z.enum(ENUM_RAW.ORDER.STATUS)
|
|
1718
|
-
},
|
|
1719
|
-
ORDER_SORT_FIELDS: {
|
|
1720
|
-
RAW: ENUM_RAW.ORDER.SORT_FIELDS,
|
|
1721
|
-
ZOD: zod.z.enum(ENUM_RAW.ORDER.SORT_FIELDS)
|
|
1722
|
-
},
|
|
1723
|
-
PAYMENT_METHODS: {
|
|
1724
|
-
RAW: ENUM_RAW.PAYMENT.METHODS,
|
|
1725
|
-
ZOD: zod.z.enum(ENUM_RAW.PAYMENT.METHODS)
|
|
1726
|
-
},
|
|
1727
|
-
USER_ROLES: {
|
|
1728
|
-
RAW: ENUM_RAW.USER.ROLES,
|
|
1729
|
-
ZOD: zod.z.enum(ENUM_RAW.USER.ROLES)
|
|
1730
|
-
},
|
|
1731
|
-
REVIEW_STATUS: {
|
|
1732
|
-
RAW: ENUM_RAW.REVIEW.STATUS,
|
|
1733
|
-
ZOD: zod.z.enum(ENUM_RAW.REVIEW.STATUS)
|
|
1734
|
-
},
|
|
1735
|
-
CATEGORY_SORT_FIELDS: {
|
|
1736
|
-
RAW: ENUM_RAW.CATEGORY.SORT_FIELDS,
|
|
1737
|
-
ZOD: zod.z.enum(ENUM_RAW.CATEGORY.SORT_FIELDS)
|
|
1738
|
-
},
|
|
1739
|
-
COMMON_SORT_ORDER: {
|
|
1740
|
-
RAW: ENUM_RAW.COMMON.SORT_ORDER,
|
|
1741
|
-
ZOD: zod.z.enum(ENUM_RAW.COMMON.SORT_ORDER)
|
|
1742
|
-
},
|
|
1743
|
-
COMMON_ERROR_CODES: {
|
|
1744
|
-
RAW: ENUM_RAW.COMMON.ERROR_CODES,
|
|
1745
|
-
ZOD: zod.z.enum(ENUM_RAW.COMMON.ERROR_CODES)
|
|
1746
|
-
},
|
|
1747
|
-
CUSTOMER_ROLE: {
|
|
1748
|
-
RAW: ENUM_RAW.CUSTOMER.ROLE,
|
|
1749
|
-
ZOD: zod.z.enum(ENUM_RAW.CUSTOMER.ROLE)
|
|
1750
|
-
},
|
|
1751
|
-
CUSTOMER_SORT_FIELDS: {
|
|
1752
|
-
RAW: ENUM_RAW.CUSTOMER.SORT_FIELDS,
|
|
1753
|
-
ZOD: zod.z.enum(ENUM_RAW.CUSTOMER.SORT_FIELDS)
|
|
1754
|
-
},
|
|
1755
|
-
REVIEW_SORT_FIELDS: {
|
|
1756
|
-
RAW: ENUM_RAW.REVIEW.SORT_FIELDS,
|
|
1757
|
-
ZOD: zod.z.enum(ENUM_RAW.REVIEW.SORT_FIELDS)
|
|
1758
|
-
},
|
|
1759
|
-
COUPONS_ORDER_BY: {
|
|
1760
|
-
RAW: ENUM_RAW.COUPONS.ORDER_BY,
|
|
1761
|
-
ZOD: zod.z.enum(ENUM_RAW.COUPONS.ORDER_BY)
|
|
1762
|
-
}
|
|
1763
|
-
};
|
|
1764
|
-
var getAppEnumZod = (key) => APP_ENUMS[key].ZOD;
|
|
1765
|
-
var getAppEnumRaw = (key) => APP_ENUMS[key].RAW;
|
|
1766
|
-
var basePaginationSchema = zod.z.object({
|
|
1767
|
-
page: zod.z.number().positive().default(1),
|
|
1768
|
-
per_page: zod.z.number().positive().max(100).default(10),
|
|
1769
|
-
offset: zod.z.number().nonnegative().optional()
|
|
770
|
+
Object.defineProperty(exports, "addToCartInputSchema", {
|
|
771
|
+
enumerable: true,
|
|
772
|
+
get: function () { return storeApi.addToCartInputSchema; }
|
|
1770
773
|
});
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
include: zod.z.array(zod.z.number()).default([])
|
|
774
|
+
Object.defineProperty(exports, "addressSchema", {
|
|
775
|
+
enumerable: true,
|
|
776
|
+
get: function () { return storeApi.addressSchema; }
|
|
1775
777
|
});
|
|
1776
|
-
|
|
1777
|
-
|
|
778
|
+
Object.defineProperty(exports, "billingAddressSchema", {
|
|
779
|
+
enumerable: true,
|
|
780
|
+
get: function () { return storeApi.billingAddressSchemaMandatory; }
|
|
1778
781
|
});
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
782
|
+
Object.defineProperty(exports, "cartItemImageSchema", {
|
|
783
|
+
enumerable: true,
|
|
784
|
+
get: function () { return storeApi.cartItemImageSchema; }
|
|
1782
785
|
});
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
context: zod.z.enum(["view", "edit"]).default("view")
|
|
786
|
+
Object.defineProperty(exports, "cartSchema", {
|
|
787
|
+
enumerable: true,
|
|
788
|
+
get: function () { return storeApi.cartSchema; }
|
|
1787
789
|
});
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
about: zod.z.array(zod.z.object({ href: zod.z.string() })).optional(),
|
|
1792
|
-
author: zod.z.array(
|
|
1793
|
-
zod.z.object({
|
|
1794
|
-
embeddable: zod.z.boolean().optional(),
|
|
1795
|
-
href: zod.z.string()
|
|
1796
|
-
})
|
|
1797
|
-
).optional()
|
|
790
|
+
Object.defineProperty(exports, "checkoutInputSchema", {
|
|
791
|
+
enumerable: true,
|
|
792
|
+
get: function () { return storeApi.checkoutInputSchema; }
|
|
1798
793
|
});
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
order: getAppEnumZod("COMMON_SORT_ORDER").default("desc"),
|
|
1803
|
-
orderby: zod.z.string().optional()
|
|
794
|
+
Object.defineProperty(exports, "checkoutSchema", {
|
|
795
|
+
enumerable: true,
|
|
796
|
+
get: function () { return storeApi.checkoutSchema; }
|
|
1804
797
|
});
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
modified_after: zod.z.string().datetime().optional(),
|
|
1809
|
-
modified_before: zod.z.string().datetime().optional(),
|
|
1810
|
-
dates_are_gmt: zod.z.boolean().default(false)
|
|
798
|
+
Object.defineProperty(exports, "couponInputSchema", {
|
|
799
|
+
enumerable: true,
|
|
800
|
+
get: function () { return storeApi.couponInputSchema; }
|
|
1811
801
|
});
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
value: zod.z.any()
|
|
802
|
+
Object.defineProperty(exports, "paginationMetaSchema", {
|
|
803
|
+
enumerable: true,
|
|
804
|
+
get: function () { return storeApi.paginationMetaSchema; }
|
|
1816
805
|
});
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
company: zod.z.string().default(""),
|
|
1821
|
-
address_1: zod.z.string().default(""),
|
|
1822
|
-
address_2: zod.z.string().default(""),
|
|
1823
|
-
city: zod.z.string().default(""),
|
|
1824
|
-
state: zod.z.string().default(""),
|
|
1825
|
-
postcode: zod.z.string().default(""),
|
|
1826
|
-
country: zod.z.string().default("BA"),
|
|
1827
|
-
phone: zod.z.string().default(""),
|
|
1828
|
-
email: zod.z.string().email().optional()
|
|
806
|
+
Object.defineProperty(exports, "paginationParamsSchema", {
|
|
807
|
+
enumerable: true,
|
|
808
|
+
get: function () { return storeApi.paginationParamsSchema; }
|
|
1829
809
|
});
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
...wcSortingSchema.shape
|
|
810
|
+
Object.defineProperty(exports, "productCategorySchema", {
|
|
811
|
+
enumerable: true,
|
|
812
|
+
get: function () { return storeApi.productCategorySchema; }
|
|
1834
813
|
});
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
814
|
+
Object.defineProperty(exports, "productImageSchema", {
|
|
815
|
+
enumerable: true,
|
|
816
|
+
get: function () { return storeApi.productImageSchema; }
|
|
1838
817
|
});
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
currentPage: zod.z.number(),
|
|
1843
|
-
perPage: zod.z.number()
|
|
818
|
+
Object.defineProperty(exports, "productSchema", {
|
|
819
|
+
enumerable: true,
|
|
820
|
+
get: function () { return storeApi.productSchema; }
|
|
1844
821
|
});
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
data: zod.z.object({
|
|
1849
|
-
status: zod.z.number()
|
|
1850
|
-
}).optional()
|
|
1851
|
-
}).passthrough();
|
|
1852
|
-
|
|
1853
|
-
// src/schemas/admin-api/coupons/coupon-filter.schema.ts
|
|
1854
|
-
var couponFilterSchema = wcBaseParamsSchema.extend({
|
|
1855
|
-
orderby: getAppEnumZod("COUPONS_ORDER_BY").default("date"),
|
|
1856
|
-
code: zod.z.string().optional()
|
|
822
|
+
Object.defineProperty(exports, "removeCartItemInputSchema", {
|
|
823
|
+
enumerable: true,
|
|
824
|
+
get: function () { return storeApi.removeCartItemInputSchema; }
|
|
1857
825
|
});
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
amount: zod.z.string(),
|
|
1862
|
-
status: zod.z.string(),
|
|
1863
|
-
discount_type: zod.z.enum(["percent", "fixed_cart", "fixed_product"]),
|
|
1864
|
-
description: zod.z.string(),
|
|
1865
|
-
date_expires: zod.z.string().nullable(),
|
|
1866
|
-
usage_count: zod.z.number(),
|
|
1867
|
-
individual_use: zod.z.boolean(),
|
|
1868
|
-
product_ids: zod.z.array(zod.z.number()),
|
|
1869
|
-
excluded_product_ids: zod.z.array(zod.z.number()),
|
|
1870
|
-
usage_limit: zod.z.number().nullable(),
|
|
1871
|
-
usage_limit_per_user: zod.z.number().nullable(),
|
|
1872
|
-
limit_usage_to_x_items: zod.z.number().nullable(),
|
|
1873
|
-
free_shipping: zod.z.boolean(),
|
|
1874
|
-
product_categories: zod.z.array(zod.z.number()),
|
|
1875
|
-
excluded_product_categories: zod.z.array(zod.z.number()),
|
|
1876
|
-
exclude_sale_items: zod.z.boolean(),
|
|
1877
|
-
minimum_amount: zod.z.string(),
|
|
1878
|
-
maximum_amount: zod.z.string(),
|
|
1879
|
-
email_restrictions: zod.z.array(zod.z.string())
|
|
826
|
+
Object.defineProperty(exports, "searchParamsSchema", {
|
|
827
|
+
enumerable: true,
|
|
828
|
+
get: function () { return storeApi.searchParamsSchema; }
|
|
1880
829
|
});
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
}).extend({
|
|
1885
|
-
code: zod.z.string().min(1, "Code is required"),
|
|
1886
|
-
amount: zod.z.string().min(1, "Amount is required")
|
|
830
|
+
Object.defineProperty(exports, "selectShippingRateInputSchema", {
|
|
831
|
+
enumerable: true,
|
|
832
|
+
get: function () { return storeApi.selectShippingRateInputSchema; }
|
|
1887
833
|
});
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
email: zod.z.string().email().optional()
|
|
834
|
+
Object.defineProperty(exports, "storeApiOrderSchema", {
|
|
835
|
+
enumerable: true,
|
|
836
|
+
get: function () { return storeApi.storeApiOrderSchema; }
|
|
1892
837
|
});
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
first_name: zod.z.string(),
|
|
1897
|
-
last_name: zod.z.string(),
|
|
1898
|
-
email: zod.z.string().email(),
|
|
1899
|
-
role: getAppEnumZod("CUSTOMER_ROLE"),
|
|
1900
|
-
date_created: zod.z.string(),
|
|
1901
|
-
date_modified: zod.z.string(),
|
|
1902
|
-
is_paying_customer: zod.z.boolean(),
|
|
1903
|
-
avatar_url: zod.z.string(),
|
|
1904
|
-
billing: wcAddressSchema.extend({
|
|
1905
|
-
email: zod.z.string().email()
|
|
1906
|
-
}),
|
|
1907
|
-
shipping: wcAddressSchema
|
|
838
|
+
Object.defineProperty(exports, "updateCartItemInputSchema", {
|
|
839
|
+
enumerable: true,
|
|
840
|
+
get: function () { return storeApi.updateCartItemInputSchema; }
|
|
1908
841
|
});
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
last_name: true,
|
|
1913
|
-
shipping: true
|
|
1914
|
-
}).extend({
|
|
1915
|
-
loyalty_card_number: zod.z.string().optional()
|
|
842
|
+
Object.defineProperty(exports, "updateCustomerInputSchema", {
|
|
843
|
+
enumerable: true,
|
|
844
|
+
get: function () { return storeApi.updateCustomerInputSchema; }
|
|
1916
845
|
});
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
})
|
|
1921
|
-
).partial();
|
|
1922
|
-
var orderFilterSchema = wcBaseParamsSchema.extend({
|
|
1923
|
-
orderby: getAppEnumZod("ORDER_SORT_FIELDS").default("date"),
|
|
1924
|
-
status: zod.z.array(getAppEnumZod("ORDER_STATUS")).optional(),
|
|
1925
|
-
customer: zod.z.number().optional(),
|
|
1926
|
-
product: zod.z.number().optional(),
|
|
1927
|
-
dp: zod.z.number().default(2).optional()
|
|
1928
|
-
// decimal points
|
|
1929
|
-
}).merge(wcDateFilterSchema);
|
|
1930
|
-
var orderLineItemSchema = zod.z.object({
|
|
1931
|
-
id: zod.z.number(),
|
|
1932
|
-
name: zod.z.string(),
|
|
1933
|
-
product_id: zod.z.number(),
|
|
1934
|
-
variation_id: zod.z.number(),
|
|
1935
|
-
quantity: zod.z.number(),
|
|
1936
|
-
tax_class: zod.z.string(),
|
|
1937
|
-
subtotal: zod.z.string(),
|
|
1938
|
-
subtotal_tax: zod.z.string(),
|
|
1939
|
-
total: zod.z.string(),
|
|
1940
|
-
total_tax: zod.z.string(),
|
|
1941
|
-
sku: zod.z.string(),
|
|
1942
|
-
price: zod.z.number()
|
|
846
|
+
Object.defineProperty(exports, "adminCategoryFilterSchema", {
|
|
847
|
+
enumerable: true,
|
|
848
|
+
get: function () { return adminApi.categoryFilterSchema; }
|
|
1943
849
|
});
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
status: getAppEnumZod("ORDER_STATUS"),
|
|
1948
|
-
currency: zod.z.string(),
|
|
1949
|
-
version: zod.z.string(),
|
|
1950
|
-
prices_include_tax: zod.z.boolean(),
|
|
1951
|
-
date_created: zod.z.string(),
|
|
1952
|
-
date_modified: zod.z.string(),
|
|
1953
|
-
discount_total: zod.z.string(),
|
|
1954
|
-
shipping_total: zod.z.string(),
|
|
1955
|
-
cart_tax: zod.z.string(),
|
|
1956
|
-
total: zod.z.string(),
|
|
1957
|
-
customer_id: zod.z.number(),
|
|
1958
|
-
order_key: zod.z.string(),
|
|
1959
|
-
billing: wcAddressSchema.extend({
|
|
1960
|
-
email: zod.z.string().email()
|
|
1961
|
-
}),
|
|
1962
|
-
shipping: wcAddressSchema,
|
|
1963
|
-
payment_method: getAppEnumZod("PAYMENT_METHODS"),
|
|
1964
|
-
payment_method_title: zod.z.string(),
|
|
1965
|
-
line_items: zod.z.array(orderLineItemSchema),
|
|
1966
|
-
// specific fields
|
|
1967
|
-
payment_url: zod.z.string().optional(),
|
|
1968
|
-
pikpay_transaction_id: zod.z.string().optional(),
|
|
1969
|
-
pikpay_status: zod.z.string().optional(),
|
|
1970
|
-
monri_transaction_id: zod.z.string().optional(),
|
|
1971
|
-
monri_status: zod.z.string().optional()
|
|
850
|
+
Object.defineProperty(exports, "adminCouponFilterSchema", {
|
|
851
|
+
enumerable: true,
|
|
852
|
+
get: function () { return adminApi.couponFilterSchema; }
|
|
1972
853
|
});
|
|
1973
|
-
|
|
1974
|
-
|
|
854
|
+
Object.defineProperty(exports, "adminCouponSchema", {
|
|
855
|
+
enumerable: true,
|
|
856
|
+
get: function () { return adminApi.couponSchema; }
|
|
1975
857
|
});
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
description: zod.z.string(),
|
|
1980
|
-
enabled: zod.z.boolean(),
|
|
1981
|
-
method_title: zod.z.string(),
|
|
1982
|
-
method_description: zod.z.string()
|
|
858
|
+
Object.defineProperty(exports, "adminOrderFilterSchema", {
|
|
859
|
+
enumerable: true,
|
|
860
|
+
get: function () { return adminApi.orderFilterSchema; }
|
|
1983
861
|
});
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
parent: zod.z.number().optional(),
|
|
1988
|
-
product: zod.z.number().nullable().default(null),
|
|
1989
|
-
slug: zod.z.string().optional()
|
|
862
|
+
Object.defineProperty(exports, "adminOrderSchema", {
|
|
863
|
+
enumerable: true,
|
|
864
|
+
get: function () { return adminApi.orderSchema; }
|
|
1990
865
|
});
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
date_modified: zod.z.string(),
|
|
1995
|
-
src: zod.z.string(),
|
|
1996
|
-
name: zod.z.string(),
|
|
1997
|
-
alt: zod.z.string()
|
|
866
|
+
Object.defineProperty(exports, "adminProductCategorySchema", {
|
|
867
|
+
enumerable: true,
|
|
868
|
+
get: function () { return adminApi.productCategorySchema; }
|
|
1998
869
|
});
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
slug: zod.z.string(),
|
|
2003
|
-
date_created: zod.z.string(),
|
|
2004
|
-
date_modified: zod.z.string(),
|
|
2005
|
-
type: zod.z.string(),
|
|
2006
|
-
status: zod.z.string(),
|
|
2007
|
-
featured: zod.z.boolean(),
|
|
2008
|
-
catalog_visibility: zod.z.string(),
|
|
2009
|
-
description: zod.z.string(),
|
|
2010
|
-
short_description: zod.z.string(),
|
|
2011
|
-
sku: zod.z.string(),
|
|
2012
|
-
price: zod.z.string(),
|
|
2013
|
-
regular_price: zod.z.string(),
|
|
2014
|
-
sale_price: zod.z.string(),
|
|
2015
|
-
stock_status: getAppEnumZod("PRODUCT_STOCK_STATUS"),
|
|
2016
|
-
stock_quantity: zod.z.number().nullable(),
|
|
2017
|
-
categories: zod.z.array(
|
|
2018
|
-
zod.z.object({
|
|
2019
|
-
id: zod.z.number(),
|
|
2020
|
-
name: zod.z.string(),
|
|
2021
|
-
slug: zod.z.string()
|
|
2022
|
-
})
|
|
2023
|
-
),
|
|
2024
|
-
images: zod.z.array(productImageSchema2),
|
|
2025
|
-
attributes: zod.z.array(
|
|
2026
|
-
zod.z.object({
|
|
2027
|
-
id: zod.z.number(),
|
|
2028
|
-
name: zod.z.string(),
|
|
2029
|
-
position: zod.z.number(),
|
|
2030
|
-
visible: zod.z.boolean(),
|
|
2031
|
-
variation: zod.z.boolean(),
|
|
2032
|
-
options: zod.z.array(zod.z.string())
|
|
2033
|
-
})
|
|
2034
|
-
),
|
|
2035
|
-
meta_data: zod.z.array(wcMetaDataSchema),
|
|
2036
|
-
on_sale: zod.z.boolean(),
|
|
2037
|
-
manufacturer: zod.z.string().optional()
|
|
870
|
+
Object.defineProperty(exports, "adminProductFilterSchema", {
|
|
871
|
+
enumerable: true,
|
|
872
|
+
get: function () { return adminApi.productFilterSchema; }
|
|
2038
873
|
});
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
id: zod.z.number(),
|
|
2043
|
-
name: zod.z.string(),
|
|
2044
|
-
slug: zod.z.string(),
|
|
2045
|
-
parent: zod.z.number(),
|
|
2046
|
-
description: zod.z.string(),
|
|
2047
|
-
display: zod.z.string(),
|
|
2048
|
-
image: productImageSchema2.nullable(),
|
|
2049
|
-
menu_order: zod.z.number(),
|
|
2050
|
-
count: zod.z.number()
|
|
874
|
+
Object.defineProperty(exports, "adminProductSchema", {
|
|
875
|
+
enumerable: true,
|
|
876
|
+
get: function () { return adminApi.productSchema; }
|
|
2051
877
|
});
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
})
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
})
|
|
2072
|
-
|
|
878
|
+
Object.defineProperty(exports, "createCategorySchema", {
|
|
879
|
+
enumerable: true,
|
|
880
|
+
get: function () { return adminApi.createCategorySchema; }
|
|
881
|
+
});
|
|
882
|
+
Object.defineProperty(exports, "createCouponSchema", {
|
|
883
|
+
enumerable: true,
|
|
884
|
+
get: function () { return adminApi.createCouponSchema; }
|
|
885
|
+
});
|
|
886
|
+
Object.defineProperty(exports, "createCustomerSchema", {
|
|
887
|
+
enumerable: true,
|
|
888
|
+
get: function () { return adminApi.createCustomerSchema; }
|
|
889
|
+
});
|
|
890
|
+
Object.defineProperty(exports, "customerFilterSchema", {
|
|
891
|
+
enumerable: true,
|
|
892
|
+
get: function () { return adminApi.customerFilterSchema; }
|
|
893
|
+
});
|
|
894
|
+
Object.defineProperty(exports, "customerSchema", {
|
|
895
|
+
enumerable: true,
|
|
896
|
+
get: function () { return adminApi.customerSchema; }
|
|
897
|
+
});
|
|
898
|
+
Object.defineProperty(exports, "getAppEnumRaw", {
|
|
899
|
+
enumerable: true,
|
|
900
|
+
get: function () { return adminApi.getAppEnumRaw; }
|
|
901
|
+
});
|
|
902
|
+
Object.defineProperty(exports, "getAppEnumZod", {
|
|
903
|
+
enumerable: true,
|
|
904
|
+
get: function () { return adminApi.getAppEnumZod; }
|
|
905
|
+
});
|
|
906
|
+
Object.defineProperty(exports, "paymentMethodFilterSchema", {
|
|
907
|
+
enumerable: true,
|
|
908
|
+
get: function () { return adminApi.paymentMethodFilterSchema; }
|
|
909
|
+
});
|
|
910
|
+
Object.defineProperty(exports, "paymentMethodSchema", {
|
|
911
|
+
enumerable: true,
|
|
912
|
+
get: function () { return adminApi.paymentMethodSchema; }
|
|
913
|
+
});
|
|
914
|
+
Object.defineProperty(exports, "schemas", {
|
|
915
|
+
enumerable: true,
|
|
916
|
+
get: function () { return adminApi.schemas; }
|
|
917
|
+
});
|
|
918
|
+
Object.defineProperty(exports, "updateCustomerSchema", {
|
|
919
|
+
enumerable: true,
|
|
920
|
+
get: function () { return adminApi.updateCustomerSchema; }
|
|
921
|
+
});
|
|
922
|
+
Object.defineProperty(exports, "wcErrorResponseSchema", {
|
|
923
|
+
enumerable: true,
|
|
924
|
+
get: function () { return adminApi.wcErrorResponseSchema; }
|
|
2073
925
|
});
|
|
2074
|
-
|
|
2075
|
-
// src/schemas/admin-api/index.ts
|
|
2076
|
-
var schemas = {
|
|
2077
|
-
resources: {
|
|
2078
|
-
product: {
|
|
2079
|
-
filter: productFilterSchema,
|
|
2080
|
-
entity: productSchema2,
|
|
2081
|
-
category: {
|
|
2082
|
-
filter: categoryFilterSchema,
|
|
2083
|
-
entity: productCategorySchema2
|
|
2084
|
-
}
|
|
2085
|
-
},
|
|
2086
|
-
order: {
|
|
2087
|
-
filter: orderFilterSchema,
|
|
2088
|
-
entity: orderSchema,
|
|
2089
|
-
lineItem: orderLineItemSchema
|
|
2090
|
-
},
|
|
2091
|
-
customer: {
|
|
2092
|
-
filter: customerFilterSchema,
|
|
2093
|
-
entity: customerSchema,
|
|
2094
|
-
create: createCustomerSchema,
|
|
2095
|
-
update: updateCustomerSchema
|
|
2096
|
-
},
|
|
2097
|
-
coupon: {
|
|
2098
|
-
filter: couponFilterSchema,
|
|
2099
|
-
entity: couponSchema,
|
|
2100
|
-
create: createCouponSchema
|
|
2101
|
-
},
|
|
2102
|
-
paymentMethod: {
|
|
2103
|
-
filter: paymentMethodFilterSchema,
|
|
2104
|
-
entity: paymentMethodSchema
|
|
2105
|
-
}
|
|
2106
|
-
}
|
|
2107
|
-
};
|
|
2108
|
-
|
|
2109
926
|
exports.WooCommerceApiError = WooCommerceApiError;
|
|
2110
927
|
exports.WooCommerceDataValidationError = WooCommerceDataValidationError;
|
|
2111
|
-
exports.addToCartInputSchema = addToCartInputSchema;
|
|
2112
|
-
exports.addressSchema = addressSchema;
|
|
2113
|
-
exports.adminCategoryFilterSchema = categoryFilterSchema;
|
|
2114
|
-
exports.adminCouponFilterSchema = couponFilterSchema;
|
|
2115
|
-
exports.adminCouponSchema = couponSchema;
|
|
2116
|
-
exports.adminOrderFilterSchema = orderFilterSchema;
|
|
2117
|
-
exports.adminOrderSchema = orderSchema;
|
|
2118
|
-
exports.adminProductCategorySchema = productCategorySchema2;
|
|
2119
|
-
exports.adminProductFilterSchema = productFilterSchema;
|
|
2120
|
-
exports.adminProductSchema = productSchema2;
|
|
2121
|
-
exports.billingAddressSchema = billingAddressSchemaMandatory;
|
|
2122
|
-
exports.cartItemImageSchema = cartItemImageSchema;
|
|
2123
|
-
exports.cartSchema = cartSchema;
|
|
2124
|
-
exports.checkoutInputSchema = checkoutInputSchema;
|
|
2125
|
-
exports.checkoutSchema = checkoutSchema;
|
|
2126
|
-
exports.couponInputSchema = couponInputSchema;
|
|
2127
|
-
exports.createCategorySchema = createCategorySchema;
|
|
2128
928
|
exports.createClient = createClient;
|
|
2129
|
-
exports.createCouponSchema = createCouponSchema;
|
|
2130
|
-
exports.createCustomerSchema = createCustomerSchema;
|
|
2131
|
-
exports.customerFilterSchema = customerFilterSchema;
|
|
2132
|
-
exports.customerSchema = customerSchema;
|
|
2133
|
-
exports.getAppEnumRaw = getAppEnumRaw;
|
|
2134
|
-
exports.getAppEnumZod = getAppEnumZod;
|
|
2135
|
-
exports.paginationMetaSchema = paginationMetaSchema;
|
|
2136
|
-
exports.paginationParamsSchema = paginationParamsSchema;
|
|
2137
|
-
exports.paymentMethodFilterSchema = paymentMethodFilterSchema;
|
|
2138
|
-
exports.paymentMethodSchema = paymentMethodSchema;
|
|
2139
|
-
exports.productCategorySchema = productCategorySchema;
|
|
2140
|
-
exports.productImageSchema = productImageSchema;
|
|
2141
|
-
exports.productSchema = productSchema;
|
|
2142
|
-
exports.removeCartItemInputSchema = removeCartItemInputSchema;
|
|
2143
|
-
exports.schemas = schemas;
|
|
2144
|
-
exports.searchParamsSchema = storeProductsSearchParamsSchema;
|
|
2145
|
-
exports.selectShippingRateInputSchema = selectShippingRateInputSchema;
|
|
2146
|
-
exports.storeApiOrderSchema = storeApiOrderSchema;
|
|
2147
|
-
exports.updateCartItemInputSchema = updateCartItemInputSchema;
|
|
2148
|
-
exports.updateCustomerInputSchema = updateCustomerInputSchema;
|
|
2149
|
-
exports.updateCustomerSchema = updateCustomerSchema;
|
|
2150
|
-
exports.wcErrorResponseSchema = wcErrorResponseSchema;
|
|
2151
929
|
//# sourceMappingURL=index.js.map
|
|
2152
930
|
//# sourceMappingURL=index.js.map
|