@tapcart/mobile-components 0.7.63 → 0.7.65
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/hooks/use-mock-cart.d.ts +12 -5
- package/dist/components/hooks/use-mock-cart.d.ts.map +1 -1
- package/dist/components/hooks/use-mock-cart.js +10 -11
- package/dist/components/ui/apple-pay-button.d.ts +2 -1
- package/dist/components/ui/apple-pay-button.d.ts.map +1 -1
- package/dist/components/ui/apple-pay-button.js +8 -4
- package/dist/components/ui/quantity-picker.d.ts +2 -0
- package/dist/components/ui/quantity-picker.d.ts.map +1 -1
- package/dist/components/ui/quantity-picker.js +4 -4
- package/dist/components/ui/tap.d.ts.map +1 -1
- package/dist/components/ui/tap.js +12 -2
- package/dist/components/ui/wishlist.js +1 -1
- package/dist/lib/cart.util.test.js +1 -0
- package/dist/styles.css +0 -6
- package/package.json +5 -5
|
@@ -47,7 +47,7 @@ export declare const useMockCart: ({ apiUrl, appId, enabled, limit, }: UseMockCa
|
|
|
47
47
|
createdAt: string;
|
|
48
48
|
displayName: string;
|
|
49
49
|
inventoryPolicy: "continue" | "deny";
|
|
50
|
-
|
|
50
|
+
quantityAvailable: number;
|
|
51
51
|
legacyResourceId: string;
|
|
52
52
|
metafield?: import("app-studio-types").Metafield | undefined;
|
|
53
53
|
position: number;
|
|
@@ -60,10 +60,16 @@ export declare const useMockCart: ({ apiUrl, appId, enabled, limit, }: UseMockCa
|
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
62
|
sellingPlanAllocation: {
|
|
63
|
-
priceAdjustments:
|
|
64
|
-
perDeliveryPrice:
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
priceAdjustments: {
|
|
64
|
+
perDeliveryPrice: {
|
|
65
|
+
amount: string;
|
|
66
|
+
currencyCode: string;
|
|
67
|
+
};
|
|
68
|
+
price: {
|
|
69
|
+
amount: string;
|
|
70
|
+
currencyCode: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
67
73
|
sellingPlan: {
|
|
68
74
|
id: string;
|
|
69
75
|
name: string;
|
|
@@ -154,6 +160,7 @@ export declare const useMockCart: ({ apiUrl, appId, enabled, limit, }: UseMockCa
|
|
|
154
160
|
currencyCode: string;
|
|
155
161
|
};
|
|
156
162
|
}[];
|
|
163
|
+
checkoutUrl: string;
|
|
157
164
|
};
|
|
158
165
|
};
|
|
159
166
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mock-cart.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-mock-cart.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"use-mock-cart.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-mock-cart.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAgLhF,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,eAAO,MAAM,WAAW,uCAKrB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCnB,CAAA"}
|
|
@@ -27,6 +27,7 @@ const cartMock = {
|
|
|
27
27
|
presentmentAmountUsed: { amount: "10.00", currencyCode: "USD" },
|
|
28
28
|
},
|
|
29
29
|
],
|
|
30
|
+
checkoutUrl: "",
|
|
30
31
|
};
|
|
31
32
|
const transformCart = ({ products, cartOrigin = cartMock, }) => {
|
|
32
33
|
let subtotal = cartOrigin.subtotal;
|
|
@@ -59,18 +60,16 @@ const transformCart = ({ products, cartOrigin = cartMock, }) => {
|
|
|
59
60
|
}
|
|
60
61
|
const sellingPlanAllocation = i === 0
|
|
61
62
|
? {
|
|
62
|
-
priceAdjustments:
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
currencyCode: "USD",
|
|
67
|
-
},
|
|
68
|
-
price: {
|
|
69
|
-
amount: price,
|
|
70
|
-
currencyCode: "USD",
|
|
71
|
-
},
|
|
63
|
+
priceAdjustments: {
|
|
64
|
+
perDeliveryPrice: {
|
|
65
|
+
amount: price.toString(),
|
|
66
|
+
currencyCode: "USD",
|
|
72
67
|
},
|
|
73
|
-
|
|
68
|
+
price: {
|
|
69
|
+
amount: price.toString(),
|
|
70
|
+
currencyCode: "USD",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
74
73
|
sellingPlan: {
|
|
75
74
|
id: "gid://shopify/SellingPlan/123",
|
|
76
75
|
name: "Delivery every 30 Days",
|
|
@@ -25,12 +25,13 @@ export interface ApplePayButtonProps extends React.ButtonHTMLAttributes<HTMLButt
|
|
|
25
25
|
boxSizing?: string | undefined;
|
|
26
26
|
};
|
|
27
27
|
onPaymentAuthorized?: (paymentData: ApplePayJS.ApplePayPayment) => Promise<boolean>;
|
|
28
|
+
onPaymentMethodSelected?: (paymentMethod: ApplePayJS.ApplePayPaymentMethod) => Promise<ApplePayJS.ApplePayPaymentMethodUpdate>;
|
|
28
29
|
onShippingContactSelected?: (shippingContact: ApplePayJS.ApplePayPaymentContact) => Promise<ApplePayJS.ApplePayShippingMethodUpdate>;
|
|
29
30
|
onShippingMethodSelected?: (shippingMethod: ApplePayJS.ApplePayShippingMethod) => Promise<ApplePayJS.ApplePayShippingMethodUpdate>;
|
|
30
31
|
onPaymentCancelled?: (event?: ApplePayJS.Event) => void;
|
|
31
32
|
}
|
|
32
33
|
declare const ApplePayButton: {
|
|
33
|
-
({ displayName, amount, requiredBillingContactFields, requiredShippingContactFields, startSessionURL, startSessionCacheBypass, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, applePayButtonStyle, onPaymentAuthorized, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
({ displayName, amount, requiredBillingContactFields, requiredShippingContactFields, startSessionURL, startSessionCacheBypass, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, applePayButtonStyle, onPaymentAuthorized, onPaymentMethodSelected, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
34
35
|
displayName: string;
|
|
35
36
|
};
|
|
36
37
|
export { ApplePayButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple-pay-button.d.ts","sourceRoot":"","sources":["../../../components/ui/apple-pay-button.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,WAAW,GACX,MAAM,GACN,KAAK,GACL,WAAW,GACX,UAAU,GACV,YAAY,GACZ,QAAQ,GACR,OAAO,GACP,KAAK,GACL,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,WAAW,GACX,SAAS,GACT,KAAK,GACL,QAAQ,CAAA;AAEZ,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,CAAA;AAErE,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B,CAAC,EAAE,UAAU,CAAC,oBAAoB,EAAE,CAAA;IAChE,6BAA6B,CAAC,EAAE,UAAU,CAAC,oBAAoB,EAAE,CAAA;IACjE,eAAe,EAAE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pB,WAAW,EAAE,UAAU,CAAC,eAAe,KACpC,OAAO,CAAC,OAAO,CAAC,CAAA;IACrB,uBAAuB,CAAC,EAAE,CACxB,aAAa,EAAE,UAAU,CAAC,qBAAqB,KAC5C,OAAO,CAAC,UAAU,CAAC,2BAA2B,CAAC,CAAA;IACpD,yBAAyB,CAAC,EAAE,CAC1B,eAAe,EAAE,UAAU,CAAC,sBAAsB,KAC/C,OAAO,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAA;IACrD,wBAAwB,CAAC,EAAE,CACzB,cAAc,EAAE,UAAU,CAAC,sBAAsB,KAC9C,OAAO,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAA;IACrD,kBAAkB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,KAAK,IAAI,CAAA;CACxD;AAED,QAAA,MAAM,cAAc;kYAqBjB,mBAAmB;;CA4KrB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import ApplePayButtonComponent from "apple-pay-button";
|
|
13
|
-
const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["name", "postalAddress", "phone", "email"], requiredShippingContactFields = ["name", "postalAddress", "phone", "email"], startSessionURL, startSessionCacheBypass = false, appId, domainName, countryCode = "US", currencyCode = "USD", merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = "plain", buttonStyle = "white-outline", applePayButtonStyle, onPaymentAuthorized, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }) => {
|
|
13
|
+
const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["name", "postalAddress", "phone", "email"], requiredShippingContactFields = ["name", "postalAddress", "phone", "email"], startSessionURL, startSessionCacheBypass = false, appId, domainName, countryCode = "US", currencyCode = "USD", merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = "plain", buttonStyle = "white-outline", applePayButtonStyle, onPaymentAuthorized, onPaymentMethodSelected, onShippingContactSelected, onShippingMethodSelected, onPaymentCancelled, }) => {
|
|
14
14
|
const onClick = () => {
|
|
15
15
|
const applePayRequest = {
|
|
16
16
|
countryCode,
|
|
@@ -59,16 +59,20 @@ const ApplePayButton = ({ displayName, amount, requiredBillingContactFields = ["
|
|
|
59
59
|
console.error("Error during validating merchant");
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
session.onpaymentmethodselected = (event) => {
|
|
63
|
-
const
|
|
62
|
+
session.onpaymentmethodselected = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const paymentMethod = event.paymentMethod;
|
|
64
|
+
let update = {
|
|
64
65
|
newTotal: {
|
|
65
66
|
label: displayName,
|
|
66
67
|
type: "final",
|
|
67
68
|
amount: amount.toString(),
|
|
68
69
|
},
|
|
69
70
|
};
|
|
71
|
+
if (onPaymentMethodSelected) {
|
|
72
|
+
update = yield onPaymentMethodSelected(paymentMethod);
|
|
73
|
+
}
|
|
70
74
|
session.completePaymentMethodSelection(update);
|
|
71
|
-
};
|
|
75
|
+
});
|
|
72
76
|
session.onshippingmethodselected = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
77
|
const shippingMethod = event.shippingMethod;
|
|
74
78
|
let update = {
|
|
@@ -7,6 +7,8 @@ export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement
|
|
|
7
7
|
iconColor: string;
|
|
8
8
|
onDecreaseClick: React.ReactEventHandler;
|
|
9
9
|
onIncreaseClick: React.ReactEventHandler;
|
|
10
|
+
isDecreaseDisabled?: boolean;
|
|
11
|
+
isIncreaseDisabled?: boolean;
|
|
10
12
|
value: number;
|
|
11
13
|
setValue: (_: number) => void;
|
|
12
14
|
className?: string;
|
|
@@ -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,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;
|
|
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"}
|
|
@@ -15,14 +15,14 @@ import * as React from "react";
|
|
|
15
15
|
import { cn } from "../../lib/utils";
|
|
16
16
|
import { Icon } from "./icon";
|
|
17
17
|
import { useTap } from "./tap";
|
|
18
|
-
const IconButton = ({ iconUrl, iconColor, handler, className, style }) => {
|
|
18
|
+
const IconButton = ({ iconUrl, iconColor, handler, className, style, disabled }) => {
|
|
19
19
|
const { onTap, isPressed, ref: tapRef } = useTap();
|
|
20
|
-
return (_jsx("button", Object.assign({ onClick: onTap(handler), ref: tapRef, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton border border-coreColors-dividingLines", className), style: style }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4, style: {
|
|
20
|
+
return (_jsx("button", Object.assign({ onClick: onTap(handler), ref: tapRef, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton border border-coreColors-dividingLines", className), style: style, disabled: disabled }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4, style: {
|
|
21
21
|
opacity: isPressed ? 0.7 : 1,
|
|
22
22
|
} }) })));
|
|
23
23
|
};
|
|
24
24
|
const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
25
|
-
var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, value, setValue, inputStyle, buttonStyle, buttonCornerRadius = 4 } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "value", "setValue", "inputStyle", "buttonStyle", "buttonCornerRadius"]);
|
|
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"]);
|
|
26
26
|
const leftButtonStyle = Object.assign(Object.assign({}, buttonStyle), { borderTopLeftRadius: buttonCornerRadius
|
|
27
27
|
? `${buttonCornerRadius}px`
|
|
28
28
|
: undefined, borderBottomLeftRadius: buttonCornerRadius
|
|
@@ -34,7 +34,7 @@ const QuantityPicker = React.forwardRef((_a, ref) => {
|
|
|
34
34
|
? `${buttonCornerRadius}px`
|
|
35
35
|
: undefined });
|
|
36
36
|
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 }), _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 })] })) })));
|
|
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 })] })) })));
|
|
38
38
|
});
|
|
39
39
|
QuantityPicker.displayName = "QuantityPicker";
|
|
40
40
|
export { QuantityPicker };
|
|
@@ -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;AAyFd,QAAA,MAAM,MAAM;6BAyBU,GAAG,KAAK,IAAI,aACb,GAAG;;;
|
|
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;;;CA2BvB,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"}
|
|
@@ -92,11 +92,21 @@ const useTap = (tapThreshold = 10) => {
|
|
|
92
92
|
return;
|
|
93
93
|
if (event.type === "touchend" && !data.touchMoved) {
|
|
94
94
|
handler(event);
|
|
95
|
-
|
|
95
|
+
try {
|
|
96
|
+
(_a = webbridgeActions.action) === null || _a === void 0 ? void 0 : _a.call(webbridgeActions, "trigger/haptic");
|
|
97
|
+
}
|
|
98
|
+
catch (e) {
|
|
99
|
+
console.error(e);
|
|
100
|
+
}
|
|
96
101
|
}
|
|
97
102
|
else if (event.type === "click" && !data.touchStarted) {
|
|
98
103
|
handler(event);
|
|
99
|
-
|
|
104
|
+
try {
|
|
105
|
+
(_b = webbridgeActions.action) === null || _b === void 0 ? void 0 : _b.call(webbridgeActions, "trigger/haptic");
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
console.error(e);
|
|
109
|
+
}
|
|
100
110
|
setIsPressed(true);
|
|
101
111
|
setTimeout(() => setIsPressed(false), 100);
|
|
102
112
|
}
|
|
@@ -22,7 +22,7 @@ const Wishlist = React.forwardRef((_a, ref) => {
|
|
|
22
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
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: {
|
|
24
24
|
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
|
|
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
|
|
26
26
|
? translations["checkout-summary-items"]
|
|
27
27
|
: translations["checkout-summary-item"]}` })))] }))] })));
|
|
28
28
|
});
|
package/dist/styles.css
CHANGED
|
@@ -998,9 +998,6 @@ video {
|
|
|
998
998
|
.h-\[22px\] {
|
|
999
999
|
height: 22px;
|
|
1000
1000
|
}
|
|
1001
|
-
.h-\[36\] {
|
|
1002
|
-
height: 36;
|
|
1003
|
-
}
|
|
1004
1001
|
.h-\[38px\] {
|
|
1005
1002
|
height: 38px;
|
|
1006
1003
|
}
|
|
@@ -1097,9 +1094,6 @@ video {
|
|
|
1097
1094
|
.w-\[138px\] {
|
|
1098
1095
|
width: 138px;
|
|
1099
1096
|
}
|
|
1100
|
-
.w-\[154px\] {
|
|
1101
|
-
width: 154px;
|
|
1102
|
-
}
|
|
1103
1097
|
.w-\[1px\] {
|
|
1104
1098
|
width: 1px;
|
|
1105
1099
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tapcart/mobile-components",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.65",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"style": "dist/styles.css",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"ts-jest": "^29.2.5",
|
|
35
35
|
"tsc-alias": "^1.8.10",
|
|
36
36
|
"typescript": "^4.5.2",
|
|
37
|
-
"app-studio-types": "0.0.
|
|
38
|
-
"
|
|
39
|
-
"
|
|
37
|
+
"app-studio-types": "0.0.8",
|
|
38
|
+
"eslint-config-custom": "0.0.0",
|
|
39
|
+
"tsconfig": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@radix-ui/react-toggle": "^1.0.3",
|
|
58
58
|
"@radix-ui/react-toggle-group": "^1.0.4",
|
|
59
59
|
"@tabler/icons-react": "^3.2.0",
|
|
60
|
-
"@tapcart/webbridge-react": "^1.
|
|
60
|
+
"@tapcart/webbridge-react": "^1.15.0",
|
|
61
61
|
"apple-pay-button": "^1.1.7",
|
|
62
62
|
"class-variance-authority": "^0.6.0",
|
|
63
63
|
"clsx": "^1.2.1",
|