@tapcart/mobile-components 0.7.66 → 0.7.68

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.
@@ -1 +1 @@
1
- {"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAMA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AA2JD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CA0C1C"}
1
+ {"version":3,"file":"use-order-details.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-order-details.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAClC,CAAA;AAkKD,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,EACN,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAY,GACb,EAAE,oBAAoB,GAAG,iBAAiB,CA6C1C"}
@@ -1,53 +1,6 @@
1
1
  "use client";
2
- import { getIdFromGid } from "../../lib/utils";
3
- import { useProducts } from "./use-products";
4
2
  import { useEffect, useMemo, useState } from "react";
5
- const getSellingPlan = (lineItems = [], productGid) => {
6
- var _a, _b;
7
- const productId = getIdFromGid(productGid);
8
- const item = lineItems.find((item) => { var _a, _b; return ((_b = (_a = item === null || item === void 0 ? void 0 : item.variant) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.id) === productId; });
9
- if (!item) {
10
- return;
11
- }
12
- return (_b = (_a = item === null || item === void 0 ? void 0 : item.sellingPlanAllocation) === null || _a === void 0 ? void 0 : _a.sellingPlan) === null || _b === void 0 ? void 0 : _b.name;
13
- };
14
- const getSalesAmount = (lines) => {
15
- return lines === null || lines === void 0 ? void 0 : lines.reduce((acc, line) => {
16
- const sale = line.sale ? parseFloat(line.sale) : 0;
17
- return acc + sale * line.quantity;
18
- }, 0);
19
- };
20
- const getSubtotal = (lines) => {
21
- return lines === null || lines === void 0 ? void 0 : lines.reduce((acc, line) => {
22
- const price = parseFloat(line.compareAtPrice ? line.compareAtPrice.amount : line.price.amount);
23
- return acc + price * line.quantity;
24
- }, 0);
25
- };
26
- const findProductById = (products, productId) => products.find((product) => product.id === productId);
27
- const findVariantById = (variants, merchandiseId) => variants.find((variant) => variant.id === merchandiseId);
28
- const calculateSale = (compareAtPrice, price) => parseFloat(compareAtPrice) - parseFloat(price);
29
- const updateLineWithVariantDetails = (line, variant) => {
30
- var _a;
31
- line.compareAtPrice = variant.compareAtPrice;
32
- line.variantName = variant.title;
33
- line.sale = ((_a = variant.compareAtPrice) === null || _a === void 0 ? void 0 : _a.amount)
34
- ? calculateSale(variant.compareAtPrice.amount, variant.price.amount)
35
- : 0;
36
- };
37
- const updateLineDetails = (line, products, checkoutData) => {
38
- const product = findProductById(products, line.productId);
39
- if (!product)
40
- return;
41
- line.title = product.title;
42
- line.vendor = product.vendor;
43
- if (checkoutData && checkoutData.lineItems) {
44
- line.sellingPlan = getSellingPlan(checkoutData.lineItems, line.productId);
45
- }
46
- const productVariant = findVariantById(product.variants, line.merchandiseId);
47
- if (productVariant) {
48
- updateLineWithVariantDetails(line, productVariant);
49
- }
50
- };
3
+ import { useProducts } from "./use-products";
51
4
  const getProductIds = (lines) => lines === null || lines === void 0 ? void 0 : lines.map((line) => line.productId);
52
5
  const calculateCompareAtPrice = (variant) => {
53
6
  var _a, _b, _c, _d;
@@ -75,34 +28,46 @@ const createCartLines = (product, variant, compareAtPrice) => {
75
28
  price: variant === null || variant === void 0 ? void 0 : variant.price,
76
29
  compareAtPrice,
77
30
  variantName: variant.title,
78
- sale: calculateSale(compareAtPrice.amount, variant.price.amount),
79
31
  },
80
32
  ];
81
33
  };
82
- const calculateCartPrice = (variant, lines) => {
83
- var _a;
84
- const subtotal = (_a = calculateCompareAtPrice(variant)) === null || _a === void 0 ? void 0 : _a.amount;
85
- const salesAmount = getSalesAmount(lines);
86
- const discounts = [
34
+ const calculateCartPrice = (lines) => {
35
+ const subtotal = lines[0].price;
36
+ const orderLevelDiscounts = [
37
+ {
38
+ title: "APP15",
39
+ valueType: "percentage",
40
+ value: { currencyCode: "USD", amount: 15.0 },
41
+ applicationType: "code",
42
+ },
43
+ ];
44
+ const shippingLevelDiscounts = [
87
45
  {
88
- amount: { currencyCode: "USD", amount: 5.0 },
89
- title: "WELCOME20",
46
+ title: "FREESHIPPING",
90
47
  valueType: "percentage",
91
- value: 15,
48
+ value: { currencyCode: "USD", amount: 30.0 },
92
49
  applicationType: "code",
93
50
  },
94
51
  ];
95
52
  const taxes = { amount: 5.0, currencyCode: "USD" };
53
+ const oldShipping = { amount: 30, currencyCode: "USD" };
96
54
  const shipping = { amount: 0, currencyCode: "USD" };
97
55
  const total = {
98
- amount: subtotal -
99
- salesAmount -
100
- discounts[0].amount.amount -
56
+ amount: subtotal.amount -
57
+ orderLevelDiscounts[0].value.amount -
101
58
  20 + // Payment method amount
102
59
  taxes.amount,
103
60
  currencyCode: "USD",
104
61
  };
105
- return { subtotal, salesAmount, discounts, taxes, shipping, total };
62
+ return {
63
+ subtotal,
64
+ orderLevelDiscounts,
65
+ shippingLevelDiscounts,
66
+ taxes,
67
+ shipping,
68
+ oldShipping,
69
+ total,
70
+ };
106
71
  };
107
72
  const updateOrderDetails = (orderDetails, products) => {
108
73
  const product = products[0];
@@ -112,7 +77,49 @@ const updateOrderDetails = (orderDetails, products) => {
112
77
  orderDetails.cart = {
113
78
  lines: createCartLines(product, variant, compareAtPrice),
114
79
  };
115
- orderDetails.cart.price = calculateCartPrice(variant, orderDetails.cart.lines);
80
+ orderDetails.cart.price = calculateCartPrice(orderDetails.cart.lines);
81
+ };
82
+ const mapDiscountsByType = (discounts = [], type) => {
83
+ return discounts.filter((discount) => discount.targetType === type && discount.targetSelection === "ALL");
84
+ };
85
+ const mapShippingDiscount = (discounts = [], shipping) => {
86
+ const mappedDiscounts = mapDiscountsByType(discounts, "SHIPPING_LINE");
87
+ return mappedDiscounts.map((discount) => {
88
+ var _a;
89
+ return (Object.assign(Object.assign({}, discount), { value: {
90
+ currencyCode: shipping.currencyCode,
91
+ amount: ((shipping === null || shipping === void 0 ? void 0 : shipping.amount) * ((_a = discount.value) === null || _a === void 0 ? void 0 : _a.percentage)) / 100,
92
+ } }));
93
+ });
94
+ };
95
+ const updateCartPriceDetails = (orderDetails, checkoutData) => {
96
+ var _a;
97
+ const newCartPrice = {
98
+ subtotal: checkoutData.subtotalPrice,
99
+ orderLevelDiscounts: mapDiscountsByType(checkoutData.discountApplications, "LINE_ITEM"),
100
+ shippingLevelDiscounts: mapShippingDiscount(checkoutData.discountApplications, orderDetails.cart.price.shipping),
101
+ total: checkoutData.totalPrice,
102
+ taxes: checkoutData.totalTax,
103
+ shipping: (_a = checkoutData.shippingLine) === null || _a === void 0 ? void 0 : _a.price,
104
+ oldShipping: orderDetails.cart.price.shipping,
105
+ };
106
+ orderDetails.cart.price = newCartPrice;
107
+ };
108
+ const updateLineDetails = (line, product) => {
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
110
+ if (!product) {
111
+ return;
112
+ }
113
+ line.uniqueId = crypto.randomUUID();
114
+ line.title = (_b = (_a = product.variant) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.title;
115
+ line.vendor = (_d = (_c = product.variant) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.vendor;
116
+ line.compareAtPrice = {
117
+ amount: ((_f = (_e = product === null || product === void 0 ? void 0 : product.variant) === null || _e === void 0 ? void 0 : _e.price) === null || _f === void 0 ? void 0 : _f.amount) * (product === null || product === void 0 ? void 0 : product.quantity),
118
+ currencyCode: (_h = (_g = product === null || product === void 0 ? void 0 : product.variant) === null || _g === void 0 ? void 0 : _g.price) === null || _h === void 0 ? void 0 : _h.currencyCode,
119
+ };
120
+ line.price = product.finalLinePrice;
121
+ line.sellingPlan = (_k = (_j = product.sellingPlanAllocation) === null || _j === void 0 ? void 0 : _j.sellingPlan) === null || _k === void 0 ? void 0 : _k.name;
122
+ line.variantName = (_l = product.variant) === null || _l === void 0 ? void 0 : _l.title;
116
123
  };
117
124
  export function useOrderDetails({ variables, apiUrl, appId, language, country, mock = false, }) {
118
125
  const [orderDetails, setOrderDetails] = useState({});
@@ -128,20 +135,25 @@ export function useOrderDetails({ variables, apiUrl, appId, language, country, m
128
135
  mock,
129
136
  });
130
137
  useEffect(() => {
131
- var _a, _b, _c, _d;
138
+ var _a, _b;
132
139
  if (products.length > 0) {
133
140
  const updatedOrderDetails = Object.assign({}, variables === null || variables === void 0 ? void 0 : variables.orderDetails);
134
141
  if (mock) {
135
142
  updateOrderDetails(updatedOrderDetails, products);
136
143
  }
137
144
  else {
138
- (_b = (_a = updatedOrderDetails === null || updatedOrderDetails === void 0 ? void 0 : updatedOrderDetails.cart) === null || _a === void 0 ? void 0 : _a.lines) === null || _b === void 0 ? void 0 : _b.forEach((line) => updateLineDetails(line, products, variables.checkoutData));
139
- updatedOrderDetails.cart.price.salesAmount = getSalesAmount((_c = updatedOrderDetails === null || updatedOrderDetails === void 0 ? void 0 : updatedOrderDetails.cart) === null || _c === void 0 ? void 0 : _c.lines);
140
- updatedOrderDetails.cart.price.subtotal = getSubtotal((_d = updatedOrderDetails === null || updatedOrderDetails === void 0 ? void 0 : updatedOrderDetails.cart) === null || _d === void 0 ? void 0 : _d.lines);
145
+ (_b = (_a = updatedOrderDetails === null || updatedOrderDetails === void 0 ? void 0 : updatedOrderDetails.cart) === null || _a === void 0 ? void 0 : _a.lines) === null || _b === void 0 ? void 0 : _b.forEach((line, index) => {
146
+ if (variables.checkoutData &&
147
+ variables.checkoutData.lineItems &&
148
+ variables.checkoutData.lineItems.length > 0) {
149
+ updateLineDetails(line, variables.checkoutData.lineItems[index]);
150
+ }
151
+ });
152
+ updateCartPriceDetails(updatedOrderDetails, variables.checkoutData);
141
153
  }
142
154
  setOrderDetails(updatedOrderDetails);
143
155
  }
144
- }, [products, products, mock, variables === null || variables === void 0 ? void 0 : variables.orderDetails]);
156
+ }, [products, mock, variables === null || variables === void 0 ? void 0 : variables.orderDetails]);
145
157
  return {
146
158
  orderDetails,
147
159
  };
@@ -13,7 +13,7 @@ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElemen
13
13
  labelClassName?: string;
14
14
  labelStyle?: React.CSSProperties | undefined;
15
15
  iconColor?: string;
16
- iconSize?: string;
16
+ iconSize?: "xs" | "sm" | "md" | "lg" | null | undefined;
17
17
  iconStrokeColor?: string;
18
18
  iconClassName?: string;
19
19
  iconPosition?: "left" | "right";
@@ -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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"./text";
19
19
  import { useTap } from "./tap";
20
20
  import { useMergeRefs } from "../hooks/use-merge-refs";
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", {
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 disabled:opacity-70 cursor-pointer", {
22
22
  variants: {
23
23
  size: {
24
- default: "py-3 px-4",
24
+ default: "py-2 px-3",
25
25
  sm: "px-3 rounded-md",
26
26
  lg: "px-8 rounded-md",
27
27
  icon: "p-3 w-auto",
28
- content: "py-3 px-4 w-auto",
28
+ content: "py-2 px-4 w-auto",
29
29
  },
30
30
  variant: {
31
31
  default: "bg-buttonColors-primaryFill border border-buttonColors-primaryOutlineColor shadow-primary",
@@ -86,7 +86,8 @@ const Button = React.forwardRef((_a, ref) => {
86
86
  const mergedRef = useMergeRefs(ref, tapRef);
87
87
  const Comp = asChild ? Slot : "button";
88
88
  const IconButton = () => icon || iconUrl ? (_jsx(Icon, { name: icon, url: iconUrl, size: "sm", style: { color: iconColor } })) : null;
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 }), {
89
+ // TODO: need to refactor icon sizing. This isnt extensible.
90
+ const BasicButton = () => (_jsxs(_Fragment, { children: [icon || iconUrl ? (_jsx(Icon, { name: iconUrl ? undefined : icon, url: iconUrl, size: iconSize ? iconSize : "sm", className: cn(iconVariants({ variant }), {
90
91
  "mr-2": iconPosition === "left",
91
92
  "ml-2": iconPosition === "right",
92
93
  }, iconClassName), style: { color: iconColor } })) : null, !loading ? (_jsx(Text, Object.assign({ type: "body-primary", className: cn(labelVariants({ variant }), labelClassName), style: labelStyle }, { children: props.children }))) : (_jsx(_Fragment, {}))] }));
@@ -15,6 +15,7 @@ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement
15
15
  inputStyle?: React.CSSProperties;
16
16
  buttonStyle?: React.CSSProperties;
17
17
  buttonCornerRadius?: number;
18
+ max?: number;
18
19
  }
19
20
  declare const QuantityPicker: React.ForwardRefExoticComponent<QuantityPickerProps & React.RefAttributes<HTMLDivElement>>;
20
21
  export { QuantityPicker };
@@ -1 +1 @@
1
- {"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAmCD,QAAA,MAAM,cAAc,4FAuFnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
1
+ {"version":3,"file":"quantity-picker.d.ts","sourceRoot":"","sources":["../../../components/ui/quantity-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAA;IACxC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAmCD,QAAA,MAAM,cAAc,4FAoGnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -22,7 +22,9 @@ const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled })
22
22
  } }) })));
23
23
  };
24
24
  const QuantityPicker = React.forwardRef((_a, ref) => {
25
- var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius"]);
25
+ var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, isDecreaseDisabled, isIncreaseDisabled, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4, max = 99 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "isDecreaseDisabled", "isIncreaseDisabled", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius", "max"]);
26
+ const [isFocused, setIsFocused] = React.useState(false);
27
+ const [localValue, setLocalValue] = React.useState(value);
26
28
  const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
27
29
  ? `${buttonCornerRadius}px`
28
30
  : undefined, borderBottomLeftRadius: buttonCornerRadius
@@ -34,7 +36,13 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
34
36
  ? `${buttonCornerRadius}px`
35
37
  : undefined });
36
38
  const singleButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderRadius: buttonCornerRadius ? `${buttonCornerRadius}px` : undefined });
37
- return (_jsx("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, style: singleButtonStyle })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, style: leftButtonStyle, disabled: isDecreaseDisabled }), _jsx("input", { type: "text", pattern: "[0-9]*", value: value, onBlur: (e) => (e.target.value = value.toString()), onFocus: (e) => (e.target.value = ""), onChange: (e) => setValue(parseInt(e.target.value) || 0), className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style: inputStyle }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled })] })) })));
39
+ return (_jsx("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, style: singleButtonStyle })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, style: leftButtonStyle, disabled: isDecreaseDisabled }), _jsx("input", { type: "number", pattern: "[0-9]*", max: max, value: isFocused ? localValue : value, onBlur: (e) => {
40
+ setIsFocused(false);
41
+ setValue(Math.min(parseInt(e.target.value) || 0, max));
42
+ }, onFocus: (e) => {
43
+ setIsFocused(true);
44
+ setLocalValue(value);
45
+ }, onChange: (e) => setLocalValue(Math.min(parseInt(e.target.value), max)), className: "w-8 h-7 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor border-t border-b border-coreColors-dividingLines", style: inputStyle, inputMode: "numeric" }), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, style: rightButtonStyle, disabled: isIncreaseDisabled })] })) })));
38
46
  });
39
47
  QuantityPicker.displayName = "QuantityPicker";
40
48
  export { QuantityPicker };
@@ -13,6 +13,6 @@ declare const virtualGridVariants: (props?: ({
13
13
  } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
14
14
  export interface VirtualGridProps extends GridType, VariantProps<typeof virtualGridVariants> {
15
15
  }
16
- declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem, ...props }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function VirtualGrid({ className, columns, children, overscan, estimatedHeight, isLoadingMore, loaderItem, }: VirtualGridProps): import("react/jsx-runtime").JSX.Element;
17
17
  export { VirtualGrid, virtualGridVariants };
18
18
  //# sourceMappingURL=virtual-grid.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAMjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAa,EACb,eAAqB,EACrB,aAAa,EACb,UAAU,EACV,GAAG,KAAK,EACT,EAAE,gBAAgB,2CAkElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
1
+ {"version":3,"file":"virtual-grid.d.ts","sourceRoot":"","sources":["../../../components/ui/virtual-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,UAAU,QAAQ;IAChB,SAAS,EAAE,GAAG,CAAA;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,aAAa,EAAE,OAAO,CAAA;IACtB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,QAAA,MAAM,mBAAmB;;mFAYvB,CAAA;AAEF,MAAM,WAAW,gBACf,SAAQ,QAAQ,EACd,YAAY,CAAC,OAAO,mBAAmB,CAAC;CAAG;AAE/C,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAY,EACZ,eAAqB,EACrB,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,2CA4ElB;AAED,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
@@ -1,18 +1,6 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { jsx as _jsx } from "react/jsx-runtime";
13
2
  import * as React from "react";
14
3
  import { cva } from "class-variance-authority";
15
- import { Container } from "./container";
16
4
  import { useVirtual } from "react-virtual";
17
5
  import { cn } from "../../lib/utils";
18
6
  const virtualGridVariants = cva("grid", {
@@ -28,38 +16,47 @@ const virtualGridVariants = cva("grid", {
28
16
  columns: 2,
29
17
  },
30
18
  });
31
- function VirtualGrid(_a) {
32
- var { className, columns, children, overscan = 50, estimatedHeight = 375, isLoadingMore, loaderItem } = _a, props = __rest(_a, ["className", "columns", "children", "overscan", "estimatedHeight", "isLoadingMore", "loaderItem"]);
33
- const NUM_LOADER_ITEMS = 8;
19
+ function VirtualGrid({ className, columns, children, overscan = 4, estimatedHeight = 375, isLoadingMore, loaderItem, }) {
20
+ const NUM_LOADER_ITEMS = columns || 2;
34
21
  const col = columns || 2;
35
- const parentRef = React.useRef(null);
22
+ const parentRef = React.useRef(document.getElementById("tc-vgsl"));
36
23
  const childrenArray = React.Children.toArray(children);
37
24
  const rowCount = Math.ceil(childrenArray.length / col);
38
- const loaderRowCount = Math.ceil(NUM_LOADER_ITEMS / col);
39
- const totalItems = isLoadingMore ? rowCount + loaderRowCount : rowCount;
25
+ const totalItems = rowCount + (isLoadingMore ? 1 : 0);
40
26
  const rowVirtualizer = useVirtual({
41
27
  size: totalItems,
42
28
  parentRef,
43
29
  estimateSize: React.useCallback(() => estimatedHeight, []),
44
30
  overscan,
31
+ initialRect: { width: 0, height: estimatedHeight },
45
32
  });
46
- React.useEffect(() => {
47
- rowVirtualizer.measure();
48
- }, [childrenArray.length]);
49
- return (_jsx(Container, Object.assign({ style: { padding: "0" } }, { children: _jsx("div", Object.assign({ ref: parentRef }, { children: _jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns }), className), style: {
50
- height: rowVirtualizer.totalSize,
51
- } }, props, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
52
- const rowStartIndex = virtualRow.index * col;
53
- // Render loader as a full row if we're loading and this is the last virtual row
54
- if (isLoadingMore && virtualRow.index === rowCount - 1) {
55
- return (_jsx(React.Fragment, { children: Array.from({ length: NUM_LOADER_ITEMS }).map((_, index) => (_jsx("div", Object.assign({ ref: virtualRow.measureRef }, { children: loaderItem }), index))) }, "loader"));
56
- }
57
- return (_jsx(React.Fragment, { children: Array.from({ length: col }).map((_, colIndex) => {
58
- const index = rowStartIndex + colIndex;
59
- if (index >= childrenArray.length)
60
- return null;
61
- return (_jsx("div", Object.assign({ ref: virtualRow.measureRef }, { children: childrenArray[index] }), index));
62
- }) }, virtualRow.index));
63
- }) })) })) })));
33
+ return (_jsx("div", Object.assign({ style: {
34
+ width: "100%",
35
+ position: "relative",
36
+ willChange: "transform",
37
+ }, className: cn(virtualGridVariants({ columns }), className) }, { children: rowVirtualizer.virtualItems.map((virtualRow) => {
38
+ const rowStartIndex = virtualRow.index * col;
39
+ if (isLoadingMore && virtualRow.index === rowCount) {
40
+ return (_jsx("div", Object.assign({ style: {
41
+ position: "absolute",
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ transform: `translateY(${virtualRow.start}px)`,
46
+ }, className: cn(virtualGridVariants({ columns })), ref: virtualRow.measureRef }, { children: Array.from({ length: NUM_LOADER_ITEMS }).map((_, index) => (_jsx("div", { children: loaderItem }, index))) }), `loader-row-${virtualRow.index}`));
47
+ }
48
+ return (_jsx("div", Object.assign({ className: cn(virtualGridVariants({ columns })), style: {
49
+ position: "absolute",
50
+ top: 0,
51
+ left: 0,
52
+ width: "100%",
53
+ transform: `translateY(${virtualRow.start}px)`,
54
+ }, ref: virtualRow.measureRef }, { children: Array.from({ length: col }).map((_, colIndex) => {
55
+ const index = rowStartIndex + colIndex;
56
+ if (index >= childrenArray.length)
57
+ return null;
58
+ return _jsx("div", { children: childrenArray[index] }, index);
59
+ }) }), `row-${virtualRow.index}`));
60
+ }) })));
64
61
  }
65
62
  export { VirtualGrid, virtualGridVariants };
@@ -7,6 +7,8 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
7
7
  onClick?: () => void;
8
8
  className?: string;
9
9
  imgUrl?: string;
10
+ imgRightBorderRadius?: number;
11
+ imgLeftBorderRadius?: number;
10
12
  aspectRatio?: string;
11
13
  objectFit?: "none" | "fit" | "fill" | "cover" | "contain" | "scale-down";
12
14
  isTrigger?: boolean;
@@ -14,7 +16,10 @@ export interface WishlistProps extends React.ButtonHTMLAttributes<HTMLButtonElem
14
16
  nameStyle?: React.CSSProperties;
15
17
  amountStyle?: React.CSSProperties;
16
18
  }
17
- declare const PlaceholderIcon: () => import("react/jsx-runtime").JSX.Element;
19
+ declare const PlaceholderIcon: ({ rightBorderRadius, leftBorderRadius, }: {
20
+ rightBorderRadius?: number | undefined;
21
+ leftBorderRadius?: number | undefined;
22
+ }) => import("react/jsx-runtime").JSX.Element;
18
23
  declare const Wishlist: React.ForwardRefExoticComponent<WishlistProps & React.RefAttributes<HTMLButtonElement>>;
19
24
  export interface CreateNewProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
20
25
  selected?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"wishlist.d.ts","sourceRoot":"","sources":["../../../components/ui/wishlist.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAA;IACxE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,YAAY,CAAA;IAC1B,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAClC;AAED,QAAA,MAAM,eAAe,+CASpB,CAAA;AAED,QAAA,MAAM,QAAQ,yFA2Eb,CAAA;AAID,MAAM,WAAW,cACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED,QAAA,MAAM,SAAS,0FAwBd,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAA"}
1
+ {"version":3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
  import { Text } from "./text";
16
16
  import { cn } from "../../lib/utils";
17
17
  import { Icon } from "./icon";
18
- const PlaceholderIcon = () => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
18
+ const PlaceholderIcon = ({ rightBorderRadius, leftBorderRadius, }) => (_jsx("div", Object.assign({ className: "flex items-center justify-center h-10 w-10 bg-stateColors-skeleton rounded-sm", style: {
19
19
  flex: "0 1 auto",
20
+ borderTopRightRadius: `${rightBorderRadius}px`,
21
+ borderBottomRightRadius: `${rightBorderRadius}px`,
22
+ borderTopLeftRadius: `${leftBorderRadius}px`,
23
+ borderBottomLeftRadius: `${leftBorderRadius}px`,
20
24
  } }, { children: _jsx(Icon, { name: "heart-filled", size: "sm", color: "coreColors-secondaryIcon" }) })));
21
25
  const Wishlist = React.forwardRef((_a, ref) => {
22
- var { selected = false, onClick, className, name, amount, imgUrl, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
23
- return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines rounded-sm overflow-hidden", style: {
26
+ var { selected = false, onClick, className, name, amount, imgUrl, imgRightBorderRadius = 4, imgLeftBorderRadius = 0, aspectRatio, objectFit, isTrigger, translations, nameStyle, amountStyle } = _a, props = __rest(_a, ["selected", "onClick", "className", "name", "amount", "imgUrl", "imgRightBorderRadius", "imgLeftBorderRadius", "aspectRatio", "objectFit", "isTrigger", "translations", "nameStyle", "amountStyle"]);
27
+ return (_jsxs("button", Object.assign({ className: cn("flex flex-row items-center px-4 py-2 w-full ", selected ? "bg-stateColors-skeleton" : "", className), ref: ref, onClick: onClick }, props, { children: [imgUrl ? (_jsx("div", Object.assign({ className: "h-10 w-10 border border-coreColors-dividingLines overflow-hidden", style: {
24
28
  flex: "0 1 auto",
25
- } }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("rounded-sm w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover") }) }))) : (_jsx(PlaceholderIcon, {})), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
29
+ borderTopRightRadius: `${imgRightBorderRadius}px`,
30
+ borderBottomRightRadius: `${imgRightBorderRadius}px`,
31
+ borderTopLeftRadius: `${imgLeftBorderRadius}px`,
32
+ borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
33
+ } }, { children: _jsx("img", { alt: "wishlist-image", src: `${imgUrl}?width=40`, width: 40, height: 40, className: cn("w-full h-full", objectFit === "contain" ? "object-contain" : "object-cover"), style: {
34
+ borderTopRightRadius: `${imgRightBorderRadius}px`,
35
+ borderBottomRightRadius: `${imgRightBorderRadius}px`,
36
+ borderTopLeftRadius: `${imgLeftBorderRadius}px`,
37
+ borderBottomLeftRadius: `${imgLeftBorderRadius}px`,
38
+ } }) }))) : (_jsx(PlaceholderIcon, { rightBorderRadius: imgRightBorderRadius, leftBorderRadius: imgLeftBorderRadius })), _jsxs("div", Object.assign({ className: "flex flex-col flex-1 items-start mx-2 overflow-hidden" }, { children: [isTrigger && _jsx(Text, Object.assign({ type: "body-secondary" }, { children: "Wishlists" })), _jsx(Text, Object.assign({ type: "body-primary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: nameStyle }, { children: name })), !isTrigger && (_jsx(Text, Object.assign({ type: "body-secondary", className: "w-full overflow-hidden text-ellipsis whitespace-nowrap text-left", style: amountStyle }, { children: `${amount} ${amount !== 1
26
39
  ? translations["checkout-summary-items"]
27
40
  : translations["checkout-summary-item"]}` })))] }))] })));
28
41
  });
@@ -1 +1 @@
1
- {"version":3,"file":"cart.util.d.ts","sourceRoot":"","sources":["../../lib/cart.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AAuCzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,QAAQ,YAAY,YAGpE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,QAAQ,YAAY,YAGlE,CAAA;AAqGD,MAAM,MAAM,cAAc,GAAG;IAC3B,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;CAC7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,cASrC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,YAAY,KAAG,cA4B1D,CAAA"}
1
+ {"version":3,"file":"cart.util.d.ts","sourceRoot":"","sources":["../../lib/cart.util.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,6BAA6B,EAC9B,MAAM,kBAAkB,CAAA;AA2CzB,eAAO,MAAM,oBAAoB,SAAU,MAAM,QAAQ,YAAY,YAGpE,CAAA;AAED,eAAO,MAAM,kBAAkB,SAAU,MAAM,QAAQ,YAAY,YAGlE,CAAA;AAqGD,MAAM,MAAM,cAAc,GAAG;IAC3B,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;CAC7B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,cASrC,CAAA;AAED,eAAO,MAAM,qBAAqB,SAAU,YAAY,KAAG,cA4B1D,CAAA"}
@@ -2,7 +2,7 @@ const getOrderLevelDiscounts = (cart) => {
2
2
  var _a;
3
3
  const discountMap = (_a = cart.discountAllocations) === null || _a === void 0 ? void 0 : _a.filter((discount) => discount.targetType !== "SHIPPING_LINE").reduce((acc, discount) => {
4
4
  var _a;
5
- const code = (_a = discount.code) !== null && _a !== void 0 ? _a : "unknown";
5
+ const code = ((_a = discount.code) !== null && _a !== void 0 ? _a : "unknown").toUpperCase();
6
6
  if (!acc[code]) {
7
7
  acc[code] = 0;
8
8
  }
@@ -18,7 +18,9 @@ const getOrderLevelDiscounts = (cart) => {
18
18
  name: `Discount - ${code}`,
19
19
  type: "ORDER_LEVEL",
20
20
  }))
21
- .filter((discount) => cart.discounts.includes(discount.id));
21
+ .filter((discount) => cart.discounts
22
+ .map((d) => d.toUpperCase())
23
+ .includes(discount.id.toUpperCase()));
22
24
  };
23
25
  const getShippingDiscounts = (cart) => {
24
26
  var _a;
@@ -89,7 +89,7 @@ describe("cart-provider.util", () => {
89
89
  expect(result.isFreeShipping).toBe(true);
90
90
  });
91
91
  it("should calculate total discounted price correctly", () => {
92
- const mockCart = Object.assign(Object.assign({}, baseCartData), { discounts: ["DISCOUNT10"], items: [
92
+ const mockCart = Object.assign(Object.assign({}, baseCartData), { discounts: ["Discount10"], items: [
93
93
  {
94
94
  id: "line1",
95
95
  quantity: 1,
@@ -132,7 +132,7 @@ describe("cart-provider.util", () => {
132
132
  {
133
133
  targetType: DiscountApplicationTargetType.LineItem,
134
134
  discountedAmount: { amount: "10.00", currencyCode: "USD" },
135
- code: "DISCOUNT10",
135
+ code: "DiScOUnT10",
136
136
  },
137
137
  ], appliedGiftCards: [
138
138
  {
package/dist/styles.css CHANGED
@@ -1730,6 +1730,9 @@ video {
1730
1730
  .pb-2 {
1731
1731
  padding-bottom: 0.5rem;
1732
1732
  }
1733
+ .pb-3 {
1734
+ padding-bottom: 0.75rem;
1735
+ }
1733
1736
  .pb-4 {
1734
1737
  padding-bottom: 1rem;
1735
1738
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.66",
3
+ "version": "0.7.68",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",
@@ -45,7 +45,7 @@
45
45
  "eslint-config-custom": "workspace:*",
46
46
  "jest": "^29.7.0",
47
47
  "jest-environment-jsdom": "^29.7.0",
48
- "postcss": "^8.5.2",
48
+ "postcss": "^8.4.24",
49
49
  "tailwindcss": "^3.3.2",
50
50
  "ts-jest": "^29.2.5",
51
51
  "tsc-alias": "^1.8.10",