@atomic-solutions/woocommerce-react 0.2.4 → 0.2.6

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/index.d.cts CHANGED
@@ -2,10 +2,10 @@ import * as react from 'react';
2
2
  import react__default from 'react';
3
3
  import { WooCommerceClient } from '@atomic-solutions/woocommerce-api-client';
4
4
  export { Address, BillingAddress, Cart, CartHeadersAdapter, CartItem, Checkout, Product, ProductCategory, ProductImage, ProductParams, StoreApiOrder, addressSchema, checkoutSchema } from '@atomic-solutions/woocommerce-api-client';
5
- import { Q as QueryKeys, W as WooCommerceEventHandler, S as StoreLocale, a as StoreValidationResult, R as RateLimitConfig, b as WooCommerceEventType } from './types-8KIvr2ze.cjs';
6
- export { C as CartCouponAppliedEvent, c as CartCouponRemovedEvent, d as CartCustomerUpdatedEvent, e as CartItemAddedEvent, f as CartItemRemovedEvent, g as CartItemUpdatedEvent, h as CartShippingSelectedEvent, i as CheckoutProcessedEvent, D as DEFAULT_STORE_CONFIG, O as OrderFetchedEvent, j as StoreConfig, k as StoreContextValue, l as StoreFeatures, m as StoreGuardrails, n as StoreTheme, o as WooCommerceEvent, p as createQueryKeys } from './types-8KIvr2ze.cjs';
5
+ import { Q as QueryKeys, W as WooCommerceEventHandler, S as StoreLocale, a as StoreValidationResult, R as RateLimitConfig, b as WooCommerceEventType } from './types-_8YqnkO-.cjs';
6
+ export { C as CartCouponAppliedEvent, c as CartCouponRemovedEvent, d as CartCustomerUpdatedEvent, e as CartItemAddedEvent, f as CartItemRemovedEvent, g as CartItemUpdatedEvent, h as CartShippingSelectedEvent, i as CheckoutProcessedEvent, D as DEFAULT_STORE_CONFIG, O as OrderFetchedEvent, j as StoreConfig, k as StoreContextValue, l as StoreFeatures, m as StoreGuardrails, n as StoreTheme, o as WooCommerceEvent, p as createQueryKeys } from './types-_8YqnkO-.cjs';
7
7
  export { WooCommerceStoreContext, WooCommerceStoreProvider, WooCommerceStoreProviderProps } from './provider/index.cjs';
8
- export { A as AppliedCoupon, C as CartTotals, I as ImageSize, P as PLACEHOLDER_IMAGE_URL, a as PaymentMethod, b as ProcessedCartItem, c as ProcessedCategory, d as ProcessedProduct, e as ProcessedProductDetails, f as ProductCartState, g as ProductCategoryTreeNode, S as ShippingRate, U as UseCartViewOptions, h as UseCartViewReturn, i as UseProductViewOptions, j as UseProductViewReturn, k as UseProductsFeedOptions, l as UseProductsFeedReturn, m as getAllImageUrls, n as getImageUrl, o as getImageUrlOrPlaceholder, p as getPrimaryImage, q as getSizedImageUrl, r as preloadImage, s as preloadImages, u as useAddToCart, t as useApplyCoupon, v as useCart, w as useCartView, x as useCheckout, y as useInfiniteProducts, z as useOrder, B as useProcessCheckout, D as useProduct, E as useProductCategories, F as useProductCategoryTree, G as useProductView, H as useProducts, J as useProductsFeed, K as useRemoveCoupon, L as useRemoveFromCart, M as useSelectShippingRate, N as useStore, O as useStoreFeatures, Q as useStoreLocale, R as useStoreTheme, T as useUpdateCartItem, V as useUpdateCustomer, W as useWooCommerceClient, X as useWooCommerceQueryKeys } from './index-Cq857W8p.cjs';
8
+ export { A as AppliedCoupon, C as CartTotals, I as ImageSize, P as PLACEHOLDER_IMAGE_URL, a as PaymentMethod, b as ProcessedCartItem, c as ProcessedCategory, d as ProcessedProduct, e as ProcessedProductDetails, f as ProductCartState, g as ProductCategoryTreeNode, S as ShippingRate, U as UseCartViewOptions, h as UseCartViewReturn, i as UseProductViewOptions, j as UseProductViewReturn, k as UseProductsFeedOptions, l as UseProductsFeedReturn, m as getAllImageUrls, n as getImageUrl, o as getImageUrlOrPlaceholder, p as getPrimaryImage, q as getSizedImageUrl, r as preloadImage, s as preloadImages, u as useAddToCart, t as useApplyCoupon, v as useCart, w as useCartView, x as useCheckout, y as useInfiniteProducts, z as useOrder, B as useProcessCheckout, D as useProduct, E as useProductCategories, F as useProductCategoryTree, G as useProductView, H as useProducts, J as useProductsFeed, K as useRemoveCoupon, L as useRemoveFromCart, M as useSelectShippingRate, N as useStore, O as useStoreFeatures, Q as useStoreLocale, R as useStoreTheme, T as useUpdateCartItem, V as useUpdateCustomer, W as useWooCommerceClient, X as useWooCommerceQueryKeys } from './index-CaNfLsEj.cjs';
9
9
  import 'react/jsx-runtime';
10
10
  import '@tanstack/react-query';
11
11
 
package/dist/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import * as react from 'react';
2
2
  import react__default from 'react';
3
3
  import { WooCommerceClient } from '@atomic-solutions/woocommerce-api-client';
4
4
  export { Address, BillingAddress, Cart, CartHeadersAdapter, CartItem, Checkout, Product, ProductCategory, ProductImage, ProductParams, StoreApiOrder, addressSchema, checkoutSchema } from '@atomic-solutions/woocommerce-api-client';
5
- import { Q as QueryKeys, W as WooCommerceEventHandler, S as StoreLocale, a as StoreValidationResult, R as RateLimitConfig, b as WooCommerceEventType } from './types-8KIvr2ze.js';
6
- export { C as CartCouponAppliedEvent, c as CartCouponRemovedEvent, d as CartCustomerUpdatedEvent, e as CartItemAddedEvent, f as CartItemRemovedEvent, g as CartItemUpdatedEvent, h as CartShippingSelectedEvent, i as CheckoutProcessedEvent, D as DEFAULT_STORE_CONFIG, O as OrderFetchedEvent, j as StoreConfig, k as StoreContextValue, l as StoreFeatures, m as StoreGuardrails, n as StoreTheme, o as WooCommerceEvent, p as createQueryKeys } from './types-8KIvr2ze.js';
5
+ import { Q as QueryKeys, W as WooCommerceEventHandler, S as StoreLocale, a as StoreValidationResult, R as RateLimitConfig, b as WooCommerceEventType } from './types-_8YqnkO-.js';
6
+ export { C as CartCouponAppliedEvent, c as CartCouponRemovedEvent, d as CartCustomerUpdatedEvent, e as CartItemAddedEvent, f as CartItemRemovedEvent, g as CartItemUpdatedEvent, h as CartShippingSelectedEvent, i as CheckoutProcessedEvent, D as DEFAULT_STORE_CONFIG, O as OrderFetchedEvent, j as StoreConfig, k as StoreContextValue, l as StoreFeatures, m as StoreGuardrails, n as StoreTheme, o as WooCommerceEvent, p as createQueryKeys } from './types-_8YqnkO-.js';
7
7
  export { WooCommerceStoreContext, WooCommerceStoreProvider, WooCommerceStoreProviderProps } from './provider/index.js';
8
- export { A as AppliedCoupon, C as CartTotals, I as ImageSize, P as PLACEHOLDER_IMAGE_URL, a as PaymentMethod, b as ProcessedCartItem, c as ProcessedCategory, d as ProcessedProduct, e as ProcessedProductDetails, f as ProductCartState, g as ProductCategoryTreeNode, S as ShippingRate, U as UseCartViewOptions, h as UseCartViewReturn, i as UseProductViewOptions, j as UseProductViewReturn, k as UseProductsFeedOptions, l as UseProductsFeedReturn, m as getAllImageUrls, n as getImageUrl, o as getImageUrlOrPlaceholder, p as getPrimaryImage, q as getSizedImageUrl, r as preloadImage, s as preloadImages, u as useAddToCart, t as useApplyCoupon, v as useCart, w as useCartView, x as useCheckout, y as useInfiniteProducts, z as useOrder, B as useProcessCheckout, D as useProduct, E as useProductCategories, F as useProductCategoryTree, G as useProductView, H as useProducts, J as useProductsFeed, K as useRemoveCoupon, L as useRemoveFromCart, M as useSelectShippingRate, N as useStore, O as useStoreFeatures, Q as useStoreLocale, R as useStoreTheme, T as useUpdateCartItem, V as useUpdateCustomer, W as useWooCommerceClient, X as useWooCommerceQueryKeys } from './index-curVj6LB.js';
8
+ export { A as AppliedCoupon, C as CartTotals, I as ImageSize, P as PLACEHOLDER_IMAGE_URL, a as PaymentMethod, b as ProcessedCartItem, c as ProcessedCategory, d as ProcessedProduct, e as ProcessedProductDetails, f as ProductCartState, g as ProductCategoryTreeNode, S as ShippingRate, U as UseCartViewOptions, h as UseCartViewReturn, i as UseProductViewOptions, j as UseProductViewReturn, k as UseProductsFeedOptions, l as UseProductsFeedReturn, m as getAllImageUrls, n as getImageUrl, o as getImageUrlOrPlaceholder, p as getPrimaryImage, q as getSizedImageUrl, r as preloadImage, s as preloadImages, u as useAddToCart, t as useApplyCoupon, v as useCart, w as useCartView, x as useCheckout, y as useInfiniteProducts, z as useOrder, B as useProcessCheckout, D as useProduct, E as useProductCategories, F as useProductCategoryTree, G as useProductView, H as useProducts, J as useProductsFeed, K as useRemoveCoupon, L as useRemoveFromCart, M as useSelectShippingRate, N as useStore, O as useStoreFeatures, Q as useStoreLocale, R as useStoreTheme, T as useUpdateCartItem, V as useUpdateCustomer, W as useWooCommerceClient, X as useWooCommerceQueryKeys } from './index-BWIYt7TO.js';
9
9
  import 'react/jsx-runtime';
10
10
  import '@tanstack/react-query';
11
11
 
package/dist/index.js CHANGED
@@ -857,10 +857,11 @@ var useProcessCheckout = () => {
857
857
  mutationKey: queryKeys.checkout.mutations.process(),
858
858
  mutationFn: (input) => client.checkout.process(input),
859
859
  onSuccess: (checkout) => {
860
+ const cart = queryClient.getQueryData(queryKeys.cart.details()) ?? null;
860
861
  queryClient.invalidateQueries({ queryKey: queryKeys.cart.all });
861
862
  queryClient.invalidateQueries({ queryKey: queryKeys.checkout.all });
862
863
  if (emitEvent) {
863
- emitEvent(createSuccessEvent("checkout:processed", { checkout }));
864
+ emitEvent(createSuccessEvent("checkout:processed", { checkout, cart }));
864
865
  }
865
866
  },
866
867
  onError: (error) => {
@@ -1697,12 +1698,17 @@ function createAnalyticsHandler(provider) {
1697
1698
  coupon_code: event.data.code
1698
1699
  });
1699
1700
  break;
1700
- case "checkout:processed":
1701
+ case "checkout:processed": {
1702
+ const { checkout, cart } = event.data;
1703
+ const parsedTotal = cart ? parseFloat(cart.totals.total_price) : void 0;
1701
1704
  provider.log("purchase", {
1702
- order_id: event.data.checkout.order_id,
1703
- payment_method: event.data.checkout.payment_method
1705
+ order_id: checkout.order_id,
1706
+ payment_method: checkout.payment_method,
1707
+ order_total: Number.isFinite(parsedTotal) ? parsedTotal : void 0,
1708
+ items_count: cart?.items_count
1704
1709
  });
1705
1710
  break;
1711
+ }
1706
1712
  }
1707
1713
  };
1708
1714
  }