@wistia/ui 3.0.0-beta.5c261d13.6582851 → 3.0.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/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v3.0.0-beta.5c261d13.6582851
3
+ * @license @wistia/ui v3.0.0
4
4
  *
5
5
  * Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -5854,24 +5854,19 @@ const Link = ({ beforeAction, children, type, disabled = false, colorScheme = "i
5854
5854
  const to = generateHref(props.href, type, disabled);
5855
5855
  const shouldUseReactRouterLink = inRouterContext && type !== "external" && !to?.startsWith("http");
5856
5856
  const hasIcons = isNotNil(leftIcon) || isNotNil(rightIcon);
5857
- const runBeforeAction = async (action) => {
5858
- try {
5859
- await action();
5860
- } catch (error) {
5861
- console.error(error);
5862
- }
5863
- if (!shouldUseReactRouterLink && isNotNil(to)) window.location.assign(to);
5864
- };
5865
- const handleClick = (event) => {
5866
- if (disabled) {
5867
- event.preventDefault();
5868
- return;
5869
- }
5870
- if (beforeAction) {
5857
+ const handleClick = async (event) => {
5858
+ if (disabled) event.preventDefault();
5859
+ else if (beforeAction) {
5871
5860
  if (!shouldUseReactRouterLink) event.preventDefault();
5872
- runBeforeAction(beforeAction);
5873
- }
5874
- if (isFunction(props.onClick)) props.onClick(event);
5861
+ try {
5862
+ await beforeAction();
5863
+ } catch (error) {
5864
+ console.error(error);
5865
+ } finally {
5866
+ if (isFunction(props.onClick)) props.onClick(event);
5867
+ if (!shouldUseReactRouterLink && isNotNil(to)) window.location.assign(to);
5868
+ }
5869
+ } else if (isFunction(props.onClick)) props.onClick(event);
5875
5870
  };
5876
5871
  const commonProps = {
5877
5872
  $colorScheme: colorScheme,