@tapcart/mobile-components 0.7.37 → 0.7.39

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.
@@ -0,0 +1,10 @@
1
+ type Customer = {
2
+ isAuthenticated: boolean;
3
+ };
4
+ type UseCustomerProps = {};
5
+ type UseCustomerReturn = {
6
+ customer: Customer;
7
+ };
8
+ export declare const useCustomer: (props: UseCustomerProps | null) => UseCustomerReturn;
9
+ export {};
10
+ //# sourceMappingURL=use-customer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-customer.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-customer.ts"],"names":[],"mappings":"AAWA,KAAK,QAAQ,GAAG;IACd,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAGD,KAAK,gBAAgB,GAAG,EAAE,CAAA;AAE1B,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,UACf,gBAAgB,GAAG,IAAI,KAC7B,iBAuBF,CAAA"}
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { useState, useEffect } from "react";
3
+ // @ts-ignore -- webbridge-react is not typed (yet)
4
+ import { useActions } from "@tapcart/webbridge-react";
5
+ export const useCustomer = (props) => {
6
+ const [isAuthenticated, setIsAuthenticated] = useState(false);
7
+ const [customer, setCustomer] = useState({});
8
+ const actions = useActions();
9
+ // verify customer
10
+ useEffect(() => {
11
+ try {
12
+ // webbridge method to get customerIdentity
13
+ actions.getCustomerIdentity(null, {
14
+ onSuccess: (user) => setIsAuthenticated(!!(user === null || user === void 0 ? void 0 : user.email)),
15
+ });
16
+ }
17
+ catch (e) {
18
+ console.log("unable to get customer identity ", e);
19
+ }
20
+ }, [actions]);
21
+ return {
22
+ customer: Object.assign({ isAuthenticated }, customer),
23
+ };
24
+ };
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ declare const useTap: (tapThreshold?: number) => {
3
+ onTap: (handler: (event: any) => void) => (event: any) => void;
4
+ isPressed: boolean;
5
+ ref: React.MutableRefObject<null>;
6
+ };
7
+ export { useTap };
8
+ //# sourceMappingURL=use-tap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tap.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-tap.ts"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAuFvE,QAAA,MAAM,MAAM;6BAuBkC,GAAG,KAAK,IAAI,aACvC,GAAG;;;CAerB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
@@ -0,0 +1,100 @@
1
+ "use client";
2
+ import { useState, useEffect, useCallback, useRef } from "react";
3
+ // Shared manager for all instances of the hook
4
+ const tapManager = (() => {
5
+ const elements = new Map();
6
+ let isListening = false;
7
+ const startListening = () => {
8
+ if (isListening)
9
+ return;
10
+ const handleTouchStart = (e) => {
11
+ const touch = e.touches[0];
12
+ elements.forEach((data, el) => {
13
+ if (el.contains(touch.target)) {
14
+ data.touchStarted = true;
15
+ data.touchMoved = false;
16
+ data.startPosition = { x: touch.clientX, y: touch.clientY };
17
+ // Don't set isPressed here, wait to determine if it's a tap or drag
18
+ }
19
+ });
20
+ };
21
+ const handleTouchMove = (e) => {
22
+ const touch = e.touches[0];
23
+ elements.forEach((data, el) => {
24
+ if (data.touchStarted) {
25
+ const deltaX = Math.abs(touch.clientX - data.startPosition.x);
26
+ const deltaY = Math.abs(touch.clientY - data.startPosition.y);
27
+ if (deltaX > data.tapThreshold || deltaY > data.tapThreshold) {
28
+ data.touchMoved = true;
29
+ data.setIsPressed(false);
30
+ }
31
+ }
32
+ });
33
+ };
34
+ const handleTouchEnd = () => {
35
+ elements.forEach((data) => {
36
+ if (data.touchStarted) {
37
+ data.touchStarted = false;
38
+ if (!data.touchMoved) {
39
+ // It's a tap, set isPressed briefly
40
+ data.setIsPressed(true);
41
+ setTimeout(() => data.setIsPressed(false), 100);
42
+ }
43
+ }
44
+ });
45
+ };
46
+ document.addEventListener("touchstart", (e) => handleTouchStart(e), { passive: true });
47
+ document.addEventListener("touchmove", (e) => handleTouchMove(e), { passive: true });
48
+ document.addEventListener("touchend", () => handleTouchEnd(), {
49
+ passive: true,
50
+ });
51
+ isListening = true;
52
+ };
53
+ return {
54
+ register: (el, data) => {
55
+ elements.set(el, data);
56
+ startListening();
57
+ },
58
+ unregister: (el) => {
59
+ elements.delete(el);
60
+ },
61
+ elements,
62
+ };
63
+ })();
64
+ const useTap = (tapThreshold = 10) => {
65
+ const [isPressed, setIsPressed] = useState(false);
66
+ const elementRef = useRef(null);
67
+ useEffect(() => {
68
+ const element = elementRef.current;
69
+ if (!element)
70
+ return;
71
+ const data = {
72
+ touchStarted: false,
73
+ touchMoved: false,
74
+ startPosition: { x: 0, y: 0 },
75
+ setIsPressed,
76
+ tapThreshold,
77
+ };
78
+ tapManager.register(element, data);
79
+ return () => {
80
+ tapManager.unregister(element);
81
+ };
82
+ }, [tapThreshold]);
83
+ const onTap = useCallback((handler) => {
84
+ return (event) => {
85
+ const data = tapManager.elements.get(elementRef.current);
86
+ if (!data)
87
+ return;
88
+ if (event.type === "touchend" && !data.touchMoved) {
89
+ handler(event);
90
+ }
91
+ else if (event.type === "click" && !data.touchStarted) {
92
+ handler(event);
93
+ setIsPressed(true);
94
+ setTimeout(() => setIsPressed(false), 100);
95
+ }
96
+ };
97
+ }, []);
98
+ return { onTap, isPressed, ref: elementRef };
99
+ };
100
+ export { useTap };
@@ -0,0 +1,24 @@
1
+ /// <reference types="applepayjs" />
2
+ import * as React from "react";
3
+ export type ApplePayButtonType = 'plain' | 'add-money' | 'book' | 'buy' | 'check-out' | 'continue' | 'contribute' | 'donate' | 'order' | 'pay' | 'reload' | 'rent' | 'set-up' | 'subscribe' | 'support' | 'tip' | 'top-up';
4
+ export type ApplePayButtonStyle = 'black' | 'white' | 'white-outline';
5
+ export interface ApplePayButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ displayName: string;
7
+ amount: number;
8
+ startSessionURL: string;
9
+ appId: string;
10
+ domainName: string;
11
+ countryCode?: string;
12
+ currencyCode?: string;
13
+ merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
14
+ supportedNetworks?: string[];
15
+ buttonType?: ApplePayButtonType;
16
+ buttonStyle?: ApplePayButtonStyle;
17
+ onPaymentAuthorized?: (paymentData: ApplePayJS.ApplePayPayment) => void;
18
+ }
19
+ declare const ApplePayButton: {
20
+ ({ displayName, amount, startSessionURL, appId, domainName, countryCode, currencyCode, merchantCapabilities, supportedNetworks, buttonType, buttonStyle, onPaymentAuthorized, }: ApplePayButtonProps): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ export { ApplePayButton };
24
+ //# sourceMappingURL=apple-pay-button.d.ts.map
@@ -0,0 +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,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE3N,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,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,UAAU,CAAC,0BAA0B,EAAE,CAAC;IAC/D,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,eAAe,KAAK,IAAI,CAAC;CACzE;AAED,QAAA,MAAM,cAAc;qLAcf,mBAAmB;;CA2IvB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,122 @@
1
+ "use client";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import * as React from "react";
13
+ import ApplePayButtonComponent from 'apple-pay-button';
14
+ const ApplePayButton = ({ displayName, amount, startSessionURL, appId, domainName, countryCode = 'US', currencyCode = 'USD', merchantCapabilities = ["supports3DS"], supportedNetworks = ["visa", "masterCard", "amex", "discover"], buttonType = 'plain', buttonStyle = 'white-outline', onPaymentAuthorized, }) => {
15
+ const [paymentDataResult, setPaymentDataResult] = React.useState("");
16
+ const onClick = () => {
17
+ const applePayRequest = {
18
+ countryCode,
19
+ currencyCode,
20
+ merchantCapabilities,
21
+ supportedNetworks,
22
+ total: {
23
+ label: displayName,
24
+ type: "final",
25
+ amount: amount.toString(),
26
+ }
27
+ };
28
+ const session = new ApplePaySession(3, applePayRequest);
29
+ handleEventsForApplePay(session);
30
+ session.begin();
31
+ };
32
+ const defaultFetcher = (url, body) => fetch(url, {
33
+ method: body ? "POST" : "GET",
34
+ headers: {
35
+ "Content-Type": "application/json",
36
+ },
37
+ body: body ? JSON.stringify(body) : undefined,
38
+ }).then((res) => res.json());
39
+ const validateMerchant = (validationURL, appId, domainName, displayName) => __awaiter(void 0, void 0, void 0, function* () {
40
+ let url = startSessionURL;
41
+ let body = {
42
+ validationURL,
43
+ appId,
44
+ domainName,
45
+ displayName
46
+ };
47
+ console.log("request body", body);
48
+ const response = yield defaultFetcher(url, body);
49
+ return response.data;
50
+ });
51
+ const handleEventsForApplePay = (session) => {
52
+ session.onvalidatemerchant = (event) => __awaiter(void 0, void 0, void 0, function* () {
53
+ const response = yield validateMerchant(event.validationURL, appId, domainName, displayName);
54
+ if (response) {
55
+ session.completeMerchantValidation(response);
56
+ }
57
+ else {
58
+ console.error("Error during validating merchant");
59
+ }
60
+ });
61
+ session.onpaymentmethodselected = (event) => {
62
+ const update = {
63
+ newTotal: {
64
+ label: displayName,
65
+ type: "final",
66
+ amount: amount.toString(),
67
+ }
68
+ };
69
+ session.completePaymentMethodSelection(update);
70
+ };
71
+ session.onshippingmethodselected = (event) => {
72
+ const update = {
73
+ newTotal: {
74
+ label: displayName,
75
+ type: "final",
76
+ amount: amount.toString(),
77
+ }
78
+ };
79
+ session.completeShippingMethodSelection(update);
80
+ };
81
+ session.onshippingcontactselected = (event) => {
82
+ const update = {
83
+ newTotal: {
84
+ label: displayName,
85
+ type: "final",
86
+ amount: amount.toString(),
87
+ }
88
+ };
89
+ session.completeShippingContactSelection(update);
90
+ };
91
+ session.onpaymentauthorized = (event) => __awaiter(void 0, void 0, void 0, function* () {
92
+ const paymentData = event.payment;
93
+ if (onPaymentAuthorized) { // Call the callback if provided
94
+ onPaymentAuthorized(paymentData);
95
+ }
96
+ if (paymentData.token) {
97
+ const paymentDataJson = JSON.stringify(paymentData.token, null, 2);
98
+ console.log("paymentData", paymentDataJson);
99
+ setPaymentDataResult(paymentDataJson);
100
+ const result = {
101
+ status: ApplePaySession.STATUS_SUCCESS,
102
+ };
103
+ session.completePayment(result);
104
+ }
105
+ else {
106
+ const result = {
107
+ status: ApplePaySession.STATUS_FAILURE,
108
+ };
109
+ session.completePayment(result);
110
+ }
111
+ });
112
+ session.oncancel = (event) => {
113
+ console.log("Session Cancelled.");
114
+ };
115
+ };
116
+ return (_jsxs("div", { children: [_jsx("div", Object.assign({ className: "flex flex-row justify-center items-center pt-40" }, { children: _jsx(ApplePayButtonComponent, { onClick: onClick, style: {
117
+ height: "48px",
118
+ borderRadius: '4px',
119
+ }, type: buttonType, buttonStyle: buttonStyle }) })), _jsx("div", Object.assign({ className: "w-100 overflow-auto" }, { children: _jsx("pre", Object.assign({ className: "whitespace-pre-wrap break-words" }, { children: paymentDataResult })) }))] }));
120
+ };
121
+ ApplePayButton.displayName = "ApplePayButton";
122
+ export { ApplePayButton };
@@ -12,8 +12,9 @@ export interface IconProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "c
12
12
  fillColor?: string | null;
13
13
  secondaryFillColor?: string;
14
14
  strokeColor?: string | null;
15
+ strokeWidth?: number | null;
15
16
  fillPercentage?: number | null;
16
17
  }
17
- declare function Icon({ className, name, size, color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
18
+ declare function Icon({ className, name, size, color, url, fillColor, secondaryFillColor, strokeColor, strokeWidth, fillPercentage, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
18
19
  export { Icon, iconVariants, IconPencilMinus };
19
20
  //# sourceMappingURL=icon.d.ts.map
@@ -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;AAC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AG,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;AA0HD,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,2CAoBX;AAED,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,CAAA"}
@@ -87,7 +87,7 @@ const TablerIcon = ({ name, size }) => {
87
87
  const IconComponent = icons[name];
88
88
  return IconComponent ? (_jsx(IconComponent, { size: sizeMapping[size], strokeWidth: strokeWidthMapping[size] })) : null;
89
89
  };
90
- const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage, secondaryFillColor }) => {
90
+ const CustomIcon = ({ url, size, color, strokeColor, strokeWidth, fillColor, fillPercentage, secondaryFillColor, }) => {
91
91
  return (_jsx(ReactSVG, { src: url, beforeInjection: (svg) => {
92
92
  svg.setAttribute("style", `width: ${sizeMapping[size]}px; height: ${sizeMapping[size]}px`);
93
93
  const paths = svg.querySelectorAll("path");
@@ -99,7 +99,9 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
99
99
  path.setAttribute("stroke", color);
100
100
  }
101
101
  else {
102
- if (fillColor && path.hasAttribute("fill") && fillPercentage === 1) {
102
+ if (fillColor &&
103
+ path.hasAttribute("fill") &&
104
+ fillPercentage === 1) {
103
105
  path.setAttribute("fill", fillColor);
104
106
  }
105
107
  if (strokeColor) {
@@ -109,6 +111,9 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
109
111
  if (path.hasAttribute("stroke")) {
110
112
  path.setAttribute("stroke-width", strokeWidthMapping[size].toString());
111
113
  }
114
+ if (strokeWidth != null && path.hasAttribute("stroke")) {
115
+ path.setAttribute("stroke-width", strokeWidth.toString());
116
+ }
112
117
  // Create a gradient fill based on the fillPercentage
113
118
  if (fillPercentage && fillPercentage > 0 && fillPercentage < 1) {
114
119
  const percentage = Math.min(Math.max(fillPercentage, 0), 1);
@@ -134,7 +139,7 @@ const CustomIcon = ({ url, size, color, strokeColor, fillColor, fillPercentage,
134
139
  } }));
135
140
  };
136
141
  function Icon(_a) {
137
- var { className, name, size = "md", color, url, fillColor, secondaryFillColor, strokeColor, fillPercentage } = _a, props = __rest(_a, ["className", "name", "size", "color", "url", "fillColor", "secondaryFillColor", "strokeColor", "fillPercentage"]);
138
- return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color }), className) }, props, { children: [url ? (_jsx(CustomIcon, { url: url, size: size, color: color, fillColor: fillColor, secondaryFillColor: secondaryFillColor, strokeColor: strokeColor, fillPercentage: fillPercentage || (color || fillColor ? 1 : 0) })) : (_jsx(TablerIcon, { name: name, size: size })), props.children] })));
142
+ 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"]);
143
+ return (_jsxs("div", Object.assign({ className: cn(iconVariants({ size, color }), className) }, 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] })));
139
144
  }
140
145
  export { Icon, iconVariants, IconPencilMinus };
@@ -1,8 +1,10 @@
1
1
  import * as React from "react";
2
2
  export interface QuantityPickerProps extends React.HTMLAttributes<HTMLDivElement> {
3
- decreaseIcon: string;
4
- increaseIcon: string;
5
- deleteIcon: string;
3
+ decreaseIconUrl: string;
4
+ increaseIconUrl: string;
5
+ deleteIconUrl: string;
6
+ isDeleteOnly: boolean;
7
+ iconColor: string;
6
8
  onDecreaseClick: React.ReactEventHandler;
7
9
  onIncreaseClick: React.ReactEventHandler;
8
10
  value: number;
@@ -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;AAI9B,MAAM,WAAW,mBACf,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,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;CACnB;AAgBD,QAAA,MAAM,cAAc,4FAyCnB,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;AAI9B,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;CACnB;AAiBD,QAAA,MAAM,cAAc,4FAwDnB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -10,14 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  }
11
11
  return t;
12
12
  };
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import * as React from "react";
15
15
  import { cn } from "../../lib/utils";
16
16
  import { Icon } from "./icon";
17
- const IconButton = ({ icon, handler, className }) => (_jsx("button", Object.assign({ onClick: handler, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton outline outline-1 outline-stateColors-skeleton", className) }, { children: _jsx(Icon, { name: icon, size: "sm", color: "coreColors-secondaryIcon" }) })));
17
+ const IconButton = ({ iconUrl, iconColor, handler, className }) => (_jsx("button", Object.assign({ onClick: handler, className: cn("flex items-center justify-center h-7 w-7 bg-stateColors-skeleton outline outline-1 outline-stateColors-skeleton", className) }, { children: _jsx(Icon, { url: iconUrl, size: "sm", strokeColor: iconColor, strokeWidth: 4 }) })));
18
18
  const QuantityPicker = React.forwardRef((_a, ref) => {
19
- var { className, decreaseIcon, increaseIcon, deleteIcon, onDecreaseClick, onIncreaseClick, value, setValue } = _a, props = __rest(_a, ["className", "decreaseIcon", "increaseIcon", "deleteIcon", "onDecreaseClick", "onIncreaseClick", "value", "setValue"]);
20
- return (_jsxs("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: [_jsx(IconButton, { handler: onDecreaseClick, icon: value === 1 ? deleteIcon : decreaseIcon, className: "rounded-tl rounded-bl" }), _jsx("div", Object.assign({ className: "w-8 h-7 py-1 flex justify-center bg-coreColors-inputBackground outline outline-1 outline-coreColors-dividingLines text-[14px] font-sfpro-roboto leading-[160%] font-normal text-textColors-primaryColor" }, { children: _jsx("input", { type: "tel", 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 focus-visible:outline-none text-center" }) })), _jsx(IconButton, { handler: onIncreaseClick, icon: increaseIcon, className: "rounded-tr rounded-br" })] })));
19
+ var { className, decreaseIconUrl, increaseIconUrl, deleteIconUrl, isDeleteOnly = false, iconColor, onDecreaseClick, onIncreaseClick, value, setValue } = _a, props = __rest(_a, ["className", "decreaseIconUrl", "increaseIconUrl", "deleteIconUrl", "isDeleteOnly", "iconColor", "onDecreaseClick", "onIncreaseClick", "value", "setValue"]);
20
+ return (_jsx("div", Object.assign({ className: cn("flex", className), ref: ref }, props, { children: isDeleteOnly ? (_jsx(IconButton, { handler: onDecreaseClick, iconUrl: deleteIconUrl, iconColor: iconColor, className: "rounded" })) : (_jsxs(_Fragment, { children: [_jsx(IconButton, { handler: onDecreaseClick, iconUrl: value === 1 ? deleteIconUrl : decreaseIconUrl, iconColor: iconColor, className: "rounded-tl rounded-bl" }), _jsx("div", Object.assign({ className: "w-8 h-7 py-1 flex justify-center bg-coreColors-inputBackground outline outline-1 outline-stateColors-skeleton text-[14px] font-sfpro-roboto leading-[160%] font-normal text-textColors-primaryColor" }, { children: _jsx("input", { type: "tel", 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 focus-visible:outline-none text-center bg-coreColors-inputBackground text-textColors-primaryColor" }) })), _jsx(IconButton, { handler: onIncreaseClick, iconUrl: increaseIconUrl, iconColor: iconColor, className: "rounded-tr rounded-br" })] })) })));
21
21
  });
22
22
  QuantityPicker.displayName = "QuantityPicker";
23
23
  export { QuantityPicker };
@@ -202,4 +202,5 @@ export declare const createCollectionImageMap: (collections: {
202
202
  image?: string;
203
203
  }[]) => Record<string, string>;
204
204
  export declare const isFavoriteIntegrationEnabled: (integrations: Integrations) => boolean;
205
+ export declare const pluralize: (word: string, count?: number, inclusive?: boolean) => string;
205
206
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAIvC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI9C,eAAO,MAAM,QAAQ,gBAAiB,KAAK,GAAG,SAAS,uBAUtD,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAU/B,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ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from "dayjs";
4
4
  import relativeTime from "dayjs/plugin/relativeTime";
5
+ import Pluralize from "pluralize";
5
6
  export function cn(...inputs) {
6
7
  return twMerge(clsx(inputs));
7
8
  }
@@ -240,4 +241,7 @@ export const createCollectionImageMap = (collections) => {
240
241
  export const isFavoriteIntegrationEnabled = (integrations) => {
241
242
  return integrations.some(integration => (integration.name === "tapcart-wishlist" || integration.name === "swym") && integration.enabled);
242
243
  };
244
+ export const pluralize = (word, count, inclusive) => {
245
+ return Pluralize(word, count, inclusive);
246
+ };
243
247
  // #endregion =-=-=-= END BLOCK UTILS =-=-=-=
package/dist/styles.css CHANGED
@@ -755,6 +755,9 @@ video {
755
755
  .top-\[50\%\] {
756
756
  top: 50%;
757
757
  }
758
+ .z-0 {
759
+ z-index: 0;
760
+ }
758
761
  .z-10 {
759
762
  z-index: 10;
760
763
  }
@@ -840,6 +843,9 @@ video {
840
843
  .ml-2 {
841
844
  margin-left: 0.5rem;
842
845
  }
846
+ .ml-4 {
847
+ margin-left: 1rem;
848
+ }
843
849
  .mr-2 {
844
850
  margin-right: 0.5rem;
845
851
  }
@@ -1017,6 +1023,9 @@ video {
1017
1023
  .w-1\/2 {
1018
1024
  width: 50%;
1019
1025
  }
1026
+ .w-1\/3 {
1027
+ width: 33.333333%;
1028
+ }
1020
1029
  .w-10 {
1021
1030
  width: 2.5rem;
1022
1031
  }
@@ -1035,6 +1044,9 @@ video {
1035
1044
  .w-2\.5 {
1036
1045
  width: 0.625rem;
1037
1046
  }
1047
+ .w-2\/3 {
1048
+ width: 66.666667%;
1049
+ }
1038
1050
  .w-4 {
1039
1051
  width: 1rem;
1040
1052
  }
@@ -1266,6 +1278,9 @@ video {
1266
1278
  .items-center {
1267
1279
  align-items: center;
1268
1280
  }
1281
+ .items-stretch {
1282
+ align-items: stretch;
1283
+ }
1269
1284
  .justify-start {
1270
1285
  justify-content: flex-start;
1271
1286
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapcart/mobile-components",
3
- "version": "0.7.37",
3
+ "version": "0.7.39",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/styles.css",
@@ -77,6 +77,7 @@
77
77
  "next": "^14.2.5",
78
78
  "next-themes": "^0.2.1",
79
79
  "postcss-cli": "^11.0.0",
80
+ "pluralize": "^8.0.0",
80
81
  "react-intersection-observer": "^9.10.2",
81
82
  "react-svg": "^16.1.34",
82
83
  "swr": "^2.2.5",
@@ -84,4 +85,4 @@
84
85
  "tailwindcss-animate": "^1.0.6",
85
86
  "vaul": "0.9.1"
86
87
  }
87
- }
88
+ }
@@ -1,10 +0,0 @@
1
- /**
2
- * Custom hook to debug dependency changes.
3
- *
4
- * Usage:
5
- * useDebugDependencies([dependencyA, dependencyB]);
6
- *
7
- * @param {Array} deps - Array of dependencies to monitor for changes.
8
- */
9
- export declare function useDebugDependencies(deps: any[]): void;
10
- //# sourceMappingURL=use-debug-dependencies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-debug-dependencies.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-debug-dependencies.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAU/C"}
@@ -1,18 +0,0 @@
1
- "use client";
2
- import { useRef, useEffect } from "react";
3
- /**
4
- * Custom hook to debug dependency changes.
5
- *
6
- * Usage:
7
- * useDebugDependencies([dependencyA, dependencyB]);
8
- *
9
- * @param {Array} deps - Array of dependencies to monitor for changes.
10
- */
11
- export function useDebugDependencies(deps) {
12
- const prevDeps = useRef(deps);
13
- useEffect(() => {
14
- const changedDeps = deps.map((dep, i) => dep !== prevDeps.current[i] ? dep : null);
15
- console.log("Changed dependencies:", changedDeps);
16
- prevDeps.current = deps;
17
- }, [deps]);
18
- }
@@ -1,13 +0,0 @@
1
- import { PhoenixLayout } from "lib/tapcart/types";
2
- type UseLayoutProps = {
3
- appId: string;
4
- layoutId: string;
5
- };
6
- type UseLayoutReturn = {
7
- layout: PhoenixLayout | null;
8
- error: any;
9
- isLoading: boolean;
10
- };
11
- export declare function useLayout({ appId, layoutId, }: UseLayoutProps): UseLayoutReturn;
12
- export {};
13
- //# sourceMappingURL=use-layout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-layout.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGjD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,aAAa,GAAG,IAAI,CAAA;IAC5B,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,GAAG,eAAe,CAYlC"}
@@ -1,23 +0,0 @@
1
- "use client";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- import useSWR from "swr";
12
- import { fetchLayoutById } from "apps/tapcart-ssr-app/lib/tapcart/index";
13
- export function useLayout({ appId, layoutId, }) {
14
- const fetcher = (appId, layoutId) => __awaiter(this, void 0, void 0, function* () {
15
- return fetchLayoutById(appId, layoutId);
16
- });
17
- const { data, error } = useSWR([appId, layoutId], fetcher);
18
- return {
19
- layout: data || null,
20
- error,
21
- isLoading: !data && !error,
22
- };
23
- }