@tapcart/mobile-components 0.8.56 → 0.8.58
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/components/ui/animate-container.d.ts.map +1 -1
- package/dist/components/ui/animate-container.js +3 -0
- package/dist/components/ui/favorite.js +1 -1
- package/dist/components/ui/icon.d.ts.map +1 -1
- package/dist/components/ui/icon.js +6 -2
- package/dist/components/ui/input-otp.d.ts +35 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input-otp.js +40 -0
- package/dist/components/ui/product-card.d.ts +8 -0
- package/dist/components/ui/product-card.d.ts.map +1 -1
- package/dist/components/ui/product-card.js +33 -6
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/star-rating.d.ts.map +1 -1
- package/dist/components/ui/star-rating.js +28 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/variablesCart.util.d.ts +3 -6
- package/dist/lib/variablesCart.util.d.ts.map +1 -1
- package/dist/lib/variablesCart.util.js +59 -50
- package/dist/styles.css +59 -3
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAW7D,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,QAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"animate-container.d.ts","sourceRoot":"","sources":["../../../components/ui/animate-container.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAG1D,KAAK,aAAa,GAAG,OAAO,GAAG,MAAM,CAAA;AAErC,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE,eAAe,CAW7D,CAAA;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,UAAU,EAAE,eAAe,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,UAAU,EACV,QAAc,EACd,SAAS,EACT,SAAS,EACT,OAAO,GACR,EAAE,qBAAqB,2CAmCvB"}
|
|
@@ -25,6 +25,9 @@ export function AnimateContainer({ children, animations, duration = 300, classNa
|
|
|
25
25
|
return;
|
|
26
26
|
}, [isLoading, animations]);
|
|
27
27
|
const getAnimationClasses = () => {
|
|
28
|
+
if (!animations || !Array.isArray(animations)) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
28
31
|
return animations
|
|
29
32
|
.map((animation) => (hasData ? animation.enter : animation.exit))
|
|
30
33
|
.join(" ");
|
|
@@ -41,7 +41,7 @@ const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px]", {
|
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
43
|
const Favorite = (_a) => {
|
|
44
|
-
var { className, size = "small", selected = false, onClick, iconUrl = "https://
|
|
44
|
+
var { className, size = "small", selected = false, onClick, iconUrl = "https://assets.tapcart.com/default-icon-options/heart-1.svg", showBackground = false, showBackgroundShadow = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18", disabledFillColor = "#727272", backgroundColor = "#FFFFFF", borderSides = ["all"], borderColorStyle = undefined, borderPadding = {}, disableHaptic = false } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "showBackgroundShadow", "cornerRadius", "layoutType", "favoriteFillColor", "disabledFillColor", "backgroundColor", "borderSides", "borderColorStyle", "borderPadding", "disableHaptic"]);
|
|
45
45
|
const { action } = useActions();
|
|
46
46
|
const handleClick = (e) => {
|
|
47
47
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../components/ui/icon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAEL,eAAe,EAyChB,MAAM,qBAAqB,CAAA;AAI5B,QAAA,MAAM,YAAY;;;mFAiBjB,CAAA;AA+DD,MAAM,WAAW,SACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,EACzD,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B;AA8KD,iBAAS,IAAI,CAAC,EACZ,SAAS,EACT,IAAI,EACJ,IAAW,EACX,KAAK,EACL,GAAG,EACH,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,cAAc,EACd,GAAG,KAAK,EACT,EAAE,SAAS,2CA+BX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { ReactSVG } from "react-svg";
|
|
15
15
|
import { cva } from "class-variance-authority";
|
|
16
|
-
import { IconUpload, IconPencilMinus, IconPlus, IconMinus, IconAdjustmentsAlt, IconArrowsSort, IconAlertCircle, IconCircleX, IconInfoCircle, IconCheck, IconSquareOff, IconMapPin, IconRepeat, IconSquare, IconSquareCheck, IconChevronUp, IconChevronRight, IconChevronLeft, IconEyeOff, IconSquareX, IconCircle, IconChevronDown, IconHeartFilled, IconCurrencyDollar, IconX, IconCircleOff, IconCircleDotFilled, IconMoodSad, IconSquareXFilled, IconTrash, IconLoader2, IconColumns1, IconColumns2, IconColumns3, IconSearch, IconShoppingCartOff, IconStarFilled, IconShoppingBagPlus, IconShieldCheckFilled, IconShoppingBag, IconHeartCancel, } from "@tabler/icons-react";
|
|
16
|
+
import { IconUpload, IconPencilMinus, IconPlus, IconMinus, IconAdjustmentsAlt, IconArrowsSort, IconAlertCircle, IconCircleX, IconInfoCircle, IconCheck, IconSquareOff, IconMapPin, IconRepeat, IconSquare, IconSquareCheck, IconChevronUp, IconChevronRight, IconChevronLeft, IconEyeOff, IconSquareX, IconCircle, IconChevronDown, IconHeartFilled, IconCurrencyDollar, IconX, IconCircleOff, IconCircleDotFilled, IconMoodSad, IconSquareXFilled, IconTrash, IconLoader2, IconColumns1, IconColumns2, IconColumns3, IconSearch, IconShoppingCartOff, IconStarFilled, IconShoppingBagPlus, IconShieldCheckFilled, IconShoppingBag, IconHeartCancel, IconStar, } from "@tabler/icons-react";
|
|
17
17
|
import { cn, iconColorVariantClasses } from "../../lib/utils";
|
|
18
18
|
const iconVariants = cva("inline-flex items-center justify-center text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ring-offset-background", {
|
|
19
19
|
variants: {
|
|
@@ -86,6 +86,7 @@ const icons = {
|
|
|
86
86
|
"shopping-bag-plus": IconShoppingBagPlus,
|
|
87
87
|
"shield-check-filled": IconShieldCheckFilled,
|
|
88
88
|
"heart-cancel": IconHeartCancel,
|
|
89
|
+
star: IconStar,
|
|
89
90
|
};
|
|
90
91
|
const TablerIcon = ({ name, size }) => {
|
|
91
92
|
const IconComponent = icons[name];
|
|
@@ -168,6 +169,9 @@ const CustomIcon = ({ url, size, color, strokeColor, strokeWidth, fillColor, fil
|
|
|
168
169
|
};
|
|
169
170
|
function Icon(_a) {
|
|
170
171
|
var { className, name, size = "md", color, url, fillColor, secondaryFillColor, strokeColor, strokeWidth, fillPercentage } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "secondaryFillColor", "strokeColor", "strokeWidth", "fillPercentage"]);
|
|
171
|
-
|
|
172
|
+
// For Tabler icons, we need to apply custom colors as inline styles
|
|
173
|
+
const isCustomColor = color && !iconColorVariantClasses[color];
|
|
174
|
+
const iconStyle = isCustomColor ? { color } : {};
|
|
175
|
+
return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color: isCustomColor ? undefined : color }), className), style: iconStyle }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, secondaryFillColor: secondaryFillColor, strokeColor: strokeColor, strokeWidth: strokeWidth, fillPercentage: fillPercentage || (color || fillColor ? 1 : 0) })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
|
|
172
176
|
}
|
|
173
177
|
export { Icon, iconVariants, IconPencilMinus };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
3
|
+
value?: string | undefined;
|
|
4
|
+
onChange?: ((newValue: string) => unknown) | undefined;
|
|
5
|
+
maxLength: number;
|
|
6
|
+
textAlign?: "left" | "right" | "center" | undefined;
|
|
7
|
+
onComplete?: ((...args: any[]) => unknown) | undefined;
|
|
8
|
+
pushPasswordManagerStrategy?: "none" | "increase-width" | undefined;
|
|
9
|
+
pasteTransformer?: ((pasted: string) => string) | undefined;
|
|
10
|
+
containerClassName?: string | undefined;
|
|
11
|
+
noScriptCSSFallback?: string | null | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
render: (props: import("input-otp").RenderProps) => React.ReactNode;
|
|
14
|
+
children?: undefined;
|
|
15
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
16
|
+
value?: string | undefined;
|
|
17
|
+
onChange?: ((newValue: string) => unknown) | undefined;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
textAlign?: "left" | "right" | "center" | undefined;
|
|
20
|
+
onComplete?: ((...args: any[]) => unknown) | undefined;
|
|
21
|
+
pushPasswordManagerStrategy?: "none" | "increase-width" | undefined;
|
|
22
|
+
pasteTransformer?: ((pasted: string) => string) | undefined;
|
|
23
|
+
containerClassName?: string | undefined;
|
|
24
|
+
noScriptCSSFallback?: string | null | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
render?: undefined;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
} & React.RefAttributes<HTMLInputElement>, "ref">) & React.RefAttributes<HTMLInputElement>>;
|
|
29
|
+
declare const InputOTPGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
declare const InputOTPSlot: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
31
|
+
index: number;
|
|
32
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
33
|
+
declare const InputOTPSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
35
|
+
//# sourceMappingURL=input-otp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../../components/ui/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;2FAaZ,CAAA;AAGF,QAAA,MAAM,aAAa,mKAKjB,CAAA;AAGF,QAAA,MAAM,YAAY;WAEiC,MAAM;wCAuBvD,CAAA;AAGF,QAAA,MAAM,iBAAiB,mKAOrB,CAAA;AAGF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { OTPInput, OTPInputContext } from "input-otp";
|
|
16
|
+
import { Minus } from "lucide-react";
|
|
17
|
+
import { cn } from "../../lib/utils";
|
|
18
|
+
const InputOTP = React.forwardRef((_a, ref) => {
|
|
19
|
+
var { className, containerClassName } = _a, props = __rest(_a, ["className", "containerClassName"]);
|
|
20
|
+
return (_jsx(OTPInput, Object.assign({ ref: ref, containerClassName: cn("flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName), className: cn("disabled:cursor-not-allowed", className) }, props)));
|
|
21
|
+
});
|
|
22
|
+
InputOTP.displayName = "InputOTP";
|
|
23
|
+
const InputOTPGroup = React.forwardRef((_a, ref) => {
|
|
24
|
+
var { className } = _a, props = __rest(_a, ["className"]);
|
|
25
|
+
return (_jsx("div", Object.assign({ ref: ref, className: cn("flex items-center", className) }, props)));
|
|
26
|
+
});
|
|
27
|
+
InputOTPGroup.displayName = "InputOTPGroup";
|
|
28
|
+
const InputOTPSlot = React.forwardRef((_a, ref) => {
|
|
29
|
+
var { index, className } = _a, props = __rest(_a, ["index", "className"]);
|
|
30
|
+
const inputOTPContext = React.useContext(OTPInputContext);
|
|
31
|
+
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
|
|
32
|
+
return (_jsxs("div", Object.assign({ ref: ref, className: cn("relative flex h-9 w-9 items-center justify-center border-y border-r border-input text-sm shadow-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md", isActive && "z-10 ring-1 ring-ring", className) }, props, { children: [char, hasFakeCaret && (_jsx("div", Object.assign({ className: "pointer-events-none absolute inset-0 flex items-center justify-center" }, { children: _jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) })))] })));
|
|
33
|
+
});
|
|
34
|
+
InputOTPSlot.displayName = "InputOTPSlot";
|
|
35
|
+
const InputOTPSeparator = React.forwardRef((_a, ref) => {
|
|
36
|
+
var props = __rest(_a, []);
|
|
37
|
+
return (_jsx("div", Object.assign({ ref: ref, role: "separator" }, props, { children: _jsx(Minus, {}) })));
|
|
38
|
+
});
|
|
39
|
+
InputOTPSeparator.displayName = "InputOTPSeparator";
|
|
40
|
+
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
|
@@ -25,6 +25,14 @@ type Config = {
|
|
|
25
25
|
uppercase: boolean;
|
|
26
26
|
textAlignment: string;
|
|
27
27
|
cornerRadius: number;
|
|
28
|
+
defaultText?: string;
|
|
29
|
+
defaultTextColor?: string;
|
|
30
|
+
defaultBackgroundColor?: string;
|
|
31
|
+
defaultBorderColor?: string;
|
|
32
|
+
soldOutText?: string;
|
|
33
|
+
soldOutTextColor?: string;
|
|
34
|
+
soldOutBackgroundColor?: string;
|
|
35
|
+
soldOutBorderColor?: string;
|
|
28
36
|
};
|
|
29
37
|
favoritesIcon?: {
|
|
30
38
|
enabled: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../components/ui/product-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAQ1C,KAAK,MAAM,GAAG;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,YAAY,EAAE,MAAM,CAAA;QACpB,iBAAiB,EAAE,OAAO,CAAA;KAC3B,CAAA;IACD,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,aAAa,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAA;KAClD,CAAA;IACD,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,OAAO,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,QAAQ,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,QAAQ,CAAC,EAAE;QACT,OAAO,EAAE,OAAO,CAAA;QAChB,QAAQ,EAAE,MAAM,CAAA;QAChB,SAAS,EAAE,OAAO,CAAA;QAClB,aAAa,EAAE,MAAM,CAAA;QACrB,YAAY,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"product-card.d.ts","sourceRoot":"","sources":["../../../components/ui/product-card.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAQ1C,KAAK,MAAM,GAAG;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE;QACb,OAAO,EAAE,OAAO,CAAA;QAChB,YAA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,KACb,IAAI,CAAA;IACT,UAAU,CAAC,EAAE,CACX,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC1C,OAAO,EAAE,OAAO,KACb,IAAI,CAAA;IACT,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AA8HD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAqY3C,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -190,7 +190,12 @@ const ProductCard = ({ config, tapcartData, product, isLoading, favorited, onFav
|
|
|
190
190
|
const imageSwipeEnabled = ((_e = config.productImage) === null || _e === void 0 ? void 0 : _e.allowSwipeability) && product.images.length > 1;
|
|
191
191
|
return (_jsx("div", Object.assign({ className: cn("w-1/2", className) }, { children: _jsxs("div", Object.assign({ className: "w-full active:opacity-70 cursor-pointer", onClick: () => {
|
|
192
192
|
_openProduct();
|
|
193
|
-
}
|
|
193
|
+
}, onKeyDown: (e) => {
|
|
194
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
195
|
+
e.preventDefault();
|
|
196
|
+
_openProduct();
|
|
197
|
+
}
|
|
198
|
+
}, role: "button", tabIndex: 0 }, { children: [((_f = config.productImage) === null || _f === void 0 ? void 0 : _f.enabled) && (_jsxs("div", Object.assign({ className: "relative w-full overflow-hidden", style: {
|
|
194
199
|
borderTopLeftRadius: `${config.productImage.cornerRadius}px`,
|
|
195
200
|
borderTopRightRadius: `${config.productImage.cornerRadius}px`,
|
|
196
201
|
borderBottomLeftRadius: `${((_g = config.quickAdd) === null || _g === void 0 ? void 0 : _g.enabled)
|
|
@@ -223,13 +228,35 @@ const ProductCard = ({ config, tapcartData, product, isLoading, favorited, onFav
|
|
|
223
228
|
imageSwipeEnabled,
|
|
224
229
|
})), selected: favorited, onClick: (e) => {
|
|
225
230
|
onFavoriteClick === null || onFavoriteClick === void 0 ? void 0 : onFavoriteClick(e, product);
|
|
226
|
-
}, iconUrl: (_q = (_p = config.favoritesIcon) === null || _p === void 0 ? void 0 : _p.icon) === null || _q === void 0 ? void 0 : _q.url, layoutType: (_r = config.favoritesIcon) === null || _r === void 0 ? void 0 : _r.layoutType, showBackground: (_s = config.favoritesIcon) === null || _s === void 0 ? void 0 : _s.showBackground, cornerRadius: (_t = config.favoritesIcon) === null || _t === void 0 ? void 0 : _t.cornerRadius }))] }))), ((_u = config.quickAdd) === null || _u === void 0 ? void 0 : _u.enabled) && (_jsx(Button, Object.assign({ className: "outline-0", style: {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
231
|
+
}, iconUrl: (_q = (_p = config.favoritesIcon) === null || _p === void 0 ? void 0 : _p.icon) === null || _q === void 0 ? void 0 : _q.url, layoutType: (_r = config.favoritesIcon) === null || _r === void 0 ? void 0 : _r.layoutType, showBackground: (_s = config.favoritesIcon) === null || _s === void 0 ? void 0 : _s.showBackground, cornerRadius: (_t = config.favoritesIcon) === null || _t === void 0 ? void 0 : _t.cornerRadius }))] }))), ((_u = config.quickAdd) === null || _u === void 0 ? void 0 : _u.enabled) && (_jsx(Button, Object.assign({ className: "outline-0", style: Object.assign({ borderBottomLeftRadius: `${config.quickAdd.cornerRadius}px`, borderBottomRightRadius: `${config.quickAdd.cornerRadius}px` }, (product.availableForSale
|
|
232
|
+
? {
|
|
233
|
+
backgroundColor: config.quickAdd.defaultBackgroundColor || undefined,
|
|
234
|
+
borderColor: config.quickAdd.defaultBorderColor || undefined,
|
|
235
|
+
color: config.quickAdd.defaultTextColor || undefined,
|
|
236
|
+
}
|
|
237
|
+
: {
|
|
238
|
+
backgroundColor: config.quickAdd.soldOutBackgroundColor || undefined,
|
|
239
|
+
borderColor: config.quickAdd.soldOutBorderColor || undefined,
|
|
240
|
+
color: config.quickAdd.soldOutTextColor || undefined,
|
|
241
|
+
})), labelClassName: cn("outline-0 w-full", { uppercase: (_v = config.quickAdd) === null || _v === void 0 ? void 0 : _v.uppercase }, { "text-left": ((_w = config.quickAdd) === null || _w === void 0 ? void 0 : _w.textAlignment) === "left" }, { "text-right": ((_x = config.quickAdd) === null || _x === void 0 ? void 0 : _x.textAlignment) === "right" }, { "text-center": ((_y = config.quickAdd) === null || _y === void 0 ? void 0 : _y.textAlignment) === "center" }), labelStyle: {
|
|
242
|
+
fontSize: (_z = config.quickAdd) === null || _z === void 0 ? void 0 : _z.fontSize,
|
|
243
|
+
color: product.availableForSale
|
|
244
|
+
? config.quickAdd.defaultTextColor || undefined
|
|
245
|
+
: config.quickAdd.soldOutTextColor || undefined,
|
|
246
|
+
}, variant: "quickadd", size: "default", disabled: product.availableForSale === false, onClick: (e) => {
|
|
230
247
|
e.stopPropagation();
|
|
231
248
|
onQuickAdd === null || onQuickAdd === void 0 ? void 0 : onQuickAdd(e, product);
|
|
232
|
-
} }, { children: _jsxs("div", Object.assign({ className: "flex items-center justify-center gap-2"
|
|
249
|
+
} }, { children: _jsxs("div", Object.assign({ className: "flex items-center justify-center gap-2", style: {
|
|
250
|
+
color: product.availableForSale
|
|
251
|
+
? config.quickAdd.defaultTextColor || undefined
|
|
252
|
+
: config.quickAdd.soldOutTextColor || undefined,
|
|
253
|
+
} }, { children: [_jsx(Icon, { name: product.availableForSale ? "plus" : "shopping-cart-off", size: "xs", style: {
|
|
254
|
+
color: product.availableForSale
|
|
255
|
+
? config.quickAdd.defaultTextColor || undefined
|
|
256
|
+
: config.quickAdd.soldOutTextColor || undefined,
|
|
257
|
+
} }), product.availableForSale
|
|
258
|
+
? config.quickAdd.defaultText || "Quick Add"
|
|
259
|
+
: config.quickAdd.soldOutText || "Sold Out"] })) }))), _jsxs("div", Object.assign({ className: "w-full flex-col justify-start items-start gap-0 inline-flex" }, { children: [belowBadge && (_jsx("div", Object.assign({ className: cn("mt-2 w-full flex justify-start", {
|
|
233
260
|
"justify-end": belowBadge.horizontalPosition === "end",
|
|
234
261
|
}) }, { children: _jsx(Badge, Object.assign({ size: "plp-layout", alignment: belowBadge.horizontalPosition, icon: belowBadge.image, className: cn("truncate", { rounded: belowBadge.cornerRadius === "rounded" }, { "rounded-none": belowBadge.cornerRadius === "square" }) }, { children: belowBadge.text })) }))), ((_0 = config.productTitle) === null || _0 === void 0 ? void 0 : _0.enabled) && (_jsx("div", Object.assign({ className: "mt-2 w-full" }, { children: _jsx(Text, Object.assign({ type: "body-secondary", className: cn({ uppercase: (_1 = config.productTitle) === null || _1 === void 0 ? void 0 : _1.uppercase }, {
|
|
235
262
|
"text-left": ((_2 = config.productTitle) === null || _2 === void 0 ? void 0 : _2.textAlignment) === "left",
|
|
@@ -41,7 +41,7 @@ const Slider = React.forwardRef((_a, ref) => {
|
|
|
41
41
|
const debouncedSliderVal = useDebounce(value, 200);
|
|
42
42
|
return (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "mt-3 mb-6" }, { children: _jsxs(SliderPrimitive.Root, Object.assign({ ref: ref, className: cn("flex relative h-0.5 w-auto items-center select-none", className), onValueChange: (value) => onChange(value), onValueCommit: (value) => {
|
|
43
43
|
handleCommit(value);
|
|
44
|
-
}, defaultValue: defaultValue, value: value, max: max, min: min, step: step }, props, { children: [_jsx(SliderPrimitive.Track, Object.assign({ className: "relative h-1 rounded w-full grow overflow-hidden bg-coreColors-dividingLines" }, { children: _jsx(SliderPrimitive.Range, { className: "absolute h-full bg-coreColors-brandColorPrimary" }) })), _jsx(SliderPrimitive.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-coreColors-brandColorPrimary bg-coreColors-modalBackground focus-visible:outline-none disabled:pointer-events-none" })] })) })), _jsxs("div", Object.assign({ className: "flex w-auto gap-4 " }, { children: [doubleValue && doubleValue == true ? (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "w-full px-4 py-2 border bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Minimum" })), _jsxs("div", Object.assign({ className: "flex text-textColors-primaryColor text-[14px]" }, { children: ["$", min] }))] })) })), _jsx("div", { className: "w-4 h-0 self-center border-2 bg-coreColors-dividingLines" })] })) : (""), _jsx("div", Object.assign({ className: "w-full px-4 py-2 outline outline-1 outline-coreColors-dividingLines rounded bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "flex items-center h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Maximum" })), _jsxs("div", Object.assign({ className: "flex h-6 text-textColors-primaryColor text-[14px] w-full [&>div]:w-full" }, { children: ["$", _jsx(Input, { className: "border-0
|
|
44
|
+
}, defaultValue: defaultValue, value: value, max: max, min: min, step: step }, props, { children: [_jsx(SliderPrimitive.Track, Object.assign({ className: "relative h-1 rounded w-full grow overflow-hidden bg-coreColors-dividingLines" }, { children: _jsx(SliderPrimitive.Range, { className: "absolute h-full bg-coreColors-brandColorPrimary" }) })), _jsx(SliderPrimitive.Thumb, { className: "block h-4 w-4 rounded-full border-2 border-coreColors-brandColorPrimary bg-coreColors-modalBackground focus-visible:outline-none disabled:pointer-events-none" })] })) })), _jsxs("div", Object.assign({ className: "flex w-auto gap-4 " }, { children: [doubleValue && doubleValue == true ? (_jsxs(_Fragment, { children: [_jsx("div", Object.assign({ className: "w-full px-4 py-2 border bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Minimum" })), _jsxs("div", Object.assign({ className: "flex text-textColors-primaryColor text-[14px]" }, { children: ["$", min] }))] })) })), _jsx("div", { className: "w-4 h-0 self-center border-2 bg-coreColors-dividingLines" })] })) : (""), _jsx("div", Object.assign({ className: "w-full px-4 py-2 outline outline-1 outline-coreColors-dividingLines rounded bg-coreColors-inputBackground" }, { children: _jsxs("div", Object.assign({ className: "flex flex-col" }, { children: [_jsx("div", Object.assign({ className: "flex items-center h-4 text-textColors-secondaryColor text-[10px] leading-[13px]" }, { children: "Maximum" })), _jsxs("div", Object.assign({ className: "flex h-6 text-textColors-primaryColor text-[14px] w-full [&>div]:w-full" }, { children: ["$", _jsx(Input, { className: "border-0 pl-1 pr-0 py-0 h-full w-full text-[14px]", id: "slider-maximum", value: debouncedSliderVal[0].toString(), placeholder: defaultValue[0].toString(), onChange: (value) => {
|
|
45
45
|
const inputValue = Number(value);
|
|
46
46
|
inputValue > max ? onChange([max]) : onChange([inputValue]);
|
|
47
47
|
} })] }))] })) }))] }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star-rating.d.ts","sourceRoot":"","sources":["../../../components/ui/star-rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC3E,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;CACzC;AAED,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"star-rating.d.ts","sourceRoot":"","sources":["../../../components/ui/star-rating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC3E,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;CACzC;AAED,QAAA,MAAM,UAAU,wFAqGf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -9,24 +9,44 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import * as React from "react";
|
|
14
14
|
import { cn } from "../../lib/utils";
|
|
15
15
|
import { Icon } from "./icon";
|
|
16
16
|
const StarRating = React.forwardRef((_a, ref) => {
|
|
17
|
-
var { className, score, iconSize = "sm", iconUrl, filledColor
|
|
17
|
+
var { className, score, iconSize = "sm", iconUrl, filledColor = "#facc15", // default to yellow-400
|
|
18
|
+
emptyColor = "#e5e7eb", // default to gray-200
|
|
19
|
+
designOptions } = _a, props = __rest(_a, ["className", "score", "iconSize", "iconUrl", "filledColor", "emptyColor", "designOptions"]);
|
|
20
|
+
const getIconProps = (isFilled) => {
|
|
21
|
+
if (iconUrl) {
|
|
22
|
+
return { url: iconUrl };
|
|
23
|
+
}
|
|
24
|
+
return { name: isFilled ? "star-filled" : "star" };
|
|
25
|
+
};
|
|
18
26
|
if (designOptions === "condensed") {
|
|
19
|
-
return _jsx(Icon, { size: iconSize,
|
|
27
|
+
return (_jsx(Icon, Object.assign({ size: iconSize }, getIconProps(score > 0), { color: score > 0 ? filledColor : emptyColor })));
|
|
20
28
|
}
|
|
21
29
|
return (_jsx("div", Object.assign({ className: cn("flex flex-row gap-1", className), ref: ref }, props, { children: Array.from({ length: 5 }).map((_, index) => {
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
const starNumber = index + 1;
|
|
31
|
+
if (score >= starNumber) {
|
|
32
|
+
// Fully filled star
|
|
33
|
+
return (_jsx(Icon, Object.assign({ size: iconSize }, getIconProps(true), { color: filledColor }), index));
|
|
24
34
|
}
|
|
25
|
-
else if (index
|
|
26
|
-
|
|
35
|
+
else if (score > index && score < starNumber) {
|
|
36
|
+
// Partial star - create overlay effect
|
|
37
|
+
const fillPercentage = score - index;
|
|
38
|
+
if (iconUrl) {
|
|
39
|
+
// Use fillPercentage for custom icons
|
|
40
|
+
return (_jsx(Icon, { size: iconSize, url: iconUrl, fillColor: filledColor, secondaryFillColor: emptyColor, fillPercentage: fillPercentage }, index));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// For Tabler icons, create overlay effect
|
|
44
|
+
return (_jsxs("div", Object.assign({ className: "relative" }, { children: [_jsx(Icon, { size: iconSize, name: "star", color: emptyColor }), _jsx("div", Object.assign({ className: "absolute inset-0 overflow-hidden", style: { width: `${fillPercentage * 100}%` } }, { children: _jsx(Icon, { size: iconSize, name: "star-filled", color: filledColor }) }))] }), index));
|
|
45
|
+
}
|
|
27
46
|
}
|
|
28
47
|
else {
|
|
29
|
-
|
|
48
|
+
// Empty star
|
|
49
|
+
return (_jsx(Icon, Object.assign({ size: iconSize }, getIconProps(false), { color: emptyColor }), index));
|
|
30
50
|
}
|
|
31
51
|
}) })));
|
|
32
52
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -83,4 +83,5 @@ export * from "./components/ui/tap";
|
|
|
83
83
|
export * from "./components/ui/circular-progress";
|
|
84
84
|
export * from "./components/ui/swipeable-list-item";
|
|
85
85
|
export * from "./components/ui/dialog";
|
|
86
|
+
export * from "./components/ui/input-otp";
|
|
86
87
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":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BAAyB,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,sBAAsB,CAAA;AACpC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kDAAkD,CAAA;AAChE,cAAc,gCAAgC,CAAA;AAC9C,cAAc,qCAAqC,CAAA;AACnD,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,aAAa,CAAA;AAC3B,cAAc,6CAA6C,CAAA;AAC3D,cAAc,kDAAkD,CAAA;AAChE,cAAc,qBAAqB,CAAA;AACnC,cAAc,mCAAmC,CAAA;AACjD,cAAc,qCAAqC,CAAA;AACnD,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { CartState, CartCalculatedDiscount, CartCalculatedAppliedGiftCard } from "app-studio-types";
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
variantCompareAtPrice: number;
|
|
2
|
+
export declare const getSubscriptionPriceDetails: ({ totalAmount, quantity, sellingPlanAllocation, }: {
|
|
3
|
+
totalAmount?: number | undefined;
|
|
5
4
|
quantity: number;
|
|
6
|
-
currencyCode: string;
|
|
7
5
|
sellingPlanAllocation?: {
|
|
8
6
|
priceAdjustments: {
|
|
9
7
|
perDeliveryPrice?: number;
|
|
@@ -12,9 +10,8 @@ export declare const getVariablesVariantPrice: ({ variantPrice, variantCompareAt
|
|
|
12
10
|
}[];
|
|
13
11
|
} | undefined;
|
|
14
12
|
}) => {
|
|
15
|
-
price: number;
|
|
13
|
+
price: number | undefined;
|
|
16
14
|
compareAtPrice: number;
|
|
17
|
-
currency: string;
|
|
18
15
|
isSale: boolean;
|
|
19
16
|
};
|
|
20
17
|
export declare const isVariablesOrderLevelDiscount: (code: string, cart: CartState | null) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"variablesCart.util.d.ts","sourceRoot":"","sources":["../../lib/variablesCart.util.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,6BAA6B,EAO9B,MAAM,kBAAkB,CAAA;AAEzB,eAAO,MAAM,2BAA2B;;cAM5B,MAAM;;0BAEI;YAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;YACzB,KAAK,EAAE,MAAM,CAAA;YACb,cAAc,CAAC,EAAE,MAAM,CAAA;SACxB,EAAE;;;;;;CAyBN,CAAA;AAyED,eAAO,MAAM,6BAA6B,SAClC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAED,eAAO,MAAM,2BAA2B,SAChC,MAAM,QACN,SAAS,GAAG,IAAI,YAUvB,CAAA;AAkLD,MAAM,MAAM,uBAAuB,GAAG;IACpC,yBAAyB,EAAE,sBAAsB,EAAE,CAAA;IACnD,gBAAgB,EAAE,6BAA6B,EAAE,CAAA;IACjD,cAAc,EAAE,OAAO,CAAA;IACvB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,iCAAiC,EAAE,uBAU/C,CAAA;AAED,eAAO,MAAM,8BAA8B,SACnC,SAAS,GAAG,IAAI,KACrB,uBAmCF,CAAA"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { DiscountApplicationTargetType, } from "app-studio-types";
|
|
3
|
-
export const
|
|
3
|
+
export const getSubscriptionPriceDetails = ({ totalAmount, quantity, sellingPlanAllocation = { priceAdjustments: [] }, }) => {
|
|
4
4
|
var _a;
|
|
5
5
|
const isSubscription = ((_a = sellingPlanAllocation === null || sellingPlanAllocation === void 0 ? void 0 : sellingPlanAllocation.priceAdjustments) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
6
6
|
if (isSubscription) {
|
|
7
7
|
const { perDeliveryPrice, price, compareAtPrice } = sellingPlanAllocation.priceAdjustments[0];
|
|
8
8
|
const effectivePrice = perDeliveryPrice || price;
|
|
9
9
|
const subscriptionUnitPrice = perDeliveryPrice || 0;
|
|
10
|
-
const effectiveCompareAtPrice = compareAtPrice ||
|
|
10
|
+
const effectiveCompareAtPrice = compareAtPrice * quantity || totalAmount || 0;
|
|
11
11
|
return {
|
|
12
|
-
price:
|
|
13
|
-
compareAtPrice: effectiveCompareAtPrice
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
price: totalAmount,
|
|
13
|
+
compareAtPrice: effectiveCompareAtPrice,
|
|
14
|
+
isSale: totalAmount < subscriptionUnitPrice * quantity,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.error("No selling plan allocation found");
|
|
19
|
+
return {
|
|
20
|
+
price: 0,
|
|
21
|
+
compareAtPrice: 0,
|
|
22
|
+
isSale: false,
|
|
16
23
|
};
|
|
17
24
|
}
|
|
18
|
-
const variantUnitPrice = variantPrice || 0;
|
|
19
|
-
const variantComparePrice = variantCompareAtPrice || 0;
|
|
20
|
-
return {
|
|
21
|
-
price: variantUnitPrice * quantity,
|
|
22
|
-
compareAtPrice: variantComparePrice * quantity,
|
|
23
|
-
currency: currencyCode,
|
|
24
|
-
isSale: variantUnitPrice < variantComparePrice,
|
|
25
|
-
};
|
|
26
25
|
};
|
|
27
26
|
const getOrderLevelDiscounts = (cart) => {
|
|
28
27
|
// Handle null cart gracefully - the shopping cart state can be null sometimes
|
|
@@ -118,40 +117,36 @@ const getAppliedGiftCards = (cart) => {
|
|
|
118
117
|
});
|
|
119
118
|
});
|
|
120
119
|
};
|
|
121
|
-
const
|
|
120
|
+
const getCompareAtPriceDifference = (cart) => {
|
|
122
121
|
var _a;
|
|
123
122
|
// Handle null cart gracefully - the shopping cart state can be null sometimes
|
|
124
123
|
if (!cart)
|
|
125
124
|
return 0;
|
|
126
125
|
return (_a = cart === null || cart === void 0 ? void 0 : cart.items) === null || _a === void 0 ? void 0 : _a.reduce((acc, item) => {
|
|
127
|
-
var _a, _b;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
let
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
};
|
|
126
|
+
var _a, _b, _c, _d, _e, _f;
|
|
127
|
+
/**
|
|
128
|
+
* Regular price details
|
|
129
|
+
*/
|
|
130
|
+
let itemPrice = (item === null || item === void 0 ? void 0 : item.price) || 0;
|
|
131
|
+
let itemCompareAtPrice = (item === null || item === void 0 ? void 0 : item.compareAtPrice) || 0;
|
|
132
|
+
/**
|
|
133
|
+
* Subscription price details
|
|
134
|
+
*/
|
|
135
|
+
if (((_b = (_a = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _a === void 0 ? void 0 : _a.priceAdjustments) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
136
|
+
itemPrice =
|
|
137
|
+
((_d = (_c = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _c === void 0 ? void 0 : _c.priceAdjustments[0]) === null || _d === void 0 ? void 0 : _d.perDeliveryPrice) ||
|
|
138
|
+
((_f = (_e = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _e === void 0 ? void 0 : _e.priceAdjustments[0]) === null || _f === void 0 ? void 0 : _f.price) ||
|
|
139
|
+
0;
|
|
140
|
+
const { compareAtPrice } = getSubscriptionPriceDetails({
|
|
141
|
+
quantity: (item === null || item === void 0 ? void 0 : item.quantity) || 1,
|
|
142
|
+
sellingPlanAllocation: item === null || item === void 0 ? void 0 : item.sellingPlanAllocation,
|
|
143
|
+
});
|
|
144
|
+
if (compareAtPrice && compareAtPrice > itemPrice) {
|
|
145
|
+
itemCompareAtPrice = compareAtPrice;
|
|
146
|
+
}
|
|
145
147
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
variantPrice: itemPrice,
|
|
149
|
-
variantCompareAtPrice: itemCompareAtPrice,
|
|
150
|
-
currencyCode: (item === null || item === void 0 ? void 0 : item.currencyCode) || "USD",
|
|
151
|
-
sellingPlanAllocation: customSellingPlanAllocation,
|
|
152
|
-
});
|
|
153
|
-
if (compareAtPrice && compareAtPrice > price) {
|
|
154
|
-
return acc + (compareAtPrice - price);
|
|
148
|
+
if (itemPrice && itemCompareAtPrice && itemCompareAtPrice > itemPrice) {
|
|
149
|
+
return (acc + (itemCompareAtPrice * (item === null || item === void 0 ? void 0 : item.quantity) - itemPrice * (item === null || item === void 0 ? void 0 : item.quantity)));
|
|
155
150
|
}
|
|
156
151
|
return acc;
|
|
157
152
|
}, 0);
|
|
@@ -200,11 +195,25 @@ const getTotalCompareAtPrice = (cart) => {
|
|
|
200
195
|
if (!cart)
|
|
201
196
|
return 0;
|
|
202
197
|
return (_a = cart === null || cart === void 0 ? void 0 : cart.items) === null || _a === void 0 ? void 0 : _a.reduce((acc, item) => {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
198
|
+
var _a, _b;
|
|
199
|
+
/*
|
|
200
|
+
* Regular price details
|
|
201
|
+
*/
|
|
202
|
+
let itemCompareAtPrice = (item === null || item === void 0 ? void 0 : item.compareAtPrice) || (item === null || item === void 0 ? void 0 : item.price) || 0;
|
|
203
|
+
const quantity = (item === null || item === void 0 ? void 0 : item.quantity) || 1;
|
|
204
|
+
/**
|
|
205
|
+
* Subscription price details
|
|
206
|
+
*/
|
|
207
|
+
if (((_b = (_a = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _a === void 0 ? void 0 : _a.priceAdjustments) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
208
|
+
const { compareAtPrice } = getSubscriptionPriceDetails({
|
|
209
|
+
quantity: (item === null || item === void 0 ? void 0 : item.quantity) || 1,
|
|
210
|
+
sellingPlanAllocation: item === null || item === void 0 ? void 0 : item.sellingPlanAllocation,
|
|
211
|
+
});
|
|
212
|
+
if (compareAtPrice) {
|
|
213
|
+
itemCompareAtPrice = compareAtPrice;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return acc + itemCompareAtPrice * quantity;
|
|
208
217
|
}, 0);
|
|
209
218
|
};
|
|
210
219
|
const getTotalDiscountedPrice = (totalCompareAtPrice, discountsTotalAmount, salesAmount, giftCardsTotalAmount) => {
|
|
@@ -224,10 +233,10 @@ const getTotalSavedAmount = (cart) => {
|
|
|
224
233
|
// Handle null cart gracefully - the shopping cart state can be null sometimes
|
|
225
234
|
if (!cart)
|
|
226
235
|
return 0;
|
|
227
|
-
const
|
|
236
|
+
const totalCompareAtPriceDifference = getCompareAtPriceDifference(cart);
|
|
228
237
|
const totalDiscountsAmount = getDiscountsTotalAmount(getOrderLevelDiscounts(cart).concat(getLineItemDiscounts(cart)));
|
|
229
238
|
const totalGiftCardsAmount = getGiftCardsTotalAmount(getAppliedGiftCards(cart));
|
|
230
|
-
const totalSavedAmount =
|
|
239
|
+
const totalSavedAmount = totalCompareAtPriceDifference + totalDiscountsAmount + totalGiftCardsAmount;
|
|
231
240
|
return totalSavedAmount;
|
|
232
241
|
};
|
|
233
242
|
export const DEFAULT_VARIABLES_CALCULATED_DATA = {
|
|
@@ -251,7 +260,7 @@ export const getVariablesCalculatedCartData = (cart) => {
|
|
|
251
260
|
const isFreeShipping = getShippingDiscounts(cart).length > 0;
|
|
252
261
|
const discountsTotalAmount = getDiscountsTotalAmount(orderAndLineItemDiscounts);
|
|
253
262
|
const giftCardsTotalAmount = getGiftCardsTotalAmount(appliedGiftCards);
|
|
254
|
-
const salesAmount =
|
|
263
|
+
const salesAmount = getCompareAtPriceDifference(cart);
|
|
255
264
|
const totalCompareAtPrice = getTotalCompareAtPrice(cart);
|
|
256
265
|
const totalDiscountedPrice = getTotalDiscountedPrice(totalCompareAtPrice, discountsTotalAmount, salesAmount, giftCardsTotalAmount);
|
|
257
266
|
const totalSavedAmount = getTotalSavedAmount(cart);
|
package/dist/styles.css
CHANGED
|
@@ -1152,6 +1152,9 @@ video {
|
|
|
1152
1152
|
.w-8 {
|
|
1153
1153
|
width: 2rem;
|
|
1154
1154
|
}
|
|
1155
|
+
.w-9 {
|
|
1156
|
+
width: 2.25rem;
|
|
1157
|
+
}
|
|
1155
1158
|
.w-\[138px\] {
|
|
1156
1159
|
width: 138px;
|
|
1157
1160
|
}
|
|
@@ -1181,6 +1184,9 @@ video {
|
|
|
1181
1184
|
width: -moz-max-content;
|
|
1182
1185
|
width: max-content;
|
|
1183
1186
|
}
|
|
1187
|
+
.w-px {
|
|
1188
|
+
width: 1px;
|
|
1189
|
+
}
|
|
1184
1190
|
.min-w-0 {
|
|
1185
1191
|
min-width: 0px;
|
|
1186
1192
|
}
|
|
@@ -1547,9 +1553,6 @@ video {
|
|
|
1547
1553
|
.text-wrap {
|
|
1548
1554
|
text-wrap: wrap;
|
|
1549
1555
|
}
|
|
1550
|
-
.break-words {
|
|
1551
|
-
overflow-wrap: break-word;
|
|
1552
|
-
}
|
|
1553
1556
|
.break-all {
|
|
1554
1557
|
word-break: break-all;
|
|
1555
1558
|
}
|
|
@@ -1621,6 +1624,10 @@ video {
|
|
|
1621
1624
|
.border-2 {
|
|
1622
1625
|
border-width: 2px;
|
|
1623
1626
|
}
|
|
1627
|
+
.border-y {
|
|
1628
|
+
border-top-width: 1px;
|
|
1629
|
+
border-bottom-width: 1px;
|
|
1630
|
+
}
|
|
1624
1631
|
.border-y-8 {
|
|
1625
1632
|
border-top-width: 8px;
|
|
1626
1633
|
border-bottom-width: 8px;
|
|
@@ -1637,6 +1644,9 @@ video {
|
|
|
1637
1644
|
.border-l-\[16px\] {
|
|
1638
1645
|
border-left-width: 16px;
|
|
1639
1646
|
}
|
|
1647
|
+
.border-r {
|
|
1648
|
+
border-right-width: 1px;
|
|
1649
|
+
}
|
|
1640
1650
|
.border-t {
|
|
1641
1651
|
border-top-width: 1px;
|
|
1642
1652
|
}
|
|
@@ -1736,6 +1746,9 @@ video {
|
|
|
1736
1746
|
.bg-coreColors-pageColor {
|
|
1737
1747
|
background-color: var(--coreColors-pageColor);
|
|
1738
1748
|
}
|
|
1749
|
+
.bg-foreground {
|
|
1750
|
+
background-color: hsl(var(--foreground));
|
|
1751
|
+
}
|
|
1739
1752
|
.bg-gray-300 {
|
|
1740
1753
|
--tw-bg-opacity: 1;
|
|
1741
1754
|
background-color: rgb(209 213 219 / var(--tw-bg-opacity, 1));
|
|
@@ -1900,6 +1913,9 @@ video {
|
|
|
1900
1913
|
.pl-0 {
|
|
1901
1914
|
padding-left: 0px;
|
|
1902
1915
|
}
|
|
1916
|
+
.pl-1 {
|
|
1917
|
+
padding-left: 0.25rem;
|
|
1918
|
+
}
|
|
1903
1919
|
.pl-2 {
|
|
1904
1920
|
padding-left: 0.5rem;
|
|
1905
1921
|
}
|
|
@@ -1912,6 +1928,9 @@ video {
|
|
|
1912
1928
|
.pl-8 {
|
|
1913
1929
|
padding-left: 2rem;
|
|
1914
1930
|
}
|
|
1931
|
+
.pr-0 {
|
|
1932
|
+
padding-right: 0px;
|
|
1933
|
+
}
|
|
1915
1934
|
.pr-1 {
|
|
1916
1935
|
padding-right: 0.25rem;
|
|
1917
1936
|
}
|
|
@@ -2237,6 +2256,11 @@ video {
|
|
|
2237
2256
|
--tw-shadow-colored: calc(var(--buttonColors-secondaryShadowEnabled) * 0px) calc(var(--buttonColors-secondaryShadowEnabled) * 5px) calc(var(--buttonColors-secondaryShadowEnabled) * 25px) calc(var(--buttonColors-secondaryShadowEnabled)* 0px) rgb(0, 0, 0, 0.10);;
|
|
2238
2257
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2239
2258
|
}
|
|
2259
|
+
.shadow-sm {
|
|
2260
|
+
--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
2261
|
+
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
|
|
2262
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
2263
|
+
}
|
|
2240
2264
|
.shadow-buttonColors-primaryShadow {
|
|
2241
2265
|
--tw-shadow-color: var(--buttonColors-primaryShadow);
|
|
2242
2266
|
--tw-shadow: var(--tw-shadow-colored);
|
|
@@ -2279,6 +2303,14 @@ video {
|
|
|
2279
2303
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
2280
2304
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
2281
2305
|
}
|
|
2306
|
+
.ring-1 {
|
|
2307
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
2308
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
2309
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
2310
|
+
}
|
|
2311
|
+
.ring-ring {
|
|
2312
|
+
--tw-ring-color: hsl(var(--ring));
|
|
2313
|
+
}
|
|
2282
2314
|
.ring-offset-background {
|
|
2283
2315
|
--tw-ring-offset-color: hsl(var(--background));
|
|
2284
2316
|
}
|
|
@@ -2321,6 +2353,9 @@ video {
|
|
|
2321
2353
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
2322
2354
|
transition-duration: 150ms;
|
|
2323
2355
|
}
|
|
2356
|
+
.duration-1000 {
|
|
2357
|
+
transition-duration: 1000ms;
|
|
2358
|
+
}
|
|
2324
2359
|
.duration-150 {
|
|
2325
2360
|
transition-duration: 150ms;
|
|
2326
2361
|
}
|
|
@@ -2356,6 +2391,9 @@ video {
|
|
|
2356
2391
|
transform: translate3d(var(--tw-exit-translate-x, 0), var(--tw-exit-translate-y, 0), 0) scale3d(var(--tw-exit-scale, 1), var(--tw-exit-scale, 1), var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0));
|
|
2357
2392
|
}
|
|
2358
2393
|
}
|
|
2394
|
+
.duration-1000 {
|
|
2395
|
+
animation-duration: 1000ms;
|
|
2396
|
+
}
|
|
2359
2397
|
.duration-150 {
|
|
2360
2398
|
animation-duration: 150ms;
|
|
2361
2399
|
}
|
|
@@ -2486,6 +2524,20 @@ body::-webkit-scrollbar {
|
|
|
2486
2524
|
color: var(--textColors-secondaryColor, #727272ff);
|
|
2487
2525
|
}
|
|
2488
2526
|
|
|
2527
|
+
.first\:rounded-l-md:first-child {
|
|
2528
|
+
border-top-left-radius: calc(var(--radius) - 2px);
|
|
2529
|
+
border-bottom-left-radius: calc(var(--radius) - 2px);
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
.first\:border-l:first-child {
|
|
2533
|
+
border-left-width: 1px;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
.last\:rounded-r-md:last-child {
|
|
2537
|
+
border-top-right-radius: calc(var(--radius) - 2px);
|
|
2538
|
+
border-bottom-right-radius: calc(var(--radius) - 2px);
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2489
2541
|
.last\:border-b-0:last-child {
|
|
2490
2542
|
border-bottom-width: 0px;
|
|
2491
2543
|
}
|
|
@@ -2702,6 +2754,10 @@ body::-webkit-scrollbar {
|
|
|
2702
2754
|
opacity: 0.7;
|
|
2703
2755
|
}
|
|
2704
2756
|
|
|
2757
|
+
.has-\[\:disabled\]\:opacity-50:has(:disabled) {
|
|
2758
|
+
opacity: 0.5;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2705
2761
|
.data-\[disabled\]\:pointer-events-none[data-disabled] {
|
|
2706
2762
|
pointer-events: none;
|
|
2707
2763
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.58",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"embla-carousel-autoplay": "8.5.2",
|
|
82
82
|
"embla-carousel-fade": "8.5.2",
|
|
83
83
|
"embla-carousel-react": "^8.3.0",
|
|
84
|
+
"input-otp": "^1.4.2",
|
|
84
85
|
"lucide-react": "^0.488.0",
|
|
85
86
|
"next": "^14.2.28",
|
|
86
87
|
"next-themes": "^0.2.1",
|