@tapcart/mobile-components 0.7.10-beta.0 → 0.7.10

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.
@@ -14,7 +14,7 @@ type UseReviewsProps = {
14
14
  page: number;
15
15
  };
16
16
  type UseReviewsReturn = {
17
- data: ReviewSummaryData | ReviewMetaData | ReviewSearchData;
17
+ data: ReviewSummaryData | ReviewMetaData | ReviewSearchData | null;
18
18
  error: any;
19
19
  isLoading: boolean;
20
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-reviews.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-reviews.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGtF,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,QAAQ,EAAE,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAC;IACjF,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,iBAAiB,GAAG,cAAc,GAAG,gBAAgB,CAAA;IAC3D,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,UA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gBAAgB,CAwD1E;AAED,KAAK,wBAAwB,GAAG,gBAAgB,GAAG;IACjD,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAC;CACtC,CAAA;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,GAAG,wBAAwB,CA0H1F"}
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useEffect } from "react";
2
+ import { useCallback, useEffect, useRef } from "react";
3
3
  import useSWR from "swr";
4
4
  import useSWRInfinite from "swr/infinite";
5
5
  import { useInView } from 'react-intersection-observer';
@@ -52,13 +52,13 @@ export function useReviews(props) {
52
52
  };
53
53
  }
54
54
  export function useReviewsInfinite(props) {
55
- var _a, _b;
55
+ var _a;
56
56
  let url = null;
57
57
  const { ref, inView } = useInView({ rootMargin: "800px" });
58
58
  let baseURL = "";
59
59
  let queryParams = new URLSearchParams();
60
60
  if (props) {
61
- const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage } = props; // Destructure all relevant props
61
+ const { productId, provider, dataType, searchText, ratings, topics, sortBy, ascending, perPage } = props;
62
62
  baseURL = props.baseURL;
63
63
  if (productId.length > 0) {
64
64
  queryParams.set("id", productId);
@@ -92,12 +92,29 @@ export function useReviewsInfinite(props) {
92
92
  url = `${baseURL}/reviews/by-id?${queryParams.toString()}`;
93
93
  }
94
94
  }
95
+ const isEndReached = useRef(false);
95
96
  const getKey = (pageIndex, previousPageData) => {
96
- const dataType = queryParams.get("dataType") === "null" ? null : queryParams.get("dataType");
97
- if (dataType == null) {
98
- return null;
97
+ var _a, _b;
98
+ if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
99
+ const dataType = queryParams.get("dataType") === "null" ? null : queryParams.get("dataType");
100
+ if (dataType == null) {
101
+ return null;
102
+ }
103
+ if (previousPageData && previousPageData.pagination) {
104
+ const { perPage, total } = previousPageData.pagination;
105
+ isEndReached.current = (((pageIndex + 1) * perPage) >= total);
106
+ }
107
+ return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
108
+ }
109
+ if ((props === null || props === void 0 ? void 0 : props.provider) === "okendo") {
110
+ if (pageIndex === 0)
111
+ return `${baseURL}/reviews/by-id?${queryParams.toString()}`;
112
+ if (!((_a = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagination) === null || _a === void 0 ? void 0 : _a.nextUrl)) {
113
+ isEndReached.current = true;
114
+ return null;
115
+ }
116
+ return `${baseURL}/reviews/by-id?${queryParams.toString()}&nextUrl=${((_b = previousPageData === null || previousPageData === void 0 ? void 0 : previousPageData.pagination) === null || _b === void 0 ? void 0 : _b.nextUrl) || null}`;
99
117
  }
100
- return `${baseURL}/reviews/by-id?${queryParams.toString()}&page=${pageIndex + 1}`;
101
118
  };
102
119
  const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
103
120
  const { data: dataInfinite, error: errorInfinite, size, setSize, isLoading, isValidating, } = useSWRInfinite(getKey, fetcher);
@@ -110,17 +127,22 @@ export function useReviewsInfinite(props) {
110
127
  pagination: (dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite.length) ? dataInfinite[0].pagination : null,
111
128
  reviews: mergedReviews
112
129
  };
113
- const isAllReviewsLoaded = (mergedReviews === null || mergedReviews === void 0 ? void 0 : mergedReviews.length) === ((_b = (_a = dataInfinite === null || dataInfinite === void 0 ? void 0 : dataInfinite[0]) === null || _a === void 0 ? void 0 : _a.pagination) === null || _b === void 0 ? void 0 : _b.total);
130
+ if ((props === null || props === void 0 ? void 0 : props.provider) === "yotpo") {
131
+ isEndReached.current = (mergedReviews === null || mergedReviews === void 0 ? void 0 : mergedReviews.length) === ((_a = searchResponse.pagination) === null || _a === void 0 ? void 0 : _a.total);
132
+ }
114
133
  const loadMore = useCallback(() => {
115
- if (!isLoading && !isValidating && !isAllReviewsLoaded) {
134
+ if (!isLoading && !isValidating && !isEndReached.current) {
116
135
  setSize(size + 1);
117
136
  }
118
- }, [isLoading, isValidating, setSize, size, isAllReviewsLoaded]);
137
+ }, [isLoading, isValidating, setSize, size]);
119
138
  useEffect(() => {
120
139
  if (inView) {
121
140
  loadMore();
122
141
  }
123
142
  }, [inView, loadMore]);
143
+ useEffect(() => {
144
+ isEndReached.current = false;
145
+ }, [props]);
124
146
  return {
125
147
  data: searchResponse || {},
126
148
  error: errorInfinite,
@@ -17,6 +17,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
17
17
  iconStrokeColor?: string;
18
18
  iconClassName?: string;
19
19
  iconPosition?: "left" | "right";
20
+ onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
20
21
  }
21
22
  declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
22
23
  declare const getButtonProps: (buttonConfig: TextStyle & BackgroundAndPadding & {
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAGL,KAAK,EAEL,SAAS,EAET,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAIxB,QAAA,MAAM,cAAc;;;mFAgCnB,CAAA;AAwCD,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,GAAG,SAAS,CAAA;IAC5C,SAAS,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CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;CAC9D;AAED,QAAA,MAAM,MAAM,uFA0GX,CAAA;AAGD,QAAA,MAAM,cAAc,iBACJ,SAAS,GACrB,oBAAoB,GAAG;IACrB,SAAS,EAAE,KAAK,CAAA;IAChB,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,gBAAgB,EAAE,OAAO,CAAA;CAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkBJ,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,CAAA"}
@@ -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
@@ -122,7 +122,7 @@ const CarouselPrevious = React.forwardRef((_a, ref) => {
122
122
  const { orientation, scrollPrev, canScrollPrev } = useCarousel();
123
123
  return (_jsxs(Button, Object.assign({ ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
124
124
  ? "-left-12 top-1/2 -translate-y-1/2"
125
- : "-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" }))] })));
126
126
  });
127
127
  CarouselPrevious.displayName = "CarouselPrevious";
128
128
  const CarouselNext = React.forwardRef((_a, ref) => {
@@ -130,7 +130,7 @@ const CarouselNext = React.forwardRef((_a, ref) => {
130
130
  const { orientation, scrollNext, canScrollNext } = useCarousel();
131
131
  return (_jsxs(Button, Object.assign({ ref: ref, variant: variant, size: size, className: cn("absolute h-8 w-8 rounded-full", orientation === "horizontal"
132
132
  ? "-right-12 top-1/2 -translate-y-1/2"
133
- : "-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" }))] })));
134
134
  });
135
135
  CarouselNext.displayName = "CarouselNext";
136
136
  const CarouselDots = React.forwardRef((_a, ref) => {
@@ -5,33 +5,27 @@ type DrawerTriggerProps = React.ComponentPropsWithoutRef<"button"> & {
5
5
  };
6
6
  type DrawerPortalProps = {
7
7
  children: React.ReactNode;
8
- containerRef?: HTMLElement;
9
8
  };
10
9
  type DrawerCloseProps = React.ComponentPropsWithoutRef<"button"> & {
11
10
  asChild?: boolean;
12
11
  };
13
12
  declare const DrawerTrigger: React.FC<DrawerTriggerProps>;
14
- declare const DrawerPortal: {
15
- ({ children, containerRef }: DrawerPortalProps): import("react/jsx-runtime").JSX.Element;
16
- displayName: string;
17
- };
13
+ declare const DrawerPortal: React.FC<DrawerPortalProps>;
18
14
  declare const DrawerClose: React.FC<DrawerCloseProps>;
19
15
  type DrawerProps = React.ComponentProps<typeof DrawerPrimitive.Root> & {
20
16
  containerRef?: HTMLElement;
21
17
  };
22
18
  declare const Drawer: {
23
- ({ shouldScaleBackground, containerRef, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
19
+ ({ shouldScaleBackground, ...props }: DrawerProps): import("react/jsx-runtime").JSX.Element;
24
20
  displayName: string;
25
21
  };
26
22
  declare const DrawerOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
27
23
  backdropHexColor?: string | undefined;
28
- containerRef?: HTMLElement | undefined;
29
24
  } & React.RefAttributes<HTMLDivElement>>;
30
25
  declare const DrawerContentBase: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
31
26
  hideBackdrop?: boolean | undefined;
32
27
  backdropHexColor?: string | undefined;
33
28
  isSheet?: boolean | undefined;
34
- containerRef?: HTMLElement | undefined;
35
29
  } & React.RefAttributes<HTMLDivElement>>;
36
30
  declare const DrawerFooter: {
37
31
  ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
@@ -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;AAKhD,KAAK,kBAAkB,GAAG,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED,KAAK,iBAAiB,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,MAAM,YAAY,0DAKf,iBAAiB,4CA8BnB,CAAA;AAED,QAAA,MAAM,aAAa,sCAAuC,MAAM,cAAc,CAAC,cAAc,CAAC,4CAE7F,CAAA;AAED,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,YAAY,GACb,CAAA"}
@@ -15,40 +15,29 @@ import * as React from "react";
15
15
  import { Drawer as DrawerPrimitive } from "vaul";
16
16
  import { cn } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
- import ReactDOM from "react-dom";
19
18
  const DrawerTrigger = DrawerPrimitive.Trigger;
20
19
  DrawerTrigger.displayName = "DrawerTrigger";
21
- const DrawerPortal = ({ children, containerRef }) => {
22
- if (containerRef) {
23
- return ReactDOM.createPortal(children, containerRef);
24
- }
25
- return _jsx(DrawerPrimitive.Portal, { children: children });
26
- };
20
+ const DrawerPortal = DrawerPrimitive.Portal;
27
21
  DrawerPortal.displayName = "DrawerPortal";
28
22
  const DrawerClose = DrawerPrimitive.Close;
29
23
  DrawerClose.displayName = "DrawerClose";
30
24
  const Drawer = (_a) => {
31
- var { shouldScaleBackground, containerRef } = _a, props = __rest(_a, ["shouldScaleBackground", "containerRef"]);
32
- return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: true }, props, { noBodyStyles: true, disablePreventScroll: true }, { children: React.Children.map(props.children, (child) => {
33
- if (React.isValidElement(child)) {
34
- return React.cloneElement(child, { containerRef });
35
- }
36
- return child;
37
- }) })));
25
+ var { shouldScaleBackground } = _a, props = __rest(_a, ["shouldScaleBackground"]);
26
+ return (_jsx(DrawerPrimitive.Root, Object.assign({ shouldScaleBackground: true }, props, { noBodyStyles: true, disablePreventScroll: true })));
38
27
  };
39
28
  Drawer.displayName = "Drawer";
40
29
  const DrawerOverlay = React.forwardRef((_a, ref) => {
41
- var { className, backdropHexColor = "#000000", containerRef } = _a, props = __rest(_a, ["className", "backdropHexColor", "containerRef"]);
42
- const style = Object.assign({ backgroundColor: `${backdropHexColor}CC` }, (containerRef && { position: "absolute" }));
43
- return (_jsx(DrawerPrimitive.Overlay, Object.assign({ style: style, ref: ref, className: cn(`fixed inset-0 z-50`, containerRef && "absolute", className) }, props)));
30
+ var { className, backdropHexColor = "#000000" } = _a, props = __rest(_a, ["className", "backdropHexColor"]);
31
+ const style = { backgroundColor: `${backdropHexColor}CC` };
32
+ return (_jsx(DrawerPrimitive.Overlay, Object.assign({ style: style, ref: ref, className: cn(`fixed inset-0 z-50`, className) }, props)));
44
33
  });
45
34
  DrawerOverlay.displayName = "DrawerOverlay";
46
35
  const DrawerContentBase = React.forwardRef((_a, ref) => {
47
- var { className, children, hideBackdrop = false, backdropHexColor, isSheet = false, containerRef } = _a, props = __rest(_a, ["className", "children", "hideBackdrop", "backdropHexColor", "isSheet", "containerRef"]);
48
- const styles = Object.assign(Object.assign({}, (isSheet
36
+ var { className, children, hideBackdrop = false, backdropHexColor, isSheet = false, onAnimationEnd } = _a, props = __rest(_a, ["className", "children", "hideBackdrop", "backdropHexColor", "isSheet", "onAnimationEnd"]);
37
+ const styles = isSheet
49
38
  ? { height: "calc(100vh - 112px)" }
50
- : { maxHeight: "calc(100vh - 112px)" })), (containerRef && { position: "absolute" }));
51
- return (_jsxs(DrawerPortal, Object.assign({ containerRef: containerRef }, { children: [hideBackdrop ? null : (_jsx(DrawerOverlay, { backdropHexColor: backdropHexColor, containerRef: containerRef })), _jsxs(DrawerPrimitive.Content, Object.assign({ ref: ref, style: styles, className: cn("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-2xl bg-coreColors-modalBackground", containerRef && "absolute", className) }, props, { "data-testid": "drawer-content" }, { children: [_jsx("div", { className: "mx-auto mb-2 mt-2 h-[4px] w-[40px] rounded-full bg-coreColors-dividingLines" }), children] }))] })));
39
+ : { maxHeight: "calc(100vh - 112px)" };
40
+ return (_jsxs(DrawerPortal, { children: [hideBackdrop ? null : (_jsx(DrawerOverlay, { backdropHexColor: backdropHexColor })), _jsxs(DrawerPrimitive.Content, Object.assign({ ref: ref, style: styles, className: cn("fixed inset-x-0 bottom-0 z-50 flex h-auto flex-col rounded-t-2xl bg-coreColors-modalBackground", className) }, props, { "data-testid": "drawer-content" }, { children: [_jsx("div", { className: "mx-auto mb-2 mt-2 h-[4px] w-[40px] rounded-full bg-coreColors-dividingLines" }), children] }))] }));
52
41
  });
53
42
  DrawerContentBase.displayName = "DrawerContentBase";
54
43
  const DrawerHeaderBase = (_a) => {
@@ -76,6 +65,6 @@ const DrawerHeader = ({ title, iconLeftName, iconRightName, onCloseClick, }) =>
76
65
  };
77
66
  const DrawerContent = (_a) => {
78
67
  var { children, className } = _a, props = __rest(_a, ["children", "className"]);
79
- return (_jsx("div", Object.assign({ className: cn("h-full overflow-scroll", className) }, props, { children: children })));
68
+ return _jsx("div", Object.assign({ className: cn("h-full overflow-scroll", className) }, props, { children: children }));
80
69
  };
81
70
  export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContentBase, DrawerContent, DrawerFooter, DrawerDescription, DrawerHeader, };
@@ -1 +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;AAuFd,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,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
+ {"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,6 +1,8 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
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";
4
6
  // Shared manager for all instances of the hook
5
7
  const tapManager = (() => {
6
8
  const elements = new Map();
@@ -65,6 +67,7 @@ const tapManager = (() => {
65
67
  const useTap = (tapThreshold = 10) => {
66
68
  const [isPressed, setIsPressed] = useState(false);
67
69
  const elementRef = useRef(null);
70
+ const webbridgeActions = useActions();
68
71
  useEffect(() => {
69
72
  const element = elementRef.current;
70
73
  if (!element)
@@ -83,19 +86,22 @@ const useTap = (tapThreshold = 10) => {
83
86
  }, [tapThreshold]);
84
87
  const onTap = useCallback((handler) => {
85
88
  return (event) => {
89
+ var _a, _b;
86
90
  const data = tapManager.elements.get(elementRef.current);
87
91
  if (!data)
88
92
  return;
89
93
  if (event.type === "touchend" && !data.touchMoved) {
90
94
  handler(event);
95
+ (_a = webbridgeActions.action) === null || _a === void 0 ? void 0 : _a.call(webbridgeActions, "trigger/haptic");
91
96
  }
92
97
  else if (event.type === "click" && !data.touchStarted) {
93
98
  handler(event);
99
+ (_b = webbridgeActions.action) === null || _b === void 0 ? void 0 : _b.call(webbridgeActions, "trigger/haptic");
94
100
  setIsPressed(true);
95
101
  setTimeout(() => setIsPressed(false), 100);
96
102
  }
97
103
  };
98
- }, []);
104
+ }, [webbridgeActions]);
99
105
  return { onTap, isPressed, ref: elementRef };
100
106
  };
101
107
  const Tap = ({ children }) => {
@@ -1 +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,qFAkOV,CAAA;AAID,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,CAAA"}
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"}
@@ -29,45 +29,38 @@ const videoVariants = {
29
29
  },
30
30
  };
31
31
  const Video = React.forwardRef((_a, ref) => {
32
- var _b;
33
32
  var { src, videoAttributes, naturalAspectRatio = "1/1", className } = _a, props = __rest(_a, ["src", "videoAttributes", "naturalAspectRatio", "className"]);
33
+ const autoPlayEnabled = videoAttributes.autoplay && !videoAttributes.videoSound;
34
34
  const internalRef = React.useRef(null);
35
35
  const videoRef = ref || internalRef;
36
- const playAttemptRef = React.useRef(false);
37
36
  const observerRef = React.useRef(null);
38
37
  const lastPositionRef = React.useRef(0);
39
38
  const [isLoaded, setIsLoaded] = React.useState(false);
40
39
  const [isVisible, setIsVisible] = React.useState(false);
41
40
  const [isPlaying, setIsPlaying] = React.useState(false);
42
- const setupVideo = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
41
+ const handlePlay = React.useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
43
42
  const video = videoRef.current;
44
43
  if (!video)
45
44
  return;
46
45
  try {
47
46
  video.currentTime = lastPositionRef.current;
48
- if (!videoAttributes.videoSound) {
49
- video.muted = true;
50
- }
47
+ video.muted = true;
51
48
  yield video.play();
52
- setIsPlaying(true);
53
- playAttemptRef.current = true;
54
- // If sound is enabled and autoplay was successful, unmute
55
- if (videoAttributes.videoSound && videoAttributes.autoplay) {
49
+ if (videoAttributes.videoSound) {
56
50
  video.muted = false;
57
51
  }
58
52
  }
59
53
  catch (error) {
60
54
  console.error("Error playing video:", error);
61
- setIsPlaying(false);
62
55
  }
63
- }), [videoAttributes.autoplay, videoAttributes.videoSound, videoRef]);
56
+ }), [videoRef, videoAttributes.videoSound]);
64
57
  const handlePlayPause = () => __awaiter(void 0, void 0, void 0, function* () {
65
58
  const video = videoRef.current;
66
59
  if (!video)
67
60
  return;
68
61
  if (video.paused) {
69
62
  try {
70
- yield setupVideo();
63
+ yield handlePlay();
71
64
  }
72
65
  catch (error) {
73
66
  console.error("Error playing video:", error);
@@ -75,9 +68,9 @@ const Video = React.forwardRef((_a, ref) => {
75
68
  }
76
69
  else {
77
70
  video.pause();
78
- setIsPlaying(false);
79
71
  }
80
72
  });
73
+ // intersection observer setup
81
74
  React.useEffect(() => {
82
75
  const video = videoRef.current;
83
76
  if (!video)
@@ -88,15 +81,11 @@ const Video = React.forwardRef((_a, ref) => {
88
81
  setIsVisible(entry.isIntersecting);
89
82
  // Handle visibility change
90
83
  if (!entry.isIntersecting && !video.paused) {
91
- lastPositionRef.current = video.currentTime;
92
84
  video.pause();
93
- setIsPlaying(false);
94
85
  }
95
- else if (entry.isIntersecting &&
96
- videoAttributes.autoplay &&
97
- video.paused) {
86
+ else if (entry.isIntersecting && autoPlayEnabled && video.paused) {
98
87
  video.currentTime = lastPositionRef.current;
99
- setupVideo();
88
+ handlePlay();
100
89
  }
101
90
  }, {
102
91
  threshold: 0.1, // 10% of the video needs to be visible
@@ -109,42 +98,28 @@ const Video = React.forwardRef((_a, ref) => {
109
98
  video.addEventListener("play", handlePlay);
110
99
  video.addEventListener("pause", handlePause);
111
100
  return () => {
112
- if (video && !video.paused) {
113
- lastPositionRef.current = video.currentTime;
114
- }
115
101
  if (observerRef.current) {
116
102
  observerRef.current.disconnect();
117
103
  }
118
104
  video.removeEventListener("play", handlePlay);
119
105
  video.removeEventListener("pause", handlePause);
120
- playAttemptRef.current = false;
121
106
  };
122
- }, [setupVideo, videoAttributes.autoplay, videoRef]);
123
- // Handle attribute changes
107
+ }, [handlePlay, autoPlayEnabled, videoRef]);
108
+ // handle visibility change
109
+ // pause video when not visible
110
+ // play video when visible and autoplay is on
124
111
  React.useEffect(() => {
125
112
  const video = videoRef.current;
126
113
  if (!video)
127
114
  return;
128
- if (isVisible && videoAttributes.autoplay) {
129
- setupVideo();
115
+ if (isVisible && autoPlayEnabled) {
116
+ handlePlay();
130
117
  }
131
118
  else if (!isVisible && !video.paused) {
132
- lastPositionRef.current = video.currentTime;
133
119
  video.pause();
134
- setIsPlaying(false);
135
120
  }
136
- return () => {
137
- if (video && !video.paused) {
138
- lastPositionRef.current = video.currentTime;
139
- }
140
- };
141
- }, [
142
- videoAttributes.autoplay,
143
- videoAttributes.videoSound,
144
- isVisible,
145
- videoRef,
146
- setupVideo,
147
- ]);
121
+ }, [autoPlayEnabled, isVisible, videoRef, handlePlay]);
122
+ // update lastPositionRef on video timeupdate event
148
123
  React.useEffect(() => {
149
124
  const video = videoRef.current;
150
125
  if (!video)
@@ -157,14 +132,14 @@ const Video = React.forwardRef((_a, ref) => {
157
132
  video.removeEventListener("timeupdate", handleTimeUpdate);
158
133
  };
159
134
  }, [videoRef]);
160
- // Initial load and metadata setup - only needs to run when src changes
135
+ // metadata setup
161
136
  React.useEffect(() => {
162
137
  const video = videoRef.current;
163
138
  if (!video)
164
139
  return;
165
140
  const handleLoadedMetadata = () => {
166
141
  setIsLoaded(true);
167
- if (videoAttributes.autoplay && isVisible) {
142
+ if (autoPlayEnabled && isVisible) {
168
143
  const currentTime = lastPositionRef.current;
169
144
  video.currentTime = currentTime;
170
145
  video.play().catch((error) => {
@@ -173,15 +148,16 @@ const Video = React.forwardRef((_a, ref) => {
173
148
  }
174
149
  };
175
150
  video.addEventListener("loadedmetadata", handleLoadedMetadata);
176
- video.load();
177
151
  return () => {
178
152
  video.removeEventListener("loadedmetadata", handleLoadedMetadata);
179
153
  };
180
- }, [src]);
154
+ }, []);
181
155
  React.useEffect(() => {
182
- lastPositionRef.current = 0;
183
- setIsLoaded(false);
184
- }, [src]);
156
+ const video = videoRef.current;
157
+ if (!video)
158
+ return;
159
+ video.load();
160
+ }, [videoRef]);
185
161
  const videoStyle = {
186
162
  aspectRatio: videoAttributes.enabled && videoAttributes.aspectRatio !== "auto"
187
163
  ? videoAttributes.aspectRatio.replace(":", "/")
@@ -189,9 +165,7 @@ const Video = React.forwardRef((_a, ref) => {
189
165
  };
190
166
  return (_jsxs("div", Object.assign({ className: "relative w-full" }, { children: [_jsx("video", Object.assign({ ref: videoRef, className: cn(videoVariants.base, videoAttributes.videoFit === "fill"
191
167
  ? videoVariants.fit.cover
192
- : videoVariants.fit.contain, className), style: videoStyle, preload: "metadata", playsInline: true, loop: videoAttributes.enabled, controls: false, src: src }, props)), ((isLoaded && !isPlaying) ||
193
- (videoAttributes.videoSound && ((_b = videoRef.current) === null || _b === void 0 ? void 0 : _b.muted))) &&
194
- videoAttributes.enabled && (_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]" }) })))] })));
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]" }) })))] })));
195
169
  });
196
170
  Video.displayName = "Video";
197
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, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
1
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, 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";
@@ -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,gBAAgB,EAChB,qBAAqB,EACrB,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,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cA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A6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,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, throttleFunction, getDestinationHandler, getProductGidsFromIds, createCollectionImageMap, } from "./lib/utils";
2
+ export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, getIdFromGid, productGidFromId, variantGidFromId, getPaddingStyle, getMarginStyle, 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";
@@ -1,4 +1,5 @@
1
1
  import { ClassValue } from "clsx";
2
+ import { Integrations } from "app-studio-types";
2
3
  export type Color = {
3
4
  type: "custom" | "brand-kit";
4
5
  value: string;
@@ -58,6 +59,17 @@ export declare const getPaddingStyle: (padding: Partial<Spacing> | undefined) =>
58
59
  paddingLeft: string | undefined;
59
60
  paddingRight: string | undefined;
60
61
  };
62
+ export declare const getMarginStyle: (margin: Partial<Spacing> | undefined) => {
63
+ marginTop?: undefined;
64
+ marginBottom?: undefined;
65
+ marginLeft?: undefined;
66
+ marginRight?: undefined;
67
+ } | {
68
+ marginTop: string | undefined;
69
+ marginBottom: string | undefined;
70
+ marginLeft: string | undefined;
71
+ marginRight: string | undefined;
72
+ };
61
73
  export type BackgroundAndPadding = {
62
74
  backgroundColor?: Color;
63
75
  borderSides?: BorderSides;
@@ -178,4 +190,5 @@ export declare const createCollectionImageMap: (collections: {
178
190
  customImage: boolean;
179
191
  image?: string;
180
192
  }[]) => Record<string, string>;
193
+ export declare const isFavoriteIntegrationEnabled: (integrations: Integrations) => boolean;
181
194
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAKvC,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM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wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAOpC,GAAG,EAAE,aAU3B;AACD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,IAAI,GAAG,MAAM,UAG1D;AAED,eAAO,MAAM,gBAAgB,WAAY,MAAM,WAQ9C,CAAA;AAED,eAAO,MAAM,eAAe,YAAa,MAAM;;;;;;;CAW9C,CAAA;AAED,KAAK,kBAAkB,GAAG;IACxB,UAAU,EAAE,CAAC,GAAG,EAAE;QAChB,WAAW,EAAE;YAAE,IAAI,EAAE,UAAU,GAAG,KAAK,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAA;KACvD,KAAK,IAAI,CAAA;IACV,WAAW,EAAE,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACjD,cAAc,EAAE,CAAC,GAAG,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACxD,CAAA;AAmBD,eAAO,MAAM,qBAAqB,SAC1B,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,YAAY,GAAG,MAAM,iBAjBrC,MAAM,WAAW,kBAAkB,yBAE5C,MAAM,WAAW,kBAAkB,yBAO/B,MAAM,WAAW,kBAAkB,yBAEhC,MAAM,WAAW,kBAAkB,yBAS3D,CAAA;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,YAOlD;AAED,eAAO,MAAM,wBAAwB,gBACtB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAAE,2BAQpE,CAAA;AAED,eAAO,MAAM,4BAA4B,yCAIxC,CAAA"}
package/dist/lib/utils.js CHANGED
@@ -70,6 +70,16 @@ export const getPaddingStyle = (padding) => {
70
70
  paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
71
71
  };
72
72
  };
73
+ export const getMarginStyle = (margin) => {
74
+ if (!margin)
75
+ return {};
76
+ return {
77
+ marginTop: (margin === null || margin === void 0 ? void 0 : margin.top) !== undefined ? `${margin.top}px` : undefined,
78
+ marginBottom: (margin === null || margin === void 0 ? void 0 : margin.bottom) !== undefined ? `${margin.bottom}px` : undefined,
79
+ marginLeft: (margin === null || margin === void 0 ? void 0 : margin.left) !== undefined ? `${margin.left}px` : undefined,
80
+ marginRight: (margin === null || margin === void 0 ? void 0 : margin.right) !== undefined ? `${margin.right}px` : undefined,
81
+ };
82
+ };
73
83
  export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
74
84
  const { backgroundColor, borderSides, borderColor, cornerRadius, padding, borderRadius, } = backgroundAndPadding;
75
85
  const radius = cornerRadius || borderRadius;
@@ -221,4 +231,7 @@ export const createCollectionImageMap = (collections) => {
221
231
  return imageMap;
222
232
  }, {});
223
233
  };
234
+ export const isFavoriteIntegrationEnabled = (integrations) => {
235
+ return integrations.some(integration => (integration.name === "tapcart-wishlist" || integration.name === "swym") && integration.enabled);
236
+ };
224
237
  // #endregion =-=-=-= END BLOCK UTILS =-=-=-=
package/dist/styles.css CHANGED
@@ -829,6 +829,9 @@ video {
829
829
  .mb-2 {
830
830
  margin-bottom: 0.5rem;
831
831
  }
832
+ .mb-3 {
833
+ margin-bottom: 0.75rem;
834
+ }
832
835
  .mb-6 {
833
836
  margin-bottom: 1.5rem;
834
837
  }
@@ -862,6 +865,9 @@ video {
862
865
  .mt-auto {
863
866
  margin-top: auto;
864
867
  }
868
+ .box-border {
869
+ box-sizing: border-box;
870
+ }
865
871
  .line-clamp-1 {
866
872
  overflow: hidden;
867
873
  display: -webkit-box;
@@ -892,6 +898,9 @@ video {
892
898
  .grid {
893
899
  display: grid;
894
900
  }
901
+ .contents {
902
+ display: contents;
903
+ }
895
904
  .hidden {
896
905
  display: none;
897
906
  }
@@ -1640,6 +1649,10 @@ video {
1640
1649
  padding-left: 2rem;
1641
1650
  padding-right: 2rem;
1642
1651
  }
1652
+ .py-0 {
1653
+ padding-top: 0px;
1654
+ padding-bottom: 0px;
1655
+ }
1643
1656
  .py-1 {
1644
1657
  padding-top: 0.25rem;
1645
1658
  padding-bottom: 0.25rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.10-beta.0",
3
+ "version": "0.7.10",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",
@@ -65,6 +65,7 @@
65
65
  "@radix-ui/react-toggle": "^1.0.3",
66
66
  "@radix-ui/react-toggle-group": "^1.0.4",
67
67
  "@tabler/icons-react": "^3.2.0",
68
+ "@tapcart/webbridge-react": "^1.13.0",
68
69
  "class-variance-authority": "^0.6.0",
69
70
  "clsx": "^1.2.1",
70
71
  "dayjs": "^1.11.13",
@@ -80,4 +81,4 @@
80
81
  "tailwindcss-animate": "^1.0.6",
81
82
  "vaul": "0.9.1"
82
83
  }
83
- }
84
+ }