@atomic-solutions/woocommerce-api-client 0.2.0 → 0.3.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 +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/index.mjs.map +1 -1
- package/dist/http/index.d.mts +2 -2
- package/dist/http/index.d.ts +2 -2
- package/dist/index.d.mts +70 -3
- package/dist/index.d.ts +70 -3
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -1
- package/dist/index.mjs.map +1 -1
- package/dist/testing/index.d.mts +76 -0
- package/dist/testing/index.d.ts +76 -0
- package/dist/testing/index.js +2103 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/index.mjs +2091 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/{types-CgTmmyIP.d.mts → types-BF4_UUqp.d.mts} +1 -1
- package/dist/{types-CgTmmyIP.d.ts → types-BF4_UUqp.d.ts} +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/package.json +13 -1
package/dist/index.mjs
CHANGED
|
@@ -685,6 +685,33 @@ var billingAddressSchemaNonMandatory = addressSchemaNonMandatory.extend({
|
|
|
685
685
|
/** Email address (can be null for guest carts) */
|
|
686
686
|
email: z.string().nullable()
|
|
687
687
|
});
|
|
688
|
+
var phoneFormatRegex = /^[+\d][\d\s\-/()]{5,}$/;
|
|
689
|
+
var defaultAddressFormMessages = {
|
|
690
|
+
required: "This field is required",
|
|
691
|
+
email: "Valid email is required",
|
|
692
|
+
postcode: "Postal code is not valid",
|
|
693
|
+
phone: "Invalid phone number"
|
|
694
|
+
};
|
|
695
|
+
var defaultPostcodePattern = /^\d+$/;
|
|
696
|
+
var resolveAddressFormMessages = (messages) => ({ ...defaultAddressFormMessages, ...messages });
|
|
697
|
+
var buildAddressFormShape = (m, postcodePattern) => ({
|
|
698
|
+
first_name: z.string().trim().min(1, m.required),
|
|
699
|
+
last_name: z.string().trim().min(1, m.required),
|
|
700
|
+
company: z.string().trim(),
|
|
701
|
+
address_1: z.string().trim().min(1, m.required),
|
|
702
|
+
address_2: z.string().trim(),
|
|
703
|
+
city: z.string().trim().min(1, m.required),
|
|
704
|
+
postcode: z.string().trim().min(1, m.required).regex(postcodePattern, m.postcode),
|
|
705
|
+
phone: z.string().trim().min(1, m.required).regex(phoneFormatRegex, m.phone)
|
|
706
|
+
});
|
|
707
|
+
var makeAddressFormSchema = (messages = {}, postcodePattern = defaultPostcodePattern) => z.object(buildAddressFormShape(resolveAddressFormMessages(messages), postcodePattern));
|
|
708
|
+
var makeBillingAddressFormSchema = (messages = {}, postcodePattern = defaultPostcodePattern) => {
|
|
709
|
+
const m = resolveAddressFormMessages(messages);
|
|
710
|
+
return z.object({
|
|
711
|
+
...buildAddressFormShape(m, postcodePattern),
|
|
712
|
+
email: z.string().trim().min(1, m.required).email(m.email)
|
|
713
|
+
});
|
|
714
|
+
};
|
|
688
715
|
var moneySchema = z.object({
|
|
689
716
|
/** Currency code (e.g., 'USD', 'EUR', 'BAM') */
|
|
690
717
|
currency_code: z.string(),
|
|
@@ -2133,6 +2160,6 @@ var schemas = {
|
|
|
2133
2160
|
}
|
|
2134
2161
|
};
|
|
2135
2162
|
|
|
2136
|
-
export { WooCommerceApiError, WooCommerceDataValidationError, addToCartInputSchema, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema2 as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema2 as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
|
|
2163
|
+
export { WooCommerceApiError, WooCommerceDataValidationError, addToCartInputSchema, addressSchema, categoryFilterSchema as adminCategoryFilterSchema, couponFilterSchema as adminCouponFilterSchema, couponSchema as adminCouponSchema, orderFilterSchema as adminOrderFilterSchema, orderSchema as adminOrderSchema, productCategorySchema2 as adminProductCategorySchema, productFilterSchema as adminProductFilterSchema, productSchema2 as adminProductSchema, billingAddressSchemaMandatory as billingAddressSchema, cartItemImageSchema, cartSchema, checkoutInputSchema, checkoutSchema, couponInputSchema, createCategorySchema, createClient, createCouponSchema, createCustomerSchema, createPaginatedSchema, customerFilterSchema, customerSchema, getAppEnumRaw, getAppEnumZod, makeAddressFormSchema, makeBillingAddressFormSchema, paginationMetaSchema, paginationParamsSchema, paymentMethodFilterSchema, paymentMethodSchema, productCategorySchema, productImageSchema, productSchema, removeCartItemInputSchema, schemas, storeProductsSearchParamsSchema as searchParamsSchema, selectShippingRateInputSchema, storeApiOrderSchema, updateCartItemInputSchema, updateCustomerInputSchema, updateCustomerSchema, wcBaseParamsSchema, wcErrorResponseSchema, wcPaginationMetaSchema };
|
|
2137
2164
|
//# sourceMappingURL=index.mjs.map
|
|
2138
2165
|
//# sourceMappingURL=index.mjs.map
|