@atomic-solutions/woocommerce-react 0.6.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.cjs +35 -3
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +34 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/{index-Dmlapl9c.d.ts → index-C6OkRa8P.d.ts} +202 -5
- package/dist/{index-DEvJWFSF.d.cts → index-DtuDPfTl.d.cts} +202 -5
- package/dist/index.cjs +35 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/provider/index.d.cts +2 -2
- package/dist/provider/index.d.ts +2 -2
- package/dist/{types-Dnq60zh-.d.cts → types-DABmdACe.d.cts} +3 -1
- package/dist/{types-Dnq60zh-.d.ts → types-DABmdACe.d.ts} +3 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
3
3
|
import * as _atomic_solutions_woocommerce_api_client from '@atomic-solutions/woocommerce-api-client';
|
|
4
|
-
import { WooCommerceClient, ProductCategory, ProductParams, PaginatedResponse, Product, Cart, Checkout, GetOrderInput, StoreApiOrder, ProductImage, CartItemImage, CartItem } from '@atomic-solutions/woocommerce-api-client';
|
|
5
|
-
import { Q as QueryKeys, k as StoreContextValue, l as StoreFeatures, S as StoreLocale, n as StoreTheme } from './types-
|
|
4
|
+
import { WooCommerceClient, ProductCategory, ProductParams, PaginatedResponse, Product, ProductTagsParams, ProductTag, Cart, Checkout, GetOrderInput, StoreApiOrder, ProductImage, CartItemImage, CartItem } from '@atomic-solutions/woocommerce-api-client';
|
|
5
|
+
import { Q as QueryKeys, k as StoreContextValue, l as StoreFeatures, S as StoreLocale, n as StoreTheme } from './types-DABmdACe.js';
|
|
6
6
|
|
|
7
7
|
type QueryOptions<TData, TError = Error> = Omit<UseQueryOptions<TData, TError>, 'queryKey' | 'queryFn'>;
|
|
8
8
|
type MutationOptions<TData, TError = Error, TVariables = unknown> = Omit<UseMutationOptions<TData, TError, TVariables>, 'mutationFn'>;
|
|
@@ -2933,6 +2933,11 @@ declare const useProductCategories: (options?: QueryOptions<ProductCategory[]>)
|
|
|
2933
2933
|
count: number;
|
|
2934
2934
|
menu_order?: number | undefined;
|
|
2935
2935
|
}[], Error>;
|
|
2936
|
+
declare const useProductTags: (params?: ProductTagsParams, options?: QueryOptions<ProductTag[]>) => _tanstack_react_query.UseQueryResult<{
|
|
2937
|
+
id: number;
|
|
2938
|
+
name: string;
|
|
2939
|
+
slug: string;
|
|
2940
|
+
}[], Error>;
|
|
2936
2941
|
declare const useProductCategoryTree: () => {
|
|
2937
2942
|
data: {
|
|
2938
2943
|
id: number;
|
|
@@ -7893,6 +7898,196 @@ declare const useRemoveCoupon: () => _tanstack_react_query.UseMutationResult<{
|
|
|
7893
7898
|
}, Error, {
|
|
7894
7899
|
code: string;
|
|
7895
7900
|
}, unknown>;
|
|
7901
|
+
declare const useUpdateCartExtensions: () => _tanstack_react_query.UseMutationResult<{
|
|
7902
|
+
totals: {
|
|
7903
|
+
currency_code: string;
|
|
7904
|
+
currency_symbol: string;
|
|
7905
|
+
currency_minor_unit: number;
|
|
7906
|
+
currency_decimal_separator: string;
|
|
7907
|
+
currency_thousand_separator: string;
|
|
7908
|
+
currency_prefix: string;
|
|
7909
|
+
currency_suffix: string;
|
|
7910
|
+
total_items: string;
|
|
7911
|
+
total_items_tax: string;
|
|
7912
|
+
total_fees: string;
|
|
7913
|
+
total_fees_tax: string;
|
|
7914
|
+
total_discount: string;
|
|
7915
|
+
total_discount_tax: string;
|
|
7916
|
+
total_shipping: string | null;
|
|
7917
|
+
total_shipping_tax: string | null;
|
|
7918
|
+
total_price: string;
|
|
7919
|
+
total_tax: string;
|
|
7920
|
+
tax_lines: {
|
|
7921
|
+
name: string;
|
|
7922
|
+
price: string;
|
|
7923
|
+
rate: string;
|
|
7924
|
+
}[];
|
|
7925
|
+
};
|
|
7926
|
+
items: {
|
|
7927
|
+
type: "simple" | "variable" | "grouped" | "external";
|
|
7928
|
+
id: number;
|
|
7929
|
+
name: string;
|
|
7930
|
+
key: string;
|
|
7931
|
+
quantity: number;
|
|
7932
|
+
quantity_limits: {
|
|
7933
|
+
minimum: number;
|
|
7934
|
+
maximum: number;
|
|
7935
|
+
multiple_of: number;
|
|
7936
|
+
editable: boolean;
|
|
7937
|
+
};
|
|
7938
|
+
short_description: string;
|
|
7939
|
+
description: string;
|
|
7940
|
+
sku: string;
|
|
7941
|
+
low_stock_remaining: number | null;
|
|
7942
|
+
backorders_allowed: boolean;
|
|
7943
|
+
show_backorder_badge: boolean;
|
|
7944
|
+
sold_individually: boolean;
|
|
7945
|
+
permalink: string;
|
|
7946
|
+
images: {
|
|
7947
|
+
alt: string;
|
|
7948
|
+
id: number;
|
|
7949
|
+
name: string;
|
|
7950
|
+
sizes: string;
|
|
7951
|
+
src: string;
|
|
7952
|
+
srcset: string;
|
|
7953
|
+
thumbnail: string;
|
|
7954
|
+
}[];
|
|
7955
|
+
variation: {
|
|
7956
|
+
value: string;
|
|
7957
|
+
attribute: string;
|
|
7958
|
+
}[];
|
|
7959
|
+
item_data: {
|
|
7960
|
+
value: string;
|
|
7961
|
+
key: string;
|
|
7962
|
+
}[];
|
|
7963
|
+
prices: {
|
|
7964
|
+
currency_code: string;
|
|
7965
|
+
currency_symbol: string;
|
|
7966
|
+
currency_minor_unit: number;
|
|
7967
|
+
currency_decimal_separator: string;
|
|
7968
|
+
currency_thousand_separator: string;
|
|
7969
|
+
currency_prefix: string;
|
|
7970
|
+
currency_suffix: string;
|
|
7971
|
+
price: string;
|
|
7972
|
+
regular_price: string;
|
|
7973
|
+
sale_price: string;
|
|
7974
|
+
price_range: {
|
|
7975
|
+
min_amount: string;
|
|
7976
|
+
max_amount: string;
|
|
7977
|
+
} | null;
|
|
7978
|
+
raw_prices?: {
|
|
7979
|
+
price: string;
|
|
7980
|
+
regular_price: string;
|
|
7981
|
+
sale_price: string;
|
|
7982
|
+
precision: number;
|
|
7983
|
+
} | undefined;
|
|
7984
|
+
};
|
|
7985
|
+
totals: {
|
|
7986
|
+
currency_code: string;
|
|
7987
|
+
currency_symbol: string;
|
|
7988
|
+
currency_minor_unit: number;
|
|
7989
|
+
currency_decimal_separator: string;
|
|
7990
|
+
currency_thousand_separator: string;
|
|
7991
|
+
currency_prefix: string;
|
|
7992
|
+
currency_suffix: string;
|
|
7993
|
+
line_subtotal: string;
|
|
7994
|
+
line_subtotal_tax: string;
|
|
7995
|
+
line_total: string;
|
|
7996
|
+
line_total_tax: string;
|
|
7997
|
+
};
|
|
7998
|
+
catalog_visibility: string;
|
|
7999
|
+
extensions: Record<string, unknown>;
|
|
8000
|
+
}[];
|
|
8001
|
+
shipping_rates: {
|
|
8002
|
+
name: string;
|
|
8003
|
+
package_id: number;
|
|
8004
|
+
destination: {
|
|
8005
|
+
address_1: string;
|
|
8006
|
+
city: string;
|
|
8007
|
+
state: string;
|
|
8008
|
+
postcode: string;
|
|
8009
|
+
country: string;
|
|
8010
|
+
address_2?: string | undefined;
|
|
8011
|
+
};
|
|
8012
|
+
items: {
|
|
8013
|
+
name: string;
|
|
8014
|
+
key: string;
|
|
8015
|
+
quantity: number;
|
|
8016
|
+
}[];
|
|
8017
|
+
shipping_rates: {
|
|
8018
|
+
currency_code: string;
|
|
8019
|
+
currency_symbol: string;
|
|
8020
|
+
name: string;
|
|
8021
|
+
price: string;
|
|
8022
|
+
description: string;
|
|
8023
|
+
rate_id: string;
|
|
8024
|
+
delivery_time: string;
|
|
8025
|
+
instance_id: number;
|
|
8026
|
+
method_id: string;
|
|
8027
|
+
meta_data: {
|
|
8028
|
+
value: string;
|
|
8029
|
+
key: string;
|
|
8030
|
+
}[];
|
|
8031
|
+
selected: boolean;
|
|
8032
|
+
}[];
|
|
8033
|
+
}[];
|
|
8034
|
+
items_count: number;
|
|
8035
|
+
items_weight: number;
|
|
8036
|
+
needs_payment: boolean;
|
|
8037
|
+
needs_shipping: boolean;
|
|
8038
|
+
payment_methods: ("cod" | "monri")[];
|
|
8039
|
+
payment_requirements: string[];
|
|
8040
|
+
has_calculated_shipping: boolean;
|
|
8041
|
+
shipping_address: {
|
|
8042
|
+
first_name: string;
|
|
8043
|
+
last_name: string;
|
|
8044
|
+
company: string;
|
|
8045
|
+
address_1: string;
|
|
8046
|
+
address_2: string;
|
|
8047
|
+
city: string;
|
|
8048
|
+
state: string;
|
|
8049
|
+
postcode: string;
|
|
8050
|
+
country: string;
|
|
8051
|
+
phone: string;
|
|
8052
|
+
};
|
|
8053
|
+
billing_address: {
|
|
8054
|
+
first_name: string;
|
|
8055
|
+
last_name: string;
|
|
8056
|
+
company: string;
|
|
8057
|
+
address_1: string;
|
|
8058
|
+
address_2: string;
|
|
8059
|
+
city: string;
|
|
8060
|
+
state: string;
|
|
8061
|
+
postcode: string;
|
|
8062
|
+
country: string;
|
|
8063
|
+
phone: string;
|
|
8064
|
+
email: string | null;
|
|
8065
|
+
};
|
|
8066
|
+
coupons: {
|
|
8067
|
+
code: string;
|
|
8068
|
+
totals: {
|
|
8069
|
+
currency_code: string;
|
|
8070
|
+
currency_symbol: string;
|
|
8071
|
+
currency_minor_unit: number;
|
|
8072
|
+
currency_decimal_separator: string;
|
|
8073
|
+
currency_thousand_separator: string;
|
|
8074
|
+
currency_prefix: string;
|
|
8075
|
+
currency_suffix: string;
|
|
8076
|
+
total_discount: string;
|
|
8077
|
+
total_discount_tax: string;
|
|
8078
|
+
};
|
|
8079
|
+
}[];
|
|
8080
|
+
errors: {
|
|
8081
|
+
code: string;
|
|
8082
|
+
message: string;
|
|
8083
|
+
}[];
|
|
8084
|
+
cross_sells: unknown[];
|
|
8085
|
+
fees: unknown[];
|
|
8086
|
+
extensions?: Record<string, unknown> | undefined;
|
|
8087
|
+
}, Error, {
|
|
8088
|
+
data: Record<string, unknown>;
|
|
8089
|
+
namespace: string;
|
|
8090
|
+
}, unknown>;
|
|
7896
8091
|
declare const useUpdateCustomer: () => _tanstack_react_query.UseMutationResult<{
|
|
7897
8092
|
totals: {
|
|
7898
8093
|
currency_code: string;
|
|
@@ -8333,7 +8528,7 @@ declare const useCheckout: (options?: QueryOptions<Checkout>) => _tanstack_react
|
|
|
8333
8528
|
payment_status: string;
|
|
8334
8529
|
payment_details: unknown[];
|
|
8335
8530
|
redirect_url: string;
|
|
8336
|
-
};
|
|
8531
|
+
} | null;
|
|
8337
8532
|
}, Error>;
|
|
8338
8533
|
declare const useProcessCheckout: () => _tanstack_react_query.UseMutationResult<{
|
|
8339
8534
|
status: string;
|
|
@@ -8371,7 +8566,7 @@ declare const useProcessCheckout: () => _tanstack_react_query.UseMutationResult<
|
|
|
8371
8566
|
payment_status: string;
|
|
8372
8567
|
payment_details: unknown[];
|
|
8373
8568
|
redirect_url: string;
|
|
8374
|
-
};
|
|
8569
|
+
} | null;
|
|
8375
8570
|
}, Error, {
|
|
8376
8571
|
payment_method: string;
|
|
8377
8572
|
extensions?: Record<string, unknown> | undefined;
|
|
@@ -8807,6 +9002,8 @@ interface ProcessedOrderDetails {
|
|
|
8807
9002
|
}
|
|
8808
9003
|
interface UseOrderViewOptions {
|
|
8809
9004
|
localeTag?: string;
|
|
9005
|
+
fallbackImageUrl?: string;
|
|
9006
|
+
imageSize?: ImageSize;
|
|
8810
9007
|
}
|
|
8811
9008
|
interface UseOrderViewReturn {
|
|
8812
9009
|
order: ProcessedOrderDetails | undefined;
|
|
@@ -8815,4 +9012,4 @@ interface UseOrderViewReturn {
|
|
|
8815
9012
|
}
|
|
8816
9013
|
declare function useOrderView(input: GetOrderInput, options?: UseOrderViewOptions): UseOrderViewReturn;
|
|
8817
9014
|
|
|
8818
|
-
export { useOrderView as $, type AppliedCoupon as A, getImageUrlOrPlaceholder as B, type CartTotals as C, getMaxAddToCartQuantity as D, getOrderStatusLabel as E, getPrimaryImage as F, getSizedImageUrl as G, getStockSeverity as H, type ImageSize as I, getStockStatusText as J, isLowStock as K, isPurchasable as L, preloadImage as M, preloadImages as N, unavailableReason as O, PLACEHOLDER_IMAGE_URL as P, useAddManyToCart as Q, type ReorderInputItem as R, type ShippingRate as S, useAddToCart as T, type UnavailableReason as U, useApplyCoupon as V, useCart as W, useCartView as X, useCheckout as Y, useInfiniteProducts as Z, useOrder as _, type PaymentMethod as a, useProcessCheckout as a0, useProduct as a1, useProductCategories as a2, useProductCategoryTree as a3,
|
|
9015
|
+
export { useOrderView as $, type AppliedCoupon as A, getImageUrlOrPlaceholder as B, type CartTotals as C, getMaxAddToCartQuantity as D, getOrderStatusLabel as E, getPrimaryImage as F, getSizedImageUrl as G, getStockSeverity as H, type ImageSize as I, getStockStatusText as J, isLowStock as K, isPurchasable as L, preloadImage as M, preloadImages as N, unavailableReason as O, PLACEHOLDER_IMAGE_URL as P, useAddManyToCart as Q, type ReorderInputItem as R, type ShippingRate as S, useAddToCart as T, type UnavailableReason as U, useApplyCoupon as V, useCart as W, useCartView as X, useCheckout as Y, useInfiniteProducts as Z, useOrder as _, type PaymentMethod as a, useProcessCheckout as a0, useProduct as a1, useProductCategories as a2, useProductCategoryTree as a3, useProductTags as a4, useProductView as a5, useProducts as a6, useProductsFeed as a7, useRemoveCoupon as a8, useRemoveFromCart as a9, useReorderView as aa, useSelectShippingRate as ab, useStore as ac, useStoreFeatures as ad, useStoreLocale as ae, useStoreTheme as af, useUpdateCartExtensions as ag, useUpdateCartItem as ah, useUpdateCustomer as ai, useWooCommerceClient as aj, useWooCommerceQueryKeys as ak, type InfiniteQueryOptions as al, type MutationOptions as am, type QueryOptions as an, type ProcessedCartItem as b, type ProcessedCategory as c, type ProcessedOrderDetails as d, type ProcessedOrderLineItem as e, type ProcessedProduct as f, type ProcessedProductDetails as g, type ProductCartState as h, type ProductCategoryTreeNode as i, type ReorderItemView as j, type ReorderUnavailableReason as k, type StockDisplayConfig as l, type StockStatus as m, type UseCartViewOptions as n, type UseCartViewReturn as o, type UseOrderViewOptions as p, type UseOrderViewReturn as q, type UseProductViewOptions as r, type UseProductViewReturn as s, type UseProductsFeedOptions as t, type UseProductsFeedReturn as u, type UseReorderViewOptions as v, type UseReorderViewReturn as w, canAddToCart as x, getAllImageUrls as y, getImageUrl as z };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { UseQueryOptions, UseInfiniteQueryOptions, InfiniteData, UseMutationOptions } from '@tanstack/react-query';
|
|
3
3
|
import * as _atomic_solutions_woocommerce_api_client from '@atomic-solutions/woocommerce-api-client';
|
|
4
|
-
import { WooCommerceClient, ProductCategory, ProductParams, PaginatedResponse, Product, Cart, Checkout, GetOrderInput, StoreApiOrder, ProductImage, CartItemImage, CartItem } from '@atomic-solutions/woocommerce-api-client';
|
|
5
|
-
import { Q as QueryKeys, k as StoreContextValue, l as StoreFeatures, S as StoreLocale, n as StoreTheme } from './types-
|
|
4
|
+
import { WooCommerceClient, ProductCategory, ProductParams, PaginatedResponse, Product, ProductTagsParams, ProductTag, Cart, Checkout, GetOrderInput, StoreApiOrder, ProductImage, CartItemImage, CartItem } from '@atomic-solutions/woocommerce-api-client';
|
|
5
|
+
import { Q as QueryKeys, k as StoreContextValue, l as StoreFeatures, S as StoreLocale, n as StoreTheme } from './types-DABmdACe.cjs';
|
|
6
6
|
|
|
7
7
|
type QueryOptions<TData, TError = Error> = Omit<UseQueryOptions<TData, TError>, 'queryKey' | 'queryFn'>;
|
|
8
8
|
type MutationOptions<TData, TError = Error, TVariables = unknown> = Omit<UseMutationOptions<TData, TError, TVariables>, 'mutationFn'>;
|
|
@@ -2933,6 +2933,11 @@ declare const useProductCategories: (options?: QueryOptions<ProductCategory[]>)
|
|
|
2933
2933
|
count: number;
|
|
2934
2934
|
menu_order?: number | undefined;
|
|
2935
2935
|
}[], Error>;
|
|
2936
|
+
declare const useProductTags: (params?: ProductTagsParams, options?: QueryOptions<ProductTag[]>) => _tanstack_react_query.UseQueryResult<{
|
|
2937
|
+
id: number;
|
|
2938
|
+
name: string;
|
|
2939
|
+
slug: string;
|
|
2940
|
+
}[], Error>;
|
|
2936
2941
|
declare const useProductCategoryTree: () => {
|
|
2937
2942
|
data: {
|
|
2938
2943
|
id: number;
|
|
@@ -7893,6 +7898,196 @@ declare const useRemoveCoupon: () => _tanstack_react_query.UseMutationResult<{
|
|
|
7893
7898
|
}, Error, {
|
|
7894
7899
|
code: string;
|
|
7895
7900
|
}, unknown>;
|
|
7901
|
+
declare const useUpdateCartExtensions: () => _tanstack_react_query.UseMutationResult<{
|
|
7902
|
+
totals: {
|
|
7903
|
+
currency_code: string;
|
|
7904
|
+
currency_symbol: string;
|
|
7905
|
+
currency_minor_unit: number;
|
|
7906
|
+
currency_decimal_separator: string;
|
|
7907
|
+
currency_thousand_separator: string;
|
|
7908
|
+
currency_prefix: string;
|
|
7909
|
+
currency_suffix: string;
|
|
7910
|
+
total_items: string;
|
|
7911
|
+
total_items_tax: string;
|
|
7912
|
+
total_fees: string;
|
|
7913
|
+
total_fees_tax: string;
|
|
7914
|
+
total_discount: string;
|
|
7915
|
+
total_discount_tax: string;
|
|
7916
|
+
total_shipping: string | null;
|
|
7917
|
+
total_shipping_tax: string | null;
|
|
7918
|
+
total_price: string;
|
|
7919
|
+
total_tax: string;
|
|
7920
|
+
tax_lines: {
|
|
7921
|
+
name: string;
|
|
7922
|
+
price: string;
|
|
7923
|
+
rate: string;
|
|
7924
|
+
}[];
|
|
7925
|
+
};
|
|
7926
|
+
items: {
|
|
7927
|
+
type: "simple" | "variable" | "grouped" | "external";
|
|
7928
|
+
id: number;
|
|
7929
|
+
name: string;
|
|
7930
|
+
key: string;
|
|
7931
|
+
quantity: number;
|
|
7932
|
+
quantity_limits: {
|
|
7933
|
+
minimum: number;
|
|
7934
|
+
maximum: number;
|
|
7935
|
+
multiple_of: number;
|
|
7936
|
+
editable: boolean;
|
|
7937
|
+
};
|
|
7938
|
+
short_description: string;
|
|
7939
|
+
description: string;
|
|
7940
|
+
sku: string;
|
|
7941
|
+
low_stock_remaining: number | null;
|
|
7942
|
+
backorders_allowed: boolean;
|
|
7943
|
+
show_backorder_badge: boolean;
|
|
7944
|
+
sold_individually: boolean;
|
|
7945
|
+
permalink: string;
|
|
7946
|
+
images: {
|
|
7947
|
+
alt: string;
|
|
7948
|
+
id: number;
|
|
7949
|
+
name: string;
|
|
7950
|
+
sizes: string;
|
|
7951
|
+
src: string;
|
|
7952
|
+
srcset: string;
|
|
7953
|
+
thumbnail: string;
|
|
7954
|
+
}[];
|
|
7955
|
+
variation: {
|
|
7956
|
+
value: string;
|
|
7957
|
+
attribute: string;
|
|
7958
|
+
}[];
|
|
7959
|
+
item_data: {
|
|
7960
|
+
value: string;
|
|
7961
|
+
key: string;
|
|
7962
|
+
}[];
|
|
7963
|
+
prices: {
|
|
7964
|
+
currency_code: string;
|
|
7965
|
+
currency_symbol: string;
|
|
7966
|
+
currency_minor_unit: number;
|
|
7967
|
+
currency_decimal_separator: string;
|
|
7968
|
+
currency_thousand_separator: string;
|
|
7969
|
+
currency_prefix: string;
|
|
7970
|
+
currency_suffix: string;
|
|
7971
|
+
price: string;
|
|
7972
|
+
regular_price: string;
|
|
7973
|
+
sale_price: string;
|
|
7974
|
+
price_range: {
|
|
7975
|
+
min_amount: string;
|
|
7976
|
+
max_amount: string;
|
|
7977
|
+
} | null;
|
|
7978
|
+
raw_prices?: {
|
|
7979
|
+
price: string;
|
|
7980
|
+
regular_price: string;
|
|
7981
|
+
sale_price: string;
|
|
7982
|
+
precision: number;
|
|
7983
|
+
} | undefined;
|
|
7984
|
+
};
|
|
7985
|
+
totals: {
|
|
7986
|
+
currency_code: string;
|
|
7987
|
+
currency_symbol: string;
|
|
7988
|
+
currency_minor_unit: number;
|
|
7989
|
+
currency_decimal_separator: string;
|
|
7990
|
+
currency_thousand_separator: string;
|
|
7991
|
+
currency_prefix: string;
|
|
7992
|
+
currency_suffix: string;
|
|
7993
|
+
line_subtotal: string;
|
|
7994
|
+
line_subtotal_tax: string;
|
|
7995
|
+
line_total: string;
|
|
7996
|
+
line_total_tax: string;
|
|
7997
|
+
};
|
|
7998
|
+
catalog_visibility: string;
|
|
7999
|
+
extensions: Record<string, unknown>;
|
|
8000
|
+
}[];
|
|
8001
|
+
shipping_rates: {
|
|
8002
|
+
name: string;
|
|
8003
|
+
package_id: number;
|
|
8004
|
+
destination: {
|
|
8005
|
+
address_1: string;
|
|
8006
|
+
city: string;
|
|
8007
|
+
state: string;
|
|
8008
|
+
postcode: string;
|
|
8009
|
+
country: string;
|
|
8010
|
+
address_2?: string | undefined;
|
|
8011
|
+
};
|
|
8012
|
+
items: {
|
|
8013
|
+
name: string;
|
|
8014
|
+
key: string;
|
|
8015
|
+
quantity: number;
|
|
8016
|
+
}[];
|
|
8017
|
+
shipping_rates: {
|
|
8018
|
+
currency_code: string;
|
|
8019
|
+
currency_symbol: string;
|
|
8020
|
+
name: string;
|
|
8021
|
+
price: string;
|
|
8022
|
+
description: string;
|
|
8023
|
+
rate_id: string;
|
|
8024
|
+
delivery_time: string;
|
|
8025
|
+
instance_id: number;
|
|
8026
|
+
method_id: string;
|
|
8027
|
+
meta_data: {
|
|
8028
|
+
value: string;
|
|
8029
|
+
key: string;
|
|
8030
|
+
}[];
|
|
8031
|
+
selected: boolean;
|
|
8032
|
+
}[];
|
|
8033
|
+
}[];
|
|
8034
|
+
items_count: number;
|
|
8035
|
+
items_weight: number;
|
|
8036
|
+
needs_payment: boolean;
|
|
8037
|
+
needs_shipping: boolean;
|
|
8038
|
+
payment_methods: ("cod" | "monri")[];
|
|
8039
|
+
payment_requirements: string[];
|
|
8040
|
+
has_calculated_shipping: boolean;
|
|
8041
|
+
shipping_address: {
|
|
8042
|
+
first_name: string;
|
|
8043
|
+
last_name: string;
|
|
8044
|
+
company: string;
|
|
8045
|
+
address_1: string;
|
|
8046
|
+
address_2: string;
|
|
8047
|
+
city: string;
|
|
8048
|
+
state: string;
|
|
8049
|
+
postcode: string;
|
|
8050
|
+
country: string;
|
|
8051
|
+
phone: string;
|
|
8052
|
+
};
|
|
8053
|
+
billing_address: {
|
|
8054
|
+
first_name: string;
|
|
8055
|
+
last_name: string;
|
|
8056
|
+
company: string;
|
|
8057
|
+
address_1: string;
|
|
8058
|
+
address_2: string;
|
|
8059
|
+
city: string;
|
|
8060
|
+
state: string;
|
|
8061
|
+
postcode: string;
|
|
8062
|
+
country: string;
|
|
8063
|
+
phone: string;
|
|
8064
|
+
email: string | null;
|
|
8065
|
+
};
|
|
8066
|
+
coupons: {
|
|
8067
|
+
code: string;
|
|
8068
|
+
totals: {
|
|
8069
|
+
currency_code: string;
|
|
8070
|
+
currency_symbol: string;
|
|
8071
|
+
currency_minor_unit: number;
|
|
8072
|
+
currency_decimal_separator: string;
|
|
8073
|
+
currency_thousand_separator: string;
|
|
8074
|
+
currency_prefix: string;
|
|
8075
|
+
currency_suffix: string;
|
|
8076
|
+
total_discount: string;
|
|
8077
|
+
total_discount_tax: string;
|
|
8078
|
+
};
|
|
8079
|
+
}[];
|
|
8080
|
+
errors: {
|
|
8081
|
+
code: string;
|
|
8082
|
+
message: string;
|
|
8083
|
+
}[];
|
|
8084
|
+
cross_sells: unknown[];
|
|
8085
|
+
fees: unknown[];
|
|
8086
|
+
extensions?: Record<string, unknown> | undefined;
|
|
8087
|
+
}, Error, {
|
|
8088
|
+
data: Record<string, unknown>;
|
|
8089
|
+
namespace: string;
|
|
8090
|
+
}, unknown>;
|
|
7896
8091
|
declare const useUpdateCustomer: () => _tanstack_react_query.UseMutationResult<{
|
|
7897
8092
|
totals: {
|
|
7898
8093
|
currency_code: string;
|
|
@@ -8333,7 +8528,7 @@ declare const useCheckout: (options?: QueryOptions<Checkout>) => _tanstack_react
|
|
|
8333
8528
|
payment_status: string;
|
|
8334
8529
|
payment_details: unknown[];
|
|
8335
8530
|
redirect_url: string;
|
|
8336
|
-
};
|
|
8531
|
+
} | null;
|
|
8337
8532
|
}, Error>;
|
|
8338
8533
|
declare const useProcessCheckout: () => _tanstack_react_query.UseMutationResult<{
|
|
8339
8534
|
status: string;
|
|
@@ -8371,7 +8566,7 @@ declare const useProcessCheckout: () => _tanstack_react_query.UseMutationResult<
|
|
|
8371
8566
|
payment_status: string;
|
|
8372
8567
|
payment_details: unknown[];
|
|
8373
8568
|
redirect_url: string;
|
|
8374
|
-
};
|
|
8569
|
+
} | null;
|
|
8375
8570
|
}, Error, {
|
|
8376
8571
|
payment_method: string;
|
|
8377
8572
|
extensions?: Record<string, unknown> | undefined;
|
|
@@ -8807,6 +9002,8 @@ interface ProcessedOrderDetails {
|
|
|
8807
9002
|
}
|
|
8808
9003
|
interface UseOrderViewOptions {
|
|
8809
9004
|
localeTag?: string;
|
|
9005
|
+
fallbackImageUrl?: string;
|
|
9006
|
+
imageSize?: ImageSize;
|
|
8810
9007
|
}
|
|
8811
9008
|
interface UseOrderViewReturn {
|
|
8812
9009
|
order: ProcessedOrderDetails | undefined;
|
|
@@ -8815,4 +9012,4 @@ interface UseOrderViewReturn {
|
|
|
8815
9012
|
}
|
|
8816
9013
|
declare function useOrderView(input: GetOrderInput, options?: UseOrderViewOptions): UseOrderViewReturn;
|
|
8817
9014
|
|
|
8818
|
-
export { useOrderView as $, type AppliedCoupon as A, getImageUrlOrPlaceholder as B, type CartTotals as C, getMaxAddToCartQuantity as D, getOrderStatusLabel as E, getPrimaryImage as F, getSizedImageUrl as G, getStockSeverity as H, type ImageSize as I, getStockStatusText as J, isLowStock as K, isPurchasable as L, preloadImage as M, preloadImages as N, unavailableReason as O, PLACEHOLDER_IMAGE_URL as P, useAddManyToCart as Q, type ReorderInputItem as R, type ShippingRate as S, useAddToCart as T, type UnavailableReason as U, useApplyCoupon as V, useCart as W, useCartView as X, useCheckout as Y, useInfiniteProducts as Z, useOrder as _, type PaymentMethod as a, useProcessCheckout as a0, useProduct as a1, useProductCategories as a2, useProductCategoryTree as a3,
|
|
9015
|
+
export { useOrderView as $, type AppliedCoupon as A, getImageUrlOrPlaceholder as B, type CartTotals as C, getMaxAddToCartQuantity as D, getOrderStatusLabel as E, getPrimaryImage as F, getSizedImageUrl as G, getStockSeverity as H, type ImageSize as I, getStockStatusText as J, isLowStock as K, isPurchasable as L, preloadImage as M, preloadImages as N, unavailableReason as O, PLACEHOLDER_IMAGE_URL as P, useAddManyToCart as Q, type ReorderInputItem as R, type ShippingRate as S, useAddToCart as T, type UnavailableReason as U, useApplyCoupon as V, useCart as W, useCartView as X, useCheckout as Y, useInfiniteProducts as Z, useOrder as _, type PaymentMethod as a, useProcessCheckout as a0, useProduct as a1, useProductCategories as a2, useProductCategoryTree as a3, useProductTags as a4, useProductView as a5, useProducts as a6, useProductsFeed as a7, useRemoveCoupon as a8, useRemoveFromCart as a9, useReorderView as aa, useSelectShippingRate as ab, useStore as ac, useStoreFeatures as ad, useStoreLocale as ae, useStoreTheme as af, useUpdateCartExtensions as ag, useUpdateCartItem as ah, useUpdateCustomer as ai, useWooCommerceClient as aj, useWooCommerceQueryKeys as ak, type InfiniteQueryOptions as al, type MutationOptions as am, type QueryOptions as an, type ProcessedCartItem as b, type ProcessedCategory as c, type ProcessedOrderDetails as d, type ProcessedOrderLineItem as e, type ProcessedProduct as f, type ProcessedProductDetails as g, type ProductCartState as h, type ProductCategoryTreeNode as i, type ReorderItemView as j, type ReorderUnavailableReason as k, type StockDisplayConfig as l, type StockStatus as m, type UseCartViewOptions as n, type UseCartViewReturn as o, type UseOrderViewOptions as p, type UseOrderViewReturn as q, type UseProductViewOptions as r, type UseProductViewReturn as s, type UseProductsFeedOptions as t, type UseProductsFeedReturn as u, type UseReorderViewOptions as v, type UseReorderViewReturn as w, canAddToCart as x, getAllImageUrls as y, getImageUrl as z };
|
package/dist/index.cjs
CHANGED
|
@@ -478,6 +478,8 @@ var StaleTimes = {
|
|
|
478
478
|
product: STALE_TIME_SHORT,
|
|
479
479
|
/** Product categories - always fresh */
|
|
480
480
|
categories: STALE_TIME_NONE,
|
|
481
|
+
/** Product tags - names rarely change, 1 hour */
|
|
482
|
+
tags: STALE_TIME_LONG,
|
|
481
483
|
/** Orders - always fresh */
|
|
482
484
|
orders: STALE_TIME_NONE,
|
|
483
485
|
/** Default for infinite queries - 1 hour */
|
|
@@ -575,6 +577,16 @@ var processCategoriesToTree = (data) => {
|
|
|
575
577
|
});
|
|
576
578
|
return rootCategories?.map(processCategory) ?? [];
|
|
577
579
|
};
|
|
580
|
+
var useProductTags = (params, options) => {
|
|
581
|
+
const client = useWooCommerceClient();
|
|
582
|
+
const queryKeys = useWooCommerceQueryKeys();
|
|
583
|
+
return reactQuery.useQuery({
|
|
584
|
+
queryKey: queryKeys.products.tags(params),
|
|
585
|
+
queryFn: () => client.products.tags(params),
|
|
586
|
+
staleTime: StaleTimes.tags,
|
|
587
|
+
...options
|
|
588
|
+
});
|
|
589
|
+
};
|
|
578
590
|
var useProductCategoryTree = () => {
|
|
579
591
|
const query = useProductCategories();
|
|
580
592
|
const flatData = query.data ?? [];
|
|
@@ -789,6 +801,19 @@ var useRemoveCoupon = () => {
|
|
|
789
801
|
}
|
|
790
802
|
});
|
|
791
803
|
};
|
|
804
|
+
var useUpdateCartExtensions = () => {
|
|
805
|
+
const client = useWooCommerceClient();
|
|
806
|
+
const queryKeys = useWooCommerceQueryKeys();
|
|
807
|
+
const queryClient = reactQuery.useQueryClient();
|
|
808
|
+
return reactQuery.useMutation({
|
|
809
|
+
mutationKey: queryKeys.cart.mutations.updateExtensions(),
|
|
810
|
+
mutationFn: (input) => client.cart.updateExtensions(input),
|
|
811
|
+
onSuccess: (cart) => {
|
|
812
|
+
queryClient.setQueryData(queryKeys.cart.details(), cart);
|
|
813
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
};
|
|
792
817
|
var useUpdateCustomer = () => {
|
|
793
818
|
const client = useWooCommerceClient();
|
|
794
819
|
const queryKeys = useWooCommerceQueryKeys();
|
|
@@ -895,7 +920,9 @@ var createQueryKeys = (prefix = ["woocommerce"]) => ({
|
|
|
895
920
|
list: (params) => [...prefix, "products", "list", params],
|
|
896
921
|
details: () => [...prefix, "products", "detail"],
|
|
897
922
|
detail: (id) => [...prefix, "products", "detail", id],
|
|
898
|
-
categories: () => [...prefix, "products", "categories"]
|
|
923
|
+
categories: () => [...prefix, "products", "categories"],
|
|
924
|
+
// Params are in the key, so each set of tag ids is cached apart.
|
|
925
|
+
tags: (params) => [...prefix, "products", "tags", params]
|
|
899
926
|
},
|
|
900
927
|
// Cart
|
|
901
928
|
cart: {
|
|
@@ -909,6 +936,7 @@ var createQueryKeys = (prefix = ["woocommerce"]) => ({
|
|
|
909
936
|
removeItem: () => [...prefix, "cart", "mutation", "removeItem"],
|
|
910
937
|
applyCoupon: () => [...prefix, "cart", "mutation", "applyCoupon"],
|
|
911
938
|
removeCoupon: () => [...prefix, "cart", "mutation", "removeCoupon"],
|
|
939
|
+
updateExtensions: () => [...prefix, "cart", "mutation", "updateExtensions"],
|
|
912
940
|
updateCustomer: () => [...prefix, "cart", "mutation", "updateCustomer"],
|
|
913
941
|
selectShippingRate: () => [...prefix, "cart", "mutation", "selectShippingRate"]
|
|
914
942
|
}
|
|
@@ -1740,6 +1768,8 @@ function useOrderView(input, options = {}) {
|
|
|
1740
1768
|
const storeContext = react.useContext(WooCommerceStoreContext);
|
|
1741
1769
|
const storeConfig = storeContext?.config;
|
|
1742
1770
|
const localeTag = options.localeTag ?? storeConfig?.locale?.localeTag ?? DEFAULT_STORE_CONFIG.locale.localeTag;
|
|
1771
|
+
const { imageSize = "thumbnail" } = options;
|
|
1772
|
+
const getProcessedImageUrl = useProcessedImageUrl(imageSize, options.fallbackImageUrl);
|
|
1743
1773
|
const { data: rawOrder, isLoading, error } = useOrder(input);
|
|
1744
1774
|
const order = react.useMemo(() => {
|
|
1745
1775
|
if (!rawOrder) return void 0;
|
|
@@ -1750,7 +1780,7 @@ function useOrderView(input, options = {}) {
|
|
|
1750
1780
|
quantity: item.quantity,
|
|
1751
1781
|
price: formatStoreApiPriceIntl(item.prices.price, currencyCode, localeTag),
|
|
1752
1782
|
total: formatStoreApiPriceIntl(item.totals.line_total, currencyCode, localeTag),
|
|
1753
|
-
imageUrl: item.images
|
|
1783
|
+
imageUrl: getProcessedImageUrl(item.images)
|
|
1754
1784
|
}));
|
|
1755
1785
|
const status = rawOrder.status;
|
|
1756
1786
|
return {
|
|
@@ -1765,7 +1795,7 @@ function useOrderView(input, options = {}) {
|
|
|
1765
1795
|
paymentMethod: rawOrder.payment_method ?? "",
|
|
1766
1796
|
raw: rawOrder
|
|
1767
1797
|
};
|
|
1768
|
-
}, [rawOrder, localeTag]);
|
|
1798
|
+
}, [rawOrder, localeTag, getProcessedImageUrl]);
|
|
1769
1799
|
return {
|
|
1770
1800
|
order,
|
|
1771
1801
|
isLoading,
|
|
@@ -1908,6 +1938,7 @@ exports.useProcessCheckout = useProcessCheckout;
|
|
|
1908
1938
|
exports.useProduct = useProduct;
|
|
1909
1939
|
exports.useProductCategories = useProductCategories;
|
|
1910
1940
|
exports.useProductCategoryTree = useProductCategoryTree;
|
|
1941
|
+
exports.useProductTags = useProductTags;
|
|
1911
1942
|
exports.useProductView = useProductView;
|
|
1912
1943
|
exports.useProducts = useProducts;
|
|
1913
1944
|
exports.useProductsFeed = useProductsFeed;
|
|
@@ -1919,6 +1950,7 @@ exports.useStore = useStore;
|
|
|
1919
1950
|
exports.useStoreFeatures = useStoreFeatures;
|
|
1920
1951
|
exports.useStoreLocale = useStoreLocale;
|
|
1921
1952
|
exports.useStoreTheme = useStoreTheme;
|
|
1953
|
+
exports.useUpdateCartExtensions = useUpdateCartExtensions;
|
|
1922
1954
|
exports.useUpdateCartItem = useUpdateCartItem;
|
|
1923
1955
|
exports.useUpdateCustomer = useUpdateCustomer;
|
|
1924
1956
|
exports.useWooCommerceClient = useWooCommerceClient;
|