@tapcart/mobile-components 0.7.7 → 0.7.9

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.
Files changed (49) hide show
  1. package/dist/components/hooks/use-nosto-recommendation.d.ts +8 -0
  2. package/dist/components/hooks/use-nosto-recommendation.d.ts.map +1 -0
  3. package/dist/components/hooks/use-nosto-recommendation.js +105 -0
  4. package/dist/components/hooks/use-products.d.ts.map +1 -1
  5. package/dist/components/hooks/use-products.js +2 -1
  6. package/dist/components/hooks/use-reviews.d.ts +1 -1
  7. package/dist/components/hooks/use-reviews.d.ts.map +1 -1
  8. package/dist/components/hooks/use-reviews.js +32 -10
  9. package/dist/components/hooks/use-style-utils.d.ts +69 -0
  10. package/dist/components/hooks/use-style-utils.d.ts.map +1 -0
  11. package/dist/components/hooks/use-style-utils.js +77 -0
  12. package/dist/components/ui/ProductCard/utils.d.ts +94 -0
  13. package/dist/components/ui/ProductCard/utils.d.ts.map +1 -0
  14. package/dist/components/ui/ProductCard/utils.js +148 -0
  15. package/dist/components/ui/button.d.ts +1 -0
  16. package/dist/components/ui/button.d.ts.map +1 -1
  17. package/dist/components/ui/button.js +6 -2
  18. package/dist/components/ui/carousel.d.ts.map +1 -1
  19. package/dist/components/ui/carousel.js +3 -2
  20. package/dist/components/ui/drawer.d.ts +3 -5
  21. package/dist/components/ui/drawer.d.ts.map +1 -1
  22. package/dist/components/ui/drawer.js +8 -7
  23. package/dist/components/ui/favorite.js +1 -1
  24. package/dist/components/ui/image.js +2 -2
  25. package/dist/components/ui/tap.d.ts +12 -0
  26. package/dist/components/ui/tap.d.ts.map +1 -0
  27. package/dist/components/{hooks/use-tap.js → ui/tap.js} +37 -3
  28. package/dist/components/ui/video-enhanced.d.ts +18 -0
  29. package/dist/components/ui/video-enhanced.d.ts.map +1 -0
  30. package/dist/components/ui/video-enhanced.js +171 -0
  31. package/dist/index.d.ts +6 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +6 -2
  34. package/dist/lib/block-utils.d.ts +97 -0
  35. package/dist/lib/block-utils.d.ts.map +1 -0
  36. package/dist/lib/block-utils.js +77 -0
  37. package/dist/lib/price.d.ts +29 -0
  38. package/dist/lib/price.d.ts.map +1 -0
  39. package/dist/lib/price.js +66 -0
  40. package/dist/lib/utils.d.ts +2 -0
  41. package/dist/lib/utils.d.ts.map +1 -1
  42. package/dist/lib/utils.js +35 -6
  43. package/dist/styles.css +49 -11
  44. package/dist/tests/utils.test.d.ts +2 -0
  45. package/dist/tests/utils.test.d.ts.map +1 -0
  46. package/dist/tests/utils.test.js +34 -0
  47. package/package.json +10 -4
  48. package/dist/components/hooks/use-tap.d.ts +0 -8
  49. package/dist/components/hooks/use-tap.d.ts.map +0 -1
@@ -16,6 +16,8 @@ import { cva } from "class-variance-authority";
16
16
  import { cn, getColor, getTextStyle, getBackgroundAndPaddingStyle, } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
18
  import { Text } from "./text";
19
+ import { useTap } from "./tap";
20
+ import { useMergeRefs } from "../hooks/use-merge-refs";
19
21
  const buttonVariants = cva("w-full flex rounded items-center justify-center transition-colors disabled:bg-stateColors-disabled disabled:border-stateColors-disabled disabled:pointer-events-none ring-offset-background overflow-elipse whitespace-nowrap truncate active:opacity-70 disabled:opacity-70 cursor-pointer", {
20
22
  variants: {
21
23
  size: {
@@ -79,7 +81,9 @@ const labelVariants = cva("truncate", {
79
81
  },
80
82
  });
81
83
  const Button = React.forwardRef((_a, ref) => {
82
- var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName"]);
84
+ var { className, labelClassName, labelStyle, variant, size, asChild = false, loading, icon, iconColor, iconStrokeColor, iconPosition, iconSize, iconUrl, iconClassName, onClick } = _a, props = __rest(_a, ["className", "labelClassName", "labelStyle", "variant", "size", "asChild", "loading", "icon", "iconColor", "iconStrokeColor", "iconPosition", "iconSize", "iconUrl", "iconClassName", "onClick"]);
85
+ const { onTap, isPressed, ref: tapRef } = useTap();
86
+ const mergedRef = useMergeRefs(ref, tapRef);
83
87
  const Comp = asChild ? Slot : "button";
84
88
  const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
85
89
  const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize || variant === "quickadd" ? "xs" : "sm", className: cn(iconVariants({ variant }), {
@@ -90,7 +94,7 @@ const Button = React.forwardRef((_a, ref) => {
90
94
  return (_jsx(Comp, Object.assign({ className: cn(buttonVariants({ variant, size }), className, {
91
95
  "pointer-events-none": loading,
92
96
  "flex-row-reverse": (icon || iconUrl) && iconPosition === "right",
93
- }), ref: ref }, props, { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
97
+ }), ref: mergedRef, onClick: onTap(onClick) }, props, { children: loading ? (_jsx(LoadingButton, {})) : typeof props.children === "object" &&
94
98
  React.isValidElement(props.children) ? ( // if children are passed as a valid React element
95
99
  props.children // render it
96
100
  ) : // otherwise use props
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../../components/ui/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAA;AAS7B,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAA;AAC1C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAChE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAC/C,KAAK,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;AAC/C,KAAK,cAAc,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAA;AAE9C,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE,eAAe,CAAA;IACtB,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAA;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;CAC/C,CAAA;AA0BD,QAAA,MAAM,QAAQ,6HAuIb,CAAA;AAGD,QAAA,MAAM,eAAe,6GAmBnB,CAAA;AAGF,QAAA,MAAM,YAAY,6GAmBhB,CAAA;AAGF,QAAA,MAAM,gBAAgB,kLA0BpB,CAAA;AAGF,QAAA,MAAM,YAAY,kLA0BhB,CAAA;AAGF,KAAK,iBAAiB,GAAG;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,QAAA,MAAM,YAAY,iIAuDjB,CAAA;AA8DD,OAAO,EACL,KAAK,WAAW,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAA"}
@@ -90,6 +90,7 @@ const Carousel = React.forwardRef((_a, ref) => {
90
90
  .on("reInit", setTweenFactor)
91
91
  .on("reInit", tweenScale)
92
92
  .on("scroll", tweenScale)
93
+ // @ts-ignore
93
94
  .on("slideFocus", tweenScale);
94
95
  }, [api, tweenScale]);
95
96
  return (_jsx(CarouselContext.Provider, Object.assign({ value: {
@@ -121,7 +122,7 @@ const CarouselPrevious = React.forwardRef((_a, ref) => {
121
122
  const { orientation, scrollPrev, canScrollPrev } = useCarousel();
122
123
  return (_jsxs(Button, Object.assign({ ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
123
124
  ? "-left-12 top-1/2 -translate-y-1/2"
124
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev, onClick: scrollPrev }, props, { children: [_jsx(ArrowLeft, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Previous slide" }))] })));
125
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollPrev }, props, { onClick: scrollPrev }, { children: [_jsx(ArrowLeft, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Previous slide" }))] })));
125
126
  });
126
127
  CarouselPrevious.displayName = "CarouselPrevious";
127
128
  const CarouselNext = React.forwardRef((_a, ref) => {
@@ -129,7 +130,7 @@ const CarouselNext = React.forwardRef((_a, ref) => {
129
130
  const { orientation, scrollNext, canScrollNext } = useCarousel();
130
131
  return (_jsxs(Button, Object.assign({ ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
131
132
  ? "-right-12 top-1/2 -translate-y-1/2"
132
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext, onClick: scrollNext }, props, { children: [_jsx(ArrowRight, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Next slide" }))] })));
133
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", className), disabled: !canScrollNext }, props, { onClick: scrollNext }, { children: [_jsx(ArrowRight, { className: "h-4 w-4" }), _jsx("span", Object.assign({ className: "sr-only" }, { children: "Next slide" }))] })));
133
134
  });
134
135
  CarouselNext.displayName = "CarouselNext";
135
136
  const CarouselDots = React.forwardRef((_a, ref) => {
@@ -13,10 +13,10 @@ declare const DrawerTrigger: React.FC<DrawerTriggerProps>;
13
13
  declare const DrawerPortal: React.FC<DrawerPortalProps>;
14
14
  declare const DrawerClose: React.FC<DrawerCloseProps>;
15
15
  type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {
16
- containerRef?: HTMLElement | null;
16
+ containerRef?: HTMLElement;
17
17
  };
18
18
  declare const Drawer: {
19
- ({ shouldScaleBackground, containerRef, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
19
+ ({ shouldScaleBackground, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
20
20
  displayName: string;
21
21
  };
22
22
  declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
@@ -39,8 +39,6 @@ type DrawerHeaderProps = {
39
39
  onCloseClick?: (event: React.MouseEvent) => void;
40
40
  };
41
41
  declare const DrawerHeader: ({ title, iconLeftName, iconRightName, onCloseClick, }: DrawerHeaderProps) => import("react/jsx-runtime").JSX.Element;
42
- declare const DrawerContent: ({ children }: {
43
- children: React.ReactNode;
44
- }) => import("react/jsx-runtime").JSX.Element;
42
+ declare const DrawerContent: ({ children, className, ...props }: React.HTMLAttributes<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
45
43
  export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContentBase, DrawerContent, DrawerFooter, DrawerDescription, DrawerHeader, };
46
44
  //# sourceMappingURL=drawer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../../components/ui/drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAA;AAIhD,KAAK,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,gBAAgB,GA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Y,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,CAAA"}
@@ -22,8 +22,8 @@ DrawerPortal.displayName = "DrawerPortal";
22
22
  const DrawerClose = DrawerPrimitive.Close;
23
23
  DrawerClose.displayName = "DrawerClose";
24
24
  const Drawer = (_a) => {
25
- var { shouldScaleBackground, containerRef } = _a, props = __rest(_a, ["shouldScaleBackground", "containerRef"]);
26
- return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: shouldScaleBackground, container: containerRef }, props, { noBodyStyles: true, disablePreventScroll: true })));
25
+ var { shouldScaleBackground } = _a, props = __rest(_a, ["shouldScaleBackground"]);
26
+ return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: true }, props, { noBodyStyles: true, disablePreventScroll: true })));
27
27
  };
28
28
  Drawer.displayName = "Drawer";
29
29
  const DrawerOverlay = React.forwardRef((_a, ref) => {
@@ -33,7 +33,7 @@ const DrawerOverlay = React.forwardRef((_a, ref) => {
33
33
  });
34
34
  DrawerOverlay.displayName = "DrawerOverlay";
35
35
  const DrawerContentBase = React.forwardRef((_a, ref) => {
36
- var { className, children, hideBackdrop = false, backdropHexColor, isSheet = false } = _a, props = __rest(_a, ["className", "children", "hideBackdrop", "backdropHexColor", "isSheet"]);
36
+ var { className, children, hideBackdrop = false, backdropHexColor, isSheet = false, onAnimationEnd } = _a, props = __rest(_a, ["className", "children", "hideBackdrop", "backdropHexColor", "isSheet", "onAnimationEnd"]);
37
37
  const styles = isSheet
38
38
  ? { height: "calc(100vh - 112px)" }
39
39
  : { maxHeight: "calc(100vh - 112px)" };
@@ -47,9 +47,9 @@ const DrawerHeaderBase = (_a) => {
47
47
  DrawerHeaderBase.displayName = "DrawerHeaderBase";
48
48
  const DrawerTitle = React.forwardRef((_a, ref) => {
49
49
  var { className } = _a, props = __rest(_a, ["className"]);
50
- return (_jsx("h2", Object.assign({ ref: ref, className: cn("text-textColors-primaryColor text-center text-[18px] font-medium leading-[24px] truncate my-0 mx-4", className) }, props)));
50
+ return (_jsx(DrawerPrimitive.Title, Object.assign({ ref: ref, className: cn("text-textColors-primaryColor text-center text-[18px] font-medium leading-[24px] truncate my-0 mx-4", className) }, props)));
51
51
  });
52
- DrawerTitle.displayName = "DrawerTitle";
52
+ DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
53
53
  const DrawerFooter = (_a) => {
54
54
  var { className } = _a, props = __rest(_a, ["className"]);
55
55
  return (_jsx("div", Object.assign({ className: cn("mt-auto flex flex-row gap-2 pb-8 pt-4 pl-4 pr-4 border-t border-coreColors-dividingLines", className) }, props)));
@@ -63,7 +63,8 @@ DrawerDescription.displayName = "DrawerDescription";
63
63
  const DrawerHeader = ({ title, iconLeftName, iconRightName, onCloseClick, }) => {
64
64
  return (_jsxs(DrawerHeaderBase, Object.assign({ className: "p-4 text-center flex justify-between" }, { children: [iconLeftName ? (_jsx(DrawerClose, Object.assign({ className: "h-6 w-6 p-0", onClick: onCloseClick }, { children: _jsx(Icon, { name: iconLeftName, color: "coreColors-secondaryIcon", className: "h-6 w-6 p-0", size: "md" }) }))) : (_jsx("div", { className: "w-6" })), _jsx(DrawerTitle, { children: title }), iconRightName ? (_jsx(DrawerClose, Object.assign({ className: "h-6 w-6 p-0", onClick: onCloseClick }, { children: _jsx(Icon, { name: iconRightName, color: "coreColors-secondaryIcon", className: "h-6 w-6 p-0", size: "md" }) }))) : (_jsx("div", { className: "w-6" }))] })));
65
65
  };
66
- const DrawerContent = ({ children }) => {
67
- return _jsx("div", Object.assign({ className: "h-full overflow-scroll" }, { children: children }));
66
+ const DrawerContent = (_a) => {
67
+ var { children, className } = _a, props = __rest(_a, ["children", "className"]);
68
+ return _jsx("div", Object.assign({ className: cn("h-full overflow-scroll", className) }, props, { children: children }));
68
69
  };
69
70
  export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContentBase, DrawerContent, DrawerFooter, DrawerDescription, DrawerHeader, };
@@ -14,7 +14,7 @@ import * as React from "react";
14
14
  import { cva } from "class-variance-authority";
15
15
  import { cn, getBorderSidesStyle, getPaddingStyle, } from "../../lib/utils";
16
16
  import { Icon } from "./icon";
17
- import { useTap } from "../hooks/use-tap";
17
+ import { useTap } from "./tap";
18
18
  import { useMergeRefs } from "../hooks/use-merge-refs";
19
19
  const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px]", {
20
20
  variants: {
@@ -168,7 +168,7 @@ export const Image = React.forwardRef((_a, ref) => {
168
168
  }
169
169
  }, [ref]);
170
170
  const imgClassName = `opacity-0 transition-opacity duration-500 ease-in-out ${isLoaded ? "opacity-100" : ""}`;
171
- const wrapperStyle = Object.assign({ aspectRatio: (_b = normalizedProps.aspectRatio) === null || _b === void 0 ? void 0 : _b.replace(":", "/") }, imageWrapperStyles);
171
+ const wrapperStyle = Object.assign({ aspectRatio: (_b = normalizedProps === null || normalizedProps === void 0 ? void 0 : normalizedProps.aspectRatio) === null || _b === void 0 ? void 0 : _b.replace(":", "/") }, imageWrapperStyles);
172
172
  const srcSet = generateSrcSet(normalizedProps.src, generateSizes(imageWidths, normalizedProps.aspectRatio, crop), loader, normalizedProps.objectFit === "contain");
173
173
  return (_jsxs(_Fragment, { children: [loading === "eager" && (_jsx(ImagePreload, { imgAttributes: {
174
174
  srcSet,
@@ -183,7 +183,7 @@ export const Image = React.forwardRef((_a, ref) => {
183
183
  // and `sizes` are defined.
184
184
  // This bug cannot be reproduced in Chrome or Firefox.
185
185
  src: normalizedProps.src, ref: setRefs, style: Object.assign({ objectFit: normalizedProps.objectFit, maxHeight: "100%", height: "100%", width: "100%", borderRadius: `${imageRadius}px` }, passthroughProps.style) }))) : (_jsx("div", { className: "w-full h-full bg-stateColors-skeleton", style: Object.assign({ aspectRatio: aspectRatio && aspectRatio !== "auto"
186
- ? (_c = normalizedProps.aspectRatio) === null || _c === void 0 ? void 0 : _c.replace(":", "/")
186
+ ? (_c = normalizedProps === null || normalizedProps === void 0 ? void 0 : normalizedProps.aspectRatio) === null || _c === void 0 ? void 0 : _c.replace(":", "/")
187
187
  : "2/3" }, imageWrapperStyles) })) }))] }));
188
188
  });
189
189
  /**
@@ -0,0 +1,12 @@
1
+ import React, { ReactNode } from "react";
2
+ declare const useTap: (tapThreshold?: number) => {
3
+ onTap: (handler: (event: any) => void) => (event: any) => void;
4
+ isPressed: boolean;
5
+ ref: React.MutableRefObject<null>;
6
+ };
7
+ interface TapProps {
8
+ children: ReactNode;
9
+ }
10
+ declare const Tap: React.FC<TapProps>;
11
+ export { Tap, useTap };
12
+ //# sourceMappingURL=tap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tap.d.ts","sourceRoot":"","sources":["../../../components/ui/tap.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAMZ,SAAS,EACV,MAAM,OAAO,CAAA;AAyFd,QAAA,MAAM,MAAM;6BAyBU,GAAG,KAAK,IAAI,aACb,GAAG;;;CAmBvB,CAAA;AAED,UAAU,QAAQ;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,QAAA,MAAM,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAuC3B,CAAA;AAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAA"}
@@ -1,5 +1,8 @@
1
1
  "use client";
2
- import { useState, useEffect, useCallback, useRef } from "react";
2
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { useState, useEffect, useCallback, useRef, } from "react";
4
+ // @ts-ignore -- webbridge-react is not typed (yet)
5
+ import { useActions } from "@tapcart/webbridge-react";
3
6
  // Shared manager for all instances of the hook
4
7
  const tapManager = (() => {
5
8
  const elements = new Map();
@@ -64,6 +67,7 @@ const tapManager = (() => {
64
67
  const useTap = (tapThreshold = 10) => {
65
68
  const [isPressed, setIsPressed] = useState(false);
66
69
  const elementRef = useRef(null);
70
+ const webbridgeActions = useActions();
67
71
  useEffect(() => {
68
72
  const element = elementRef.current;
69
73
  if (!element)
@@ -82,19 +86,49 @@ const useTap = (tapThreshold = 10) => {
82
86
  }, [tapThreshold]);
83
87
  const onTap = useCallback((handler) => {
84
88
  return (event) => {
89
+ var _a, _b;
85
90
  const data = tapManager.elements.get(elementRef.current);
86
91
  if (!data)
87
92
  return;
88
93
  if (event.type === "touchend" && !data.touchMoved) {
89
94
  handler(event);
95
+ (_a = webbridgeActions.action) === null || _a === void 0 ? void 0 : _a.call(webbridgeActions, "trigger/haptic");
90
96
  }
91
97
  else if (event.type === "click" && !data.touchStarted) {
92
98
  handler(event);
99
+ (_b = webbridgeActions.action) === null || _b === void 0 ? void 0 : _b.call(webbridgeActions, "trigger/haptic");
93
100
  setIsPressed(true);
94
101
  setTimeout(() => setIsPressed(false), 100);
95
102
  }
96
103
  };
97
- }, []);
104
+ }, [webbridgeActions]);
98
105
  return { onTap, isPressed, ref: elementRef };
99
106
  };
100
- export { useTap };
107
+ const Tap = ({ children }) => {
108
+ const { onTap, isPressed, ref } = useTap();
109
+ const child = React.Children.only(children);
110
+ const cloneElement = (element, props) => {
111
+ return React.cloneElement(element, Object.assign(Object.assign({}, props), { onClick: undefined, onTouchEnd: (event) => {
112
+ onTap(() => {
113
+ if (element.props.onTouchEnd) {
114
+ element.props.onTouchEnd(event);
115
+ return;
116
+ }
117
+ if (element.props.onClick) {
118
+ element.props.onClick(event);
119
+ return;
120
+ }
121
+ })(event);
122
+ }, style: Object.assign(Object.assign({}, element.props.style), { cursor: "pointer", opacity: isPressed ? 0.7 : 1 }) }));
123
+ };
124
+ const cloneChildren = (children) => {
125
+ return React.Children.map(children, (child) => {
126
+ if (React.isValidElement(child)) {
127
+ return cloneElement(child, { ref });
128
+ }
129
+ return child;
130
+ });
131
+ };
132
+ return _jsx(_Fragment, { children: cloneChildren(child) });
133
+ };
134
+ export { Tap, useTap };
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ type VideoAttributes = {
3
+ enabled: boolean;
4
+ aspectRatio: string;
5
+ videoFit: "fill" | "fit";
6
+ overlayOpacity: number;
7
+ autoplay: boolean;
8
+ videoSound: boolean;
9
+ };
10
+ interface VideoProps extends React.VideoHTMLAttributes<HTMLVideoElement> {
11
+ src: string;
12
+ videoAttributes: VideoAttributes;
13
+ naturalAspectRatio?: string;
14
+ className?: string;
15
+ }
16
+ declare const Video: React.ForwardRefExoticComponent<VideoProps & React.RefAttributes<HTMLVideoElement>>;
17
+ export { Video as VideoEnhanced };
18
+ //# sourceMappingURL=video-enhanced.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-enhanced.d.ts","sourceRoot":"","sources":["../../../components/ui/video-enhanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,UAAU,UAAW,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,eAAe,CAAA;IAChC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,qFAsMV,CAAA;AAID,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,CAAA"}
@@ -0,0 +1,171 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __rest = (this && this.__rest) || function (s, e) {
11
+ var t = {};
12
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
+ t[p] = s[p];
14
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
+ t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import * as React from "react";
23
+ import { cn } from "../../lib/utils";
24
+ const videoVariants = {
25
+ base: "w-full",
26
+ fit: {
27
+ cover: "object-cover",
28
+ contain: "object-contain",
29
+ },
30
+ };
31
+ const Video = React.forwardRef((_a, ref) => {
32
+ var { src, videoAttributes, naturalAspectRatio = "1/1", className } = _a, props = __rest(_a, ["src", "videoAttributes", "naturalAspectRatio", "className"]);
33
+ const autoPlayEnabled = videoAttributes.autoplay && !videoAttributes.videoSound;
34
+ const internalRef = React.useRef(null);
35
+ const videoRef = ref || internalRef;
36
+ const observerRef = React.useRef(null);
37
+ const lastPositionRef = React.useRef(0);
38
+ const [isLoaded, setIsLoaded] = React.useState(false);
39
+ const [isVisible, setIsVisible] = React.useState(false);
40
+ const [isPlaying, setIsPlaying] = React.useState(false);
41
+ const handlePlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
42
+ const video = videoRef.current;
43
+ if (!video)
44
+ return;
45
+ try {
46
+ video.currentTime = lastPositionRef.current;
47
+ video.muted = true;
48
+ yield video.play();
49
+ if (videoAttributes.videoSound) {
50
+ video.muted = false;
51
+ }
52
+ }
53
+ catch (error) {
54
+ console.error("Error playing video:", error);
55
+ }
56
+ }), [videoRef, videoAttributes.videoSound]);
57
+ const handlePlayPause = () => __awaiter(void 0, void 0, void 0, function* () {
58
+ const video = videoRef.current;
59
+ if (!video)
60
+ return;
61
+ if (video.paused) {
62
+ try {
63
+ yield handlePlay();
64
+ }
65
+ catch (error) {
66
+ console.error("Error playing video:", error);
67
+ }
68
+ }
69
+ else {
70
+ video.pause();
71
+ }
72
+ });
73
+ // intersection observer setup
74
+ React.useEffect(() => {
75
+ const video = videoRef.current;
76
+ if (!video)
77
+ return;
78
+ // Create intersection observer
79
+ observerRef.current = new IntersectionObserver((entries) => {
80
+ const [entry] = entries;
81
+ setIsVisible(entry.isIntersecting);
82
+ // Handle visibility change
83
+ if (!entry.isIntersecting && !video.paused) {
84
+ video.pause();
85
+ }
86
+ else if (entry.isIntersecting && autoPlayEnabled && video.paused) {
87
+ video.currentTime = lastPositionRef.current;
88
+ handlePlay();
89
+ }
90
+ }, {
91
+ threshold: 0.1, // 10% of the video needs to be visible
92
+ });
93
+ // Start observing
94
+ observerRef.current.observe(video);
95
+ // Track play state
96
+ const handlePlay = () => setIsPlaying(true);
97
+ const handlePause = () => setIsPlaying(false);
98
+ video.addEventListener("play", handlePlay);
99
+ video.addEventListener("pause", handlePause);
100
+ return () => {
101
+ if (observerRef.current) {
102
+ observerRef.current.disconnect();
103
+ }
104
+ video.removeEventListener("play", handlePlay);
105
+ video.removeEventListener("pause", handlePause);
106
+ };
107
+ }, [handlePlay, autoPlayEnabled, videoRef]);
108
+ // handle visibility change
109
+ // pause video when not visible
110
+ // play video when visible and autoplay is on
111
+ React.useEffect(() => {
112
+ const video = videoRef.current;
113
+ if (!video)
114
+ return;
115
+ if (isVisible && autoPlayEnabled) {
116
+ handlePlay();
117
+ }
118
+ else if (!isVisible && !video.paused) {
119
+ video.pause();
120
+ }
121
+ }, [autoPlayEnabled, isVisible, videoRef, handlePlay]);
122
+ // update lastPositionRef on video timeupdate event
123
+ React.useEffect(() => {
124
+ const video = videoRef.current;
125
+ if (!video)
126
+ return;
127
+ const handleTimeUpdate = () => {
128
+ lastPositionRef.current = video.currentTime;
129
+ };
130
+ video.addEventListener("timeupdate", handleTimeUpdate);
131
+ return () => {
132
+ video.removeEventListener("timeupdate", handleTimeUpdate);
133
+ };
134
+ }, [videoRef]);
135
+ // metadata setup
136
+ React.useEffect(() => {
137
+ const video = videoRef.current;
138
+ if (!video)
139
+ return;
140
+ const handleLoadedMetadata = () => {
141
+ setIsLoaded(true);
142
+ if (autoPlayEnabled && isVisible) {
143
+ const currentTime = lastPositionRef.current;
144
+ video.currentTime = currentTime;
145
+ video.play().catch((error) => {
146
+ console.error("Error playing video:", error);
147
+ });
148
+ }
149
+ };
150
+ video.addEventListener("loadedmetadata", handleLoadedMetadata);
151
+ return () => {
152
+ video.removeEventListener("loadedmetadata", handleLoadedMetadata);
153
+ };
154
+ }, []);
155
+ React.useEffect(() => {
156
+ const video = videoRef.current;
157
+ if (!video)
158
+ return;
159
+ video.load();
160
+ }, [videoRef]);
161
+ const videoStyle = {
162
+ aspectRatio: videoAttributes.enabled && videoAttributes.aspectRatio !== "auto"
163
+ ? videoAttributes.aspectRatio.replace(":", "/")
164
+ : naturalAspectRatio.replace(":", "/"),
165
+ };
166
+ return (_jsxs("div", Object.assign({ className: "relative w-full" }, { children: [_jsx("video", Object.assign({ ref: videoRef, className: cn(videoVariants.base, videoAttributes.videoFit === "fill"
167
+ ? videoVariants.fit.cover
168
+ : videoVariants.fit.contain, className), style: videoStyle, preload: "metadata", playsInline: true, loop: videoAttributes.enabled, controls: false, src: src }, props)), isLoaded && !isPlaying && (_jsx("button", Object.assign({ onClick: handlePlayPause, className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-50\n w-16 h-16 rounded-full bg-black/75 hover:bg-black/90 \n flex items-center justify-center transition-all duration-300\n hover:scale-110 focus:outline-none focus:ring-2 focus:ring-white", "aria-label": "Play video" }, { children: _jsx("div", { className: "w-0 h-0 border-y-8 border-y-transparent \n border-l-[16px] border-l-white \n translate-x-[2px]" }) })))] })));
169
+ });
170
+ Video.displayName = "Video";
171
+ export { Video as VideoEnhanced };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, createCollectionImageMap, } from "./lib/utils";
1
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
2
2
  export * from "./components/hooks/use-collection";
3
3
  export * from "./components/hooks/use-infinite-scroll";
4
4
  export * from "./components/hooks/use-recommendations";
@@ -7,7 +7,6 @@ export * from "./components/hooks/use-scroll-direction";
7
7
  export * from "./components/hooks/use-sort-filter";
8
8
  export * from "./components/hooks/use-product-options";
9
9
  export * from "./components/hooks/use-shop";
10
- export * from "./components/hooks/use-tap";
11
10
  export * from "./components/ui/accordion";
12
11
  export * from "./components/ui/aspect-ratio";
13
12
  export * from "./components/ui/badge";
@@ -48,11 +47,16 @@ export * from "./components/ui/toggle-group";
48
47
  export * from "./components/ui/toggle";
49
48
  export * from "./components/ui/use-toast";
50
49
  export * from "./components/ui/video";
50
+ export * from "./components/ui/video-enhanced";
51
51
  export * from "./components/ui/wishlist";
52
52
  export * from "./components/ui/wishlist-select";
53
53
  export * from "./components/hooks/use-shop";
54
54
  export * from "./components/libs/sort-filter/search-integration";
55
55
  export * from "./components/hooks/use-reviews";
56
56
  export * from "./components/ui/subcollection-tabs";
57
+ export * from "./components/ui/ProductCard/utils";
58
+ export * from "./lib/price";
59
+ export * from "./components/hooks/use-nosto-recommendation";
57
60
  export * from "./components/libs/sort-filter/search-integration";
61
+ export * from "./components/ui/tap";
58
62
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,oCAAoC,CAAA;AAClD,cAAc,wCAAwC,CAAA;AACtD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AA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,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // component exports
2
- export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, getDestinationHandler, createCollectionImageMap, } from "./lib/utils";
2
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getVerticalAlignment, mapFlexToAlignment, formatRelativeTime, stringRatioToInt, getOverlayStyle, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
3
3
  export * from "./components/hooks/use-collection";
4
4
  export * from "./components/hooks/use-infinite-scroll";
5
5
  export * from "./components/hooks/use-recommendations";
@@ -8,7 +8,6 @@ export * from "./components/hooks/use-scroll-direction";
8
8
  export * from "./components/hooks/use-sort-filter";
9
9
  export * from "./components/hooks/use-product-options";
10
10
  export * from "./components/hooks/use-shop";
11
- export * from "./components/hooks/use-tap";
12
11
  export * from "./components/ui/accordion";
13
12
  export * from "./components/ui/aspect-ratio";
14
13
  export * from "./components/ui/badge";
@@ -49,10 +48,15 @@ export * from "./components/ui/toggle-group";
49
48
  export * from "./components/ui/toggle";
50
49
  export * from "./components/ui/use-toast";
51
50
  export * from "./components/ui/video";
51
+ export * from "./components/ui/video-enhanced";
52
52
  export * from "./components/ui/wishlist";
53
53
  export * from "./components/ui/wishlist-select";
54
54
  export * from "./components/hooks/use-shop";
55
55
  export * from "./components/libs/sort-filter/search-integration";
56
56
  export * from "./components/hooks/use-reviews";
57
57
  export * from "./components/ui/subcollection-tabs";
58
+ export * from "./components/ui/ProductCard/utils";
59
+ export * from "./lib/price";
60
+ export * from "./components/hooks/use-nosto-recommendation";
58
61
  export * from "./components/libs/sort-filter/search-integration";
62
+ export * from "./components/ui/tap";
@@ -0,0 +1,97 @@
1
+ type BorderSide = "all" | "top" | "bottom" | "left" | "right";
2
+ type BorderSides = BorderSide[];
3
+ declare const getBorderSidesStyle: (borderSides: BorderSides) => {
4
+ borderWidth: string;
5
+ borderTopWidth?: undefined;
6
+ borderBottomWidth?: undefined;
7
+ borderLeftWidth?: undefined;
8
+ borderRightWidth?: undefined;
9
+ } | {
10
+ borderTopWidth: string | number;
11
+ borderBottomWidth: string | number;
12
+ borderLeftWidth: string | number;
13
+ borderRightWidth: string | number;
14
+ borderWidth?: undefined;
15
+ };
16
+ type VerticalAlignment = "top" | "middle" | "bottom";
17
+ type Spacing = {
18
+ top: number;
19
+ bottom: number;
20
+ left: number;
21
+ right: number;
22
+ };
23
+ interface AlignmentAndSpacing {
24
+ alignment: VerticalAlignment;
25
+ spacing: Spacing;
26
+ }
27
+ declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentAndSpacing) => {
28
+ bottom: string;
29
+ top: string;
30
+ transform?: undefined;
31
+ } | {
32
+ top: string;
33
+ transform: string;
34
+ bottom?: undefined;
35
+ } | {
36
+ bottom?: undefined;
37
+ top?: undefined;
38
+ transform?: undefined;
39
+ };
40
+ type BackgroundAndPadding = {
41
+ backgroundColor?: ColorOption;
42
+ borderSides?: BorderSides;
43
+ borderColor?: ColorOption;
44
+ cornerRadius?: number;
45
+ padding?: Partial<Spacing>;
46
+ };
47
+ type ColorOption = {
48
+ type: "brand-kit" | "custom";
49
+ value: string;
50
+ } | undefined;
51
+ declare const getColor: (colorOption: ColorOption) => string | undefined;
52
+ declare function getBackgroundAndPaddingStyle(backgroundAndPadding: BackgroundAndPadding): {
53
+ backgroundColor: string | undefined;
54
+ borderColor: string | undefined;
55
+ borderTopWidth: string | undefined;
56
+ borderBottomWidth: string | undefined;
57
+ borderLeftWidth: string | undefined;
58
+ borderRightWidth: string | undefined;
59
+ paddingTop: string | undefined;
60
+ paddingBottom: string | undefined;
61
+ paddingLeft: string | undefined;
62
+ paddingRight: string | undefined;
63
+ borderStyle: string | undefined;
64
+ borderRadius: string | undefined;
65
+ };
66
+ type BackgroundAndSpacing = AlignmentAndSpacing & {
67
+ backgroundColor?: ColorOption;
68
+ borderColor?: ColorOption;
69
+ backgroundCorners?: number;
70
+ };
71
+ declare function getBackgroundAndSpacingStyle(backgroundAndSpacing: BackgroundAndSpacing): {
72
+ padding: string;
73
+ borderColor: string;
74
+ backgroundColor: string;
75
+ borderRadius: string;
76
+ };
77
+ type TextStyle = {
78
+ font: {
79
+ family: string;
80
+ weight: number | string;
81
+ };
82
+ size: number | string;
83
+ color: ColorOption;
84
+ uppercase: boolean;
85
+ textAlignment: "left" | "center" | "right" | "justify";
86
+ };
87
+ type Headline = TextStyle;
88
+ type Subtext = TextStyle;
89
+ declare function getTextStyle(textStyle: Headline | Subtext): {
90
+ fontFamily: string;
91
+ fontWeight: string | number;
92
+ fontSize: string | number;
93
+ color: string | undefined;
94
+ textTransform: string;
95
+ textAlign: "center" | "left" | "right" | "justify";
96
+ };
97
+ //# sourceMappingURL=block-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-utils.d.ts","sourceRoot":"","sources":["../../lib/block-utils.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,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